diff --git a/integration/test/API/Brig.hs b/integration/test/API/Brig.hs index d304b3ed31f..362527c7a8f 100644 --- a/integration/test/API/Brig.hs +++ b/integration/test/API/Brig.hs @@ -181,7 +181,7 @@ instance Default UpdateClient where } updateClient :: - HasCallStack => + (HasCallStack) => ClientIdentity -> UpdateClient -> App Response @@ -368,7 +368,7 @@ getSelfWithVersion v user = baseRequest user Brig v "/self" >>= submit "GET" -- | https://staging-nginz-https.zinfra.io/v6/api/swagger-ui/#/default/get_self -- this is a low-level version of `getSelf` for testing some error conditions. -getSelf' :: HasCallStack => String -> String -> App Response +getSelf' :: (HasCallStack) => String -> String -> App Response getSelf' domain uid = getSelfWithVersion Versioned $ object ["domain" .= domain, "id" .= uid] data PutSelf = PutSelf @@ -462,45 +462,45 @@ postInvitation user inv = do submit "POST" $ req & addJSONObject ["email" .= email] -getApiVersions :: HasCallStack => App Response +getApiVersions :: (HasCallStack) => App Response getApiVersions = do req <- rawBaseRequest OwnDomain Brig Unversioned $ joinHttpPath ["api-version"] submit "GET" req -getSwaggerPublicTOC :: HasCallStack => App Response +getSwaggerPublicTOC :: (HasCallStack) => App Response getSwaggerPublicTOC = do req <- rawBaseRequest OwnDomain Brig Unversioned $ joinHttpPath ["api", "swagger-ui"] submit "GET" req -getSwaggerInternalTOC :: HasCallStack => App Response +getSwaggerInternalTOC :: (HasCallStack) => App Response getSwaggerInternalTOC = error "FUTUREWORK: this API end-point does not exist." -getSwaggerPublicAllUI :: HasCallStack => Int -> App Response +getSwaggerPublicAllUI :: (HasCallStack) => Int -> App Response getSwaggerPublicAllUI version = do req <- rawBaseRequest OwnDomain Brig (ExplicitVersion version) $ joinHttpPath ["api", "swagger-ui"] submit "GET" req -getSwaggerPublicAllJson :: HasCallStack => Int -> App Response +getSwaggerPublicAllJson :: (HasCallStack) => Int -> App Response getSwaggerPublicAllJson version = do req <- rawBaseRequest OwnDomain Brig (ExplicitVersion version) $ joinHttpPath ["api", "swagger.json"] submit "GET" req -getSwaggerInternalUI :: HasCallStack => String -> App Response +getSwaggerInternalUI :: (HasCallStack) => String -> App Response getSwaggerInternalUI service = do req <- rawBaseRequest OwnDomain Brig Unversioned $ joinHttpPath ["api-internal", "swagger-ui", service] submit "GET" req -getSwaggerInternalJson :: HasCallStack => String -> App Response +getSwaggerInternalJson :: (HasCallStack) => String -> App Response getSwaggerInternalJson service = do req <- rawBaseRequest OwnDomain Nginz Unversioned $ @@ -610,7 +610,7 @@ updateService dom providerId serviceId mAcceptHeader newName = do $ req updateServiceConn :: - MakesValue conn => + (MakesValue conn) => -- | providerId String -> -- | serviceId @@ -662,7 +662,7 @@ getCallsConfigV2 user = do req <- baseRequest user Brig Versioned $ joinHttpPath ["calls", "config", "v2"] submit "GET" req -addBot :: MakesValue user => user -> String -> String -> String -> App Response +addBot :: (MakesValue user) => user -> String -> String -> String -> App Response addBot user providerId serviceId convId = do req <- baseRequest user Brig Versioned $ joinHttpPath ["conversations", convId, "bots"] submit "POST" $ diff --git a/integration/test/API/BrigInternal.hs b/integration/test/API/BrigInternal.hs index e153f0e7e5b..5fbfd5cf2e5 100644 --- a/integration/test/API/BrigInternal.hs +++ b/integration/test/API/BrigInternal.hs @@ -242,7 +242,8 @@ getClientsFull :: (HasCallStack, MakesValue users, MakesValue uid) => uid -> use getClientsFull user users = do val <- make users baseRequest user Brig Unversioned do joinHttpPath ["i", "clients", "full"] - >>= submit "POST" . addJSONObject ["users" .= val] + >>= submit "POST" + . addJSONObject ["users" .= val] -- | https://staging-nginz-https.zinfra.io/api-internal/swagger-ui/brig/#/brig/post_i_ejpd_request getEJPDInfo :: (HasCallStack, MakesValue dom) => dom -> [String] -> String -> App Response diff --git a/integration/test/API/Cargohold.hs b/integration/test/API/Cargohold.hs index 8baa18c4148..e21e26fed81 100644 --- a/integration/test/API/Cargohold.hs +++ b/integration/test/API/Cargohold.hs @@ -19,19 +19,19 @@ getFederationAsset :: (HasCallStack, MakesValue asset) => asset -> App Response getFederationAsset ga = do req <- rawBaseRequestF OwnDomain cargohold "federation/get-asset" bdy <- make ga - submit "POST" $ - req - & addBody (HTTP.RequestBodyLBS $ encode bdy) "application/json" + submit "POST" + $ req + & addBody (HTTP.RequestBodyLBS $ encode bdy) "application/json" uploadAssetV3 :: (HasCallStack, MakesValue user, MakesValue assetRetention) => user -> Bool -> assetRetention -> MIME.MIMEType -> LByteString -> App Response uploadAssetV3 user isPublic retention mimeType bdy = do uid <- user & objId req <- baseRequest user Cargohold (ExplicitVersion 1) "/assets/v3" body <- buildUploadAssetRequestBody isPublic retention bdy mimeType - submit "POST" $ - req - & zUser uid - & addBody body multipartMixedMime + submit "POST" + $ req + & zUser uid + & addBody body multipartMixedMime uploadAsset :: (HasCallStack, MakesValue user) => user -> App Response uploadAsset = flip uploadFreshAsset "Hello World!" @@ -40,23 +40,23 @@ uploadProviderAsset :: (HasCallStack, MakesValue domain) => domain -> String -> uploadProviderAsset domain pid payload = do req <- rawBaseRequest domain Cargohold Versioned $ joinHttpPath ["provider", "assets"] bdy <- txtAsset payload - submit "POST" $ - req - & zProvider pid - & zType "provider" - & addBody bdy multipartMixedMime + submit "POST" + $ req + & zProvider pid + & zType "provider" + & addBody bdy multipartMixedMime uploadFreshAsset :: (HasCallStack, MakesValue user) => user -> String -> App Response uploadFreshAsset user payload = do uid <- user & objId req <- baseRequest user Cargohold Versioned "/assets" bdy <- txtAsset payload - submit "POST" $ - req - & zUser uid - & addBody bdy multipartMixedMime + submit "POST" + $ req + & zUser uid + & addBody bdy multipartMixedMime -txtAsset :: HasCallStack => String -> App HTTP.RequestBody +txtAsset :: (HasCallStack) => String -> App HTTP.RequestBody txtAsset payload = buildUploadAssetRequestBody True @@ -99,7 +99,7 @@ instance {-# OVERLAPS #-} IsAssetLocation String where locationPathFragment = pure -- Pick out a path from the value -instance MakesValue loc => IsAssetLocation loc where +instance (MakesValue loc) => IsAssetLocation loc where locationPathFragment v = qualifiedFrag `catch` (\(_e :: SomeException) -> unqualifiedFrag) where @@ -137,7 +137,7 @@ downloadAsset user assetDomain key zHostHeader trans = do domain <- objDomain assetDomain key' <- asString key req <- baseRequest user Cargohold Versioned $ "/assets/" ++ domain ++ "/" ++ key' - submit "GET" $ - req - & zHost zHostHeader - & trans + submit "GET" + $ req + & zHost zHostHeader + & trans diff --git a/integration/test/API/Common.hs b/integration/test/API/Common.hs index cdc4b11c2d4..c07816cc5b4 100644 --- a/integration/test/API/Common.hs +++ b/integration/test/API/Common.hs @@ -66,11 +66,11 @@ randomClientId = do mkArray :: [a] -> Array.Array Int a mkArray l = Array.listArray (0, length l - 1) l -recipient :: MakesValue u => u -> App Value +recipient :: (MakesValue u) => u -> App Value recipient u = do uid <- u %. "id" - pure $ - object + pure + $ object [ "user_id" .= uid, "route" .= "any", "clients" .= ([] :: [String]) diff --git a/integration/test/API/Galley.hs b/integration/test/API/Galley.hs index c744ad12258..d4c4b6e366e 100644 --- a/integration/test/API/Galley.hs +++ b/integration/test/API/Galley.hs @@ -59,9 +59,9 @@ allowGuests cc = instance MakesValue CreateConv where make cc = do quids <- for (cc.qualifiedUsers) objQidObject - pure $ - Aeson.object $ - ( [ "qualified_users" .= quids, + pure + $ Aeson.object + $ ( [ "qualified_users" .= quids, "conversation_role" .= cc.newUsersRole, "protocol" .= cc.protocol ] @@ -158,8 +158,8 @@ getSubConversation :: getSubConversation user conv sub = do (cnvDomain, cnvId) <- objQid conv req <- - baseRequest user Galley Versioned $ - joinHttpPath + baseRequest user Galley Versioned + $ joinHttpPath [ "conversations", cnvDomain, cnvId, @@ -179,8 +179,8 @@ deleteSubConversation user sub = do groupId <- sub %. "group_id" & asString epoch :: Int <- sub %. "epoch" & asIntegral req <- - baseRequest user Galley Versioned $ - joinHttpPath ["conversations", domain, convId, "subconversations", subId] + baseRequest user Galley Versioned + $ joinHttpPath ["conversations", domain, convId, "subconversations", subId] submit "DELETE" $ req & addJSONObject ["group_id" .= groupId, "epoch" .= epoch] leaveSubConversation :: @@ -192,8 +192,8 @@ leaveSubConversation user sub = do (conv, Just subId) <- objSubConv sub (domain, convId) <- objQid conv req <- - baseRequest user Galley Versioned $ - joinHttpPath ["conversations", domain, convId, "subconversations", subId, "self"] + baseRequest user Galley Versioned + $ joinHttpPath ["conversations", domain, convId, "subconversations", subId, "self"] submit "DELETE" req getSelfConversation :: (HasCallStack, MakesValue user) => user -> App Response @@ -206,34 +206,34 @@ data ListConversationIds = ListConversationIds {pagingState :: Maybe String, siz instance Default ListConversationIds where def = ListConversationIds Nothing Nothing -listConversationIds :: MakesValue user => user -> ListConversationIds -> App Response +listConversationIds :: (MakesValue user) => user -> ListConversationIds -> App Response listConversationIds user args = do req <- baseRequest user Galley Versioned "/conversations/list-ids" - submit "POST" $ - req - & addJSONObject - ( ["paging_state" .= s | s <- toList args.pagingState] - <> ["size" .= s | s <- toList args.size] - ) + submit "POST" + $ req + & addJSONObject + ( ["paging_state" .= s | s <- toList args.pagingState] + <> ["size" .= s | s <- toList args.size] + ) -listConversations :: MakesValue user => user -> [Value] -> App Response +listConversations :: (MakesValue user) => user -> [Value] -> App Response listConversations user cnvs = do req <- baseRequest user Galley Versioned "/conversations/list" - submit "POST" $ - req - & addJSONObject ["qualified_ids" .= cnvs] + submit "POST" + $ req + & addJSONObject ["qualified_ids" .= cnvs] getMLSPublicKeys :: (HasCallStack, MakesValue user) => user -> App Response getMLSPublicKeys user = do req <- baseRequest user Galley Versioned "/mls/public-keys" submit "GET" req -postMLSMessage :: HasCallStack => ClientIdentity -> ByteString -> App Response +postMLSMessage :: (HasCallStack) => ClientIdentity -> ByteString -> App Response postMLSMessage cid msg = do req <- baseRequest cid Galley Versioned "/mls/messages" submit "POST" (addMLS msg req) -postMLSCommitBundle :: HasCallStack => ClientIdentity -> ByteString -> App Response +postMLSCommitBundle :: (HasCallStack) => ClientIdentity -> ByteString -> App Response postMLSCommitBundle cid msg = do req <- baseRequest cid Galley Versioned "/mls/commit-bundles" submit "POST" (addMLS msg req) @@ -253,24 +253,24 @@ mkProteusRecipients :: (HasCallStack, MakesValue domain, MakesValue user, MakesV mkProteusRecipients dom userClients msg = do userDomain <- asString =<< objDomain dom userEntries <- mapM mkUserEntry userClients - pure $ - Proto.defMessage - & #domain .~ fromString userDomain - & #entries .~ userEntries + pure + $ Proto.defMessage + & #domain .~ fromString userDomain + & #entries .~ userEntries where mkUserEntry (user, clients) = do userId <- LBS.toStrict . UUID.toByteString . fromJust . UUID.fromString <$> objId user clientEntries <- mapM mkClientEntry clients - pure $ - Proto.defMessage - & #user . #uuid .~ userId - & #clients .~ clientEntries + pure + $ Proto.defMessage + & #user . #uuid .~ userId + & #clients .~ clientEntries mkClientEntry client = do clientId <- (^?! hex) <$> objId client - pure $ - Proto.defMessage - & #client . #client .~ clientId - & #text .~ fromString msg + pure + $ Proto.defMessage + & #client . #client .~ clientId + & #text .~ fromString msg getGroupInfo :: (HasCallStack, MakesValue user, MakesValue conv) => @@ -330,8 +330,8 @@ getMLSOne2OneConversation :: getMLSOne2OneConversation self other = do (domain, uid) <- objQid other req <- - baseRequest self Galley Versioned $ - joinHttpPath ["conversations", "one2one", domain, uid] + baseRequest self Galley Versioned + $ joinHttpPath ["conversations", "one2one", domain, uid] submit "GET" req getGroupClients :: @@ -375,12 +375,12 @@ addMembers usr qcnv opts = do Galley (maybe Versioned ExplicitVersion opts.version) (joinHttpPath path) - submit "POST" $ - req - & addJSONObject - ( ["qualified_users" .= qUsers] - <> ["conversation_role" .= r | r <- toList opts.role] - ) + submit "POST" + $ req + & addJSONObject + ( ["qualified_users" .= qUsers] + <> ["conversation_role" .= r | r <- toList opts.role] + ) removeMember :: (HasCallStack, MakesValue remover, MakesValue conv, MakesValue removed) => remover -> conv -> removed -> App Response removeMember remover qcnv removed = do @@ -681,7 +681,7 @@ putLegalholdStatus tid usr status = do baseRequest usr Galley Versioned (joinHttpPath ["teams", tidStr, "features", "legalhold"]) >>= submit "PUT" - . addJSONObject ["status" .= status, "ttl" .= "unlimited"] + . addJSONObject ["status" .= status, "ttl" .= "unlimited"] -- | https://staging-nginz-https.zinfra.io/v5/api/swagger-ui/#/default/get_feature_configs getFeatureConfigs :: (HasCallStack, MakesValue user) => user -> App Response diff --git a/integration/test/API/GalleyInternal.hs b/integration/test/API/GalleyInternal.hs index 59a0880411f..ef0f773d426 100644 --- a/integration/test/API/GalleyInternal.hs +++ b/integration/test/API/GalleyInternal.hs @@ -63,7 +63,8 @@ getFederationStatus user domains = req <- baseRequest user Galley Unversioned $ joinHttpPath ["i", "federation-status"] submit "GET" - $ req & addJSONObject ["domains" .= domainList] + $ req + & addJSONObject ["domains" .= domainList] -- | https://staging-nginz-https.zinfra.io/api-internal/swagger-ui/galley/#/galley/put_i_legalhold_whitelisted_teams__tid_ legalholdWhitelistTeam :: (HasCallStack, MakesValue uid, MakesValue tid) => tid -> uid -> App Response diff --git a/integration/test/API/Gundeck.hs b/integration/test/API/Gundeck.hs index d44603ca2aa..15af3905074 100644 --- a/integration/test/API/Gundeck.hs +++ b/integration/test/API/Gundeck.hs @@ -47,8 +47,8 @@ getNotification :: getNotification user opts nid = do n <- nid & asString req <- - baseRequest user Gundeck Versioned $ - joinHttpPath ["notifications", n] + baseRequest user Gundeck Versioned + $ joinHttpPath ["notifications", n] submit "GET" $ req & addQueryParams [("client", c) | c <- toList opts.client] getLastNotification :: @@ -126,8 +126,8 @@ postPushToken user token = do listPushTokens :: (MakesValue user) => user -> App Response listPushTokens user = do req <- - baseRequest user Gundeck Versioned $ - joinHttpPath ["/push/tokens"] + baseRequest user Gundeck Versioned + $ joinHttpPath ["/push/tokens"] submit "GET" req unregisterClient :: @@ -138,6 +138,6 @@ unregisterClient :: unregisterClient user client = do cid <- asString client req <- - baseRequest user Gundeck Unversioned $ - joinHttpPath ["/i/clients", cid] + baseRequest user Gundeck Unversioned + $ joinHttpPath ["/i/clients", cid] submit "DELETE" req diff --git a/integration/test/API/GundeckInternal.hs b/integration/test/API/GundeckInternal.hs index 907331a98ef..a120734c17f 100644 --- a/integration/test/API/GundeckInternal.hs +++ b/integration/test/API/GundeckInternal.hs @@ -22,8 +22,9 @@ getPresence :: getPresence u = do uid <- u %. "id" & asString req <- - baseRequest u Gundeck Unversioned $ - "/i/presences/" <> uid + baseRequest u Gundeck Unversioned + $ "/i/presences/" + <> uid submit "GET" req unregisterUser :: diff --git a/integration/test/API/Nginz.hs b/integration/test/API/Nginz.hs index d963b79fe8d..ac248fd544f 100644 --- a/integration/test/API/Nginz.hs +++ b/integration/test/API/Nginz.hs @@ -53,12 +53,12 @@ uploadProviderAsset :: (HasCallStack, MakesValue domain) => domain -> String -> uploadProviderAsset domain cookie payload = do req <- rawBaseRequest domain Nginz Versioned $ joinHttpPath ["provider", "assets"] bdy <- txtAsset payload - submit "POST" $ - req - & setCookie cookie - & addBody bdy multipartMixedMime + submit "POST" + $ req + & setCookie cookie + & addBody bdy multipartMixedMime -txtAsset :: HasCallStack => String -> App HTTP.RequestBody +txtAsset :: (HasCallStack) => String -> App HTTP.RequestBody txtAsset payload = buildUploadAssetRequestBody True diff --git a/integration/test/MLS/Util.hs b/integration/test/MLS/Util.hs index 2a59f980579..246520ca2f2 100644 --- a/integration/test/MLS/Util.hs +++ b/integration/test/MLS/Util.hs @@ -122,7 +122,7 @@ mlscli cid args mbstdin = do pure out -runCli :: HasCallStack => FilePath -> [String] -> Maybe ByteString -> App ByteString +runCli :: (HasCallStack) => FilePath -> [String] -> Maybe ByteString -> App ByteString runCli store args mStdin = spawn ( proc @@ -180,7 +180,7 @@ uploadNewKeyPackage cid = do pure ref -generateKeyPackage :: HasCallStack => ClientIdentity -> App (ByteString, String) +generateKeyPackage :: (HasCallStack) => ClientIdentity -> App (ByteString, String) generateKeyPackage cid = do suite <- (.ciphersuite) <$> getMLSState kp <- mlscli cid ["key-package", "create", "--ciphersuite", suite.code] Nothing @@ -757,7 +757,7 @@ createApplicationMessage cid messageContent = do setMLSCiphersuite :: Ciphersuite -> App () setMLSCiphersuite suite = modifyMLSState $ \mls -> mls {ciphersuite = suite} -withCiphersuite :: HasCallStack => Ciphersuite -> App a -> App a +withCiphersuite :: (HasCallStack) => Ciphersuite -> App a -> App a withCiphersuite suite action = do suite0 <- (.ciphersuite) <$> getMLSState setMLSCiphersuiteIO <- appToIOKleisli setMLSCiphersuite @@ -785,7 +785,7 @@ leaveCurrentConv cid = do { members = Set.difference mls.members (Set.singleton cid) } -getCurrentConv :: HasCallStack => ClientIdentity -> App Value +getCurrentConv :: (HasCallStack) => ClientIdentity -> App Value getCurrentConv cid = do mls <- getMLSState (conv, mSubId) <- objSubConv mls.convId diff --git a/integration/test/Notifications.hs b/integration/test/Notifications.hs index 3278a94c35e..9e2639b6f78 100644 --- a/integration/test/Notifications.hs +++ b/integration/test/Notifications.hs @@ -36,8 +36,8 @@ assertNoNotifications u uc since0 p = do _ -> go Nothing (matching, _) -> do pj <- prettyJSON matching - assertFailure $ - unlines + assertFailure + $ unlines [ "Expected no matching events but got:", pj ] @@ -96,33 +96,34 @@ awaitNotification user client lastNotifId selector = do since0 <- mapM objId lastNotifId head <$> awaitNotifications user client since0 1 selector -isDeleteUserNotif :: MakesValue a => a -> App Bool +isDeleteUserNotif :: (MakesValue a) => a -> App Bool isDeleteUserNotif n = nPayload n %. "type" `isEqual` "user.delete" -isFeatureConfigUpdateNotif :: MakesValue a => a -> App Bool +isFeatureConfigUpdateNotif :: (MakesValue a) => a -> App Bool isFeatureConfigUpdateNotif n = nPayload n %. "type" `isEqual` "feature-config.update" -isNewMessageNotif :: MakesValue a => a -> App Bool +isNewMessageNotif :: (MakesValue a) => a -> App Bool isNewMessageNotif n = fieldEquals n "payload.0.type" "conversation.otr-message-add" -isNewMLSMessageNotif :: MakesValue a => a -> App Bool +isNewMLSMessageNotif :: (MakesValue a) => a -> App Bool isNewMLSMessageNotif n = fieldEquals n "payload.0.type" "conversation.mls-message-add" -isWelcomeNotif :: MakesValue a => a -> App Bool +isWelcomeNotif :: (MakesValue a) => a -> App Bool isWelcomeNotif n = fieldEquals n "payload.0.type" "conversation.mls-welcome" -isMemberJoinNotif :: MakesValue a => a -> App Bool +isMemberJoinNotif :: (MakesValue a) => a -> App Bool isMemberJoinNotif n = fieldEquals n "payload.0.type" "conversation.member-join" -isConvLeaveNotif :: MakesValue a => a -> App Bool +isConvLeaveNotif :: (MakesValue a) => a -> App Bool isConvLeaveNotif n = fieldEquals n "payload.0.type" "conversation.member-leave" isConvLeaveNotifWithLeaver :: (MakesValue user, MakesValue a) => user -> a -> App Bool isConvLeaveNotifWithLeaver user n = fieldEquals n "payload.0.type" "conversation.member-leave" - &&~ (n %. "payload.0.data.user_ids.0") `isEqual` (user %. "id") + &&~ (n %. "payload.0.data.user_ids.0") + `isEqual` (user %. "id") isNotifConv :: (MakesValue conv, MakesValue a, HasCallStack) => conv -> a -> App Bool isNotifConv conv n = fieldEquals n "payload.0.qualified_conversation" (objQidObject conv) @@ -151,52 +152,56 @@ isConvAccessUpdateNotif :: (HasCallStack, MakesValue n) => n -> App Bool isConvAccessUpdateNotif n = fieldEquals n "payload.0.type" "conversation.access-update" -isConvCreateNotif :: MakesValue a => a -> App Bool +isConvCreateNotif :: (MakesValue a) => a -> App Bool isConvCreateNotif n = fieldEquals n "payload.0.type" "conversation.create" -- | like 'isConvCreateNotif' but excludes self conversations -isConvCreateNotifNotSelf :: MakesValue a => a -> App Bool +isConvCreateNotifNotSelf :: (MakesValue a) => a -> App Bool isConvCreateNotifNotSelf n = fieldEquals n "payload.0.type" "conversation.create" &&~ do not <$> fieldEquals n "payload.0.data.access" ["private"] -isConvDeleteNotif :: MakesValue a => a -> App Bool +isConvDeleteNotif :: (MakesValue a) => a -> App Bool isConvDeleteNotif n = fieldEquals n "payload.0.type" "conversation.delete" -notifTypeIsEqual :: MakesValue a => String -> a -> App Bool +notifTypeIsEqual :: (MakesValue a) => String -> a -> App Bool notifTypeIsEqual typ n = nPayload n %. "type" `isEqual` typ -isTeamMemberLeaveNotif :: MakesValue a => a -> App Bool +isTeamMemberLeaveNotif :: (MakesValue a) => a -> App Bool isTeamMemberLeaveNotif = notifTypeIsEqual "team.member-leave" -isUserActivateNotif :: MakesValue a => a -> App Bool +isUserActivateNotif :: (MakesValue a) => a -> App Bool isUserActivateNotif = notifTypeIsEqual "user.activate" -isUserClientAddNotif :: MakesValue a => a -> App Bool +isUserClientAddNotif :: (MakesValue a) => a -> App Bool isUserClientAddNotif = notifTypeIsEqual "user.client-add" -isUserClientRemoveNotif :: MakesValue a => a -> App Bool +isUserClientRemoveNotif :: (MakesValue a) => a -> App Bool isUserClientRemoveNotif = notifTypeIsEqual "user.client-remove" -isUserLegalholdRequestNotif :: MakesValue a => a -> App Bool +isUserLegalholdRequestNotif :: (MakesValue a) => a -> App Bool isUserLegalholdRequestNotif = notifTypeIsEqual "user.legalhold-request" -isUserLegalholdEnabledNotif :: MakesValue a => a -> App Bool +isUserLegalholdEnabledNotif :: (MakesValue a) => a -> App Bool isUserLegalholdEnabledNotif = notifTypeIsEqual "user.legalhold-enable" -isUserLegalholdDisabledNotif :: MakesValue a => a -> App Bool +isUserLegalholdDisabledNotif :: (MakesValue a) => a -> App Bool isUserLegalholdDisabledNotif = notifTypeIsEqual "user.legalhold-disable" -isUserConnectionNotif :: MakesValue a => a -> App Bool +isUserConnectionNotif :: (MakesValue a) => a -> App Bool isUserConnectionNotif = notifTypeIsEqual "user.connection" -isConnectionNotif :: MakesValue a => String -> a -> App Bool +isConnectionNotif :: (MakesValue a) => String -> a -> App Bool isConnectionNotif status n = -- NB: -- (&&) <$> (print "hello" *> pure False) <*> fail "bla" === _|_ -- runMaybeT $ (lift (print "hello") *> MaybeT (pure Nothing)) *> lift (fail "bla") === pure Nothing - nPayload n %. "type" `isEqual` "user.connection" - &&~ nPayload n %. "connection.status" `isEqual` status + nPayload n + %. "type" + `isEqual` "user.connection" + &&~ nPayload n + %. "connection.status" + `isEqual` status assertLeaveNotification :: ( HasCallStack, @@ -212,8 +217,8 @@ assertLeaveNotification :: kickedUser -> App () assertLeaveNotification fromUser conv user client leaver = - void $ - awaitNotification + void + $ awaitNotification user client noValue @@ -225,7 +230,7 @@ assertLeaveNotification fromUser conv user client leaver = ] ) -assertConvUserDeletedNotif :: MakesValue leaverId => WebSocket -> leaverId -> App () +assertConvUserDeletedNotif :: (MakesValue leaverId) => WebSocket -> leaverId -> App () assertConvUserDeletedNotif ws leaverId = do n <- awaitMatch isConvLeaveNotif ws nPayload n %. "data.qualified_user_ids.0" `shouldMatch` leaverId diff --git a/integration/test/SetupHelpers.hs b/integration/test/SetupHelpers.hs index cc25f9599cb..63e4c61b786 100644 --- a/integration/test/SetupHelpers.hs +++ b/integration/test/SetupHelpers.hs @@ -173,7 +173,7 @@ addUserToTeam u = do -- | Create a user on the given domain, such that the 1-1 conversation with -- 'other' resides on 'convDomain'. This connects the two users as a side-effect. -createMLSOne2OnePartner :: MakesValue user => Domain -> user -> Domain -> App Value +createMLSOne2OnePartner :: (MakesValue user) => Domain -> user -> Domain -> App Value createMLSOne2OnePartner domain other convDomain = loop where loop = do @@ -189,22 +189,22 @@ createMLSOne2OnePartner domain other convDomain = loop else loop -- Copied from `src/CargoHold/API/V3.hs` and inlined to avoid pulling in `types-common` -randomToken :: HasCallStack => App String +randomToken :: (HasCallStack) => App String randomToken = unpack . B64Url.encode <$> liftIO (getRandomBytes 16) data TokenLength = GCM | APNS -randomSnsToken :: HasCallStack => TokenLength -> App String +randomSnsToken :: (HasCallStack) => TokenLength -> App String randomSnsToken = \case GCM -> mkTok 16 APNS -> mkTok 32 where mkTok = fmap (Text.unpack . decodeUtf8 . Base16.encode) . randomBytes -randomId :: HasCallStack => App String +randomId :: (HasCallStack) => App String randomId = liftIO (show <$> nextRandom) -randomUUIDv1 :: HasCallStack => App String +randomUUIDv1 :: (HasCallStack) => App String randomUUIDv1 = liftIO (show . fromJust <$> nextUUID) randomUserId :: (HasCallStack, MakesValue domain) => domain -> App Value @@ -213,7 +213,7 @@ randomUserId domain = do uid <- randomId pure $ object ["id" .= uid, "domain" .= d] -withFederatingBackendsAllowDynamic :: HasCallStack => ((String, String, String) -> App a) -> App a +withFederatingBackendsAllowDynamic :: (HasCallStack) => ((String, String, String) -> App a) -> App a withFederatingBackendsAllowDynamic k = do let setFederationConfig = setField "optSettings.setFederationStrategy" "allowDynamic" @@ -228,7 +228,7 @@ withFederatingBackendsAllowDynamic k = do -- | Create two users on different domains such that the one-to-one -- conversation, once finalised, will be hosted on the backend given by the -- input domain. -createOne2OneConversation :: HasCallStack => Domain -> App (Value, Value, Value) +createOne2OneConversation :: (HasCallStack) => Domain -> App (Value, Value, Value) createOne2OneConversation owningDomain = do owningUser <- randomUser owningDomain def domainName <- owningUser %. "qualified_id.domain" @@ -263,7 +263,7 @@ toConvType = \case -- | Fetch the one-to-one conversation between the two users that is in one of -- two possible states. -getOne2OneConversation :: HasCallStack => Value -> Value -> One2OneConvState -> App Value +getOne2OneConversation :: (HasCallStack) => Value -> Value -> One2OneConvState -> App Value getOne2OneConversation user1 user2 cnvState = do l <- getAllConvs user1 let isWith users c = do @@ -326,14 +326,14 @@ setUpLHDevice tid alice bob lhPort = do approveLegalHoldDevice tid bob defPassword >>= assertStatus 200 -lhDeviceIdOf :: MakesValue user => user -> App String +lhDeviceIdOf :: (MakesValue user) => user -> App String lhDeviceIdOf bob = do bobId <- objId bob getClientsFull bob [bobId] `bindResponse` \resp -> do resp.json %. bobId & asList - >>= filterM \val -> (== "legalhold") <$> (val %. "type" & asString) + >>= filterM \val -> (== "legalhold") <$> (val %. "type" & asString) >>= assertOne >>= (%. "id") >>= asString diff --git a/integration/test/Test/AccessUpdate.hs b/integration/test/Test/AccessUpdate.hs index 1d9ad94ad23..ad2f12a978b 100644 --- a/integration/test/Test/AccessUpdate.hs +++ b/integration/test/Test/AccessUpdate.hs @@ -42,7 +42,7 @@ testBaz = pure () -- The test asserts that, among others, remote users are removed from a -- conversation when an access update occurs that disallows guests from -- accessing. -testAccessUpdateGuestRemoved :: HasCallStack => App () +testAccessUpdateGuestRemoved :: (HasCallStack) => App () testAccessUpdateGuestRemoved = do (alice, tid, [bob]) <- createTeam OwnDomain 2 charlie <- randomUser OwnDomain def @@ -73,7 +73,7 @@ testAccessUpdateGuestRemoved = do res.status `shouldMatchInt` 200 res.json %. "members.others.0.qualified_id" `shouldMatch` objQidObject bob -testAccessUpdateGuestRemovedUnreachableRemotes :: HasCallStack => App () +testAccessUpdateGuestRemovedUnreachableRemotes :: (HasCallStack) => App () testAccessUpdateGuestRemovedUnreachableRemotes = do resourcePool <- asks resourcePool (alice, tid, [bob]) <- createTeam OwnDomain 2 @@ -109,7 +109,7 @@ testAccessUpdateGuestRemovedUnreachableRemotes = do res.status `shouldMatchInt` 200 res.json %. "members.others.0.qualified_id" `shouldMatch` objQidObject bob -testAccessUpdateWithRemotes :: HasCallStack => App () +testAccessUpdateWithRemotes :: (HasCallStack) => App () testAccessUpdateWithRemotes = do [alice, bob, charlie] <- createUsers [OwnDomain, OtherDomain, OwnDomain] connectTwoUsers alice bob diff --git a/integration/test/Test/AssetDownload.hs b/integration/test/Test/AssetDownload.hs index 68b60c85453..97fc9c94ff5 100644 --- a/integration/test/Test/AssetDownload.hs +++ b/integration/test/Test/AssetDownload.hs @@ -5,7 +5,7 @@ import GHC.Stack import SetupHelpers import Testlib.Prelude -testDownloadAsset :: HasCallStack => App () +testDownloadAsset :: (HasCallStack) => App () testDownloadAsset = do user <- randomUser OwnDomain def @@ -19,7 +19,7 @@ testDownloadAsset = do ("Expect 'Hello World!' as text asset content. Got: " ++ show resp.body) (resp.body == fromString "Hello World!") -testDownloadAssetMultiIngressS3DownloadUrl :: HasCallStack => App () +testDownloadAssetMultiIngressS3DownloadUrl :: (HasCallStack) => App () testDownloadAssetMultiIngressS3DownloadUrl = do user <- randomUser OwnDomain def @@ -63,14 +63,14 @@ testDownloadAssetMultiIngressS3DownloadUrl = do modifyConfig = def { cargoholdCfg = - setField "aws.multiIngress" $ - object + setField "aws.multiIngress" + $ object [ "red.example.com" .= "http://s3-download.red.example.com", "green.example.com" .= "http://s3-download.green.example.com" ] } - doUploadAsset :: HasCallStack => Value -> App Value + doUploadAsset :: (HasCallStack) => Value -> App Value doUploadAsset user = bindResponse (uploadAsset user) $ \resp -> do resp.status `shouldMatchInt` 201 resp.json %. "key" diff --git a/integration/test/Test/AssetUpload.hs b/integration/test/Test/AssetUpload.hs index d55eadc83c1..c581fd03b2f 100644 --- a/integration/test/Test/AssetUpload.hs +++ b/integration/test/Test/AssetUpload.hs @@ -5,19 +5,19 @@ import API.Cargohold import SetupHelpers import Testlib.Prelude -testAssetUploadUnverifiedUser :: HasCallStack => App () +testAssetUploadUnverifiedUser :: (HasCallStack) => App () testAssetUploadUnverifiedUser = do user <- randomUser OwnDomain $ def {activate = False} bindResponse (uploadAsset user) $ \resp -> do resp.status `shouldMatchInt` 403 -testAssetUploadVerifiedUser :: HasCallStack => App () +testAssetUploadVerifiedUser :: (HasCallStack) => App () testAssetUploadVerifiedUser = do user <- randomUser OwnDomain def bindResponse (uploadAsset user) $ \resp -> do resp.status `shouldMatchInt` 201 -testAssetUploadUnknownUser :: HasCallStack => App () +testAssetUploadUnknownUser :: (HasCallStack) => App () testAssetUploadUnknownUser = do uid <- randomId domain <- make OwnDomain diff --git a/integration/test/Test/Bot.hs b/integration/test/Test/Bot.hs index ff399e98fc7..b635b9e0acd 100644 --- a/integration/test/Test/Bot.hs +++ b/integration/test/Test/Bot.hs @@ -103,8 +103,8 @@ withBotWithSettings settings k = do provider <- setupProvider alice def {newProviderEmail = email, newProviderPassword = Just defPassword} providerId <- provider %. "id" & asString service <- - newService OwnDomain providerId $ - def {newServiceUrl = "https://" <> host <> ":" <> show port, newServiceKey = cs settings.publicKey} + newService OwnDomain providerId + $ def {newServiceUrl = "https://" <> host <> ":" <> show port, newServiceKey = cs settings.publicKey} serviceId <- asString $ service %. "id" conv <- getJSON 201 =<< postConversation alice defProteus convId <- conv %. "id" & asString @@ -138,8 +138,8 @@ onBotCreate chan _headers _req k = do writeChan chan BotCreated lpk <- getLastPrekey k $ responseLBS status201 mempty do - Aeson.encode $ - object + Aeson.encode + $ object [ "prekeys" .= pks, "last_prekey" .= lpk ] diff --git a/integration/test/Test/Brig.hs b/integration/test/Test/Brig.hs index 0feb154388e..3dd88bceec4 100644 --- a/integration/test/Test/Brig.hs +++ b/integration/test/Test/Brig.hs @@ -15,14 +15,15 @@ import Testlib.Assertions import Testlib.Prelude import UnliftIO.Temporary -testCrudFederationRemotes :: HasCallStack => App () +testCrudFederationRemotes :: (HasCallStack) => App () testCrudFederationRemotes = do otherDomain <- asString OtherDomain withModifiedBackend def $ \ownDomain -> do - let parseFedConns :: HasCallStack => Response -> App [Value] + let parseFedConns :: (HasCallStack) => Response -> App [Value] parseFedConns resp = -- Pick out the list of federation domain configs - getJSON 200 resp %. "remotes" + getJSON 200 resp + %. "remotes" & asList -- Enforce that the values are objects and not something else >>= traverse (fmap Object . asObject) @@ -61,7 +62,7 @@ testCrudFederationRemotes = do -- update updateTest (BrigI.domain remote1) remote1' [cfgRemotesExpect, remote1'] -testCrudOAuthClient :: HasCallStack => App () +testCrudOAuthClient :: (HasCallStack) => App () testCrudOAuthClient = do user <- randomUser OwnDomain def let appName = "foobar" @@ -84,7 +85,7 @@ testCrudOAuthClient = do bindResponse (BrigI.getOAuthClient user clientId) $ \resp -> do resp.status `shouldMatchInt` 404 -testCrudFederationRemoteTeams :: HasCallStack => App () +testCrudFederationRemoteTeams :: (HasCallStack) => App () testCrudFederationRemoteTeams = do (_, tid, _) <- createTeam OwnDomain 1 (_, tid2, _) <- createTeam OwnDomain 1 @@ -129,7 +130,7 @@ testCrudFederationRemoteTeams = do remoteTeams <- forM l (\e -> e %. "team_id" & asString) when (any (\t -> t `notElem` remoteTeams) tids) $ assertFailure "Expected response to contain all of the teams" -testSFTCredentials :: HasCallStack => App () +testSFTCredentials :: (HasCallStack) => App () testSFTCredentials = do let ttl = (60 :: Int) withSystemTempFile "sft-secret" $ \secretFile secretHandle -> do @@ -164,7 +165,7 @@ testSFTCredentials = do when (take 2 (parts !! 4) /= "r=") $ assertFailure "missing random data identifier" for_ parts $ \part -> when (length part < 3) $ assertFailure ("value missing for " <> part) -testSFTNoCredentials :: HasCallStack => App () +testSFTNoCredentials :: (HasCallStack) => App () testSFTNoCredentials = withModifiedBackend ( def { brigCfg = @@ -184,7 +185,7 @@ testSFTNoCredentials = withModifiedBackend usrM <- lookupField s "username" when (isJust usrM) $ assertFailure "should not generate username" -testSFTFederation :: HasCallStack => App () +testSFTFederation :: (HasCallStack) => App () testSFTFederation = do withModifiedBackend ( def diff --git a/integration/test/Test/Cargohold/API.hs b/integration/test/Test/Cargohold/API.hs index 25f3c4956d9..c6984bf57ee 100644 --- a/integration/test/Test/Cargohold/API.hs +++ b/integration/test/Test/Cargohold/API.hs @@ -42,14 +42,14 @@ import UnliftIO.Concurrent -------------------------------------------------------------------------------- -- Simple (single-step) uploads -testSimpleRoundtrip :: HasCallStack => App () +testSimpleRoundtrip :: (HasCallStack) => App () testSimpleRoundtrip = do let def' = ["public" .= False] rets = ["eternal", "persistent", "volatile", "eternal-infrequent_access", "expiring"] sets' = fmap object $ def' : fmap (\r -> "retention" .= r : def') rets mapM_ simpleRoundtrip sets' where - simpleRoundtrip :: HasCallStack => Value -> App () + simpleRoundtrip :: (HasCallStack) => Value -> App () simpleRoundtrip sets = do uid <- randomUser OwnDomain def userId1 <- uid %. "id" & asString @@ -75,8 +75,8 @@ testSimpleRoundtrip = do Just r -> do r' <- asString r -- These retention policies never expire, so an expiration date isn't sent back - unless (r' == "eternal" || r' == "persistent" || r' == "eternal-infrequent_access") $ - assertBool "invalid expiration" (Just utc < expires') + unless (r' == "eternal" || r' == "persistent" || r' == "eternal-infrequent_access") + $ assertBool "invalid expiration" (Just utc < expires') _ -> pure () -- Lookup with token and download via redirect. r2 <- downloadAsset' uid loc tok @@ -98,7 +98,7 @@ testSimpleRoundtrip = do utc' = parseTimeOrError False defaultTimeLocale rfc822DateFormat date' :: UTCTime assertBool "bad date" (utc' >= utc) -testDownloadWithAcceptHeader :: HasCallStack => App () +testDownloadWithAcceptHeader :: (HasCallStack) => App () testDownloadWithAcceptHeader = do assetId <- randomId uid <- randomUser OwnDomain def @@ -117,7 +117,7 @@ queryItem k v r = get' :: HTTP.Request -> (HTTP.Request -> HTTP.Request) -> App Response get' r f = submit "GET" $ f r -testSimpleTokens :: HasCallStack => App () +testSimpleTokens :: (HasCallStack) => App () testSimpleTokens = do uid <- randomUser OwnDomain def uid2 <- randomUser OwnDomain def @@ -134,7 +134,8 @@ testSimpleTokens = do (key, tok) <- (,) <$> asString (r1.json %. "key") - <*> r1.json %. "token" + <*> r1.json + %. "token" -- No access without token from other user (opaque 404) downloadAsset' uid2 loc () >>= \r -> r.status `shouldMatchInt` 404 -- No access with empty token query parameter from other user (opaque 404) @@ -199,7 +200,7 @@ defAssetSettings = object defAssetSettings' -- S3 closes idle connections after ~5 seconds, before the http-client 'Manager' -- does. If such a closed connection is reused for an upload, no problems should -- occur (i.e. the closed connection should be detected before sending any data). -testSimpleS3ClosedConnectionReuse :: HasCallStack => App () +testSimpleS3ClosedConnectionReuse :: (HasCallStack) => App () testSimpleS3ClosedConnectionReuse = go >> wait >> go where wait = liftIO $ putStrLn "Waiting for S3 idle timeout ..." >> threadDelay 7000000 @@ -209,7 +210,7 @@ testSimpleS3ClosedConnectionReuse = go >> wait >> go let part2 = (MIME.Text $ cs "plain", cs $ replicate 100000 'c') uploadSimple uid sets part2 >>= \r -> r.status `shouldMatchInt` 201 -testDownloadURLOverride :: HasCallStack => App () +testDownloadURLOverride :: (HasCallStack) => App () testDownloadURLOverride = do -- This is a .example domain, it shouldn't resolve. But it is also not -- supposed to be used by cargohold to make connections. @@ -227,7 +228,8 @@ testDownloadURLOverride = do let loc = decodeHeaderOrFail (mk $ cs "Location") uploadRes :: String (_key, tok, _expires) <- (,,) - <$> uploadRes.json %. "key" + <$> uploadRes.json + %. "key" <*> (uploadRes.json %. "token" & asString) <*> lookupField uploadRes.json "expires" -- Lookup with token and get download URL. Should return the @@ -249,7 +251,7 @@ testDownloadURLOverride = do -- -- The body is taken directly from a request made by the web app -- (just replaced the content with a shorter one and updated the MD5 header). -testUploadCompatibility :: HasCallStack => App () +testUploadCompatibility :: (HasCallStack) => App () testUploadCompatibility = do uid <- randomUser OwnDomain def -- Initial upload @@ -287,7 +289,7 @@ testUploadCompatibility = do -------------------------------------------------------------------------------- -- Federation behaviour -testRemoteDownloadWrongDomain :: HasCallStack => App () +testRemoteDownloadWrongDomain :: (HasCallStack) => App () testRemoteDownloadWrongDomain = do assetId <- randomId uid <- randomUser OwnDomain def @@ -300,7 +302,7 @@ testRemoteDownloadWrongDomain = do res <- downloadAsset' uid qkey () res.status `shouldMatchInt` 422 -testRemoteDownloadNoAsset :: HasCallStack => App () +testRemoteDownloadNoAsset :: (HasCallStack) => App () testRemoteDownloadNoAsset = do assetId <- randomId uid <- randomUser OwnDomain def @@ -314,10 +316,10 @@ testRemoteDownloadNoAsset = do res <- downloadAsset' uid qkey () res.status `shouldMatchInt` 404 -testRemoteDownloadShort :: HasCallStack => App () +testRemoteDownloadShort :: (HasCallStack) => App () testRemoteDownloadShort = remoteDownload "asset content" -testRemoteDownloadLong :: HasCallStack => App () +testRemoteDownloadLong :: (HasCallStack) => App () testRemoteDownloadLong = remoteDownload $ concat $ replicate 20000 $ "hello world\n" remoteDownload :: (HasCallStack, ConvertibleStrings a L8.ByteString, ConvertibleStrings a String) => a -> App () diff --git a/integration/test/Test/Cargohold/API/Federation.hs b/integration/test/Test/Cargohold/API/Federation.hs index 2b0a1da8266..8cb6f4ac26f 100644 --- a/integration/test/Test/Cargohold/API/Federation.hs +++ b/integration/test/Test/Cargohold/API/Federation.hs @@ -27,13 +27,13 @@ import SetupHelpers import Test.Cargohold.API.Util import Testlib.Prelude -testGetAssetAvailablePublic :: HasCallStack => App () +testGetAssetAvailablePublic :: (HasCallStack) => App () testGetAssetAvailablePublic = getAssetAvailable True -testGetAssetAvailablePrivate :: HasCallStack => App () +testGetAssetAvailablePrivate :: (HasCallStack) => App () testGetAssetAvailablePrivate = getAssetAvailable False -getAssetAvailable :: HasCallStack => Bool -> App () +getAssetAvailable :: (HasCallStack) => Bool -> App () getAssetAvailable isPublicAsset = do -- Initial upload let bdy = (applicationOctetStream, cs "Hello World") @@ -53,7 +53,7 @@ getAssetAvailable isPublicAsset = do res <- downloadAsset' uid2 r1.jsonBody tok res.status `shouldMatchInt` 200 -testGetAssetNotAvailable :: HasCallStack => App () +testGetAssetNotAvailable :: (HasCallStack) => App () testGetAssetNotAvailable = do uid <- randomUser OwnDomain def userId <- uid %. "id" & asString @@ -68,7 +68,7 @@ testGetAssetNotAvailable = do r.status `shouldMatchInt` 404 r.jsonBody %. "message" `shouldMatch` "Asset not found" -testGetAssetWrongToken :: HasCallStack => App () +testGetAssetWrongToken :: (HasCallStack) => App () testGetAssetWrongToken = do -- Initial upload let bdy = (applicationOctetStream, cs "Hello World") @@ -95,7 +95,7 @@ testGetAssetWrongToken = do r2.status `shouldMatchInt` 404 r2.jsonBody %. "message" `shouldMatch` "Asset not found" -testLargeAsset :: HasCallStack => App () +testLargeAsset :: (HasCallStack) => App () testLargeAsset = do -- Initial upload let settings = object ["public" .= False, "retention" .= "volatile"] @@ -122,7 +122,7 @@ testLargeAsset = do r2 <- downloadAsset' uid2 ga ga r2.status `shouldMatchInt` 200 -testStreamAsset :: HasCallStack => App () +testStreamAsset :: (HasCallStack) => App () testStreamAsset = do -- Initial upload uid <- randomUser OwnDomain def @@ -140,11 +140,11 @@ testStreamAsset = do r2.status `shouldMatchInt` 200 cs @_ @String r2.body `shouldMatch` (snd bdy :: String) where - bdy :: ConvertibleStrings String a => (MIME.MIMEType, a) + bdy :: (ConvertibleStrings String a) => (MIME.MIMEType, a) bdy = (applicationOctetStream, cs "Hello World") settings = object ["public" .= False, "retention" .= "volatile"] -testStreamAssetNotAvailable :: HasCallStack => App () +testStreamAssetNotAvailable :: (HasCallStack) => App () testStreamAssetNotAvailable = do uid <- randomUser OwnDomain def uid2 <- randomUser OtherDomain def @@ -158,7 +158,7 @@ testStreamAssetNotAvailable = do r.status `shouldMatchInt` 404 r.jsonBody %. "message" `shouldMatch` "Asset not found" -testStreamAssetWrongToken :: HasCallStack => App () +testStreamAssetWrongToken :: (HasCallStack) => App () testStreamAssetWrongToken = do -- Initial upload uid <- randomUser OwnDomain def @@ -176,6 +176,6 @@ testStreamAssetWrongToken = do r2.status `shouldMatchInt` 404 r2.jsonBody %. "message" `shouldMatch` "Asset not found" where - bdy :: ConvertibleStrings String a => (MIME.MIMEType, a) + bdy :: (ConvertibleStrings String a) => (MIME.MIMEType, a) bdy = (applicationOctetStream, cs "Hello World") settings = object ["public" .= False, "retention" .= "volatile"] diff --git a/integration/test/Test/Cargohold/API/Util.hs b/integration/test/Test/Cargohold/API/Util.hs index 16564ea6930..8ffb512da7b 100644 --- a/integration/test/Test/Cargohold/API/Util.hs +++ b/integration/test/Test/Cargohold/API/Util.hs @@ -143,10 +143,10 @@ downloadAssetWithQualifiedAssetKey r user key tok = do dom <- key %. "domain" & asString keyId <- key %. "id" & asString req <- baseRequest user Cargohold (ExplicitVersion 2) $ "assets/" <> dom <> "/" <> keyId - submit "GET" $ - req - & tokenParam tok - & r + submit "GET" + $ req + & tokenParam tok + & r postToken :: (MakesValue user, HasCallStack) => user -> String -> App Response postToken user key = do diff --git a/integration/test/Test/Cargohold/API/V3.hs b/integration/test/Test/Cargohold/API/V3.hs index 04e8797daea..55bc4933f00 100644 --- a/integration/test/Test/Cargohold/API/V3.hs +++ b/integration/test/Test/Cargohold/API/V3.hs @@ -37,14 +37,14 @@ import Testlib.Prelude -------------------------------------------------------------------------------- -- Simple (single-step) uploads -testSimpleRoundtrip :: HasCallStack => App () +testSimpleRoundtrip :: (HasCallStack) => App () testSimpleRoundtrip = do let defSettings = ["public" .= False] rets = ["eternal", "persistent", "volatile", "eternal-infrequent_access", "expiring"] allSets = fmap object $ (defSettings :) $ (\r -> ["retention" .= r]) <$> rets mapM_ simpleRoundtrip allSets where - simpleRoundtrip :: HasCallStack => Value -> App () + simpleRoundtrip :: (HasCallStack) => Value -> App () simpleRoundtrip sets = do uid <- randomUser OwnDomain def uid2 <- randomUser OwnDomain def @@ -55,7 +55,8 @@ testSimpleRoundtrip = do -- use v3 path instead of the one returned in the header (key, tok, expires) <- (,,) - <$> r1.json %. "key" + <$> r1.json + %. "key" <*> (r1.json %. "token" >>= asString) <*> (lookupField r1.json "expires" >>= maybe (pure Nothing) (fmap pure . asString)) -- Check mandatory Date header @@ -74,8 +75,8 @@ testSimpleRoundtrip = do Just r -> do r' <- asString r -- These retention policies never expire, so an expiration date isn't sent back - unless (r' == "eternal" || r' == "persistent" || r' == "eternal-infrequent_access") $ - assertBool "invalid expiration" (Just utc < expires') + unless (r' == "eternal" || r' == "persistent" || r' == "eternal-infrequent_access") + $ assertBool "invalid expiration" (Just utc < expires') _ -> pure () -- Lookup with token and download via redirect. r2 <- downloadAsset' uid r1.jsonBody tok @@ -86,8 +87,9 @@ testSimpleRoundtrip = do req <- liftIO $ parseRequest locReq r3 <- submit "GET" req r3.status `shouldMatchInt` 200 - assertBool "content-type should always be application/octet-stream" $ - getHeader (mk $ cs "content-type") r3 == Just (encodeUtf8 $ showMIMEType applicationOctetStream) + assertBool "content-type should always be application/octet-stream" + $ getHeader (mk $ cs "content-type") r3 + == Just (encodeUtf8 $ showMIMEType applicationOctetStream) assertBool "Token mismatch" $ getHeader (mk $ cs "x-amz-meta-token") r3 == pure (cs tok) uid' <- uid %. "id" >>= asString assertBool "User mismatch" $ getHeader (mk $ cs "x-amz-meta-user") r3 == pure (cs uid') diff --git a/integration/test/Test/Cargohold/Metrics.hs b/integration/test/Test/Cargohold/Metrics.hs index c88d6cff920..aec91ee8c17 100644 --- a/integration/test/Test/Cargohold/Metrics.hs +++ b/integration/test/Test/Cargohold/Metrics.hs @@ -20,7 +20,7 @@ module Test.Cargohold.Metrics where import Data.String.Conversions import Testlib.Prelude -testPrometheusMetrics :: HasCallStack => App () +testPrometheusMetrics :: (HasCallStack) => App () testPrometheusMetrics = do req <- baseRequest OwnDomain Cargohold Unversioned "i/metrics" resp <- submit "GET" req diff --git a/integration/test/Test/Client.hs b/integration/test/Test/Client.hs index b512c08d08c..d00e8174710 100644 --- a/integration/test/Test/Client.hs +++ b/integration/test/Test/Client.hs @@ -17,7 +17,7 @@ import SetupHelpers import Testlib.Prelude import Testlib.ResourcePool -testClientLastActive :: HasCallStack => App () +testClientLastActive :: (HasCallStack) => App () testClientLastActive = do alice <- randomUser OwnDomain def c0 <- addClient alice def >>= getJSON 201 @@ -41,7 +41,7 @@ testClientLastActive = do <$> parseTimeM False defaultTimeLocale "%Y-%m-%dT%H:%M:%SZ" tm1 assertBool "last_active is earlier than expected" $ ts1 >= now -testListClientsIfBackendIsOffline :: HasCallStack => App () +testListClientsIfBackendIsOffline :: (HasCallStack) => App () testListClientsIfBackendIsOffline = do resourcePool <- asks (.resourcePool) ownDomain <- asString OwnDomain diff --git a/integration/test/Test/Connection.hs b/integration/test/Test/Connection.hs index f982df677d4..d12feb41f01 100644 --- a/integration/test/Test/Connection.hs +++ b/integration/test/Test/Connection.hs @@ -24,7 +24,7 @@ import SetupHelpers import Testlib.Prelude import UnliftIO.Async (forConcurrently_) -testConnectWithRemoteUser :: HasCallStack => Domain -> App () +testConnectWithRemoteUser :: (HasCallStack) => Domain -> App () testConnectWithRemoteUser owningDomain = do (alice, bob, one2oneId) <- createOne2OneConversation owningDomain aliceId <- alice %. "qualified_id" @@ -40,7 +40,7 @@ testConnectWithRemoteUser owningDomain = do qIds <- for others (%. "qualified_id") qIds `shouldMatchSet` [aliceId] -testRemoteUserGetsDeleted :: HasCallStack => App () +testRemoteUserGetsDeleted :: (HasCallStack) => App () testRemoteUserGetsDeleted = do alice <- randomUser OwnDomain def @@ -94,7 +94,7 @@ testRemoteUserGetsDeleted = do getConnection alice charlie `waitForResponse` \resp -> resp.status `shouldMatchInt` 404 -testInternalGetConStatusesAll :: HasCallStack => App () +testInternalGetConStatusesAll :: (HasCallStack) => App () testInternalGetConStatusesAll = startDynamicBackends [mempty] \[dynBackend] -> do let mkFiveUsers dom = replicateM 5 do @@ -149,7 +149,7 @@ assertConnectionStatus userFrom userTo connStatus = resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` connStatus -testConnectFromIgnored :: HasCallStack => App () +testConnectFromIgnored :: (HasCallStack) => App () testConnectFromIgnored = do [alice, bob] <- forM [OwnDomain, OtherDomain] $ flip randomUser def void $ postConnection bob alice >>= getBody 201 @@ -168,7 +168,7 @@ testConnectFromIgnored = do resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` "accepted" -testSentFromIgnored :: HasCallStack => App () +testSentFromIgnored :: (HasCallStack) => App () testSentFromIgnored = do [alice, bob] <- forM [OwnDomain, OtherDomain] $ flip randomUser def -- set up an initial "ignored" state @@ -185,7 +185,7 @@ testSentFromIgnored = do void $ putConnection alice bob "accepted" >>= getBody 200 assertConnectionStatus alice bob "sent" -testConnectFromBlocked :: HasCallStack => App () +testConnectFromBlocked :: (HasCallStack) => App () testConnectFromBlocked = do (alice, bob, one2oneId) <- createOne2OneConversation OwnDomain bobId <- bob %. "qualified_id" @@ -211,7 +211,7 @@ testConnectFromBlocked = do qIds <- for others (%. "qualified_id") qIds `shouldMatchSet` [bobId] -testSentFromBlocked :: HasCallStack => App () +testSentFromBlocked :: (HasCallStack) => App () testSentFromBlocked = do [alice, bob] <- forM [OwnDomain, OtherDomain] $ flip randomUser def -- set up an initial "blocked" state @@ -228,7 +228,7 @@ testSentFromBlocked = do void $ putConnection alice bob "accepted" >>= getBody 200 assertConnectionStatus alice bob "sent" -testCancel :: HasCallStack => App () +testCancel :: (HasCallStack) => App () testCancel = do [alice, bob] <- forM [OwnDomain, OtherDomain] $ flip randomUser def @@ -238,7 +238,7 @@ testCancel = do void $ putConnection alice bob "cancelled" >>= getBody 200 assertConnectionStatus alice bob "cancelled" -testConnectionLimits :: HasCallStack => App () +testConnectionLimits :: (HasCallStack) => App () testConnectionLimits = do let connectionLimit = 16 @@ -308,7 +308,7 @@ testConnectionLimits = do postConnection alice charlie4 `bindResponse` \resp -> resp.status `shouldMatchInt` 201 -testNonFederatingRemoteTeam :: HasCallStack => App () +testNonFederatingRemoteTeam :: (HasCallStack) => App () testNonFederatingRemoteTeam = withFederatingBackendsAllowDynamic $ \(domainA, domainB, _) -> do sequence_ @@ -324,7 +324,7 @@ testNonFederatingRemoteTeam = where defSearchPolicy = "full_search" -testNonMutualFederationConnectionAttempt :: HasCallStack => App () +testNonMutualFederationConnectionAttempt :: (HasCallStack) => App () testNonMutualFederationConnectionAttempt = withFederatingBackendsAllowDynamic $ \(domainA, domainB, _) -> do sequence_ @@ -348,7 +348,7 @@ testNonMutualFederationConnectionAttempt = where defSearchPolicy = "full_search" -testFederationAllowAllConnectWithRemote :: HasCallStack => App () +testFederationAllowAllConnectWithRemote :: (HasCallStack) => App () testFederationAllowAllConnectWithRemote = withFederatingBackendsAllowDynamic $ \(domainA, domainB, _) -> do sequence_ @@ -359,7 +359,7 @@ testFederationAllowAllConnectWithRemote = where defSearchPolicy = "full_search" -testFederationAllowDynamicConnectWithRemote :: HasCallStack => App () +testFederationAllowDynamicConnectWithRemote :: (HasCallStack) => App () testFederationAllowDynamicConnectWithRemote = withFederatingBackendsAllowDynamic $ \(domainA, domainB, _) -> do sequence_ @@ -383,7 +383,7 @@ testFederationAllowDynamicConnectWithRemote = where defSearchPolicy = "full_search" -testFederationAllowMixedConnectWithRemote :: HasCallStack => App () +testFederationAllowMixedConnectWithRemote :: (HasCallStack) => App () testFederationAllowMixedConnectWithRemote = withFederatingBackendsAllowDynamic $ \(domainA, domainB, _) -> do sequence_ @@ -403,7 +403,7 @@ testFederationAllowMixedConnectWithRemote = where defSearchPolicy = "full_search" -testPendingConnectionUserDeleted :: HasCallStack => Domain -> App () +testPendingConnectionUserDeleted :: (HasCallStack) => Domain -> App () testPendingConnectionUserDeleted bobsDomain = do alice <- randomUser OwnDomain def bob <- randomUser bobsDomain def diff --git a/integration/test/Test/Conversation.hs b/integration/test/Test/Conversation.hs index 9426f1a41c1..f44eb9eea2f 100644 --- a/integration/test/Test/Conversation.hs +++ b/integration/test/Test/Conversation.hs @@ -36,7 +36,7 @@ import Testlib.One2One (generateRemoteAndConvIdWithDomain) import Testlib.Prelude import Testlib.ResourcePool -testDynamicBackendsFullyConnectedWhenAllowAll :: HasCallStack => App () +testDynamicBackendsFullyConnectedWhenAllowAll :: (HasCallStack) => App () testDynamicBackendsFullyConnectedWhenAllowAll = do -- The default setting is 'allowAll' startDynamicBackends [def, def, def] $ \dynDomains -> do @@ -56,7 +56,7 @@ testDynamicBackendsFullyConnectedWhenAllowAll = do resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` "fully-connected" -testDynamicBackendsNotFederating :: HasCallStack => App () +testDynamicBackendsNotFederating :: (HasCallStack) => App () testDynamicBackendsNotFederating = do let overrides = def @@ -72,7 +72,7 @@ testDynamicBackendsNotFederating = do resp.status `shouldMatchInt` 533 resp.json %. "unreachable_backends" `shouldMatchSet` [domainB, domainC] -testDynamicBackendsFullyConnectedWhenAllowDynamic :: HasCallStack => App () +testDynamicBackendsFullyConnectedWhenAllowDynamic :: (HasCallStack) => App () testDynamicBackendsFullyConnectedWhenAllowDynamic = do withFederatingBackendsAllowDynamic $ \(domainA, domainB, domainC) -> do -- Allowing 'full_search' or any type of search is how we enable federation @@ -96,7 +96,7 @@ testDynamicBackendsFullyConnectedWhenAllowDynamic = do retryT $ assertConnected uidB domainA domainC retryT $ assertConnected uidC domainA domainB -testDynamicBackendsNotFullyConnected :: HasCallStack => App () +testDynamicBackendsNotFullyConnected :: (HasCallStack) => App () testDynamicBackendsNotFullyConnected = do withFederatingBackendsAllowDynamic $ \(domainA, domainB, domainC) -> do -- A is connected to B and C, but B and C are not connected to each other @@ -113,7 +113,7 @@ testDynamicBackendsNotFullyConnected = do resp.json %. "status" `shouldMatch` "non-fully-connected" resp.json %. "not_connected" `shouldMatchSet` [domainB, domainC] -testFederationStatus :: HasCallStack => App () +testFederationStatus :: (HasCallStack) => App () testFederationStatus = do uid <- randomUser OwnDomain def {BrigI.team = True} federatingRemoteDomain <- asString OtherDomain @@ -136,7 +136,7 @@ testFederationStatus = do resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` "fully-connected" -testCreateConversationFullyConnected :: HasCallStack => App () +testCreateConversationFullyConnected :: (HasCallStack) => App () testCreateConversationFullyConnected = do startDynamicBackends [def, def, def] $ \[domainA, domainB, domainC] -> do [u1, u2, u3] <- createUsers [domainA, domainB, domainC] @@ -145,7 +145,7 @@ testCreateConversationFullyConnected = do bindResponse (postConversation u1 (defProteus {qualifiedUsers = [u2, u3]})) $ \resp -> do resp.status `shouldMatchInt` 201 -testCreateConversationNonFullyConnected :: HasCallStack => App () +testCreateConversationNonFullyConnected :: (HasCallStack) => App () testCreateConversationNonFullyConnected = do withFederatingBackendsAllowDynamic $ \(domainA, domainB, domainC) -> do -- A is connected to B and C, but B and C are not connected to each other @@ -165,7 +165,7 @@ testCreateConversationNonFullyConnected = do resp.status `shouldMatchInt` 409 resp.json %. "non_federating_backends" `shouldMatchSet` [domainB, domainC] -testAddMembersFullyConnectedProteus :: HasCallStack => App () +testAddMembersFullyConnectedProteus :: (HasCallStack) => App () testAddMembersFullyConnectedProteus = do startDynamicBackends [def, def, def] $ \[domainA, domainB, domainC] -> do [u1, u2, u3] <- createUsers [domainA, domainB, domainC] @@ -181,7 +181,7 @@ testAddMembersFullyConnectedProteus = do addedUsers <- forM users (%. "qualified_id") addedUsers `shouldMatchSet` members -testAddMembersNonFullyConnectedProteus :: HasCallStack => App () +testAddMembersNonFullyConnectedProteus :: (HasCallStack) => App () testAddMembersNonFullyConnectedProteus = do withFederatingBackendsAllowDynamic $ \(domainA, domainB, domainC) -> do void $ BrigI.createFedConn domainA (BrigI.FedConn domainB "full_search" Nothing) @@ -205,7 +205,7 @@ testAddMembersNonFullyConnectedProteus = do resp.status `shouldMatchInt` 409 resp.json %. "non_federating_backends" `shouldMatchSet` [domainB, domainC] -testAddMember :: HasCallStack => App () +testAddMember :: (HasCallStack) => App () testAddMember = do alice <- randomUser OwnDomain def aliceId <- alice %. "qualified_id" @@ -242,7 +242,7 @@ testAddMember = do mem %. "qualified_id" `shouldMatch` aliceId mem %. "conversation_role" `shouldMatch` "wire_admin" -testAddMemberV1 :: HasCallStack => Domain -> App () +testAddMemberV1 :: (HasCallStack) => Domain -> App () testAddMemberV1 domain = do [alice, bob] <- createAndConnectUsers [OwnDomain, domain] conv <- postConversation alice defProteus >>= getJSON 201 @@ -261,7 +261,7 @@ testAddMemberV1 domain = do users <- resp.json %. "data.users" >>= asList traverse (%. "qualified_id") users `shouldMatchSet` [bobId] -testConvWithUnreachableRemoteUsers :: HasCallStack => App () +testConvWithUnreachableRemoteUsers :: (HasCallStack) => App () testConvWithUnreachableRemoteUsers = do ([alice, alex, bob, charlie, dylan], domains) <- startDynamicBackends [def, def] $ \domains -> do @@ -280,7 +280,7 @@ testConvWithUnreachableRemoteUsers = do regConvs <- filterM (\c -> (==) <$> (c %. "type" & asInt) <*> pure 0) convs regConvs `shouldMatch` ([] :: [Value]) -testAddUserWithUnreachableRemoteUsers :: HasCallStack => App () +testAddUserWithUnreachableRemoteUsers :: (HasCallStack) => App () testAddUserWithUnreachableRemoteUsers = do resourcePool <- asks resourcePool own <- make OwnDomain & asString @@ -312,7 +312,7 @@ testAddUserWithUnreachableRemoteUsers = do resp.status `shouldMatchInt` 533 resp.jsonBody %. "unreachable_backends" `shouldMatchSet` [cDom.berDomain] -testAddUnreachableUserFromFederatingBackend :: HasCallStack => App () +testAddUnreachableUserFromFederatingBackend :: (HasCallStack) => App () testAddUnreachableUserFromFederatingBackend = do resourcePool <- asks resourcePool runCodensity (acquireResources 1 resourcePool) $ \[cDom] -> do @@ -335,7 +335,7 @@ testAddUnreachableUserFromFederatingBackend = do resp.status `shouldMatchInt` 533 resp.jsonBody %. "unreachable_backends" `shouldMatchSet` [cDom.berDomain] -testAddUnreachable :: HasCallStack => App () +testAddUnreachable :: (HasCallStack) => App () testAddUnreachable = do ([alex, charlie], [charlieDomain, dylanDomain], conv) <- startDynamicBackends [def, def] $ \domains -> do @@ -373,7 +373,7 @@ testGetOneOnOneConvInStatusSentFromRemote = do resp <- getConversation d1User d2ConvId resp.status `shouldMatchInt` 200 -testAddingUserNonFullyConnectedFederation :: HasCallStack => App () +testAddingUserNonFullyConnectedFederation :: (HasCallStack) => App () testAddingUserNonFullyConnectedFederation = do let overrides = def @@ -404,7 +404,7 @@ testAddingUserNonFullyConnectedFederation = do resp.status `shouldMatchInt` 409 resp.json %. "non_federating_backends" `shouldMatchSet` [other, dynBackend] -testMultiIngressGuestLinks :: HasCallStack => App () +testMultiIngressGuestLinks :: (HasCallStack) => App () testMultiIngressGuestLinks = do do configuredURI <- readServiceConfig Galley & (%. "settings.conversationCodeURI") & asText @@ -470,7 +470,7 @@ testMultiIngressGuestLinks = do res <- getJSON 403 resp res %. "label" `shouldMatch` "access-denied" -testAddUserWhenOtherBackendOffline :: HasCallStack => App () +testAddUserWhenOtherBackendOffline :: (HasCallStack) => App () testAddUserWhenOtherBackendOffline = do ([alice, alex], conv) <- startDynamicBackends [def] $ \domains -> do @@ -484,7 +484,7 @@ testAddUserWhenOtherBackendOffline = do bindResponse (addMembers alice conv def {users = [alex]}) $ \resp -> do resp.status `shouldMatchInt` 200 -testSynchroniseUserRemovalNotification :: HasCallStack => App () +testSynchroniseUserRemovalNotification :: (HasCallStack) => App () testSynchroniseUserRemovalNotification = do resourcePool <- asks resourcePool [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] @@ -511,7 +511,7 @@ testSynchroniseUserRemovalNotification = do leaveNotif <- awaitNotification charlie client noValue isConvLeaveNotif leaveNotif %. "payload.0.qualified_conversation" `shouldMatch` objQidObject conv -testConvRenaming :: HasCallStack => App () +testConvRenaming :: (HasCallStack) => App () testConvRenaming = do [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] conv <- @@ -525,7 +525,7 @@ testConvRenaming = do nameNotif %. "payload.0.data.name" `shouldMatch` newConvName nameNotif %. "payload.0.qualified_conversation" `shouldMatch` objQidObject conv -testReceiptModeWithRemotesOk :: HasCallStack => App () +testReceiptModeWithRemotesOk :: (HasCallStack) => App () testReceiptModeWithRemotesOk = do [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] conv <- @@ -539,7 +539,7 @@ testReceiptModeWithRemotesOk = do notif %. "payload.0.qualified_from" `shouldMatch` objQidObject alice notif %. "payload.0.data.receipt_mode" `shouldMatchInt` 43 -testReceiptModeWithRemotesUnreachable :: HasCallStack => App () +testReceiptModeWithRemotesUnreachable :: (HasCallStack) => App () testReceiptModeWithRemotesUnreachable = do ownDomain <- asString OwnDomain alice <- randomUser ownDomain def @@ -555,7 +555,7 @@ testReceiptModeWithRemotesUnreachable = do notif %. "payload.0.qualified_from" `shouldMatch` objQidObject alice notif %. "payload.0.data.receipt_mode" `shouldMatchInt` 43 -testDeleteLocalMember :: HasCallStack => App () +testDeleteLocalMember :: (HasCallStack) => App () testDeleteLocalMember = do [alice, alex, bob] <- createUsers [OwnDomain, OwnDomain, OtherDomain] connectTwoUsers alice alex @@ -574,7 +574,7 @@ testDeleteLocalMember = do r.status `shouldMatchInt` 204 r.jsonBody `shouldMatch` (Nothing @Aeson.Value) -testDeleteRemoteMember :: HasCallStack => App () +testDeleteRemoteMember :: (HasCallStack) => App () testDeleteRemoteMember = do [alice, alex, bob] <- createUsers [OwnDomain, OwnDomain, OtherDomain] connectTwoUsers alice alex @@ -593,7 +593,7 @@ testDeleteRemoteMember = do r.status `shouldMatchInt` 204 r.jsonBody `shouldMatch` (Nothing @Aeson.Value) -testDeleteRemoteMemberRemoteUnreachable :: HasCallStack => App () +testDeleteRemoteMemberRemoteUnreachable :: (HasCallStack) => App () testDeleteRemoteMemberRemoteUnreachable = do [alice, bob, bart] <- createUsers [OwnDomain, OtherDomain, OtherDomain] conv <- startDynamicBackends [mempty] $ \[dynBackend] -> do @@ -617,7 +617,7 @@ testDeleteRemoteMemberRemoteUnreachable = do r.status `shouldMatchInt` 204 r.jsonBody `shouldMatch` (Nothing @Aeson.Value) -testDeleteTeamConversationWithRemoteMembers :: HasCallStack => App () +testDeleteTeamConversationWithRemoteMembers :: (HasCallStack) => App () testDeleteTeamConversationWithRemoteMembers = do (alice, team, _) <- createTeam OwnDomain 1 conv <- postConversation alice (defProteus {team = Just team}) >>= getJSON 201 @@ -633,7 +633,7 @@ testDeleteTeamConversationWithRemoteMembers = do notif %. "payload.0.qualified_conversation" `shouldMatch` objQidObject conv notif %. "payload.0.qualified_from" `shouldMatch` objQidObject alice -testDeleteTeamConversationWithUnreachableRemoteMembers :: HasCallStack => App () +testDeleteTeamConversationWithUnreachableRemoteMembers :: (HasCallStack) => App () testDeleteTeamConversationWithUnreachableRemoteMembers = do resourcePool <- asks resourcePool (alice, team, _) <- createTeam OwnDomain 1 @@ -660,7 +660,7 @@ testDeleteTeamConversationWithUnreachableRemoteMembers = do notif <- awaitNotification bob bobClient noValue isConvDeleteNotif assertNotification notif -testDeleteTeamMemberLimitedEventFanout :: HasCallStack => App () +testDeleteTeamMemberLimitedEventFanout :: (HasCallStack) => App () testDeleteTeamMemberLimitedEventFanout = do -- Alex will get removed from the team (alice, team, [alex, alison]) <- createTeam OwnDomain 3 @@ -683,8 +683,8 @@ testDeleteTeamMemberLimitedEventFanout = do -- from the team assertSuccess =<< setTeamFeatureStatus OwnDomain team "limitedEventFanout" "enabled" - withWebSockets [alice, amy, bob, alison, ana] $ - \[wsAlice, wsAmy, wsBob, wsAlison, wsAna] -> do + withWebSockets [alice, amy, bob, alison, ana] + $ \[wsAlice, wsAmy, wsBob, wsAlison, wsAna] -> do void $ deleteTeamMember team alice alex >>= getBody 202 memsAfter <- getMembers team aliceId @@ -719,7 +719,7 @@ testDeleteTeamMemberLimitedEventFanout = do -- is disabled by default. The counterpart test -- 'testDeleteTeamMemberLimitedEventFanout' enables the flag and tests the -- limited fanout. -testDeleteTeamMemberFullEventFanout :: HasCallStack => App () +testDeleteTeamMemberFullEventFanout :: (HasCallStack) => App () testDeleteTeamMemberFullEventFanout = do (alice, team, [alex, alison]) <- createTeam OwnDomain 3 [amy, bob] <- for [OwnDomain, OtherDomain] $ flip randomUser def @@ -749,7 +749,7 @@ testDeleteTeamMemberFullEventFanout = do memIds `shouldMatchSet` [aliceId, alisonId, amyId] assertConvUserDeletedNotif wsBob alexId -testLeaveConversationSuccess :: HasCallStack => App () +testLeaveConversationSuccess :: (HasCallStack) => App () testLeaveConversationSuccess = do [alice, bob, chad, dee] <- createUsers [OwnDomain, OwnDomain, OtherDomain, OtherDomain] [aClient, bClient] <- forM [alice, bob] $ \user -> @@ -771,7 +771,7 @@ testLeaveConversationSuccess = do assertLeaveNotification chad conv bob bClient chad assertLeaveNotification chad conv eve eClient chad -testOnUserDeletedConversations :: HasCallStack => App () +testOnUserDeletedConversations :: (HasCallStack) => App () testOnUserDeletedConversations = do startDynamicBackends [def] $ \[dynDomain] -> do [ownDomain, otherDomain] <- forM [OwnDomain, OtherDomain] asString @@ -803,7 +803,7 @@ testOnUserDeletedConversations = do expectedIds <- for [alex, bart, chad] (%. "qualified_id") memIds `shouldMatchSet` expectedIds -testUpdateConversationByRemoteAdmin :: HasCallStack => App () +testUpdateConversationByRemoteAdmin :: (HasCallStack) => App () testUpdateConversationByRemoteAdmin = do [alice, bob, charlie] <- createUsers [OwnDomain, OtherDomain, OtherDomain] connectTwoUsers alice bob @@ -816,14 +816,14 @@ testUpdateConversationByRemoteAdmin = do void $ updateReceiptMode bob conv (41 :: Int) >>= getBody 200 for_ wss $ \ws -> awaitMatch isReceiptModeUpdateNotif ws -testGuestCreatesConversation :: HasCallStack => App () +testGuestCreatesConversation :: (HasCallStack) => App () testGuestCreatesConversation = do alice <- randomUser OwnDomain def {BrigI.activate = False} bindResponse (postConversation alice defProteus) $ \resp -> do resp.status `shouldMatchInt` 403 resp.json %. "label" `shouldMatch` "operation-denied" -testGuestLinksSuccess :: HasCallStack => App () +testGuestLinksSuccess :: (HasCallStack) => App () testGuestLinksSuccess = do (user, _, tm : _) <- createTeam OwnDomain 2 conv <- postConversation user (allowGuests defProteus) >>= getJSON 201 @@ -836,7 +836,7 @@ testGuestLinksSuccess = do resp.status `shouldMatchInt` 200 resp.json %. "id" `shouldMatch` objId conv -testGuestLinksExpired :: HasCallStack => App () +testGuestLinksExpired :: (HasCallStack) => App () testGuestLinksExpired = do withModifiedBackend def {galleyCfg = setField "settings.guestLinkTTLSeconds" (1 :: Int)} @@ -851,7 +851,7 @@ testGuestLinksExpired = do bindResponse (getJoinCodeConv tm k v) $ \resp -> do resp.status `shouldMatchInt` 404 -testConversationWithFedV0 :: HasCallStack => App () +testConversationWithFedV0 :: (HasCallStack) => App () testConversationWithFedV0 = do alice <- randomUser OwnDomain def bob <- randomUser FedV0Domain def @@ -865,7 +865,7 @@ testConversationWithFedV0 = do void $ changeConversationName alice conv "foobar" >>= getJSON 200 void $ awaitMatch isConvNameChangeNotif ws -testConversationWithoutFederation :: HasCallStack => App () +testConversationWithoutFederation :: (HasCallStack) => App () testConversationWithoutFederation = withModifiedBackend (def {galleyCfg = removeField "federator" >=> removeField "rabbitmq"}) $ \domain -> do diff --git a/integration/test/Test/EJPD.hs b/integration/test/Test/EJPD.hs index 60fc67b1413..db28ccec61b 100644 --- a/integration/test/Test/EJPD.hs +++ b/integration/test/Test/EJPD.hs @@ -23,7 +23,7 @@ import Testlib.JSON import Testlib.Prelude -- | Create some teams & users, and return their expected ejpd response values. -setupEJPD :: HasCallStack => App (A.Value, A.Value, A.Value, A.Value, A.Value) +setupEJPD :: (HasCallStack) => App (A.Value, A.Value, A.Value, A.Value, A.Value) setupEJPD = do (owner1, tid1, [usr1, usr2]) <- createTeam OwnDomain 3 @@ -128,7 +128,7 @@ setupEJPD = where -- Return value is a 'EJPDResponseItem'. mkUsr :: - HasCallStack => + (HasCallStack) => A.Value {- user -} -> Maybe String {- handle (in case usr is not up to date, we pass this separately) -} -> [String {- push tokens -}] -> @@ -182,11 +182,11 @@ setupEJPD = . (key (fromString "TeamContacts") .~ A.Null) . (key (fromString "Conversations") .~ A.Null) -testEJPDRequest :: HasCallStack => App () +testEJPDRequest :: (HasCallStack) => App () testEJPDRequest = do (usr1, usr2, usr3, usr4, usr5) <- setupEJPD - let check :: HasCallStack => [A.Value] -> App () + let check :: (HasCallStack) => [A.Value] -> App () check want = do let handle = cs . (^?! (key (fromString "Handle") . _String)) have <- BI.getEJPDInfo OwnDomain (handle <$> want) "include_contacts" @@ -214,7 +214,7 @@ testEJPDRequest = do check [usr3] check [usr4, usr5] -testEJPDRequestRemote :: HasCallStack => App () +testEJPDRequestRemote :: (HasCallStack) => App () testEJPDRequestRemote = do usrRemote <- randomUser OtherDomain def {BI.email = Nothing, BI.name = Just "usrRemote"} handleRemote <- liftIO $ UUID.nextRandom <&> UUID.toString diff --git a/integration/test/Test/Errors.hs b/integration/test/Test/Errors.hs index 795c862dedd..4093cf3dc85 100644 --- a/integration/test/Test/Errors.hs +++ b/integration/test/Test/Errors.hs @@ -12,7 +12,7 @@ import Testlib.Mock import Testlib.Prelude import Testlib.ResourcePool -testNestedError :: HasCallStack => App () +testNestedError :: (HasCallStack) => App () testNestedError = do let innerError = object @@ -39,10 +39,10 @@ testNestedError = do { port = Just (fromIntegral res.berFederatorExternal), tls = False } - void $ - startMockServer mockConfig $ - codensityApp $ - \_req -> pure $ Wai.responseLBS HTTP.status400 mempty $ Aeson.encode innerError + void + $ startMockServer mockConfig + $ codensityApp + $ \_req -> pure $ Wai.responseLBS HTTP.status400 mempty $ Aeson.encode innerError -- get remote user lift $ do diff --git a/integration/test/Test/ExternalPartner.hs b/integration/test/Test/ExternalPartner.hs index a35522140b2..ae6381f4187 100644 --- a/integration/test/Test/ExternalPartner.hs +++ b/integration/test/Test/ExternalPartner.hs @@ -25,7 +25,7 @@ import MLS.Util import SetupHelpers import Testlib.Prelude -testExternalPartnerPermissions :: HasCallStack => App () +testExternalPartnerPermissions :: (HasCallStack) => App () testExternalPartnerPermissions = do (owner, tid, u1 : u2 : u3 : _) <- createTeam OwnDomain 4 @@ -55,7 +55,7 @@ testExternalPartnerPermissions = do bindResponse (addMembers partner conv def {users = [u3]}) $ \resp -> do resp.status `shouldMatchInt` 403 -testExternalPartnerPermissionsMls :: HasCallStack => App () +testExternalPartnerPermissionsMls :: (HasCallStack) => App () testExternalPartnerPermissionsMls = do -- external partners should not be able to create (MLS) conversations (owner, tid, _) <- createTeam OwnDomain 2 @@ -64,13 +64,13 @@ testExternalPartnerPermissionsMls = do bindResponse (postConversation bobExtClient defMLS) $ \resp -> do resp.status `shouldMatchInt` 403 -testExternalPartnerPermissionMlsOne2One :: HasCallStack => App () +testExternalPartnerPermissionMlsOne2One :: (HasCallStack) => App () testExternalPartnerPermissionMlsOne2One = do (owner, tid, alice : _) <- createTeam OwnDomain 2 bobExternal <- createTeamMemberWithRole owner tid "partner" void $ getMLSOne2OneConversation alice bobExternal >>= getJSON 200 -testExternalPartnerPermissionsConvName :: HasCallStack => App () +testExternalPartnerPermissionsConvName :: (HasCallStack) => App () testExternalPartnerPermissionsConvName = do (owner, tid, u1 : _) <- createTeam OwnDomain 2 diff --git a/integration/test/Test/FeatureFlags.hs b/integration/test/Test/FeatureFlags.hs index 32a22526da7..e0943931f9e 100644 --- a/integration/test/Test/FeatureFlags.hs +++ b/integration/test/Test/FeatureFlags.hs @@ -33,7 +33,7 @@ import Test.FeatureFlags.Util import Testlib.Prelude import Testlib.ResourcePool (acquireResources) -testLimitedEventFanout :: HasCallStack => App () +testLimitedEventFanout :: (HasCallStack) => App () testLimitedEventFanout = do let featureName = "limitedEventFanout" (_alice, team, _) <- createTeam OwnDomain 1 @@ -46,7 +46,7 @@ testLimitedEventFanout = do resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` "enabled" -testLegalholdDisabledByDefault :: HasCallStack => App () +testLegalholdDisabledByDefault :: (HasCallStack) => App () testLegalholdDisabledByDefault = do let put uid tid st = Internal.setTeamFeatureConfig uid tid "legalhold" (object ["status" .= st]) >>= assertSuccess let patch uid tid st = Internal.setTeamFeatureStatus uid tid "legalhold" st >>= assertSuccess @@ -66,7 +66,7 @@ testLegalholdDisabledByDefault = do checkFeature "legalhold" owner tid disabled -- always disabled -testLegalholdDisabledPermanently :: HasCallStack => App () +testLegalholdDisabledPermanently :: (HasCallStack) => App () testLegalholdDisabledPermanently = do let cfgLhDisabledPermanently = def @@ -100,7 +100,7 @@ testLegalholdDisabledPermanently = do checkFeature "legalhold" owner tid disabled -- enabled if team is allow listed, disabled in any other case -testLegalholdWhitelistTeamsAndImplicitConsent :: HasCallStack => App () +testLegalholdWhitelistTeamsAndImplicitConsent :: (HasCallStack) => App () testLegalholdWhitelistTeamsAndImplicitConsent = do let cfgLhWhitelistTeamsAndImplicitConsent = def @@ -138,7 +138,7 @@ testLegalholdWhitelistTeamsAndImplicitConsent = do runCodensity (startDynamicBackend testBackend cfgLhWhitelistTeamsAndImplicitConsent) $ \_ -> do checkFeature "legalhold" owner tid enabled -testExposeInvitationURLsToTeamAdminConfig :: HasCallStack => App () +testExposeInvitationURLsToTeamAdminConfig :: (HasCallStack) => App () testExposeInvitationURLsToTeamAdminConfig = do let cfgExposeInvitationURLsTeamAllowlist tids = def @@ -178,7 +178,7 @@ testExposeInvitationURLsToTeamAdminConfig = do -- Interesting case: The team had the feature enabled but is not in allow list void testNoAllowlistEntry -testMlsE2EConfigCrlProxyRequired :: HasCallStack => App () +testMlsE2EConfigCrlProxyRequired :: (HasCallStack) => App () testMlsE2EConfigCrlProxyRequired = do (owner, tid, _) <- createTeam OwnDomain 1 let configWithoutCrlProxy = @@ -210,7 +210,7 @@ testMlsE2EConfigCrlProxyRequired = do expectedResponse <- configWithCrlProxy & setField "lockStatus" "unlocked" & setField "ttl" "unlimited" checkFeature "mlsE2EId" owner tid expectedResponse -testMlsE2EConfigCrlProxyNotRequiredInV5 :: HasCallStack => App () +testMlsE2EConfigCrlProxyNotRequiredInV5 :: (HasCallStack) => App () testMlsE2EConfigCrlProxyNotRequiredInV5 = do (owner, tid, _) <- createTeam OwnDomain 1 let configWithoutCrlProxy = @@ -231,7 +231,7 @@ testMlsE2EConfigCrlProxyNotRequiredInV5 = do expectedResponse <- configWithoutCrlProxy & setField "lockStatus" "unlocked" & setField "ttl" "unlimited" checkFeature "mlsE2EId" owner tid expectedResponse -testSSODisabledByDefault :: HasCallStack => App () +testSSODisabledByDefault :: (HasCallStack) => App () testSSODisabledByDefault = do let put uid tid = Internal.setTeamFeatureConfig uid tid "sso" (object ["status" .= "enabled"]) >>= assertSuccess let patch uid tid = Internal.setTeamFeatureStatus uid tid "sso" "enabled" >>= assertSuccess @@ -248,7 +248,7 @@ testSSODisabledByDefault = do enableFeature owner tid checkFeature "sso" owner tid enabled -testSSOEnabledByDefault :: HasCallStack => App () +testSSOEnabledByDefault :: (HasCallStack) => App () testSSOEnabledByDefault = do withModifiedBackend def {galleyCfg = setField "settings.featureFlags.sso" "enabled-by-default"} @@ -260,7 +260,7 @@ testSSOEnabledByDefault = do -- check that the feature cannot be disabled assertLabel 403 "not-implemented" =<< Internal.setTeamFeatureConfig owner tid "sso" (object ["status" .= "disabled"]) -testSearchVisibilityDisabledByDefault :: HasCallStack => App () +testSearchVisibilityDisabledByDefault :: (HasCallStack) => App () testSearchVisibilityDisabledByDefault = do withModifiedBackend def {galleyCfg = setField "settings.featureFlags.teamSearchVisibility" "disabled-by-default"} $ \domain -> do (owner, tid, m : _) <- createTeam domain 2 @@ -273,7 +273,7 @@ testSearchVisibilityDisabledByDefault = do assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "disabled" checkFeature "searchVisibility" owner tid disabled -testSearchVisibilityEnabledByDefault :: HasCallStack => App () +testSearchVisibilityEnabledByDefault :: (HasCallStack) => App () testSearchVisibilityEnabledByDefault = do withModifiedBackend def {galleyCfg = setField "settings.featureFlags.teamSearchVisibility" "enabled-by-default"} $ \domain -> do (owner, tid, m : _) <- createTeam domain 2 @@ -286,22 +286,22 @@ testSearchVisibilityEnabledByDefault = do assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "enabled" checkFeature "searchVisibility" owner tid enabled -testSearchVisibilityInbound :: HasCallStack => App () +testSearchVisibilityInbound :: (HasCallStack) => App () testSearchVisibilityInbound = _testSimpleFlag "searchVisibilityInbound" Public.setTeamFeatureConfig False -testDigitalSignaturesInternal :: HasCallStack => App () +testDigitalSignaturesInternal :: (HasCallStack) => App () testDigitalSignaturesInternal = _testSimpleFlag "digitalSignatures" Internal.setTeamFeatureConfig False -testValidateSAMLEmailsInternal :: HasCallStack => App () +testValidateSAMLEmailsInternal :: (HasCallStack) => App () testValidateSAMLEmailsInternal = _testSimpleFlag "validateSAMLemails" Internal.setTeamFeatureConfig True -testConferenceCallingInternal :: HasCallStack => App () +testConferenceCallingInternal :: (HasCallStack) => App () testConferenceCallingInternal = _testSimpleFlag "conferenceCalling" Internal.setTeamFeatureConfig True -testSearchVisibilityInboundInternal :: HasCallStack => App () +testSearchVisibilityInboundInternal :: (HasCallStack) => App () testSearchVisibilityInboundInternal = _testSimpleFlag "searchVisibilityInbound" Internal.setTeamFeatureConfig False -_testSimpleFlag :: HasCallStack => String -> (Value -> String -> String -> Value -> App Response) -> Bool -> App () +_testSimpleFlag :: (HasCallStack) => String -> (Value -> String -> String -> Value -> App Response) -> Bool -> App () _testSimpleFlag featureName setFeatureConfig featureEnabledByDefault = do let defaultStatus = if featureEnabledByDefault then "enabled" else "disabled" let defaultValue = if featureEnabledByDefault then enabled else disabled @@ -328,32 +328,32 @@ _testSimpleFlag featureName setFeatureConfig featureEnabledByDefault = do notif %. "payload.0.data" `shouldMatch` defaultValue checkFeature featureName m tid defaultValue -testConversationGuestLinks :: HasCallStack => App () +testConversationGuestLinks :: (HasCallStack) => App () testConversationGuestLinks = _testSimpleFlagWithLockStatus "conversationGuestLinks" Public.setTeamFeatureConfig True True -testFileSharing :: HasCallStack => App () +testFileSharing :: (HasCallStack) => App () testFileSharing = _testSimpleFlagWithLockStatus "fileSharing" Public.setTeamFeatureConfig True True -testSndFactorPasswordChallenge :: HasCallStack => App () +testSndFactorPasswordChallenge :: (HasCallStack) => App () testSndFactorPasswordChallenge = _testSimpleFlagWithLockStatus "sndFactorPasswordChallenge" Public.setTeamFeatureConfig False False -testOutlookCalIntegration :: HasCallStack => App () +testOutlookCalIntegration :: (HasCallStack) => App () testOutlookCalIntegration = _testSimpleFlagWithLockStatus "outlookCalIntegration" Public.setTeamFeatureConfig False False -testConversationGuestLinksInternal :: HasCallStack => App () +testConversationGuestLinksInternal :: (HasCallStack) => App () testConversationGuestLinksInternal = _testSimpleFlagWithLockStatus "conversationGuestLinks" Internal.setTeamFeatureConfig True True -testFileSharingInternal :: HasCallStack => App () +testFileSharingInternal :: (HasCallStack) => App () testFileSharingInternal = _testSimpleFlagWithLockStatus "fileSharing" Internal.setTeamFeatureConfig True True -testSndFactorPasswordChallengeInternal :: HasCallStack => App () +testSndFactorPasswordChallengeInternal :: (HasCallStack) => App () testSndFactorPasswordChallengeInternal = _testSimpleFlagWithLockStatus "sndFactorPasswordChallenge" Internal.setTeamFeatureConfig False False -testOutlookCalIntegrationInternal :: HasCallStack => App () +testOutlookCalIntegrationInternal :: (HasCallStack) => App () testOutlookCalIntegrationInternal = _testSimpleFlagWithLockStatus "outlookCalIntegration" Internal.setTeamFeatureConfig False False _testSimpleFlagWithLockStatus :: - HasCallStack => + (HasCallStack) => String -> (Value -> String -> String -> Value -> App Response) -> Bool -> @@ -406,13 +406,13 @@ _testSimpleFlagWithLockStatus featureName setFeatureConfig featureEnabledByDefau -- feature status should be the previously set status again checkFeature featureName m tid =<< setField "lockStatus" "unlocked" otherValue -testClassifiedDomainsEnabled :: HasCallStack => App () +testClassifiedDomainsEnabled :: (HasCallStack) => App () testClassifiedDomainsEnabled = do (_, tid, m : _) <- createTeam OwnDomain 2 expected <- enabled & setField "config.domains" ["example.com"] checkFeature "classifiedDomains" m tid expected -testClassifiedDomainsDisabled :: HasCallStack => App () +testClassifiedDomainsDisabled :: (HasCallStack) => App () testClassifiedDomainsDisabled = do withModifiedBackend def {galleyCfg = setField "settings.featureFlags.classifiedDomains" (object ["status" .= "disabled", "config" .= object ["domains" .= ["example.com"]]])} $ \domain -> do (_, tid, m : _) <- createTeam domain 2 @@ -421,65 +421,65 @@ testClassifiedDomainsDisabled = do -- | Call 'GET /teams/:tid/features' and 'GET /feature-configs', and check if all -- features are there. -testAllFeatures :: HasCallStack => App () +testAllFeatures :: (HasCallStack) => App () testAllFeatures = do (_, tid, m : _) <- createTeam OwnDomain 2 let expected = - object $ - [ "legalhold" .= disabled, - "sso" .= disabled, - "searchVisibility" .= disabled, - "validateSAMLemails" .= enabled, - "digitalSignatures" .= disabled, - "appLock" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["enforceAppLock" .= False, "inactivityTimeoutSecs" .= A.Number 60]], - "fileSharing" .= enabled, - "classifiedDomains" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["domains" .= ["example.com"]]], - "conferenceCalling" .= enabled, - "selfDeletingMessages" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["enforcedTimeoutSeconds" .= A.Number 0]], - "conversationGuestLinks" .= enabled, - "sndFactorPasswordChallenge" .= disabledLocked, - "mls" - .= object - [ "lockStatus" .= "unlocked", - "status" .= "disabled", - "ttl" .= "unlimited", - "config" - .= object - [ "protocolToggleUsers" .= ([] :: [String]), - "defaultProtocol" .= "proteus", - "supportedProtocols" .= ["proteus", "mls"], - "allowedCipherSuites" .= ([1] :: [Int]), - "defaultCipherSuite" .= A.Number 1 - ] - ], - "searchVisibilityInbound" .= disabled, - "exposeInvitationURLsToTeamAdmin" .= disabledLocked, - "outlookCalIntegration" .= disabledLocked, - "mlsE2EId" - .= object - [ "lockStatus" .= "unlocked", - "status" .= "disabled", - "ttl" .= "unlimited", - "config" - .= object - [ "verificationExpiration" .= A.Number 86400, - "useProxyOnMobile" .= False - ] - ], - "mlsMigration" - .= object - [ "lockStatus" .= "locked", - "status" .= "enabled", - "ttl" .= "unlimited", - "config" - .= object - [ "startTime" .= "2029-05-16T10:11:12.123Z", - "finaliseRegardlessAfter" .= "2029-10-17T00:00:00Z" - ] - ], - "enforceFileDownloadLocation" .= object ["lockStatus" .= "locked", "status" .= "disabled", "ttl" .= "unlimited", "config" .= object []], - "limitedEventFanout" .= disabled - ] + object + $ [ "legalhold" .= disabled, + "sso" .= disabled, + "searchVisibility" .= disabled, + "validateSAMLemails" .= enabled, + "digitalSignatures" .= disabled, + "appLock" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["enforceAppLock" .= False, "inactivityTimeoutSecs" .= A.Number 60]], + "fileSharing" .= enabled, + "classifiedDomains" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["domains" .= ["example.com"]]], + "conferenceCalling" .= enabled, + "selfDeletingMessages" .= object ["lockStatus" .= "unlocked", "status" .= "enabled", "ttl" .= "unlimited", "config" .= object ["enforcedTimeoutSeconds" .= A.Number 0]], + "conversationGuestLinks" .= enabled, + "sndFactorPasswordChallenge" .= disabledLocked, + "mls" + .= object + [ "lockStatus" .= "unlocked", + "status" .= "disabled", + "ttl" .= "unlimited", + "config" + .= object + [ "protocolToggleUsers" .= ([] :: [String]), + "defaultProtocol" .= "proteus", + "supportedProtocols" .= ["proteus", "mls"], + "allowedCipherSuites" .= ([1] :: [Int]), + "defaultCipherSuite" .= A.Number 1 + ] + ], + "searchVisibilityInbound" .= disabled, + "exposeInvitationURLsToTeamAdmin" .= disabledLocked, + "outlookCalIntegration" .= disabledLocked, + "mlsE2EId" + .= object + [ "lockStatus" .= "unlocked", + "status" .= "disabled", + "ttl" .= "unlimited", + "config" + .= object + [ "verificationExpiration" .= A.Number 86400, + "useProxyOnMobile" .= False + ] + ], + "mlsMigration" + .= object + [ "lockStatus" .= "locked", + "status" .= "enabled", + "ttl" .= "unlimited", + "config" + .= object + [ "startTime" .= "2029-05-16T10:11:12.123Z", + "finaliseRegardlessAfter" .= "2029-10-17T00:00:00Z" + ] + ], + "enforceFileDownloadLocation" .= object ["lockStatus" .= "locked", "status" .= "disabled", "ttl" .= "unlimited", "config" .= object []], + "limitedEventFanout" .= disabled + ] bindResponse (Public.getTeamFeatures m tid) $ \resp -> do resp.status `shouldMatchInt` 200 expected `shouldMatch` resp.json @@ -503,7 +503,7 @@ testAllFeatures = do resp.status `shouldMatchInt` 200 expected `shouldMatch` resp.json -testFeatureConfigConsistency :: HasCallStack => App () +testFeatureConfigConsistency :: (HasCallStack) => App () testFeatureConfigConsistency = do (_, tid, m : _) <- createTeam OwnDomain 2 @@ -511,8 +511,8 @@ testFeatureConfigConsistency = do allTeamFeaturesRes <- Public.getTeamFeatures m tid >>= parseObjectKeys - unless (allTeamFeaturesRes `Set.isSubsetOf` allFeaturesRes) $ - assertFailure (show allTeamFeaturesRes <> " is not a subset of " <> show allFeaturesRes) + unless (allTeamFeaturesRes `Set.isSubsetOf` allFeaturesRes) + $ assertFailure (show allTeamFeaturesRes <> " is not a subset of " <> show allFeaturesRes) where parseObjectKeys :: Response -> App (Set.Set String) parseObjectKeys res = do @@ -521,7 +521,7 @@ testFeatureConfigConsistency = do (A.Object hm) -> pure (Set.fromList . map (show . A.toText) . KM.keys $ hm) x -> assertFailure ("JSON was not an object, but " <> show x) -testSelfDeletingMessages :: HasCallStack => App () +testSelfDeletingMessages :: (HasCallStack) => App () testSelfDeletingMessages = _testLockStatusWithConfig "selfDeletingMessages" @@ -531,7 +531,7 @@ testSelfDeletingMessages = (object ["status" .= "enabled", "config" .= object ["enforcedTimeoutSeconds" .= A.Number 30]]) (object ["status" .= "enabled", "config" .= object ["enforcedTimeoutSeconds" .= ""]]) -testSelfDeletingMessagesInternal :: HasCallStack => App () +testSelfDeletingMessagesInternal :: (HasCallStack) => App () testSelfDeletingMessagesInternal = _testLockStatusWithConfig "selfDeletingMessages" @@ -541,7 +541,7 @@ testSelfDeletingMessagesInternal = (object ["status" .= "enabled", "config" .= object ["enforcedTimeoutSeconds" .= A.Number 30]]) (object ["status" .= "enabled", "config" .= object ["enforcedTimeoutSeconds" .= ""]]) -testMls :: HasCallStack => App () +testMls :: (HasCallStack) => App () testMls = do user <- randomUser OwnDomain def uid <- asString $ user %. "id" @@ -553,7 +553,7 @@ testMls = do mlsConfig2 mlsInvalidConfig -testMlsInternal :: HasCallStack => App () +testMlsInternal :: (HasCallStack) => App () testMlsInternal = do user <- randomUser OwnDomain def uid <- asString $ user %. "id" @@ -623,7 +623,7 @@ mlsInvalidConfig = ] ] -testEnforceDownloadLocation :: HasCallStack => App () +testEnforceDownloadLocation :: (HasCallStack) => App () testEnforceDownloadLocation = _testLockStatusWithConfig "enforceFileDownloadLocation" @@ -633,7 +633,7 @@ testEnforceDownloadLocation = (object ["status" .= "disabled", "config" .= object []]) (object ["status" .= "enabled", "config" .= object ["enforcedDownloadLocation" .= object []]]) -testEnforceDownloadLocationInternal :: HasCallStack => App () +testEnforceDownloadLocationInternal :: (HasCallStack) => App () testEnforceDownloadLocationInternal = _testLockStatusWithConfig "enforceFileDownloadLocation" @@ -643,7 +643,7 @@ testEnforceDownloadLocationInternal = (object ["status" .= "disabled", "config" .= object []]) (object ["status" .= "enabled", "config" .= object ["enforcedDownloadLocation" .= object []]]) -testMlsMigration :: HasCallStack => App () +testMlsMigration :: (HasCallStack) => App () testMlsMigration = do -- first we have to enable mls (owner, tid, m : _) <- createTeam OwnDomain 2 @@ -657,7 +657,7 @@ testMlsMigration = do mlsMigrationConfig2 mlsMigrationInvalidConfig -testMlsMigrationInternal :: HasCallStack => App () +testMlsMigrationInternal :: (HasCallStack) => App () testMlsMigrationInternal = do -- first we have to enable mls (owner, tid, m : _) <- createTeam OwnDomain 2 @@ -763,7 +763,7 @@ mlsE2EIdConfig = do ] ] -testMLSE2EId :: HasCallStack => App () +testMLSE2EId :: (HasCallStack) => App () testMLSE2EId = do (defCfg, cfg1, cfg2, invalidCfg) <- mlsE2EIdConfig _testLockStatusWithConfig @@ -774,7 +774,7 @@ testMLSE2EId = do cfg2 invalidCfg -testMLSE2EIdInternal :: HasCallStack => App () +testMLSE2EIdInternal :: (HasCallStack) => App () testMLSE2EIdInternal = do (defCfg, cfg1, cfg2, invalidCfg) <- mlsE2EIdConfig -- the internal API is not as strict as the public one, so we need to tweak the invalid config some more @@ -788,7 +788,7 @@ testMLSE2EIdInternal = do invalidCfg' _testLockStatusWithConfig :: - HasCallStack => + (HasCallStack) => String -> (Value -> String -> String -> Value -> App Response) -> -- | the default feature config (should include the lock status and ttl, as it is returned by the API) @@ -805,7 +805,7 @@ _testLockStatusWithConfig featureName setTeamFeatureConfig defaultFeatureConfig _testLockStatusWithConfigWithTeam (owner, tid, m) featureName setTeamFeatureConfig defaultFeatureConfig config1 config2 invalidConfig _testLockStatusWithConfigWithTeam :: - HasCallStack => + (HasCallStack) => -- | (owner, tid, member) (Value, String, Value) -> String -> @@ -866,7 +866,7 @@ _testLockStatusWithConfigWithTeam (owner, tid, m) featureName setTeamFeatureConf checkFeature featureName m tid =<< (config2 & setField "lockStatus" "unlocked" & setField "ttl" "unlimited") -testFeatureNoConfigMultiSearchVisibilityInbound :: HasCallStack => App () +testFeatureNoConfigMultiSearchVisibilityInbound :: (HasCallStack) => App () testFeatureNoConfigMultiSearchVisibilityInbound = do (_owner1, team1, _) <- createTeam OwnDomain 0 (_owner2, team2, _) <- createTeam OwnDomain 0 @@ -879,22 +879,22 @@ testFeatureNoConfigMultiSearchVisibilityInbound = do length statuses `shouldMatchInt` 2 statuses `shouldMatchSet` [object ["team" .= team1, "status" .= "disabled"], object ["team" .= team2, "status" .= "enabled"]] -testConferenceCallingTTLIncreaseToUnlimited :: HasCallStack => App () +testConferenceCallingTTLIncreaseToUnlimited :: (HasCallStack) => App () testConferenceCallingTTLIncreaseToUnlimited = _testSimpleFlagTTLOverride "conferenceCalling" True (Just 2) Nothing -testConferenceCallingTTLIncrease :: HasCallStack => App () +testConferenceCallingTTLIncrease :: (HasCallStack) => App () testConferenceCallingTTLIncrease = _testSimpleFlagTTLOverride "conferenceCalling" True (Just 2) (Just 4) -testConferenceCallingTTLReduceFromUnlimited :: HasCallStack => App () +testConferenceCallingTTLReduceFromUnlimited :: (HasCallStack) => App () testConferenceCallingTTLReduceFromUnlimited = _testSimpleFlagTTLOverride "conferenceCalling" True Nothing (Just 2) -testConferenceCallingTTLReduce :: HasCallStack => App () +testConferenceCallingTTLReduce :: (HasCallStack) => App () testConferenceCallingTTLReduce = _testSimpleFlagTTLOverride "conferenceCalling" True (Just 5) (Just 2) -testConferenceCallingTTLUnlimitedToUnlimited :: HasCallStack => App () +testConferenceCallingTTLUnlimitedToUnlimited :: (HasCallStack) => App () testConferenceCallingTTLUnlimitedToUnlimited = _testSimpleFlagTTLOverride "conferenceCalling" True Nothing Nothing -_testSimpleFlagTTLOverride :: HasCallStack => String -> Bool -> Maybe Int -> Maybe Int -> App () +_testSimpleFlagTTLOverride :: (HasCallStack) => String -> Bool -> Maybe Int -> Maybe Int -> App () _testSimpleFlagTTLOverride featureName enabledByDefault mTtl mTtlAfter = do let ttl = maybe (A.String . cs $ "unlimited") (A.Number . fromIntegral) mTtl let ttlAfter = maybe (A.String . cs $ "unlimited") (A.Number . fromIntegral) mTtlAfter @@ -940,37 +940,37 @@ _testSimpleFlagTTLOverride featureName enabledByDefault mTtl mTtlAfter = do -------------------------------------------------------------------------------- -- Simple flags with implicit lock status -testPatchSearchVisibility :: HasCallStack => App () +testPatchSearchVisibility :: (HasCallStack) => App () testPatchSearchVisibility = _testPatch "searchVisibility" False disabled enabled -testPatchValidateSAMLEmails :: HasCallStack => App () +testPatchValidateSAMLEmails :: (HasCallStack) => App () testPatchValidateSAMLEmails = _testPatch "validateSAMLemails" False enabled disabled -testPatchDigitalSignatures :: HasCallStack => App () +testPatchDigitalSignatures :: (HasCallStack) => App () testPatchDigitalSignatures = _testPatch "digitalSignatures" False disabled enabled -testPatchConferenceCalling :: HasCallStack => App () +testPatchConferenceCalling :: (HasCallStack) => App () testPatchConferenceCalling = _testPatch "conferenceCalling" False enabled disabled -------------------------------------------------------------------------------- -- Simple flags with explicit lock status -testPatchFileSharing :: HasCallStack => App () +testPatchFileSharing :: (HasCallStack) => App () testPatchFileSharing = _testPatch "fileSharing" True enabled disabled -testPatchGuestLinks :: HasCallStack => App () +testPatchGuestLinks :: (HasCallStack) => App () testPatchGuestLinks = _testPatch "conversationGuestLinks" True enabled disabled -testPatchSndFactorPasswordChallenge :: HasCallStack => App () +testPatchSndFactorPasswordChallenge :: (HasCallStack) => App () testPatchSndFactorPasswordChallenge = _testPatch "sndFactorPasswordChallenge" True disabledLocked enabled -testPatchOutlookCalIntegration :: HasCallStack => App () +testPatchOutlookCalIntegration :: (HasCallStack) => App () testPatchOutlookCalIntegration = _testPatch "outlookCalIntegration" True disabledLocked enabled -------------------------------------------------------------------------------- -- Flags with config & implicit lock status -testPatchAppLock :: HasCallStack => App () +testPatchAppLock :: (HasCallStack) => App () testPatchAppLock = do let defCfg = object @@ -988,7 +988,7 @@ testPatchAppLock = do -------------------------------------------------------------------------------- -- Flags with config & explicit lock status -testPatchSelfDeletingMessages :: HasCallStack => App () +testPatchSelfDeletingMessages :: (HasCallStack) => App () testPatchSelfDeletingMessages = do let defCfg = object @@ -1003,7 +1003,7 @@ testPatchSelfDeletingMessages = do _testPatch "selfDeletingMessages" True defCfg (object ["lockStatus" .= "unlocked", "config" .= object ["enforcedTimeoutSeconds" .= A.Number 30]]) _testPatch "selfDeletingMessages" True defCfg (object ["config" .= object ["enforcedTimeoutSeconds" .= A.Number 60]]) -testPatchEnforceFileDownloadLocation :: HasCallStack => App () +testPatchEnforceFileDownloadLocation :: (HasCallStack) => App () testPatchEnforceFileDownloadLocation = do let defCfg = object @@ -1018,7 +1018,7 @@ testPatchEnforceFileDownloadLocation = do _testPatch "enforceFileDownloadLocation" True defCfg (object ["lockStatus" .= "locked", "config" .= object []]) _testPatch "enforceFileDownloadLocation" True defCfg (object ["config" .= object ["enforcedDownloadLocation" .= "/tmp"]]) -testPatchE2EId :: HasCallStack => App () +testPatchE2EId :: (HasCallStack) => App () testPatchE2EId = do let defCfg = object @@ -1062,7 +1062,7 @@ testPatchE2EId = do ] ) -testPatchMLS :: HasCallStack => App () +testPatchMLS :: (HasCallStack) => App () testPatchMLS = do dom <- asString OwnDomain (_, tid, _) <- createTeam dom 0 @@ -1125,7 +1125,7 @@ testPatchMLS = do ] ) where - mlsMigrationSetup :: HasCallStack => String -> String -> App () + mlsMigrationSetup :: (HasCallStack) => String -> String -> App () mlsMigrationSetup dom tid = assertSuccess =<< Internal.patchTeamFeature @@ -1134,7 +1134,7 @@ testPatchMLS = do "mlsMigration" (object ["status" .= "disabled", "lockStatus" .= "unlocked"]) -_testPatch :: HasCallStack => String -> Bool -> Value -> Value -> App () +_testPatch :: (HasCallStack) => String -> Bool -> Value -> Value -> App () _testPatch featureName hasExplicitLockStatus defaultFeatureConfig patch = do dom <- asString OwnDomain _testPatchWithSetup @@ -1146,7 +1146,7 @@ _testPatch featureName hasExplicitLockStatus defaultFeatureConfig patch = do patch _testPatchWithSetup :: - HasCallStack => + (HasCallStack) => (String -> String -> App ()) -> String -> String -> diff --git a/integration/test/Test/FeatureFlags/Util.hs b/integration/test/Test/FeatureFlags/Util.hs index c03959919dd..92426fd5f4f 100644 --- a/integration/test/Test/FeatureFlags/Util.hs +++ b/integration/test/Test/FeatureFlags/Util.hs @@ -76,11 +76,14 @@ checkFeatureLenientTtl = checkFeatureWith shouldMatchLenientTtl checkTtl (A.Number actualTtl) (A.Number expectedTtl) = do assertBool ("expected the actual TTL to be greater than 0 and equal to or no more than 2 seconds less than " <> show expectedTtl <> ", but it was " <> show actualTtl) - ( actualTtl > 0 - && actualTtl <= expectedTtl - && abs (actualTtl - expectedTtl) <= 2 + ( actualTtl + > 0 + && actualTtl + <= expectedTtl + && abs (actualTtl - expectedTtl) + <= 2 ) checkTtl _ _ = assertFailure "unexpected ttl value(s)" -assertForbidden :: HasCallStack => Response -> App () +assertForbidden :: (HasCallStack) => Response -> App () assertForbidden = assertLabel 403 "no-team-member" diff --git a/integration/test/Test/Federation.hs b/integration/test/Test/Federation.hs index 6ac43c3d3c8..ff1f2ae2304 100644 --- a/integration/test/Test/Federation.hs +++ b/integration/test/Test/Federation.hs @@ -17,7 +17,7 @@ import SetupHelpers import Testlib.Prelude import Testlib.ResourcePool -testNotificationsForOfflineBackends :: HasCallStack => App () +testNotificationsForOfflineBackends :: (HasCallStack) => App () testNotificationsForOfflineBackends = do resourcePool <- asks (.resourcePool) -- `delUser` will eventually get deleted. diff --git a/integration/test/Test/Federator.hs b/integration/test/Test/Federator.hs index cabf7a1a522..ff097578bb5 100644 --- a/integration/test/Test/Federator.hs +++ b/integration/test/Test/Federator.hs @@ -18,8 +18,8 @@ runFederatorMetrics getService = do second <- bindResponse (getMetrics OwnDomain getService) handleRes assertBool "Two metric requests should never match" $ first.body /= second.body assertBool "Second metric response should never be 0 length (the first might be)" $ BS.length second.body /= 0 - assertBool "The seconds metric response should have text indicating that it is returning metrics" $ - BS.isInfixOf expectedString second.body + assertBool "The seconds metric response should have text indicating that it is returning metrics" + $ BS.isInfixOf expectedString second.body where expectedString = "# TYPE http_request_duration_seconds histogram" @@ -31,7 +31,7 @@ testFederatorMetricsInternal = runFederatorMetrics federatorInternal testFederatorMetricsExternal :: App () testFederatorMetricsExternal = runFederatorMetrics federatorExternal -testFederatorNumRequestsMetrics :: HasCallStack => App () +testFederatorNumRequestsMetrics :: (HasCallStack) => App () testFederatorNumRequestsMetrics = do u1 <- randomUser OwnDomain def u2 <- randomUser OtherDomain def diff --git a/integration/test/Test/LegalHold.hs b/integration/test/Test/LegalHold.hs index e049335a419..befbddccd71 100644 --- a/integration/test/Test/LegalHold.hs +++ b/integration/test/Test/LegalHold.hs @@ -95,7 +95,7 @@ testLHPreventAddingNonConsentingUsers = do addMembers alice conv def {users = [georgeQId]} >>= assertLabel 403 "missing-legalhold-consent" where - checkConvHasOtherMembers :: HasCallStack => Value -> Value -> [Value] -> App () + checkConvHasOtherMembers :: (HasCallStack) => Value -> Value -> [Value] -> App () checkConvHasOtherMembers conv u us = bindResponse (getConversation u conv) $ \resp -> do resp.status `shouldMatchInt` 200 @@ -105,7 +105,7 @@ testLHPreventAddingNonConsentingUsers = do mems `shouldMatchSet` forM us (\m -> m %. "qualified_id") testLHMessageExchange :: - HasCallStack => + (HasCallStack) => TaggedBool "clients1New" -> TaggedBool "clients2New" -> App () @@ -136,7 +136,7 @@ testLHMessageExchange (TaggedBool clients1New) (TaggedBool clients2New) = do val <- getJSON 200 res asList val - assertMessageSendingWorks :: HasCallStack => App () + assertMessageSendingWorks :: (HasCallStack) => App () assertMessageSendingWorks = do clients1 <- getClients mem1 clients2 <- getClients mem2 @@ -148,9 +148,13 @@ testLHMessageExchange (TaggedBool clients1New) (TaggedBool clients2New) = do let proteusMsg senderClient = Proto.defMessage @Proto.QualifiedNewOtrMessage - & #sender . Proto.client .~ (senderClient ^?! hex) - & #recipients .~ [proteusRecipients] - & #reportAll .~ Proto.defMessage + & #sender + . Proto.client + .~ (senderClient ^?! hex) + & #recipients + .~ [proteusRecipients] + & #reportAll + .~ Proto.defMessage sender clients = let senderClient = head $ filter (\c -> c ^? key (fromString "type") /= Just (toJSON "legalhold")) clients @@ -224,7 +228,7 @@ testLHClaimKeys approvedOrPending testmode = do objId `mapM` cls getCls lmem - let assertResp :: HasCallStack => Response -> App () + let assertResp :: (HasCallStack) => Response -> App () assertResp resp = case (testmode, llhdevs) of (TCKConsentMissing, (_ : _)) -> do resp.status `shouldMatchInt` 403 @@ -323,7 +327,7 @@ testLHRequestDevice = do -- | pops a channel until it finds an event that returns a 'Just' -- upon running the matcher function -checkChan :: HasCallStack => Chan t -> (t -> App (Maybe a)) -> App a +checkChan :: (HasCallStack) => Chan t -> (t -> App (Maybe a)) -> App a checkChan chan match = do tSecs <- asks ((* 1_000_000) . timeOutSeconds) @@ -332,7 +336,7 @@ checkChan chan match = do go -- | like 'checkChan' but throws away the request and decodes the body -checkChanVal :: HasCallStack => Chan (t, LazyByteString) -> (Value -> MaybeT App a) -> App a +checkChanVal :: (HasCallStack) => Chan (t, LazyByteString) -> (Value -> MaybeT App a) -> App a checkChanVal chan match = checkChan chan \(_, bs) -> runMaybeT do MaybeT (pure (decode bs)) >>= match @@ -366,10 +370,12 @@ testLHApproveDevice = do let uidsAndTidMatch val = do actualTid <- lookupFieldM val "team_id" - >>= lift . asString + >>= lift + . asString actualUid <- lookupFieldM val "user_id" - >>= lift . asString + >>= lift + . asString bobUid <- lift $ objId bob -- we pass the check on equality @@ -390,7 +396,8 @@ testLHApproveDevice = do let matchAuthToken val = lookupFieldM val "refresh_token" - >>= lift . asString + >>= lift + . asString checkChanVal chan matchAuthToken >>= renewToken bob @@ -503,8 +510,10 @@ testLHDisableForUser = do checkChan chan \(req, _) -> runMaybeT do unless do - BS8.unpack req.requestMethod == "POST" - && req.pathInfo == (T.pack <$> ["legalhold", "remove"]) + BS8.unpack req.requestMethod + == "POST" + && req.pathInfo + == (T.pack <$> ["legalhold", "remove"]) mzero void $ local (setTimeoutTo 90) do @@ -514,7 +523,8 @@ testLHDisableForUser = do bobId <- objId bob lhClients <- BrigI.getClientsFull bob [bobId] `bindResponse` \resp -> do - resp.json %. bobId + resp.json + %. bobId & asList >>= filterM \val -> (== "legalhold") <$> (val %. "type" & asString) @@ -815,7 +825,8 @@ testLHHappyFlow = do resp.status `shouldMatchInt` 200 resp.json %. "status" `shouldMatch` "enabled" _ <- - resp.json `lookupField` "client.id" + resp.json + `lookupField` "client.id" >>= assertJust "client id is present" resp.json %. "last_prekey" `shouldMatch` lpk @@ -825,7 +836,7 @@ testLHGetStatus = do (charlie, _tidCharlie, [debora]) <- createTeam OwnDomain 2 emil <- randomUser OwnDomain def - let check :: HasCallStack => (MakesValue getter, MakesValue target) => getter -> target -> String -> App () + let check :: (HasCallStack) => (MakesValue getter, MakesValue target) => getter -> target -> String -> App () check getter target status = do profile <- getUser getter target >>= getJSON 200 pStatus <- profile %. "legalhold_status" & asString @@ -865,7 +876,7 @@ testLHCannotCreateGroupWithUsersInConflict = do postConversation bob defProteus {qualifiedUsers = [debora, alice], newUsersRole = "wire_member", team = Just tidAlice} >>= assertLabel 403 "missing-legalhold-consent" -testNoConsentCannotBeInvited :: HasCallStack => App () +testNoConsentCannotBeInvited :: (HasCallStack) => App () testNoConsentCannotBeInvited = do -- team that is legalhold whitelisted (legalholder, tidLH, userLHNotActivated : _) <- createTeam OwnDomain 2 diff --git a/integration/test/Test/Login.hs b/integration/test/Test/Login.hs index c5ca8b2d513..096f441a50f 100644 --- a/integration/test/Test/Login.hs +++ b/integration/test/Test/Login.hs @@ -12,7 +12,7 @@ import SetupHelpers import Testlib.Prelude import Text.Printf (printf) -testLoginVerify6DigitEmailCodeSuccess :: HasCallStack => App () +testLoginVerify6DigitEmailCodeSuccess :: (HasCallStack) => App () testLoginVerify6DigitEmailCodeSuccess = do (owner, team, []) <- createTeam OwnDomain 0 email <- owner %. "email" @@ -25,7 +25,7 @@ testLoginVerify6DigitEmailCodeSuccess = do -- -- Test that login fails with wrong second factor email verification code -testLoginVerify6DigitWrongCodeFails :: HasCallStack => App () +testLoginVerify6DigitWrongCodeFails :: (HasCallStack) => App () testLoginVerify6DigitWrongCodeFails = do (owner, team, []) <- createTeam OwnDomain 0 email <- owner %. "email" @@ -40,7 +40,7 @@ testLoginVerify6DigitWrongCodeFails = do -- -- Test that login without verification code fails if SndFactorPasswordChallenge feature is enabled in team -testLoginVerify6DigitMissingCodeFails :: HasCallStack => App () +testLoginVerify6DigitMissingCodeFails :: (HasCallStack) => App () testLoginVerify6DigitMissingCodeFails = do (owner, team, []) <- createTeam OwnDomain 0 email <- owner %. "email" @@ -52,7 +52,7 @@ testLoginVerify6DigitMissingCodeFails = do -- -- Test that login fails with expired second factor email verification code -testLoginVerify6DigitExpiredCodeFails :: HasCallStack => App () +testLoginVerify6DigitExpiredCodeFails :: (HasCallStack) => App () testLoginVerify6DigitExpiredCodeFails = do withModifiedBackend (def {brigCfg = setField "optSettings.setVerificationTimeout" (Aeson.Number 2)}) @@ -73,7 +73,7 @@ testLoginVerify6DigitExpiredCodeFails = do resp.status `shouldMatchInt` 403 resp.json %. "label" `shouldMatch` "code-authentication-failed" -testLoginVerify6DigitResendCodeSuccessAndRateLimiting :: HasCallStack => App () +testLoginVerify6DigitResendCodeSuccessAndRateLimiting :: (HasCallStack) => App () testLoginVerify6DigitResendCodeSuccessAndRateLimiting = do (owner, team, []) <- createTeam OwnDomain 0 email <- owner %. "email" @@ -95,7 +95,7 @@ testLoginVerify6DigitResendCodeSuccessAndRateLimiting = do bindResponse (loginWith2ndFactor owner email defPassword mostRecentCode) \resp -> do resp.status `shouldMatchInt` 200 -testLoginVerify6DigitLimitRetries :: HasCallStack => App () +testLoginVerify6DigitLimitRetries :: (HasCallStack) => App () testLoginVerify6DigitLimitRetries = do (owner, team, []) <- createTeam OwnDomain 0 email <- owner %. "email" diff --git a/integration/test/Test/MLS.hs b/integration/test/Test/MLS.hs index b6df53ab4bb..c3a9d707ba5 100644 --- a/integration/test/Test/MLS.hs +++ b/integration/test/Test/MLS.hs @@ -16,7 +16,7 @@ import SetupHelpers import Test.Version import Testlib.Prelude -testSendMessageNoReturnToSender :: HasCallStack => App () +testSendMessageNoReturnToSender :: (HasCallStack) => App () testSendMessageNoReturnToSender = do [alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] [alice1, alice2, bob1, bob2] <- traverse (createMLSClient def) [alice, alice, bob, bob] @@ -33,8 +33,8 @@ testSendMessageNoReturnToSender = do for_ wss $ \ws -> do n <- awaitMatch (\n -> nPayload n %. "type" `isEqual` "conversation.mls-message-add") ws nPayload n %. "data" `shouldMatch` T.decodeUtf8 (Base64.encode mp.message) - expectFailure (const $ pure ()) $ - awaitMatch + expectFailure (const $ pure ()) + $ awaitMatch ( \n -> liftM2 (&&) @@ -43,7 +43,7 @@ testSendMessageNoReturnToSender = do ) wsSender -testStaleApplicationMessage :: HasCallStack => Domain -> App () +testStaleApplicationMessage :: (HasCallStack) => Domain -> App () testStaleApplicationMessage otherDomain = do [alice, bob, charlie, dave, eve] <- createAndConnectUsers [OwnDomain, otherDomain, OwnDomain, OwnDomain, OwnDomain] @@ -70,7 +70,7 @@ testStaleApplicationMessage otherDomain = do -- bob's application messages are now rejected void $ postMLSMessage bob1 msg2.message >>= getJSON 409 -testMixedProtocolUpgrade :: HasCallStack => Domain -> App () +testMixedProtocolUpgrade :: (HasCallStack) => Domain -> App () testMixedProtocolUpgrade secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 [bob, charlie] <- replicateM 2 (randomUser secondDomain def) @@ -113,7 +113,7 @@ testMixedProtocolUpgrade secondDomain = do bindResponse (putConversationProtocol bob qcnv "invalid") $ \resp -> do resp.status `shouldMatchInt` 400 -testMixedProtocolNonTeam :: HasCallStack => Domain -> App () +testMixedProtocolNonTeam :: (HasCallStack) => Domain -> App () testMixedProtocolNonTeam secondDomain = do [alice, bob] <- createAndConnectUsers [OwnDomain, secondDomain] qcnv <- @@ -123,7 +123,7 @@ testMixedProtocolNonTeam secondDomain = do bindResponse (putConversationProtocol bob qcnv "mixed") $ \resp -> do resp.status `shouldMatchInt` 403 -testMixedProtocolAddUsers :: HasCallStack => Domain -> Ciphersuite -> App () +testMixedProtocolAddUsers :: (HasCallStack) => Domain -> Ciphersuite -> App () testMixedProtocolAddUsers secondDomain suite = do setMLSCiphersuite suite (alice, tid, _) <- createTeam OwnDomain 1 @@ -160,7 +160,7 @@ testMixedProtocolAddUsers secondDomain suite = do (suiteCode, _) <- assertOne $ T.hexadecimal (T.pack suite.code) resp.json %. "cipher_suite" `shouldMatchInt` suiteCode -testMixedProtocolUserLeaves :: HasCallStack => Domain -> App () +testMixedProtocolUserLeaves :: (HasCallStack) => Domain -> App () testMixedProtocolUserLeaves secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 bob <- randomUser secondDomain def @@ -196,7 +196,7 @@ testMixedProtocolUserLeaves secondDomain = do msg %. "message.content.body.Proposal.Remove.removed" `shouldMatchInt` leafIndexBob msg %. "message.content.sender.External" `shouldMatchInt` 0 -testMixedProtocolAddPartialClients :: HasCallStack => Domain -> App () +testMixedProtocolAddPartialClients :: (HasCallStack) => Domain -> App () testMixedProtocolAddPartialClients secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 bob <- randomUser secondDomain def @@ -235,7 +235,7 @@ testMixedProtocolAddPartialClients secondDomain = do mp <- createAddCommitWithKeyPackages bob1 [kp2] void $ postMLSCommitBundle mp.sender (mkBundle mp) >>= getJSON 201 -testMixedProtocolRemovePartialClients :: HasCallStack => Domain -> App () +testMixedProtocolRemovePartialClients :: (HasCallStack) => Domain -> App () testMixedProtocolRemovePartialClients secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 bob <- randomUser secondDomain def @@ -261,7 +261,7 @@ testMixedProtocolRemovePartialClients secondDomain = do void $ postMLSCommitBundle mp.sender (mkBundle mp) >>= getJSON 201 -testMixedProtocolAppMessagesAreDenied :: HasCallStack => Domain -> App () +testMixedProtocolAppMessagesAreDenied :: (HasCallStack) => Domain -> App () testMixedProtocolAppMessagesAreDenied secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 bob <- randomUser secondDomain def @@ -290,7 +290,7 @@ testMixedProtocolAppMessagesAreDenied secondDomain = do resp.status `shouldMatchInt` 422 resp.json %. "label" `shouldMatch` "mls-unsupported-message" -testMLSProtocolUpgrade :: HasCallStack => Domain -> App () +testMLSProtocolUpgrade :: (HasCallStack) => Domain -> App () testMLSProtocolUpgrade secondDomain = do (alice, bob, conv) <- simpleMixedConversationSetup secondDomain charlie <- randomUser OwnDomain def @@ -332,7 +332,7 @@ testMLSProtocolUpgrade secondDomain = do resp.status `shouldMatchInt` 200 resp.json %. "protocol" `shouldMatch` "mls" -testAddUserSimple :: HasCallStack => Ciphersuite -> CredentialType -> App () +testAddUserSimple :: (HasCallStack) => Ciphersuite -> CredentialType -> App () testAddUserSimple suite ctype = do setMLSCiphersuite suite [alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] @@ -366,12 +366,12 @@ testAddUserSimple suite ctype = do -- check that bob can now see the conversation convs <- getAllConvs bob convIds <- traverse (%. "qualified_id") convs - void $ - assertBool + void + $ assertBool "Users added to an MLS group should find it when listing conversations" (qcnv `elem` convIds) -testRemoteAddUser :: HasCallStack => App () +testRemoteAddUser :: (HasCallStack) => App () testRemoteAddUser = do [alice, bob, charlie] <- createAndConnectUsers [OwnDomain, OtherDomain, OwnDomain] [alice1, bob1, charlie1] <- traverse (createMLSClient def) [alice, bob, charlie] @@ -388,7 +388,7 @@ testRemoteAddUser = do resp.status `shouldMatchInt` 500 resp.json %. "label" `shouldMatch` "federation-not-implemented" -testRemoteRemoveClient :: HasCallStack => Ciphersuite -> App () +testRemoteRemoveClient :: (HasCallStack) => Ciphersuite -> App () testRemoteRemoveClient suite = do setMLSCiphersuite suite [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] @@ -409,7 +409,7 @@ testRemoteRemoveClient suite = do msg %. "message.content.body.Proposal.Remove.removed" `shouldMatchInt` leafIndexBob msg %. "message.content.sender.External" `shouldMatchInt` 0 -testCreateSubConv :: HasCallStack => Ciphersuite -> App () +testCreateSubConv :: (HasCallStack) => Ciphersuite -> App () testCreateSubConv suite = do setMLSCiphersuite suite [alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] @@ -448,7 +448,7 @@ testSelfConversation v = withVersion5 v $ do void $ createExternalCommit newClient Nothing >>= sendAndConsumeCommitBundle -- | FUTUREWORK: Don't allow partial adds, not even in the first commit -testFirstCommitAllowsPartialAdds :: HasCallStack => App () +testFirstCommitAllowsPartialAdds :: (HasCallStack) => App () testFirstCommitAllowsPartialAdds = do alice <- randomUser OwnDomain def @@ -466,7 +466,7 @@ testFirstCommitAllowsPartialAdds = do resp.status `shouldMatchInt` 409 resp.json %. "label" `shouldMatch` "mls-client-mismatch" -testAddUserPartial :: HasCallStack => App () +testAddUserPartial :: (HasCallStack) => App () testAddUserPartial = do [alice, bob, charlie] <- createAndConnectUsers (replicate 3 OwnDomain) @@ -494,7 +494,7 @@ testAddUserPartial = do err %. "label" `shouldMatch` "mls-client-mismatch" -- | admin removes user from a conversation but doesn't list all clients -testRemoveClientsIncomplete :: HasCallStack => App () +testRemoveClientsIncomplete :: (HasCallStack) => App () testRemoveClientsIncomplete = do [alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] @@ -507,7 +507,7 @@ testRemoveClientsIncomplete = do err <- postMLSCommitBundle mp.sender (mkBundle mp) >>= getJSON 409 err %. "label" `shouldMatch` "mls-client-mismatch" -testAdminRemovesUserFromConv :: HasCallStack => Ciphersuite -> App () +testAdminRemovesUserFromConv :: (HasCallStack) => Ciphersuite -> App () testAdminRemovesUserFromConv suite = do setMLSCiphersuite suite [alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] @@ -539,7 +539,7 @@ testAdminRemovesUserFromConv suite = do "bob is not longer part of conversation after the commit" (qcnv `notElem` convIds) -testLocalWelcome :: HasCallStack => App () +testLocalWelcome :: (HasCallStack) => App () testLocalWelcome = do users@[alice, bob] <- createAndConnectUsers [OwnDomain, OwnDomain] @@ -569,7 +569,7 @@ testLocalWelcome = do addedUser <- (event %. "data.users") >>= asList >>= assertOne objQid addedUser `shouldMatch` objQid bob -testStaleCommit :: HasCallStack => App () +testStaleCommit :: (HasCallStack) => App () testStaleCommit = do (alice : users) <- createAndConnectUsers (replicate 5 OwnDomain) let (users1, users2) = splitAt 2 users @@ -591,7 +591,7 @@ testStaleCommit = do resp.status `shouldMatchInt` 409 resp.json %. "label" `shouldMatch` "mls-stale-message" -testPropInvalidEpoch :: HasCallStack => App () +testPropInvalidEpoch :: (HasCallStack) => App () testPropInvalidEpoch = do users@[_alice, bob, charlie, dee] <- createAndConnectUsers (replicate 4 OwnDomain) [alice1, bob1, charlie1, dee1] <- traverse (createMLSClient def) users @@ -633,7 +633,7 @@ testPropInvalidEpoch = do --- | This test submits a ReInit proposal, which is currently ignored by the -- backend, in order to check that unsupported proposal types are accepted. -testPropUnsupported :: HasCallStack => App () +testPropUnsupported :: (HasCallStack) => App () testPropUnsupported = do users@[_alice, bob] <- createAndConnectUsers (replicate 2 OwnDomain) [alice1, bob1] <- traverse (createMLSClient def) users @@ -646,7 +646,7 @@ testPropUnsupported = do -- we cannot consume this message, because the membership tag is fake void $ postMLSMessage mp.sender mp.message >>= getJSON 201 -testAddUserBareProposalCommit :: HasCallStack => App () +testAddUserBareProposalCommit :: (HasCallStack) => App () testAddUserBareProposalCommit = do [alice, bob] <- createAndConnectUsers (replicate 2 OwnDomain) [alice1, bob1] <- traverse (createMLSClient def) [alice, bob] @@ -663,12 +663,12 @@ testAddUserBareProposalCommit = do -- check that bob can now see the conversation convs <- getAllConvs bob convIds <- traverse (%. "qualified_id") convs - void $ - assertBool + void + $ assertBool "Users added to an MLS group should find it when listing conversations" (qcnv `elem` convIds) -testPropExistingConv :: HasCallStack => App () +testPropExistingConv :: (HasCallStack) => App () testPropExistingConv = do [alice, bob] <- createAndConnectUsers (replicate 2 OwnDomain) [alice1, bob1] <- traverse (createMLSClient def) [alice, bob] @@ -678,7 +678,7 @@ testPropExistingConv = do res <- createAddProposals alice1 [bob] >>= traverse sendAndConsumeMessage >>= assertOne shouldBeEmpty (res %. "events") -testCommitNotReferencingAllProposals :: HasCallStack => App () +testCommitNotReferencingAllProposals :: (HasCallStack) => App () testCommitNotReferencingAllProposals = do users@[_alice, bob, charlie] <- createAndConnectUsers (replicate 3 OwnDomain) @@ -702,7 +702,7 @@ testCommitNotReferencingAllProposals = do resp.status `shouldMatchInt` 400 resp.json %. "label" `shouldMatch` "mls-commit-missing-references" -testUnsupportedCiphersuite :: HasCallStack => App () +testUnsupportedCiphersuite :: (HasCallStack) => App () testUnsupportedCiphersuite = do setMLSCiphersuite (Ciphersuite "0x0003") alice <- randomUser OwnDomain def @@ -715,7 +715,7 @@ testUnsupportedCiphersuite = do resp.status `shouldMatchInt` 400 resp.json %. "label" `shouldMatch` "mls-protocol-error" -testBackendRemoveProposal :: HasCallStack => Ciphersuite -> Domain -> App () +testBackendRemoveProposal :: (HasCallStack) => Ciphersuite -> Domain -> App () testBackendRemoveProposal suite domain = do setMLSCiphersuite suite [alice, bob] <- createAndConnectUsers [OwnDomain, domain] diff --git a/integration/test/Test/MLS/KeyPackage.hs b/integration/test/Test/MLS/KeyPackage.hs index cf6b721db88..6afe3415e36 100644 --- a/integration/test/Test/MLS/KeyPackage.hs +++ b/integration/test/Test/MLS/KeyPackage.hs @@ -117,7 +117,8 @@ testKeyPackageSelfClaim = do claimKeyPackages def alice1 alice `bindResponse` \resp -> do resp.status `shouldMatchInt` 200 - resp.json %. "key_packages" + resp.json + %. "key_packages" & asList -- the keypackage claimed by client 1 should be issued by -- client 2 @@ -179,7 +180,7 @@ testKeyPackageRemoteClaim = do resp.json %. "count" `shouldMatchInt` 0 resp.status `shouldMatchInt` 200 -testKeyPackageCount :: HasCallStack => Ciphersuite -> App () +testKeyPackageCount :: (HasCallStack) => Ciphersuite -> App () testKeyPackageCount cs = do setMLSCiphersuite cs alice <- randomUser OwnDomain def @@ -197,7 +198,7 @@ testKeyPackageCount cs = do resp.status `shouldMatchInt` 200 resp.json %. "count" `shouldMatchInt` count -testUnsupportedCiphersuite :: HasCallStack => App () +testUnsupportedCiphersuite :: (HasCallStack) => App () testUnsupportedCiphersuite = do let suite = Ciphersuite "0x0003" setMLSCiphersuite suite @@ -208,7 +209,7 @@ testUnsupportedCiphersuite = do resp.status `shouldMatchInt` 400 resp.json %. "label" `shouldMatch` "mls-protocol-error" -testReplaceKeyPackages :: HasCallStack => App () +testReplaceKeyPackages :: (HasCallStack) => App () testReplaceKeyPackages = do alice <- randomUser OwnDomain def [alice1, alice2] <- replicateM 2 $ createMLSClient def alice @@ -220,15 +221,15 @@ testReplaceKeyPackages = do resp.json %. "count" `shouldMatchInt` n -- setup: upload a batch of key packages for each ciphersuite - void $ - replicateM 4 (fmap fst (generateKeyPackage alice1)) - >>= uploadKeyPackages alice1 - >>= getBody 201 + void + $ replicateM 4 (fmap fst (generateKeyPackage alice1)) + >>= uploadKeyPackages alice1 + >>= getBody 201 setMLSCiphersuite suite - void $ - replicateM 5 (fmap fst (generateKeyPackage alice1)) - >>= uploadKeyPackages alice1 - >>= getBody 201 + void + $ replicateM 5 (fmap fst (generateKeyPackage alice1)) + >>= uploadKeyPackages alice1 + >>= getBody 201 checkCount def 4 checkCount suite 5 @@ -245,8 +246,9 @@ testReplaceKeyPackages = do -- claim all key packages one by one claimed <- - replicateM 3 $ - bindResponse (claimKeyPackages suite alice2 alice) $ \resp -> do + replicateM 3 + $ bindResponse (claimKeyPackages suite alice2 alice) + $ \resp -> do resp.status `shouldMatchInt` 200 ks <- resp.json %. "key_packages" & asList k <- assertOne ks @@ -259,10 +261,10 @@ testReplaceKeyPackages = do do -- replenish key packages for the second ciphersuite - void $ - replicateM 5 (fmap fst (generateKeyPackage alice1)) - >>= uploadKeyPackages alice1 - >>= getBody 201 + void + $ replicateM 5 (fmap fst (generateKeyPackage alice1)) + >>= uploadKeyPackages alice1 + >>= getBody 201 checkCount def 4 checkCount suite 5 diff --git a/integration/test/Test/MLS/Keys.hs b/integration/test/Test/MLS/Keys.hs index 64bba22e119..d5ac4867c60 100644 --- a/integration/test/Test/MLS/Keys.hs +++ b/integration/test/Test/MLS/Keys.hs @@ -6,7 +6,7 @@ import qualified Data.ByteString.Char8 as B8 import SetupHelpers import Testlib.Prelude -testPublicKeys :: HasCallStack => App () +testPublicKeys :: (HasCallStack) => App () testPublicKeys = do u <- randomUserId OwnDomain keys <- getMLSPublicKeys u >>= getJSON 200 @@ -48,7 +48,7 @@ testPublicKeys = do pubkeyY <- assertOne . toList . B64U.decodeUnpadded $ B8.pack pubkeyYS B8.length pubkeyY `shouldMatchInt` 66 -testPublicKeysMLSNotEnabled :: HasCallStack => App () +testPublicKeysMLSNotEnabled :: (HasCallStack) => App () testPublicKeysMLSNotEnabled = withModifiedBackend def { galleyCfg = removeField "settings.mlsPrivateKeyPaths" diff --git a/integration/test/Test/MLS/Message.hs b/integration/test/Test/MLS/Message.hs index 3a7c2efc213..e15635f4987 100644 --- a/integration/test/Test/MLS/Message.hs +++ b/integration/test/Test/MLS/Message.hs @@ -27,7 +27,7 @@ import SetupHelpers import Testlib.Prelude -- | Test happy case of federated MLS message sending in both directions. -testApplicationMessage :: HasCallStack => App () +testApplicationMessage :: (HasCallStack) => App () testApplicationMessage = do -- local alice and alex, remote bob [alice, alex, bob, betty] <- @@ -55,7 +55,7 @@ testApplicationMessage = do void $ createApplicationMessage bob1 "hey" >>= sendAndConsumeMessage traverse_ (awaitMatch isNewMLSMessageNotif) wss -testAppMessageSomeReachable :: HasCallStack => App () +testAppMessageSomeReachable :: (HasCallStack) => App () testAppMessageSomeReachable = do alice1 <- startDynamicBackends [mempty] $ \[thirdDomain] -> do ownDomain <- make OwnDomain & asString @@ -75,7 +75,7 @@ testAppMessageSomeReachable = do mp <- createApplicationMessage alice1 "hi, bob!" void $ postMLSMessage mp.sender mp.message >>= getJSON 201 -testMessageNotifications :: HasCallStack => Domain -> App () +testMessageNotifications :: (HasCallStack) => Domain -> App () testMessageNotifications bobDomain = do [alice, bob] <- createAndConnectUsers [OwnDomain, bobDomain] @@ -105,7 +105,7 @@ testMessageNotifications bobDomain = do get def `shouldMatchInt` (numNotifs + 1) get def {client = Just bobClient} `shouldMatchInt` (numNotifsClient + 1) -testMultipleMessages :: HasCallStack => App () +testMultipleMessages :: (HasCallStack) => App () testMultipleMessages = do [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] [alice1, bob1] <- traverse (createMLSClient def) [alice, bob] diff --git a/integration/test/Test/MLS/Notifications.hs b/integration/test/Test/MLS/Notifications.hs index ad0595a48c6..61a0b60d53f 100644 --- a/integration/test/Test/MLS/Notifications.hs +++ b/integration/test/Test/MLS/Notifications.hs @@ -6,7 +6,7 @@ import Notifications import SetupHelpers import Testlib.Prelude -testWelcomeNotification :: HasCallStack => App () +testWelcomeNotification :: (HasCallStack) => App () testWelcomeNotification = do [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] [alice1, alice2, bob1, bob2] <- traverse (createMLSClient def) [alice, alice, bob, bob] diff --git a/integration/test/Test/MLS/One2One.hs b/integration/test/Test/MLS/One2One.hs index c8b5e4deedb..338cae3a7e4 100644 --- a/integration/test/Test/MLS/One2One.hs +++ b/integration/test/Test/MLS/One2One.hs @@ -30,7 +30,7 @@ import SetupHelpers import Test.Version import Testlib.Prelude -testGetMLSOne2One :: HasCallStack => Version5 -> Domain -> App () +testGetMLSOne2One :: (HasCallStack) => Version5 -> Domain -> App () testGetMLSOne2One v otherDomain = withVersion5 v $ do [alice, bob] <- createAndConnectUsers [OwnDomain, otherDomain] @@ -59,7 +59,7 @@ testGetMLSOne2One v otherDomain = withVersion5 v $ do conv2 %. "qualified_id" `shouldMatch` convId assertConvData conv2 -testMLSOne2OneOtherMember :: HasCallStack => One2OneScenario -> App () +testMLSOne2OneOtherMember :: (HasCallStack) => One2OneScenario -> App () testMLSOne2OneOtherMember scenario = do alice <- randomUser OwnDomain def let otherDomain = one2OneScenarioUserDomain scenario @@ -92,14 +92,14 @@ testMLSOne2OneOtherMember scenario = do getMLSOne2OneConversation self other `bindResponse` assertOthers other getConversation self conv `bindResponse` assertOthers other -testGetMLSOne2OneUnconnected :: HasCallStack => Domain -> App () +testGetMLSOne2OneUnconnected :: (HasCallStack) => Domain -> App () testGetMLSOne2OneUnconnected otherDomain = do [alice, bob] <- for [OwnDomain, otherDomain] $ \domain -> randomUser domain def bindResponse (getMLSOne2OneConversation alice bob) $ \resp -> resp.status `shouldMatchInt` 403 -testMLSOne2OneBlocked :: HasCallStack => Domain -> App () +testMLSOne2OneBlocked :: (HasCallStack) => Domain -> App () testMLSOne2OneBlocked otherDomain = do [alice, bob] <- for [OwnDomain, otherDomain] $ flip randomUser def void $ postConnection bob alice >>= getBody 201 @@ -108,7 +108,7 @@ testMLSOne2OneBlocked otherDomain = do void $ getMLSOne2OneConversation bob alice >>= getJSON 403 -- | Alice and Bob are initially connected, but then Alice blocks Bob. -testMLSOne2OneBlockedAfterConnected :: HasCallStack => One2OneScenario -> App () +testMLSOne2OneBlockedAfterConnected :: (HasCallStack) => One2OneScenario -> App () testMLSOne2OneBlockedAfterConnected scenario = do alice <- randomUser OwnDomain def let otherDomain = one2OneScenarioUserDomain scenario @@ -147,7 +147,7 @@ testMLSOne2OneBlockedAfterConnected scenario = do -- | Alice and Bob are initially connected, then Alice blocks Bob, and finally -- Alice unblocks Bob. -testMLSOne2OneUnblocked :: HasCallStack => One2OneScenario -> App () +testMLSOne2OneUnblocked :: (HasCallStack) => One2OneScenario -> App () testMLSOne2OneUnblocked scenario = do alice <- randomUser OwnDomain def let otherDomain = one2OneScenarioUserDomain scenario @@ -230,7 +230,7 @@ one2OneScenarioConvDomain One2OneScenarioLocal = OwnDomain one2OneScenarioConvDomain One2OneScenarioLocalConv = OwnDomain one2OneScenarioConvDomain One2OneScenarioRemoteConv = OtherDomain -testMLSOne2One :: HasCallStack => Ciphersuite -> One2OneScenario -> App () +testMLSOne2One :: (HasCallStack) => Ciphersuite -> One2OneScenario -> App () testMLSOne2One suite scenario = do setMLSCiphersuite suite alice <- randomUser OwnDomain def diff --git a/integration/test/Test/MLS/SubConversation.hs b/integration/test/Test/MLS/SubConversation.hs index d73095030da..26ebd7d8f17 100644 --- a/integration/test/Test/MLS/SubConversation.hs +++ b/integration/test/Test/MLS/SubConversation.hs @@ -26,11 +26,11 @@ testJoinSubConv = do assertBool "Epoch timestamp should not be null" (tm /= Null) -- now alice joins with her own client - void $ - createExternalCommit alice1 Nothing - >>= sendAndConsumeCommitBundle + void + $ createExternalCommit alice1 Nothing + >>= sendAndConsumeCommitBundle -testDeleteParentOfSubConv :: HasCallStack => Domain -> App () +testDeleteParentOfSubConv :: (HasCallStack) => Domain -> App () testDeleteParentOfSubConv secondDomain = do (alice, tid, _) <- createTeam OwnDomain 1 bob <- randomUser secondDomain def @@ -81,7 +81,7 @@ testDeleteParentOfSubConv secondDomain = do resp.status `shouldMatchInt` 404 resp.json %. "label" `shouldMatch` "no-conversation" -testDeleteSubConversation :: HasCallStack => Domain -> App () +testDeleteSubConversation :: (HasCallStack) => Domain -> App () testDeleteSubConversation otherDomain = do [alice, bob] <- createAndConnectUsers [OwnDomain, otherDomain] charlie <- randomUser OwnDomain def @@ -105,7 +105,7 @@ testDeleteSubConversation otherDomain = do data Leaver = Alice | Bob deriving stock (Generic) -testLeaveSubConv :: HasCallStack => Leaver -> App () +testLeaveSubConv :: (HasCallStack) => Leaver -> App () testLeaveSubConv leaver = do [alice, bob, charlie] <- createAndConnectUsers [OwnDomain, OwnDomain, OtherDomain] clients@[alice1, bob1, bob2, charlie1] <- traverse (createMLSClient def) [alice, bob, bob, charlie] @@ -222,7 +222,8 @@ testCreatorRemovesUserFromParent = do lift do (== idx) <$> (prop %. "Remove.removed" & asInt) ws - msg %. "payload.0.data" + msg + %. "payload.0.data" & asByteString >>= mlsCliConsume consumer diff --git a/integration/test/Test/MLS/Unreachable.hs b/integration/test/Test/MLS/Unreachable.hs index be8564352f5..4e32d293508 100644 --- a/integration/test/Test/MLS/Unreachable.hs +++ b/integration/test/Test/MLS/Unreachable.hs @@ -26,7 +26,7 @@ import SetupHelpers import Testlib.Prelude import Testlib.ResourcePool -testAddUsersSomeReachable :: HasCallStack => App () +testAddUsersSomeReachable :: (HasCallStack) => App () testAddUsersSomeReachable = do (addCommit, d) <- startDynamicBackends [mempty] $ \[thirdDomain] -> do ownDomain <- make OwnDomain & asString @@ -48,7 +48,7 @@ testAddUsersSomeReachable = do (resp.json %. "unreachable_backends" & asList) `shouldMatch` [d] -- | There is analogous counterpart for Proteus in the 'Test.Conversation' module. -testAddUserWithUnreachableRemoteUsers :: HasCallStack => App () +testAddUserWithUnreachableRemoteUsers :: (HasCallStack) => App () testAddUserWithUnreachableRemoteUsers = do resourcePool <- asks resourcePool runCodensity (acquireResources 1 resourcePool) $ \[cDom] -> do @@ -88,7 +88,7 @@ testAddUserWithUnreachableRemoteUsers = do resp.status `shouldMatchInt` 533 resp.jsonBody %. "unreachable_backends" `shouldMatchSet` [cDom.berDomain] -testAddUnreachableUserFromFederatingBackend :: HasCallStack => App () +testAddUnreachableUserFromFederatingBackend :: (HasCallStack) => App () testAddUnreachableUserFromFederatingBackend = do resourcePool <- asks resourcePool runCodensity (acquireResources 1 resourcePool) $ \[cDom] -> do diff --git a/integration/test/Test/MessageTimer.hs b/integration/test/Test/MessageTimer.hs index 9e2e38d4a66..853876c8632 100644 --- a/integration/test/Test/MessageTimer.hs +++ b/integration/test/Test/MessageTimer.hs @@ -26,7 +26,7 @@ import SetupHelpers import Testlib.Prelude import Testlib.ResourcePool -testMessageTimerChangeWithRemotes :: HasCallStack => App () +testMessageTimerChangeWithRemotes :: (HasCallStack) => App () testMessageTimerChangeWithRemotes = do [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] conv <- postConversation alice defProteus {qualifiedUsers = [bob]} >>= getJSON 201 @@ -37,7 +37,7 @@ testMessageTimerChangeWithRemotes = do notif %. "payload.0.qualified_conversation" `shouldMatch` objQidObject conv notif %. "payload.0.qualified_from" `shouldMatch` objQidObject alice -testMessageTimerChangeWithUnreachableRemotes :: HasCallStack => App () +testMessageTimerChangeWithUnreachableRemotes :: (HasCallStack) => App () testMessageTimerChangeWithUnreachableRemotes = do resourcePool <- asks resourcePool alice <- randomUser OwnDomain def diff --git a/integration/test/Test/Notifications.hs b/integration/test/Test/Notifications.hs index 14078b5b56e..b94060814ca 100644 --- a/integration/test/Test/Notifications.hs +++ b/integration/test/Test/Notifications.hs @@ -9,11 +9,11 @@ import Notifications import SetupHelpers import Testlib.Prelude -examplePush :: MakesValue u => u -> App Value +examplePush :: (MakesValue u) => u -> App Value examplePush u = do r <- recipient u - pure $ - object + pure + $ object [ "recipients" .= [r], "payload" .= [object ["hello" .= "world"]] ] @@ -24,8 +24,9 @@ testFetchAllNotifications = do push <- examplePush user let n = 10 - replicateM_ n $ - bindResponse (postPush user [push]) $ \res -> + replicateM_ n + $ bindResponse (postPush user [push]) + $ \res -> res.status `shouldMatchInt` 200 let c :: Maybe String = Just "deadbeef" @@ -74,23 +75,23 @@ testLastNotification = do lastNotif <- getLastNotification user def {client = Just "c"} >>= getJSON 200 lastNotif %. "payload" `shouldMatch` [object ["client" .= "c"]] -testInvalidNotification :: HasCallStack => App () +testInvalidNotification :: (HasCallStack) => App () testInvalidNotification = do user <- randomUserId OwnDomain -- test uuid v4 as "since" do notifId <- randomId - void $ - getNotifications user def {since = Just notifId} - >>= getJSON 400 + void + $ getNotifications user def {since = Just notifId} + >>= getJSON 400 -- test arbitrary uuid v1 as "since" do notifId <- randomUUIDv1 - void $ - getNotifications user def {since = Just notifId} - >>= getJSON 404 + void + $ getNotifications user def {since = Just notifId} + >>= getJSON 404 -- | Check that client-add notifications use the V5 format: -- @ @@ -98,7 +99,7 @@ testInvalidNotification = do -- @ -- -- Migration plan: clients must be able to parse both old and new schema starting from V6. Once V5 is deprecated, the backend can start sending notifications in the new form. -testAddClientNotification :: HasCallStack => App () +testAddClientNotification :: (HasCallStack) => App () testAddClientNotification = do alice <- randomUser OwnDomain def diff --git a/integration/test/Test/Presence.hs b/integration/test/Test/Presence.hs index e6252ea7e2a..75e45a51e38 100644 --- a/integration/test/Test/Presence.hs +++ b/integration/test/Test/Presence.hs @@ -12,7 +12,7 @@ ensurePresent u n = retryT $ do ps <- getPresence u >>= getJSON 200 >>= asList length ps `shouldMatchInt` n -registerUser :: HasCallStack => App (Value, String) +registerUser :: (HasCallStack) => App (Value, String) registerUser = do alice <- randomUserId OwnDomain c <- randomClientId @@ -20,10 +20,10 @@ registerUser = do ensurePresent alice 1 pure (alice, c) -testAddUser :: HasCallStack => App () +testAddUser :: (HasCallStack) => App () testAddUser = void registerUser -testRemoveUser :: HasCallStack => App () +testRemoveUser :: (HasCallStack) => App () testRemoveUser = do -- register alice and add a push token (alice, c) <- registerUser diff --git a/integration/test/Test/Provider.hs b/integration/test/Test/Provider.hs index 5663fb11912..9eb08ea114e 100644 --- a/integration/test/Test/Provider.hs +++ b/integration/test/Test/Provider.hs @@ -10,7 +10,7 @@ import Data.String.Conversions (cs) import SetupHelpers import Testlib.Prelude -testProviderUploadAsset :: HasCallStack => App () +testProviderUploadAsset :: (HasCallStack) => App () testProviderUploadAsset = do email <- randomEmail alice <- randomUser OwnDomain def diff --git a/integration/test/Test/Search.hs b/integration/test/Test/Search.hs index fab4fd54daa..af3f00d4e56 100644 --- a/integration/test/Test/Search.hs +++ b/integration/test/Test/Search.hs @@ -14,7 +14,7 @@ import Testlib.Prelude -------------------------------------------------------------------------------- -- LOCAL SEARCH -testSearchContactForExternalUsers :: HasCallStack => App () +testSearchContactForExternalUsers :: (HasCallStack) => App () testSearchContactForExternalUsers = do owner <- randomUser OwnDomain def {BrigI.team = True} tid <- owner %. "team" & asString @@ -74,7 +74,7 @@ data FedUserSearchTestCase = FedUserSearchTestCase } deriving (Eq, Ord, Show) -testFederatedUserSearch :: HasCallStack => App () +testFederatedUserSearch :: (HasCallStack) => App () testFederatedUserSearch = do let tcs = [ -- no search @@ -102,7 +102,7 @@ testFederatedUserSearch = do void $ BrigI.createFedConn d1 (BrigI.FedConn d2 "full_search" Nothing) forM_ tcs (federatedUserSearch d1 d2) -federatedUserSearch :: HasCallStack => String -> String -> FedUserSearchTestCase -> App () +federatedUserSearch :: (HasCallStack) => String -> String -> FedUserSearchTestCase -> App () federatedUserSearch d1 d2 test = do void $ BrigI.updateFedConn d2 d1 (BrigI.FedConn d1 test.searchPolicy (restriction test.restrictionD2D1)) void $ BrigI.updateFedConn d1 d2 (BrigI.FedConn d2 test.searchPolicy (restriction test.restrictionD1D2)) @@ -158,7 +158,7 @@ federatedUserSearch d1 d2 test = do TeamAllowed -> do BrigI.addFederationRemoteTeam ownDomain remoteDomain remoteTeam -testFederatedUserSearchNonTeamSearcher :: HasCallStack => App () +testFederatedUserSearchNonTeamSearcher :: (HasCallStack) => App () testFederatedUserSearchNonTeamSearcher = do startDynamicBackends [def, def] $ \[d1, d2] -> do void $ BrigI.createFedConn d2 (BrigI.FedConn d1 "full_search" (Just [])) @@ -189,7 +189,7 @@ testFederatedUserSearchNonTeamSearcher = do doc : _ -> assertFailure $ "Expected an empty result, but got " <> show doc <> " for test case " -testFederatedUserSearchForNonTeamUser :: HasCallStack => App () +testFederatedUserSearchForNonTeamUser :: (HasCallStack) => App () testFederatedUserSearchForNonTeamUser = do startDynamicBackends [def, def] $ \[d1, d2] -> do void $ BrigI.createFedConn d2 (BrigI.FedConn d1 "full_search" Nothing) diff --git a/integration/test/Test/Services.hs b/integration/test/Test/Services.hs index 3156a98561f..eea1ced16b3 100644 --- a/integration/test/Test/Services.hs +++ b/integration/test/Test/Services.hs @@ -22,7 +22,7 @@ import API.Common import SetupHelpers import Testlib.Prelude -testUpdateServiceUpdateAcceptHeader :: HasCallStack => App () +testUpdateServiceUpdateAcceptHeader :: (HasCallStack) => App () testUpdateServiceUpdateAcceptHeader = do let dom = OwnDomain email <- randomEmail @@ -31,12 +31,12 @@ testUpdateServiceUpdateAcceptHeader = do pId <- provider %. "id" & asString service <- newService dom pId def sId <- service %. "id" - void $ - updateService dom pId sId (Just "application/json") (Just "brand new service") - >>= getBody 200 - void $ - updateService dom pId sId (Just "text/plain") (Just "even newer service") - >>= getBody 200 - void $ - updateService dom pId sId Nothing (Just "really old service") - >>= getBody 200 + void + $ updateService dom pId sId (Just "application/json") (Just "brand new service") + >>= getBody 200 + void + $ updateService dom pId sId (Just "text/plain") (Just "even newer service") + >>= getBody 200 + void + $ updateService dom pId sId Nothing (Just "really old service") + >>= getBody 200 diff --git a/integration/test/Test/Spar.hs b/integration/test/Test/Spar.hs index d1e14e85984..ab147901071 100644 --- a/integration/test/Test/Spar.hs +++ b/integration/test/Test/Spar.hs @@ -7,7 +7,7 @@ import Control.Concurrent (threadDelay) import SetupHelpers import Testlib.Prelude -testSparUserCreationInvitationTimeout :: HasCallStack => App () +testSparUserCreationInvitationTimeout :: (HasCallStack) => App () testSparUserCreationInvitationTimeout = do (owner, _tid, _) <- createTeam OwnDomain 1 tok <- createScimToken owner >>= \resp -> resp.json %. "token" >>= asString diff --git a/integration/test/Test/Swagger.hs b/integration/test/Test/Swagger.hs index 76cf6ddc381..5836ead12e0 100644 --- a/integration/test/Test/Swagger.hs +++ b/integration/test/Test/Swagger.hs @@ -14,7 +14,7 @@ internalApis :: Set String internalApis = Set.fromList ["brig", "cannon", "cargohold", "cannon", "spar"] -- | See https://docs.wire.com/understand/api-client-perspective/swagger.html -testSwagger :: HasCallStack => App () +testSwagger :: (HasCallStack) => App () testSwagger = do bindResponse BrigP.getApiVersions $ \resp -> do resp.status `shouldMatchInt` 200 @@ -22,11 +22,13 @@ testSwagger = do sup <- resp.json %. "supported" & asSetOf asIntegral dev <- resp.json %. "development" & asSetOf asIntegral pure $ sup <> dev - assertBool ("unexpected actually existing versions: " <> show actualVersions) $ + assertBool ("unexpected actually existing versions: " <> show actualVersions) + $ -- make sure nobody has added a new version without adding it to `existingVersions`. -- ("subset" because blocked versions like v3 are not actually existing, but still -- documented.) - actualVersions `Set.isSubsetOf` existingVersions + actualVersions + `Set.isSubsetOf` existingVersions bindResponse BrigP.getSwaggerPublicTOC $ \resp -> do resp.status `shouldMatchInt` 200 @@ -52,7 +54,7 @@ testSwagger = do resp.status `shouldMatchInt` 200 void resp.json -testSwaggerInternalVersionedNotFound :: HasCallStack => App () +testSwaggerInternalVersionedNotFound :: (HasCallStack) => App () testSwaggerInternalVersionedNotFound = do forM_ internalApis $ \api -> do bindResponse (getSwaggerInternalUI api) $ \resp -> do @@ -63,7 +65,7 @@ testSwaggerInternalVersionedNotFound = do rawBaseRequest OwnDomain Brig (ExplicitVersion 2) (joinHttpPath ["api-internal", "swagger-ui", srv]) >>= submit "GET" -testSwaggerToc :: HasCallStack => App () +testSwaggerToc :: (HasCallStack) => App () testSwaggerToc = do forM_ ["/api/swagger-ui", "/api/swagger-ui/index.html", "/api/swagger.json"] $ \path -> bindResponse (get path) $ \resp -> do diff --git a/integration/test/Test/TeamSettings.hs b/integration/test/Test/TeamSettings.hs index 3be86c60d34..03a667cf78e 100644 --- a/integration/test/Test/TeamSettings.hs +++ b/integration/test/Test/TeamSettings.hs @@ -23,7 +23,7 @@ import API.Galley import SetupHelpers import Testlib.Prelude -testTeamSettingsUpdate :: HasCallStack => App () +testTeamSettingsUpdate :: (HasCallStack) => App () testTeamSettingsUpdate = do (ownerA, tidA, [mem]) <- createTeam OwnDomain 2 partner <- createTeamMemberWithRole ownerA tidA "partner" @@ -42,7 +42,7 @@ testTeamSettingsUpdate = do resp.status `shouldMatchInt` 403 resp.json %. "label" `shouldMatch` "no-team-member" -testTeamPropertiesUpdate :: HasCallStack => App () +testTeamPropertiesUpdate :: (HasCallStack) => App () testTeamPropertiesUpdate = do (ownerA, tidA, [mem]) <- createTeam OwnDomain 2 partner <- createTeamMemberWithRole ownerA tidA "partner" diff --git a/integration/test/Test/User.hs b/integration/test/Test/User.hs index 55fe4082550..4b397b680cc 100644 --- a/integration/test/Test/User.hs +++ b/integration/test/Test/User.hs @@ -11,7 +11,7 @@ import qualified Data.UUID.V4 as UUID import SetupHelpers import Testlib.Prelude -testSupportedProtocols :: HasCallStack => Domain -> App () +testSupportedProtocols :: (HasCallStack) => Domain -> App () testSupportedProtocols bobDomain = do alice <- randomUser OwnDomain def alice %. "supported_protocols" `shouldMatchSet` ["proteus"] @@ -43,7 +43,7 @@ testSupportedProtocols bobDomain = do resp.status `shouldMatchInt` 400 resp.json %. "label" `shouldMatch` "bad-request" -testCreateUserSupportedProtocols :: HasCallStack => App () +testCreateUserSupportedProtocols :: (HasCallStack) => App () testCreateUserSupportedProtocols = do alice <- randomUser OwnDomain def {supportedProtocols = Just ["proteus", "mls"]} bindResponse (getUserSupportedProtocols alice alice) $ \resp -> do @@ -56,7 +56,7 @@ testCreateUserSupportedProtocols = do -- | For now this only tests attempts to update /self/handle in E2EId-enabled teams. More -- tests can be found under `/services/brig/test/integration` (and should be moved here). -testUpdateHandle :: HasCallStack => App () +testUpdateHandle :: (HasCallStack) => App () testUpdateHandle = do -- create team with one member, without scim, but with `mlsE2EId` enabled. (owner, team, [mem1]) <- createTeam OwnDomain 2 @@ -120,7 +120,7 @@ testUpdateHandle = do -- | For now this only tests attempts to update one's own display name, email address, or -- language in E2EId-enabled teams (ie., everything except handle). More tests can be found -- under `/services/brig/test/integration` (and should be moved here). -testUpdateSelf :: HasCallStack => Tagged "mode" TestUpdateSelfMode -> App () +testUpdateSelf :: (HasCallStack) => Tagged "mode" TestUpdateSelfMode -> App () testUpdateSelf (MkTagged mode) = do -- create team with one member, without scim, but with `mlsE2EId` enabled. (owner, team, [mem1]) <- createTeam OwnDomain 2 diff --git a/integration/test/Test/Version.hs b/integration/test/Test/Version.hs index 40c4dfeb14d..abd59a49958 100644 --- a/integration/test/Test/Version.hs +++ b/integration/test/Test/Version.hs @@ -47,12 +47,12 @@ testVersion (Versioned' v) = withModifiedBackend domain `shouldMatch` dom federation `shouldMatch` True - unless (null (Set.intersection supported dev)) $ - assertFailure "development and supported versions should not overlap" + unless (null (Set.intersection supported dev)) + $ assertFailure "development and supported versions should not overlap" testVersionUnsupported :: App () -testVersionUnsupported = bindResponse (baseRequest OwnDomain Brig (ExplicitVersion 500) "/api-version" >>= submit "GET") $ - \resp -> do +testVersionUnsupported = bindResponse (baseRequest OwnDomain Brig (ExplicitVersion 500) "/api-version" >>= submit "GET") + $ \resp -> do resp.status `shouldMatchInt` 404 resp.json %. "label" `shouldMatch` "unsupported-version" diff --git a/integration/test/Testlib/App.hs b/integration/test/Testlib/App.hs index 904386a791e..38188f9a67e 100644 --- a/integration/test/Testlib/App.hs +++ b/integration/test/Testlib/App.hs @@ -18,7 +18,7 @@ import Testlib.JSON import Testlib.Types import Prelude -failApp :: HasCallStack => String -> App a +failApp :: (HasCallStack) => String -> App a failApp msg = throw (AppFailure msg) getPrekey :: App Value @@ -78,11 +78,11 @@ retryT :: App a -> App a retryT action = Retry.recoverAll (Retry.exponentialBackoff 8000 <> Retry.limitRetries 10) (const action) -- | make Bool lazy -liftBool :: Functor f => f Bool -> BoolT f +liftBool :: (Functor f) => f Bool -> BoolT f liftBool = MaybeT . fmap (bool Nothing (Just ())) -- | make Bool strict -unliftBool :: Functor f => BoolT f -> f Bool +unliftBool :: (Functor f) => BoolT f -> f Bool unliftBool = fmap isJust . runMaybeT -- | lazy (&&) diff --git a/integration/test/Testlib/Cannon.hs b/integration/test/Testlib/Cannon.hs index c6a57b66cce..9d0bbe22bd9 100644 --- a/integration/test/Testlib/Cannon.hs +++ b/integration/test/Testlib/Cannon.hs @@ -93,12 +93,12 @@ data WSConnect = WSConnect } class ToWSConnect a where - toWSConnect :: HasCallStack => a -> App WSConnect + toWSConnect :: (HasCallStack) => a -> App WSConnect instance {-# OVERLAPPING #-} ToWSConnect WSConnect where toWSConnect = pure -instance {-# OVERLAPPABLE #-} MakesValue user => ToWSConnect user where +instance {-# OVERLAPPABLE #-} (MakesValue user) => ToWSConnect user where toWSConnect u = do (domain, uid) <- objQid u mc <- lookupField u "client_id" @@ -118,14 +118,14 @@ instance (MakesValue user, MakesValue conn, MakesValue client) => ToWSConnect (u conn <- make c & asString pure (WSConnect uid domain (Just client) (Just conn)) -connect :: HasCallStack => WSConnect -> App WebSocket +connect :: (HasCallStack) => WSConnect -> App WebSocket connect wsConnect = do nchan <- liftIO newTChanIO latch <- liftIO newEmptyMVar wsapp <- run wsConnect (clientApp nchan latch) pure $ WebSocket nchan latch wsapp -clientApp :: HasCallStack => TChan Value -> MVar () -> WS.ClientApp () +clientApp :: (HasCallStack) => TChan Value -> MVar () -> WS.ClientApp () clientApp wsChan latch conn = do r <- async wsRead w <- async wsWrite @@ -143,7 +143,7 @@ clientApp wsChan latch conn = do -- | Start a client thread in 'Async' that opens a web socket to a Cannon, wait -- for the connection to register with Gundeck, and return the 'Async' thread. run :: - HasCallStack => + (HasCallStack) => WSConnect -> WS.ClientApp () -> App (Async ()) @@ -212,7 +212,7 @@ run wsConnect app = do liftIO $ race_ waitForPresence waitForException pure wsapp -close :: MonadIO m => WebSocket -> m () +close :: (MonadIO m) => WebSocket -> m () close ws = liftIO $ do putMVar (wsCloseLatch ws) () void $ waitCatch (wsAppThread ws) @@ -227,7 +227,7 @@ withWebSockets twcs k = do wcs <- for twcs toWSConnect go wcs [] where - go :: HasCallStack => [WSConnect] -> [WebSocket] -> App a + go :: (HasCallStack) => [WSConnect] -> [WebSocket] -> App a go [] wss = k (reverse wss) go (wc : wcs) wss = withWebSocket wc (\ws -> go wcs (ws : wss)) @@ -294,7 +294,7 @@ awaitAnyEvent tSecs = liftIO . timeout (tSecs * 1000 * 1000) . atomically . read -- received. When this functions returns it will push any non-matching -- events back to the websocket. awaitNMatchesResult :: - HasCallStack => + (HasCallStack) => -- | Number of matches Int -> -- | Selection function. Exceptions are *not* caught. @@ -334,7 +334,7 @@ awaitNMatchesResult nExpected checkMatch ws = go nExpected [] [] refill = mapM_ (liftIO . atomically . writeTChan (wsChan ws)) awaitAtLeastNMatchesResult :: - HasCallStack => + (HasCallStack) => -- | Minimum number of matches Int -> -- | Selection function. Exceptions are *not* caught. @@ -366,7 +366,7 @@ awaitAtLeastNMatchesResult nExpected checkMatch ws = go 0 [] [] refill = mapM_ (liftIO . atomically . writeTChan (wsChan ws)) awaitNToMMatchesResult :: - HasCallStack => + (HasCallStack) => -- | Minimum number of matches Int -> -- | Maximum number of matches @@ -400,7 +400,7 @@ awaitNToMMatchesResult nMin nMax checkMatch ws = go 0 [] [] refill = mapM_ (liftIO . atomically . writeTChan (wsChan ws)) awaitNMatches :: - HasCallStack => + (HasCallStack) => -- | Number of matches Int -> -- | Selection function. Should not throw any exceptions @@ -411,7 +411,7 @@ awaitNMatches nExpected checkMatch ws = do res <- awaitNMatchesResult nExpected checkMatch ws assertAwaitResult res -assertAwaitResult :: HasCallStack => AwaitResult -> App [Value] +assertAwaitResult :: (HasCallStack) => AwaitResult -> App [Value] assertAwaitResult res = do if res.success then pure res.matches @@ -421,7 +421,7 @@ assertAwaitResult res = do assertFailure $ unlines [msgHeader, details] awaitAtLeastNMatches :: - HasCallStack => + (HasCallStack) => -- | Minumum number of matches Int -> -- | Selection function. Should not throw any exceptions @@ -438,7 +438,7 @@ awaitAtLeastNMatches nExpected checkMatch ws = do assertFailure $ unlines [msgHeader, details] awaitNToMMatches :: - HasCallStack => + (HasCallStack) => -- | Minimum Number of matches Int -> -- | Maximum Number of matches @@ -457,7 +457,7 @@ awaitNToMMatches nMin nMax checkMatch ws = do assertFailure $ unlines [msgHeader, details] awaitMatch :: - HasCallStack => + (HasCallStack) => -- | Selection function. Should not throw any exceptions (Value -> App Bool) -> WebSocket -> @@ -465,7 +465,7 @@ awaitMatch :: awaitMatch checkMatch ws = head <$> awaitNMatches 1 checkMatch ws assertNoEvent :: - HasCallStack => + (HasCallStack) => Int -> WebSocket -> App () @@ -475,13 +475,13 @@ assertNoEvent to ws = do Just event -> assertFailure $ "Expected no event, but got: " <> show event Nothing -> pure () -nPayload :: MakesValue a => a -> App Value +nPayload :: (MakesValue a) => a -> App Value nPayload event = do payloads <- event %. "payload" & asList assertOne payloads -- | waits for an http response to satisfy a predicate -waitForResponse :: HasCallStack => App Response -> (Response -> App r) -> App r +waitForResponse :: (HasCallStack) => App Response -> (Response -> App r) -> App r waitForResponse act p = do tSecs <- asks timeOutSeconds r <- withRunInIO \inIO -> diff --git a/integration/test/Testlib/Certs.hs b/integration/test/Testlib/Certs.hs index 5a8ecee6af2..b6fda9b5204 100644 --- a/integration/test/Testlib/Certs.hs +++ b/integration/test/Testlib/Certs.hs @@ -37,10 +37,10 @@ keyPairToString :: RSAKeyPair -> (String, String) keyPairToString = bimap publicKeyToString privateKeyToString -- | the minimum key size is hard coded to be 256 bytes (= 2048 bits) -mkKeyPair :: HasCallStack => (Integer, Integer) -> App RSAKeyPair +mkKeyPair :: (HasCallStack) => (Integer, Integer) -> App RSAKeyPair mkKeyPair primes = - assertJust "key generation failed" $ - RSA.generateWith + assertJust "key generation failed" + $ RSA.generateWith primes 2048 65537 @@ -59,7 +59,7 @@ primesB = -- | create a root certificate authority CertificateBundle createRootCA :: - HasCallStack => + (HasCallStack) => -- | the root CA's name String -> -- | the root CA's keymaterial @@ -74,7 +74,7 @@ createRootCA caName (pubKey, privKey) = -- | sign an intermediate/ leaf certificate by signing with an intermediate/ root CA's key intermediateCert :: - HasCallStack => + (HasCallStack) => -- | name of the owner of the certificate String -> -- | the public key of the owner @@ -93,7 +93,7 @@ intermediateCert intermediateCaName pubKey rootCaName rootKey = -- | self sign a certificate selfSignedCert :: - HasCallStack => + (HasCallStack) => -- | name of the owner String -> -- | key material of the owner @@ -106,12 +106,12 @@ selfSignedCert ownerName (pubKey, privKey) = ownerName ownerName -signMsgWithPrivateKey :: HasCallStack => RSA.PrivateKey -> ByteString -> ByteString +signMsgWithPrivateKey :: (HasCallStack) => RSA.PrivateKey -> ByteString -> ByteString signMsgWithPrivateKey privKey = fromRight (error "signing unsuccessful") . PKCS15.sign Nothing (Just SHA256) privKey -- | create a signed certificate mkSignedCert :: - HasCallStack => + (HasCallStack) => -- | public key of the *owner* RSA.PublicKey -> -- | private key of *signatory* @@ -127,8 +127,8 @@ mkSignedCert pubKey privKey caName ownerName = [ (getObjectID DnCommonName, fromString $ name), (getObjectID DnCountry, fromString "DE") ] - in fst $ - objectToSignedExact + in fst + $ objectToSignedExact (\msg -> (signMsgWithPrivateKey privKey msg, SignatureALG HashSHA256 PubKeyALG_RSA, ())) Certificate { certVersion = 3, diff --git a/integration/test/Testlib/HTTP.hs b/integration/test/Testlib/HTTP.hs index 712c99a17ca..d155a45c46f 100644 --- a/integration/test/Testlib/HTTP.hs +++ b/integration/test/Testlib/HTTP.hs @@ -37,7 +37,7 @@ joinHttpPath = intercalate "/" addJSONObject :: [Aeson.Pair] -> HTTP.Request -> HTTP.Request addJSONObject = addJSON . Aeson.object -addJSON :: Aeson.ToJSON a => a -> HTTP.Request -> HTTP.Request +addJSON :: (Aeson.ToJSON a) => a -> HTTP.Request -> HTTP.Request addJSON obj = addBody (HTTP.RequestBodyLBS (Aeson.encode obj)) "application/json" addBody :: HTTP.RequestBody -> String -> HTTP.Request -> HTTP.Request @@ -83,41 +83,41 @@ contentTypeJSON = addHeader "Content-Type" "application/json" contentTypeMixed :: HTTP.Request -> HTTP.Request contentTypeMixed = addHeader "Content-Type" "multipart/mixed" -bindResponse :: HasCallStack => App Response -> (Response -> App a) -> App a +bindResponse :: (HasCallStack) => App Response -> (Response -> App a) -> App a bindResponse m k = m >>= \r -> withResponse r k infixl 1 `bindResponse` -withResponse :: HasCallStack => Response -> (Response -> App a) -> App a +withResponse :: (HasCallStack) => Response -> (Response -> App a) -> App a withResponse r k = onFailureAddResponse r (k r) -- | Check response status code, then return body. -getBody :: HasCallStack => Int -> Response -> App ByteString +getBody :: (HasCallStack) => Int -> Response -> App ByteString getBody status = flip withResponse \resp -> do resp.status `shouldMatch` status pure resp.body -- | Check response status code, then return JSON body. -getJSON :: HasCallStack => Int -> Response -> App Aeson.Value +getJSON :: (HasCallStack) => Int -> Response -> App Aeson.Value getJSON status = flip withResponse \resp -> do resp.status `shouldMatch` status resp.json -- | assert a response code in the 2** range -assertSuccess :: HasCallStack => Response -> App () +assertSuccess :: (HasCallStack) => Response -> App () assertSuccess = flip withResponse \resp -> resp.status `shouldMatchRange` (200, 299) -- | assert a response status code -assertStatus :: HasCallStack => Int -> Response -> App () +assertStatus :: (HasCallStack) => Int -> Response -> App () assertStatus status = flip withResponse \resp -> resp.status `shouldMatchInt` status -- | assert a failure with some failure code and label -assertLabel :: HasCallStack => Int -> String -> Response -> App () +assertLabel :: (HasCallStack) => Int -> String -> Response -> App () assertLabel status label resp = do j <- getJSON status resp j %. "label" `shouldMatch` label -onFailureAddResponse :: HasCallStack => Response -> App a -> App a +onFailureAddResponse :: (HasCallStack) => Response -> App a -> App a onFailureAddResponse r m = App $ do e <- ask liftIO $ E.catch (runAppWithEnv e m) $ \(AssertionFailure stack _ msg) -> do diff --git a/integration/test/Testlib/JSON.hs b/integration/test/Testlib/JSON.hs index 62eda62cba2..a62065ed5f4 100644 --- a/integration/test/Testlib/JSON.hs +++ b/integration/test/Testlib/JSON.hs @@ -54,42 +54,42 @@ import Prelude -- 2. has no "user" field -- 3. the nested update fails class MakesValue a where - make :: HasCallStack => a -> App Value + make :: (HasCallStack) => a -> App Value -instance {-# OVERLAPPABLE #-} ToJSON a => MakesValue a where +instance {-# OVERLAPPABLE #-} (ToJSON a) => MakesValue a where make = pure . toJSON -instance {-# OVERLAPPING #-} ToJSON a => MakesValue (App a) where +instance {-# OVERLAPPING #-} (ToJSON a) => MakesValue (App a) where make m = m <&> toJSON -- use this to provide Nothing for MakesValue a => (Maybe a) values. noValue :: Maybe Value noValue = Nothing -(.=) :: ToJSON a => String -> a -> Aeson.Pair +(.=) :: (ToJSON a) => String -> a -> Aeson.Pair (.=) k v = fromString k Aeson..= v -(.=?) :: ToJSON a => String -> Maybe a -> Maybe Aeson.Pair +(.=?) :: (ToJSON a) => String -> Maybe a -> Maybe Aeson.Pair (.=?) k v = (Aeson..=) (fromString k) <$> v -- | Convert JSON null to Nothing. -asOptional :: HasCallStack => MakesValue a => a -> App (Maybe Value) +asOptional :: (HasCallStack) => (MakesValue a) => a -> App (Maybe Value) asOptional x = do v <- make x pure $ case v of Null -> Nothing _ -> Just v -asString :: HasCallStack => MakesValue a => a -> App String +asString :: (HasCallStack) => (MakesValue a) => a -> App String asString x = make x >>= \case (String s) -> pure (T.unpack s) v -> assertFailureWithJSON x ("String" `typeWasExpectedButGot` v) -asText :: HasCallStack => MakesValue a => a -> App T.Text +asText :: (HasCallStack) => (MakesValue a) => a -> App T.Text asText = (fmap T.pack) . asString -asStringM :: HasCallStack => MakesValue a => a -> App (Maybe String) +asStringM :: (HasCallStack) => (MakesValue a) => a -> App (Maybe String) asStringM x = make x >>= \case (String s) -> pure (Just (T.unpack s)) @@ -103,16 +103,16 @@ asByteString x = do Left _ -> assertFailure "Could not base64 decode" Right a -> pure a -asObject :: HasCallStack => MakesValue a => a -> App Object +asObject :: (HasCallStack) => (MakesValue a) => a -> App Object asObject x = make x >>= \case (Object o) -> pure o v -> assertFailureWithJSON x ("Object" `typeWasExpectedButGot` v) -asInt :: HasCallStack => MakesValue a => a -> App Int +asInt :: (HasCallStack) => (MakesValue a) => a -> App Int asInt = asIntegral -asIntegral :: (Integral i, HasCallStack) => MakesValue a => a -> App i +asIntegral :: (Integral i, HasCallStack) => (MakesValue a) => a -> App i asIntegral x = make x >>= \case (Number n) -> @@ -121,23 +121,23 @@ asIntegral x = Right i -> pure i v -> assertFailureWithJSON x ("Number" `typeWasExpectedButGot` v) -asList :: HasCallStack => MakesValue a => a -> App [Value] +asList :: (HasCallStack) => (MakesValue a) => a -> App [Value] asList x = make x >>= \case (Array arr) -> pure (toList arr) v -> assertFailureWithJSON x ("Array" `typeWasExpectedButGot` v) -asListOf :: HasCallStack => (Value -> App b) -> MakesValue a => a -> App [b] +asListOf :: (HasCallStack) => (Value -> App b) -> (MakesValue a) => a -> App [b] asListOf makeElem x = asList x >>= mapM makeElem -asSet :: HasCallStack => MakesValue a => a -> App (Set.Set Value) +asSet :: (HasCallStack) => (MakesValue a) => a -> App (Set.Set Value) asSet = fmap Set.fromList . asList -asSetOf :: (HasCallStack, Ord b) => (Value -> App b) -> MakesValue a => a -> App (Set.Set b) +asSetOf :: (HasCallStack, Ord b) => (Value -> App b) -> (MakesValue a) => a -> App (Set.Set b) asSetOf makeElem x = Set.fromList <$> asListOf makeElem x -asBool :: HasCallStack => MakesValue a => a -> App Bool +asBool :: (HasCallStack) => (MakesValue a) => a -> App Bool asBool x = make x >>= \case (Bool b) -> pure b @@ -301,20 +301,20 @@ removeField selector x = do ob <- asObject v pure $ Object $ KM.insert (KM.fromString k) newValue ob -assertFailureWithJSON :: HasCallStack => MakesValue a => a -> String -> App b +assertFailureWithJSON :: (HasCallStack) => (MakesValue a) => a -> String -> App b assertFailureWithJSON v msg = do msg' <- ((msg <> "\n") <>) <$> prettyJSON v assertFailure msg' -- | Useful for debugging -printJSON :: MakesValue a => a -> App () +printJSON :: (MakesValue a) => a -> App () printJSON = prettyJSON >=> liftIO . putStrLn -- | useful for debugging, same as 'printJSON' but returns input JSON -traceJSON :: MakesValue a => a -> App a +traceJSON :: (MakesValue a) => a -> App a traceJSON a = printJSON a $> a -prettyJSON :: MakesValue a => a -> App String +prettyJSON :: (MakesValue a) => a -> App String prettyJSON x = make x <&> LC8.unpack . Aeson.encodePretty @@ -330,7 +330,7 @@ typeWasExpectedButGot :: String -> Value -> String typeWasExpectedButGot expectedType x = "Expected " <> expectedType <> " but got " <> jsonType x <> ":" -- Get "id" field or - if already string-like return String -objId :: HasCallStack => MakesValue a => a -> App String +objId :: (HasCallStack) => (MakesValue a) => a -> App String objId x = do v <- make x case v of @@ -339,7 +339,7 @@ objId x = do other -> assertFailureWithJSON other (typeWasExpectedButGot "Object or String" other) -- Get "qualified_id" field as (domain, id) or - if already is a qualified id object - return that -objQid :: HasCallStack => MakesValue a => a -> App (String, String) +objQid :: (HasCallStack) => (MakesValue a) => a -> App (String, String) objQid ob = do m <- firstSuccess [select ob, inField] case m of @@ -360,7 +360,7 @@ objQid ob = do Nothing -> pure Nothing Just x -> select x - firstSuccess :: Monad m => [m (Maybe a)] -> m (Maybe a) + firstSuccess :: (Monad m) => [m (Maybe a)] -> m (Maybe a) firstSuccess [] = pure Nothing firstSuccess (x : xs) = x >>= \case @@ -368,7 +368,7 @@ objQid ob = do Just y -> pure (Just y) -- | Get "qualified_id" field as {"id": _, "domain": _} object or - if already is a qualified id object - return that. -objQidObject :: HasCallStack => MakesValue a => a -> App Value +objQidObject :: (HasCallStack) => (MakesValue a) => a -> App Value objQidObject o = do (domain, id_) <- objQid o pure $ object ["domain" .= domain, "id" .= id_] diff --git a/integration/test/Testlib/Mock.hs b/integration/test/Testlib/Mock.hs index 9e957ccd702..6fd346c50cb 100644 --- a/integration/test/Testlib/Mock.hs +++ b/integration/test/Testlib/Mock.hs @@ -47,8 +47,8 @@ startMockServer config app = do let closeSocket sock = catch (Socket.close sock) (\(_ :: SomeException) -> pure ()) (port, sock) <- Codensity $ \k -> do action <- appToIOKleisli k - liftIO $ - bracket + liftIO + $ bracket ( case config.port of Nothing -> bindRandomPortTCP (fromString "*6") Just n -> (n,) <$> bindPortTCP n (fromString "*6") diff --git a/integration/test/Testlib/MockIntegrationService.hs b/integration/test/Testlib/MockIntegrationService.hs index 36ab35612dd..95dccb2fff7 100644 --- a/integration/test/Testlib/MockIntegrationService.hs +++ b/integration/test/Testlib/MockIntegrationService.hs @@ -32,7 +32,7 @@ import UnliftIO.Timeout (timeout) withFreePortAnyAddr :: (MonadMask m, MonadIO m) => ((Warp.Port, Socket) -> m a) -> m a withFreePortAnyAddr = bracket openFreePortAnyAddr (liftIO . Socket.close . snd) -openFreePortAnyAddr :: MonadIO m => m (Warp.Port, Socket) +openFreePortAnyAddr :: (MonadIO m) => m (Warp.Port, Socket) openFreePortAnyAddr = liftIO $ bindRandomPortTCP (fromString "*6") type LiftedApplication = Request -> (Wai.Response -> App ResponseReceived) -> App ResponseReceived @@ -119,10 +119,12 @@ lhMockAppWithPrekeys mks ch req cont = withRunInIO \inIO -> do where initiateResp :: Value -> [Value] -> Wai.Response initiateResp npk pks = - responseLBS status200 [(hContentType, cs "application/json")] . encode . Data.Aeson.object $ - [ "prekeys" .= pks, - "last_prekey" .= npk - ] + responseLBS status200 [(hContentType, cs "application/json")] + . encode + . Data.Aeson.object + $ [ "prekeys" .= pks, + "last_prekey" .= npk + ] respondOk :: Wai.Response respondOk = responseLBS status200 mempty mempty diff --git a/integration/test/Testlib/ModService.hs b/integration/test/Testlib/ModService.hs index f4390d7286f..061acca529e 100644 --- a/integration/test/Testlib/ModService.hs +++ b/integration/test/Testlib/ModService.hs @@ -46,7 +46,7 @@ import Testlib.Types import Text.RawString.QQ import Prelude -withModifiedBackend :: HasCallStack => ServiceOverrides -> (HasCallStack => String -> App a) -> App a +withModifiedBackend :: (HasCallStack) => ServiceOverrides -> ((HasCallStack) => String -> App a) -> App a withModifiedBackend overrides k = startDynamicBackends [overrides] (\domains -> k (head domains)) @@ -64,8 +64,8 @@ copyDirectoryRecursively from to = do -- | Concurrent traverse in the 'Codensity App' monad. traverseConcurrentlyCodensity :: - (HasCallStack => a -> Codensity App ()) -> - (HasCallStack => [a] -> Codensity App ()) + ((HasCallStack) => a -> Codensity App ()) -> + ((HasCallStack) => [a] -> Codensity App ()) traverseConcurrentlyCodensity f args = do -- Create variables for synchronisation of the various threads: -- * @result@ is used to store a possible exception @@ -242,7 +242,7 @@ updateServiceMapInConfig resource forSrv config = [(srv, berInternalServicePorts resource srv :: Int) | srv <- allServices] startBackend :: - HasCallStack => + (HasCallStack) => BackendResource -> ServiceOverrides -> Codensity App () @@ -382,7 +382,7 @@ logToConsole colorize prefix hdl = do `E.catch` (\(_ :: E.IOException) -> pure ()) go -retryRequestUntil :: HasCallStack => App Bool -> String -> App () +retryRequestUntil :: (HasCallStack) => App Bool -> String -> App () retryRequestUntil reqAction err = do isUp <- retrying diff --git a/integration/test/Testlib/One2One.hs b/integration/test/Testlib/One2One.hs index 0ef4ab6ff56..41cacb4949c 100644 --- a/integration/test/Testlib/One2One.hs +++ b/integration/test/Testlib/One2One.hs @@ -43,10 +43,10 @@ generateRemoteAndConvIdWithDomain remoteDomain shouldBeLocal lUserId = do isLocal = localDomain == cDomain if shouldBeLocal == isLocal then - pure $ - ( object ["id" .= (otherUsr), "domain" .= otherDomain], - object ["id" .= (UUID.toString cId), "domain" .= cDomain] - ) + pure + $ ( object ["id" .= (otherUsr), "domain" .= otherDomain], + object ["id" .= (UUID.toString cId), "domain" .= cDomain] + ) else generateRemoteAndConvIdWithDomain remoteDomain shouldBeLocal lUserId one2OneConvId :: (UUID, String) -> (UUID, String) -> (UUID, String) @@ -86,8 +86,8 @@ newtype UuidV5 = UuidV5 {toUuidV5 :: UUID} deriving (Eq, Ord, Show) mkV5 :: UUID -> UuidV5 -mkV5 u = UuidV5 $ - case toWords u of +mkV5 u = UuidV5 + $ case toWords u of (x0, x1, x2, x3) -> fromWords x0 diff --git a/integration/test/Testlib/Ports.hs b/integration/test/Testlib/Ports.hs index 4ca16d06910..29367b64dd8 100644 --- a/integration/test/Testlib/Ports.hs +++ b/integration/test/Testlib/Ports.hs @@ -9,7 +9,7 @@ data PortNamespace | FederatorExternal | ServiceInternal Service -port :: Num a => PortNamespace -> BackendName -> a +port :: (Num a) => PortNamespace -> BackendName -> a port NginzSSL bn = mkPort 8443 bn port NginzHttp2 bn = mkPort 8099 bn port FederatorExternal bn = mkPort 8098 bn @@ -24,10 +24,10 @@ port (ServiceInternal Nginz) bn = mkPort 8080 bn port (ServiceInternal Spar) bn = mkPort 8088 bn port (ServiceInternal Stern) bn = mkPort 8091 bn -portForDyn :: Num a => PortNamespace -> Int -> a +portForDyn :: (Num a) => PortNamespace -> Int -> a portForDyn ns i = port ns (DynamicBackend i) -mkPort :: Num a => Int -> BackendName -> a +mkPort :: (Num a) => Int -> BackendName -> a mkPort basePort bn = let i = case bn of BackendA -> 0 @@ -35,5 +35,5 @@ mkPort basePort bn = (DynamicBackend k) -> 1 + k in fromIntegral basePort + (fromIntegral i) * 1000 -internalServicePorts :: Num a => BackendName -> Service -> a +internalServicePorts :: (Num a) => BackendName -> Service -> a internalServicePorts backend service = port (ServiceInternal service) backend diff --git a/integration/test/Testlib/Prelude.hs b/integration/test/Testlib/Prelude.hs index 4f29605a227..69c3797f54d 100644 --- a/integration/test/Testlib/Prelude.hs +++ b/integration/test/Testlib/Prelude.hs @@ -174,37 +174,37 @@ import qualified Prelude as P ---------------------------------------------------------------------------- -- Lifted functions from Prelude -putChar :: MonadIO m => Char -> m () +putChar :: (MonadIO m) => Char -> m () putChar = liftIO . P.putChar -putStr :: MonadIO m => String -> m () +putStr :: (MonadIO m) => String -> m () putStr = liftIO . P.putStr -putStrLn :: MonadIO m => String -> m () +putStrLn :: (MonadIO m) => String -> m () putStrLn = liftIO . P.putStrLn print :: (Show a, MonadIO m) => a -> m () print = liftIO . P.print -getChar :: MonadIO m => m Char +getChar :: (MonadIO m) => m Char getChar = liftIO P.getChar -getLine :: MonadIO m => m String +getLine :: (MonadIO m) => m String getLine = liftIO P.getLine -getContents :: MonadIO m => m String +getContents :: (MonadIO m) => m String getContents = liftIO P.getContents -interact :: MonadIO m => (String -> String) -> m () +interact :: (MonadIO m) => (String -> String) -> m () interact = liftIO . P.interact -readFile :: MonadIO m => FilePath -> m String +readFile :: (MonadIO m) => FilePath -> m String readFile = liftIO . P.readFile -writeFile :: MonadIO m => FilePath -> String -> m () +writeFile :: (MonadIO m) => FilePath -> String -> m () writeFile = fmap liftIO . P.writeFile -appendFile :: MonadIO m => FilePath -> String -> m () +appendFile :: (MonadIO m) => FilePath -> String -> m () appendFile = fmap liftIO . P.appendFile readIO :: (Read a, MonadIO m) => String -> m a diff --git a/integration/test/Testlib/RunServices.hs b/integration/test/Testlib/RunServices.hs index aca7867aff3..e5c5c7611ce 100644 --- a/integration/test/Testlib/RunServices.hs +++ b/integration/test/Testlib/RunServices.hs @@ -53,8 +53,9 @@ main = do exitWith =<< waitForProcess ph runCodensity (createGlobalEnv cfg >>= mkEnv) $ \env -> - runAppWithEnv env $ - lowerCodensity $ do + runAppWithEnv env + $ lowerCodensity + $ do _modifyEnv <- traverseConcurrentlyCodensity (\r -> startDynamicBackend r mempty) diff --git a/libs/bilge/src/Bilge/Assert.hs b/libs/bilge/src/Bilge/Assert.hs index 622c945887c..b169e45621c 100644 --- a/libs/bilge/src/Bilge/Assert.hs +++ b/libs/bilge/src/Bilge/Assert.hs @@ -57,10 +57,10 @@ instance Contains ByteString where instance Contains Lazy.ByteString where contains a b = contains (Lazy.toStrict a) (Lazy.toStrict b) -instance Eq a => Contains [a] where +instance (Eq a) => Contains [a] where contains = isInfixOf -instance Contains a => Contains (Maybe a) where +instance (Contains a) => Contains (Maybe a) where contains (Just a) (Just b) = contains a b contains Nothing _ = True contains _ Nothing = False @@ -87,11 +87,12 @@ io String @@ -145,25 +146,25 @@ f =~= g = Assertions $ tell [\r -> test " not in " contains (f r) (g r)] -- | Most generic assertion on a request. If the test function evaluates to -- @(Just msg)@ then the assertion fails with the error message @msg@. -assertResponse :: HasCallStack => (Response (Maybe Lazy.ByteString) -> Maybe String) -> Assertions () +assertResponse :: (HasCallStack) => (Response (Maybe Lazy.ByteString) -> Maybe String) -> Assertions () assertResponse f = Assertions $ tell [f] -- | Generic assertion on a request. The 'String' argument will be printed -- in case the assertion fails. -assertTrue :: HasCallStack => String -> (Response (Maybe Lazy.ByteString) -> Bool) -> Assertions () +assertTrue :: (HasCallStack) => String -> (Response (Maybe Lazy.ByteString) -> Bool) -> Assertions () assertTrue e f = Assertions $ tell [\r -> if f r then Nothing else Just e] -- | Generic assertion on a request. -assertTrue_ :: HasCallStack => (Response (Maybe Lazy.ByteString) -> Bool) -> Assertions () +assertTrue_ :: (HasCallStack) => (Response (Maybe Lazy.ByteString) -> Bool) -> Assertions () assertTrue_ = assertTrue "false" -- | Generic assertion inside the 'Assertions' monad. The 'String' argument -- will be printed in case the assertion fails. -assert :: HasCallStack => String -> Bool -> Assertions () +assert :: (HasCallStack) => String -> Bool -> Assertions () assert m = assertTrue m . const -- | Generic assertion inside the 'Assertions' monad. -assert_ :: HasCallStack => Bool -> Assertions () +assert_ :: (HasCallStack) => Bool -> Assertions () assert_ = assertTrue_ . const -- Internal diff --git a/libs/bilge/src/Bilge/IO.hs b/libs/bilge/src/Bilge/IO.hs index f1fa331ea05..193c7e65b1b 100644 --- a/libs/bilge/src/Bilge/IO.hs +++ b/libs/bilge/src/Bilge/IO.hs @@ -113,10 +113,10 @@ class MonadHttp m where handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> m a {-# MINIMAL handleRequestWithCont #-} -handleRequest :: MonadHttp m => Request -> m (Response (Maybe LByteString)) +handleRequest :: (MonadHttp m) => Request -> m (Response (Maybe LByteString)) handleRequest req = handleRequestWithCont req consumeBody -instance MonadIO m => MonadHttp (HttpT m) where +instance (MonadIO m) => MonadHttp (HttpT m) where handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> HttpT m a handleRequestWithCont req h = do m <- ask @@ -138,7 +138,7 @@ trivialBodyReader bodyBytes = do instance MonadHttp WaiTest.Session where handleRequestWithCont req cont = unSessionT $ handleRequestWithCont req cont -instance MonadIO m => MonadHttp (SessionT m) where +instance (MonadIO m) => MonadHttp (SessionT m) where handleRequestWithCont req cont = do reqBody <- liftIO $ getHttpClientRequestBody (Client.requestBody req) -- `srequest` sets the requestBody for us @@ -151,8 +151,8 @@ instance MonadIO m => MonadHttp (SessionT m) where where wRequest :: Wai.Request wRequest = - flip WaiTest.setPath (Client.path req <> Client.queryString req) $ - Wai.defaultRequest + flip WaiTest.setPath (Client.path req <> Client.queryString req) + $ Wai.defaultRequest { Wai.requestMethod = Client.method req, Wai.httpVersion = Client.requestVersion req, Wai.requestHeaders = Client.requestHeaders req, @@ -180,7 +180,7 @@ instance MonadIO m => MonadHttp (SessionT m) where -- | Does not support all constructors, but so far we only use 'RequestBodyLBS'. -- The other ones are slightly less straight-forward, so we can implement them later if needed. -getHttpClientRequestBody :: HasCallStack => Client.RequestBody -> IO LByteString +getHttpClientRequestBody :: (HasCallStack) => Client.RequestBody -> IO LByteString getHttpClientRequestBody = \case Client.RequestBodyLBS lbs -> pure lbs Client.RequestBodyBS bs -> pure (LBS.fromStrict bs) @@ -207,7 +207,7 @@ instance MonadBaseControl IO (HttpT IO) where liftBaseWith = defaultLiftBaseWith restoreM = defaultRestoreM -instance MonadUnliftIO m => MonadUnliftIO (HttpT m) where +instance (MonadUnliftIO m) => MonadUnliftIO (HttpT m) where withRunInIO inner = HttpT . ReaderT $ \r -> withRunInIO $ \run -> @@ -227,7 +227,7 @@ get, options, trace, patch :: - MonadHttp m => + (MonadHttp m) => (Request -> Request) -> m (Response (Maybe LByteString)) get f = httpLbs empty (method GET . f) @@ -247,7 +247,7 @@ get', options', trace', patch' :: - MonadHttp m => + (MonadHttp m) => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) @@ -261,14 +261,14 @@ trace' r f = httpLbs r (method TRACE . f) patch' r f = httpLbs r (method PATCH . f) httpLbs :: - MonadHttp m => + (MonadHttp m) => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) httpLbs r f = http r f consumeBody http :: - MonadHttp m => + (MonadHttp m) => Request -> (Request -> Request) -> (Response BodyReader -> IO a) -> @@ -288,8 +288,9 @@ httpDebug debug r f h = do then putStrLn (showRequest rq) else putStrLn (showRequest (rq {requestBody = RequestBodyLBS ""})) putStrLn "-" - handleRequestWithCont rq $ - consumeBody >=> \rsp -> do + handleRequestWithCont rq + $ consumeBody + >=> \rsp -> do if debug > Head then putStrLn (showResponse rsp) else putStrLn (showResponse $ rsp {responseBody = "" :: String}) diff --git a/libs/bilge/src/Bilge/RPC.hs b/libs/bilge/src/Bilge/RPC.hs index 386ba6b0279..a1d96f5e620 100644 --- a/libs/bilge/src/Bilge/RPC.hs +++ b/libs/bilge/src/Bilge/RPC.hs @@ -45,7 +45,7 @@ import System.Logger.Class class HasRequestId m where getRequestId :: m RequestId -instance Monad m => HasRequestId (ReaderT RequestId m) where +instance (Monad m) => HasRequestId (ReaderT RequestId m) where getRequestId = ask data RPCException = RPCException @@ -111,9 +111,9 @@ statusCheck :: Response (Maybe LByteString) -> m () statusCheck c f r = - unless (statusCode r == c) $ - throwError $ - f ("unexpected status code: " <> pack (show $ statusCode r)) + unless (statusCode r == c) + $ throwError + $ f ("unexpected status code: " <> pack (show $ statusCode r)) parseResponse :: (Exception e, MonadThrow m, FromJSON a) => diff --git a/libs/bilge/src/Bilge/Request.hs b/libs/bilge/src/Bilge/Request.hs index 1acd96aa03e..ed4facd59ca 100644 --- a/libs/bilge/src/Bilge/Request.hs +++ b/libs/bilge/src/Bilge/Request.hs @@ -199,7 +199,7 @@ lbytes = body . RequestBodyLBS -- bytestring produced by JSON will get computed and stored as it is in memory -- in order to compute the @Content-Length@ header. For making a request with -- big JSON objects, please use @lbytesRefChunked@ -json :: ToJSON a => a -> Request -> Request +json :: (ToJSON a) => a -> Request -> Request json a = contentJson . lbytes (encode a) -- | Like @lbytesChunkedIO@ but for sending a JSON body @@ -227,7 +227,7 @@ jsonChunkedIO a = do -- This is because the closure for @lbytesPopper@ keeps the reference to @bs@ -- alive. To avoid this, this function allocates an @IORef@ and passes that to -- @lbytesRefChunked@. -lbytesChunkedIO :: MonadIO m => Lazy.ByteString -> m (Request -> Request) +lbytesChunkedIO :: (MonadIO m) => Lazy.ByteString -> m (Request -> Request) lbytesChunkedIO bs = do chunksRef <- newIORef $ Lazy.toChunks bs pure $ lbytesRefChunked chunksRef diff --git a/libs/bilge/src/Bilge/Response.hs b/libs/bilge/src/Bilge/Response.hs index a4e422094ae..f4e4f3d07d5 100644 --- a/libs/bilge/src/Bilge/Response.hs +++ b/libs/bilge/src/Bilge/Response.hs @@ -142,12 +142,13 @@ responseJsonUnsafeWithMsg :: responseJsonUnsafeWithMsg userErr = either err id . responseJsonEither where err parserErr = - error . unwords $ - ["responseJsonUnsafeWithMsg:"] - <> [userErr | not $ null userErr] - <> [parserErr] + error + . unwords + $ ["responseJsonUnsafeWithMsg:"] + <> [userErr | not $ null userErr] + <> [parserErr] -showResponse :: Show a => Response a -> String +showResponse :: (Show a) => Response a -> String showResponse r = showString "HTTP/" . shows (httpMajor . responseVersion $ r) diff --git a/libs/bilge/src/Bilge/Retry.hs b/libs/bilge/src/Bilge/Retry.hs index 01f2dc7ab01..055a1ff5219 100644 --- a/libs/bilge/src/Bilge/Retry.hs +++ b/libs/bilge/src/Bilge/Retry.hs @@ -25,10 +25,10 @@ import Imports import Network.HTTP.Client (HttpException (..), HttpExceptionContent (..), responseStatus) import Network.HTTP.Types -httpHandlers :: Monad m => [a -> Handler m Bool] +httpHandlers :: (Monad m) => [a -> Handler m Bool] httpHandlers = [const . Handler $ pure . canRetry] -rpcHandlers :: Monad m => [a -> Handler m Bool] +rpcHandlers :: (Monad m) => [a -> Handler m Bool] rpcHandlers = [ const . Handler $ \(RPCException _ _ cause) -> pure $ maybe False canRetry (fromException cause) diff --git a/libs/bilge/src/Bilge/TestSession.hs b/libs/bilge/src/Bilge/TestSession.hs index b9c8223986e..246b7a17bcb 100644 --- a/libs/bilge/src/Bilge/TestSession.hs +++ b/libs/bilge/src/Bilge/TestSession.hs @@ -33,7 +33,7 @@ newtype SessionT m a = SessionT {unSessionT :: ReaderT Wai.Application (StateT W instance MonadTrans SessionT where lift = SessionT . lift . lift -liftSession :: MonadIO m => WaiTest.Session a -> SessionT m a +liftSession :: (MonadIO m) => WaiTest.Session a -> SessionT m a liftSession session = SessionT $ do app <- ask clientState <- lift ST.get @@ -41,5 +41,5 @@ liftSession session = SessionT $ do let resultInIO = ST.evalStateT resultInState clientState liftIO resultInIO -runSessionT :: Monad m => SessionT m a -> Wai.Application -> m a +runSessionT :: (Monad m) => SessionT m a -> Wai.Application -> m a runSessionT session app = ST.evalStateT (runReaderT (unSessionT session) app) WaiTest.initState diff --git a/libs/brig-types/src/Brig/Types/Instances.hs b/libs/brig-types/src/Brig/Types/Instances.hs index 347be2c0192..ca5fb8f6aa0 100644 --- a/libs/brig-types/src/Brig/Types/Instances.hs +++ b/libs/brig-types/src/Brig/Types/Instances.hs @@ -74,7 +74,7 @@ instance Cql ServiceKey where 0 -> pure $! ServiceKey RsaServiceKey s p _ -> Left $ "Unexpected service key type: " ++ show t where - required :: Cql r => Text -> Either String r + required :: (Cql r) => Text -> Either String r required f = maybe (Left ("ServiceKey: Missing required field '" ++ show f ++ "'")) diff --git a/libs/brig-types/src/Brig/Types/Search.hs b/libs/brig-types/src/Brig/Types/Search.hs index 2bf55eb1ea8..3e92bfe9156 100644 --- a/libs/brig-types/src/Brig/Types/Search.hs +++ b/libs/brig-types/src/Brig/Types/Search.hs @@ -75,8 +75,10 @@ instance ToByteString SearchVisibilityInbound where instance FromByteString SearchVisibilityInbound where parser = - SearchableByOwnTeam <$ string "searchable-by-own-team" - <|> SearchableByAllTeams <$ string "searchable-by-all-teams" + SearchableByOwnTeam + <$ string "searchable-by-own-team" + <|> SearchableByAllTeams + <$ string "searchable-by-all-teams" instance C.Cql SearchVisibilityInbound where ctype = C.Tagged C.IntColumn diff --git a/libs/brig-types/src/Brig/Types/User/Auth.hs b/libs/brig-types/src/Brig/Types/User/Auth.hs index d6426a1483d..378f49f53bd 100644 --- a/libs/brig-types/src/Brig/Types/User/Auth.hs +++ b/libs/brig-types/src/Brig/Types/User/Auth.hs @@ -51,11 +51,11 @@ instance FromJSON LegalHoldLogin where parseJSON = withObject "LegalHoldLogin" $ \o -> LegalHoldLogin <$> o - .: "user" + .: "user" <*> o - .:? "password" + .:? "password" <*> o - .:? "label" + .:? "label" instance ToJSON LegalHoldLogin where toJSON (LegalHoldLogin uid password label) = diff --git a/libs/brig-types/test/unit/Main.hs b/libs/brig-types/test/unit/Main.hs index a3c1b63c0bd..caec8ee578c 100644 --- a/libs/brig-types/test/unit/Main.hs +++ b/libs/brig-types/test/unit/Main.hs @@ -28,8 +28,8 @@ import Test.Tasty main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Test.Brig.Types.Common.tests, Test.Brig.Types.Team.tests, diff --git a/libs/brig-types/test/unit/Test/Brig/Roundtrip.hs b/libs/brig-types/test/unit/Test/Brig/Roundtrip.hs index 13cfc3570e6..394f658e55a 100644 --- a/libs/brig-types/test/unit/Test/Brig/Roundtrip.hs +++ b/libs/brig-types/test/unit/Test/Brig/Roundtrip.hs @@ -35,8 +35,9 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v testRoundTripWithSwagger :: forall a. @@ -47,13 +48,14 @@ testRoundTripWithSwagger = testProperty msg (trip .&&. scm) msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v scm (v :: a) = counterexample - ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" $ - validatePrettyToJSON v + ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" + $ validatePrettyToJSON v ) $ isNothing (validatePrettyToJSON v) @@ -65,5 +67,6 @@ testRoundTripByteString = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toByteString' v) $ - Just v === (fromByteString . toByteString') v + counterexample (show $ toByteString' v) + $ Just v + === (fromByteString . toByteString') v diff --git a/libs/brig-types/test/unit/Test/Brig/Types/User.hs b/libs/brig-types/test/unit/Test/Brig/Types/User.hs index dee80388143..a3b4ce73af9 100644 --- a/libs/brig-types/test/unit/Test/Brig/Types/User.hs +++ b/libs/brig-types/test/unit/Test/Brig/Types/User.hs @@ -52,8 +52,8 @@ roundtripTests = testRoundTrip @UpdateConnectionsInternal, testRoundTrip @SearchVisibilityInbound, testRoundTripWithSwagger @UserAccount, - testGroup "golden tests" $ - [testCaseUserAccount] + testGroup "golden tests" + $ [testCaseUserAccount] ] instance Arbitrary ReAuthUser where diff --git a/libs/cassandra-util/src/Cassandra/Exec.hs b/libs/cassandra-util/src/Cassandra/Exec.hs index 795083fe39d..a01f619675f 100644 --- a/libs/cassandra-util/src/Cassandra/Exec.hs +++ b/libs/cassandra-util/src/Cassandra/Exec.hs @@ -101,10 +101,11 @@ paginateC :: paginateC q p r = go =<< lift (retry r (paginate q p)) where go page = do - unless (null (result page)) $ - yield (result page) - when (hasMore page) $ - go =<< lift (retry r (liftClient (nextPage page))) + unless (null (result page)) + $ yield (result page) + when (hasMore page) + $ go + =<< lift (retry r (liftClient (nextPage page))) data PageWithState a = PageWithState { pwsResults :: [a], diff --git a/libs/cassandra-util/src/Cassandra/MigrateSchema.hs b/libs/cassandra-util/src/Cassandra/MigrateSchema.hs index 33b08258343..bdd48fb2b5e 100644 --- a/libs/cassandra-util/src/Cassandra/MigrateSchema.hs +++ b/libs/cassandra-util/src/Cassandra/MigrateSchema.hs @@ -118,8 +118,8 @@ retryWhileN n f m = migrationPolicy :: IO Policy migrationPolicy = do h <- newIORef Nothing - pure $ - Policy + pure + $ Policy { setup = setHost h, onEvent = const $ pure (), select = readIORef h, diff --git a/libs/cassandra-util/src/Cassandra/Schema.hs b/libs/cassandra-util/src/Cassandra/Schema.hs index 72676858a43..e9374d3b159 100644 --- a/libs/cassandra-util/src/Cassandra/Schema.hs +++ b/libs/cassandra-util/src/Cassandra/Schema.hs @@ -108,42 +108,44 @@ schemaVersion = catch (fmap runIdentity <$> qry) h q = QueryString "select version from meta where id=1 order by version desc limit 1" h :: SomeException -> a h e = - error $ - "Failed to read schema version from meta table. Error was: " - <> show e + error + $ "Failed to read schema version from meta table. Error was: " + <> show e versionCheck :: Int32 -> Client () versionCheck v = do v' <- schemaVersion - unless (Just v <= v') $ - error $ - "Schema Version too old! Expecting at least: " - <> show v - <> ", but got: " - <> maybe "" show v' + unless (Just v <= v') + $ error + $ "Schema Version too old! Expecting at least: " + <> show v + <> ", but got: " + <> maybe "" show v' createKeyspace :: Keyspace -> ReplicationStrategy -> Client () createKeyspace (Keyspace k) rs = void $ schema (cql rs) (params All ()) where cql (SimpleStrategy (ReplicationFactor n)) = - QueryString . toLazyText $ - fromText "create keyspace if not exists " - <> fromText k - <> fromText " with replication = { " - <> fromText " 'class': 'SimpleStrategy' " - <> fromText " , 'replication_factor': '" - <> fromString (show n) - <> "'" - <> fromText "};" + QueryString + . toLazyText + $ fromText "create keyspace if not exists " + <> fromText k + <> fromText " with replication = { " + <> fromText " 'class': 'SimpleStrategy' " + <> fromText " , 'replication_factor': '" + <> fromString (show n) + <> "'" + <> fromText "};" cql (NetworkTopologyStrategy (ReplicationMap dcs)) = - QueryString . toLazyText $ - fromText "create keyspace if not exists " - <> fromText k - <> fromText " with replication = { " - <> fromText " 'class': 'NetworkTopologyStrategy' " - <> fromText " , " - <> fromText (intercalate "," (map pair dcs)) - <> fromText "};" + QueryString + . toLazyText + $ fromText "create keyspace if not exists " + <> fromText k + <> fromText " with replication = { " + <> fromText " 'class': 'NetworkTopologyStrategy' " + <> fromText " , " + <> fromText (intercalate "," (map pair dcs)) + <> fromText "};" pair (dc, ReplicationFactor n) = "'" <> dc <> "': " <> pack (show n) useKeyspace :: Keyspace -> Client () @@ -169,20 +171,23 @@ migrationOptsParser = <> value 9042 <> help "Cassandra port" ) - <*> ( fmap pack . strOption $ - long "keyspace" - <> metavar "STRING" - <> help "Cassandra Keyspace" + <*> ( fmap pack + . strOption + $ long "keyspace" + <> metavar "STRING" + <> help "Cassandra Keyspace" ) - <*> ( ( fmap (SimpleStrategy . ReplicationFactor) . option auto $ - long "replication-factor" - <> metavar "INT" - <> help "Replication Factor" + <*> ( ( fmap (SimpleStrategy . ReplicationFactor) + . option auto + $ long "replication-factor" + <> metavar "INT" + <> help "Replication Factor" ) - <|> ( fmap NetworkTopologyStrategy . option auto $ - long "replication-map" - <> metavar "STRING" - <> help "Replication Map (i.e. \"eu-west:3,us-east:3\")" + <|> ( fmap NetworkTopologyStrategy + . option auto + $ long "replication-map" + <> metavar "STRING" + <> help "Replication Map (i.e. \"eu-west:3,us-east:3\")" ) ) <*> switch diff --git a/libs/cassandra-util/src/Cassandra/Settings.hs b/libs/cassandra-util/src/Cassandra/Settings.hs index f4b4818dd5a..1847d188827 100644 --- a/libs/cassandra-util/src/Cassandra/Settings.hs +++ b/libs/cassandra-util/src/Cassandra/Settings.hs @@ -43,11 +43,11 @@ import System.Logger qualified as Log -- Given a server name and a url returning a wire-custom "disco" json (AWS describe-instances-like json), e.g. -- { "roles" : { "server_name": [ {"privateIpAddress": "...", ...}, {...} ] } }, -- return a list of IP addresses. -initialContactsDisco :: MonadIO m => String -> String -> m (NonEmpty String) +initialContactsDisco :: (MonadIO m) => String -> String -> m (NonEmpty String) initialContactsDisco (pack -> srv) url = liftIO $ do rs <- asValue =<< get url - let srvs = map Key.fromText $ - case stripSuffix "_seed" srv of + let srvs = map Key.fromText + $ case stripSuffix "_seed" srv of Nothing -> [srv, srv <> "_seed"] Just _ -> [srv] -- requesting only seeds is a valid use-case let ip = @@ -65,7 +65,7 @@ initialContactsDisco (pack -> srv) url = liftIO $ do _ -> error "initial-contacts: no IP addresses found." -- | Puts the address into a list using the same signature as the other initialContacts -initialContactsPlain :: MonadIO m => Text -> m (NonEmpty String) +initialContactsPlain :: (MonadIO m) => Text -> m (NonEmpty String) initialContactsPlain address = pure $ unpack address :| [] -- | Use dcAwareRandomPolicy if config option filterNodesByDatacentre is set, @@ -74,9 +74,9 @@ initialContactsPlain address = pure $ unpack address :| [] -- This is only useful during a cassandra datacentre migration. dcFilterPolicyIfConfigured :: Log.Logger -> Maybe Text -> IO Policy dcFilterPolicyIfConfigured lgr mDatacentre = do - Log.info lgr $ - Log.msg ("Using the following cassandra load balancing options ('Policy'):" :: Text) - . Log.field "filter_datacentre" (show mDatacentre) + Log.info lgr + $ Log.msg ("Using the following cassandra load balancing options ('Policy'):" :: Text) + . Log.field "filter_datacentre" (show mDatacentre) maybe random dcAwareRandomPolicy mDatacentre -- | Return hosts in random order for a given DC. diff --git a/libs/deriving-swagger2/src/Deriving/Swagger.hs b/libs/deriving-swagger2/src/Deriving/Swagger.hs index 95a0c121a3e..508947a33b5 100644 --- a/libs/deriving-swagger2/src/Deriving/Swagger.hs +++ b/libs/deriving-swagger2/src/Deriving/Swagger.hs @@ -131,13 +131,13 @@ instance (StringModifier a, StringModifier b, StringModifier c, StringModifier d -- | Strips the given prefix, has no effect if the prefix doesn't exist data StripPrefix t -instance KnownSymbol prefix => StringModifier (StripPrefix prefix) where +instance (KnownSymbol prefix) => StringModifier (StripPrefix prefix) where getStringModifier = fromMaybe <*> stripPrefix (symbolVal (Proxy @prefix)) -- | Strips the given suffix, has no effect if the suffix doesn't exist data StripSuffix t -instance KnownSymbol suffix => StringModifier (StripSuffix suffix) where +instance (KnownSymbol suffix) => StringModifier (StripSuffix suffix) where getStringModifier = fromMaybe <*> stripSuffix (symbolVal (Proxy @suffix)) data CamelTo (separator :: Symbol) diff --git a/libs/dns-util/src/Wire/Network/DNS/Effect.hs b/libs/dns-util/src/Wire/Network/DNS/Effect.hs index fa82130f4eb..9910c28ba42 100644 --- a/libs/dns-util/src/Wire/Network/DNS/Effect.hs +++ b/libs/dns-util/src/Wire/Network/DNS/Effect.hs @@ -32,13 +32,13 @@ data DNSLookup m a where makeSem ''DNSLookup -runDNSLookupDefault :: Member (Embed IO) r => Sem (DNSLookup ': r) a -> Sem r a +runDNSLookupDefault :: (Member (Embed IO) r) => Sem (DNSLookup ': r) a -> Sem r a runDNSLookupDefault = interpret $ \action -> embed $ do rs <- DNS.makeResolvSeed DNS.defaultResolvConf DNS.withResolver rs $ flip runLookupIO action -runDNSLookupWithResolver :: Member (Embed IO) r => Resolver -> Sem (DNSLookup ': r) a -> Sem r a +runDNSLookupWithResolver :: (Member (Embed IO) r) => Resolver -> Sem (DNSLookup ': r) a -> Sem r a runDNSLookupWithResolver resolver = interpret $ embed . runLookupIO resolver runLookupIO :: Resolver -> DNSLookup m a -> IO a diff --git a/libs/dns-util/test/Test/Wire/Network/DNS/SRVSpec.hs b/libs/dns-util/test/Test/Wire/Network/DNS/SRVSpec.hs index 297a378740d..e0d3a6d783d 100644 --- a/libs/dns-util/test/Test/Wire/Network/DNS/SRVSpec.hs +++ b/libs/dns-util/test/Test/Wire/Network/DNS/SRVSpec.hs @@ -26,14 +26,17 @@ import Wire.Network.DNS.SRV spec :: Spec spec = do describe "interpretResponse" $ do - it "should interpret error correctly" $ - interpretResponse (Left DNS.UnknownDNSError) `shouldBe` SrvResponseError DNS.UnknownDNSError + it "should interpret error correctly" + $ interpretResponse (Left DNS.UnknownDNSError) + `shouldBe` SrvResponseError DNS.UnknownDNSError - it "should interpret empty response as SrvNotAvailable" $ - interpretResponse (Right []) `shouldBe` SrvNotAvailable + it "should interpret empty response as SrvNotAvailable" + $ interpretResponse (Right []) + `shouldBe` SrvNotAvailable - it "should interpret explicitly not available response as SrvNotAvailable" $ - interpretResponse (Right [(0, 0, 0, ".")]) `shouldBe` SrvNotAvailable + it "should interpret explicitly not available response as SrvNotAvailable" + $ interpretResponse (Right [(0, 0, 0, ".")]) + `shouldBe` SrvNotAvailable it "should interpret an available service correctly" $ do let input = @@ -49,24 +52,26 @@ spec = do describe "orderSrvResult" $ do it "orders records according to ascending priority" $ do actual <- - orderSrvResult . map toSrvEntry $ - [ -- priority, weight, port, domain - (0, 0, 443, "offline.com"), - (15, 10, 443, "main.com"), - (0, 5, 443, "backup.com"), - (2, 10, 443, "main.com"), - (2, 20, 443, "main.com"), - (3, 5, 443, "main.com"), - (0, 0, 443, "backup.com") - ] + orderSrvResult + . map toSrvEntry + $ [ + -- priority, weight, port, domain + (0, 0, 443, "offline.com"), + (15, 10, 443, "main.com"), + (0, 5, 443, "backup.com"), + (2, 10, 443, "main.com"), + (2, 20, 443, "main.com"), + (3, 5, 443, "main.com"), + (0, 0, 443, "backup.com") + ] (srvPriority <$> actual) `shouldBe` [0, 0, 0, 2, 2, 3, 15] it "orders records with the same priority according to weight with certain probability" $ do let raw = - map toSrvEntry $ - [ (2, 10, 443, "server1.com"), - (2, 20, 443, "server2.com"), - (2, 0, 443, "dontuseoften.com") - ] + map toSrvEntry + $ [ (2, 10, 443, "server1.com"), + (2, 20, 443, "server2.com"), + (2, 0, 443, "dontuseoften.com") + ] -- order the list 50 times actuals <- replicateM 50 (orderSrvResult raw) let weightLists = fmap (fmap srvWeight) actuals diff --git a/libs/extended/src/Network/AMQP/Extended.hs b/libs/extended/src/Network/AMQP/Extended.hs index 502cdb95a77..ea066c55e62 100644 --- a/libs/extended/src/Network/AMQP/Extended.hs +++ b/libs/extended/src/Network/AMQP/Extended.hs @@ -49,8 +49,9 @@ mkRabbitMqAdminClientEnv opts = do manager <- HTTP.newManager HTTP.defaultManagerSettings let basicAuthData = Servant.BasicAuthData (Text.encodeUtf8 username) (Text.encodeUtf8 password) clientEnv = Servant.mkClientEnv manager (Servant.BaseUrl Servant.Http opts.host opts.adminPort "") - pure . fromServant $ - hoistClient + pure + . fromServant + $ hoistClient (Proxy @(ToServant AdminAPI AsApi)) (either throwM pure <=< flip runClientM clientEnv) (toServant $ adminClient basicAuthData) @@ -74,8 +75,9 @@ mkRabbitMqChannelMVar :: Logger -> RabbitMqOpts -> IO (MVar Q.Channel) mkRabbitMqChannelMVar l opts = do chanMVar <- newEmptyMVar connThread <- - async . openConnectionWithRetries l opts $ - RabbitMqHooks + async + . openConnectionWithRetries l opts + $ RabbitMqHooks { onNewChannel = \conn -> putMVar chanMVar conn >> forever (threadDelay maxBound), onChannelException = \_ -> void $ tryTakeMVar chanMVar, onConnectionClose = void $ tryTakeMVar chanMVar @@ -110,11 +112,11 @@ openConnectionWithRetries l RabbitMqOpts {..} hooks = do -- delay. let policy = capDelay 5_000_000 $ fullJitterBackoff 1000 logError willRetry e retryStatus = do - Log.err l $ - Log.msg (Log.val "Failed to connect to RabbitMQ") - . Log.field "error" (displayException @SomeException e) - . Log.field "willRetry" willRetry - . Log.field "retryCount" retryStatus.rsIterNumber + Log.err l + $ Log.msg (Log.val "Failed to connect to RabbitMQ") + . Log.field "error" (displayException @SomeException e) + . Log.field "willRetry" willRetry + . Log.field "retryCount" retryStatus.rsIterNumber getConn = recovering policy @@ -147,20 +149,20 @@ openConnectionWithRetries l RabbitMqOpts {..} hooks = do hooks.onChannelException e `catch` logException l "onChannelException hook threw an exception" case (Q.isNormalChannelClose e, fromException e) of (True, _) -> - Log.info l $ - Log.msg (Log.val "RabbitMQ channel is closed normally, not attempting to reopen channel") + Log.info l + $ Log.msg (Log.val "RabbitMQ channel is closed normally, not attempting to reopen channel") (_, Just (Q.ConnectionClosedException {})) -> - Log.info l $ - Log.msg (Log.val "RabbitMQ connection is closed, not attempting to reopen channel") + Log.info l + $ Log.msg (Log.val "RabbitMQ connection is closed, not attempting to reopen channel") _ -> do logException l "RabbitMQ channel closed" e openChan conn logException :: (MonadIO m) => Logger -> String -> SomeException -> m () logException l m (SomeException e) = do - Log.err l $ - Log.msg m - . Log.field "error" (displayException e) + Log.err l + $ Log.msg m + . Log.field "error" (displayException e) readCredsFromEnv :: IO (Text, Text) readCredsFromEnv = diff --git a/libs/extended/src/Options/Applicative/Extended.hs b/libs/extended/src/Options/Applicative/Extended.hs index 588fa9668b0..3a44fecb188 100644 --- a/libs/extended/src/Options/Applicative/Extended.hs +++ b/libs/extended/src/Options/Applicative/Extended.hs @@ -32,7 +32,7 @@ import Options.Applicative -- | A reader that accepts either @N@ or @N..M@ (not necessarily just -- numbers). -autoRange :: Read a => ReadM (a, a) +autoRange :: (Read a) => ReadM (a, a) autoRange = eitherReader $ \arg -> case stripInfix ".." arg of Nothing -> (\a -> (a, a)) <$> readEither arg Just (l, r) -> case (readEither l, readEither r) of diff --git a/libs/extended/src/Servant/API/Extended.hs b/libs/extended/src/Servant/API/Extended.hs index a531f141bd7..57b4c586193 100644 --- a/libs/extended/src/Servant/API/Extended.hs +++ b/libs/extended/src/Servant/API/Extended.hs @@ -80,8 +80,8 @@ instance hoistServerWithContext _ pc nt s = hoistServerWithContext (Proxy :: Proxy api) pc nt . s route Proxy context subserver = - route (Proxy :: Proxy api) context $ - addBodyCheck subserver ctCheck bodyCheck + route (Proxy :: Proxy api) context + $ addBodyCheck subserver ctCheck bodyCheck where -- Content-Type check, we only lookup we can try to parse the request body ctCheck = withRequest $ \request -> do @@ -90,9 +90,9 @@ instance -- See also "W3C Internet Media Type registration, consistency of use" -- http://www.w3.org/2001/tag/2002/0129-mime let contentTypeH = - fromMaybe "application/octet-stream" $ - lookup hContentType $ - requestHeaders request + fromMaybe "application/octet-stream" + $ lookup hContentType + $ requestHeaders request case canHandleCTypeH (Proxy :: Proxy list) (fromStrict contentTypeH) :: Maybe (BL.ByteString -> Either String a) of Nothing -> delayedFail err415 Just f -> pure f @@ -109,10 +109,10 @@ instance Right v -> pure v instance - HasOpenApi (ReqBody' '[Required, Strict] cts a :> api) => + (HasOpenApi (ReqBody' '[Required, Strict] cts a :> api)) => HasOpenApi (ReqBodyCustomError cts tag a :> api) where toOpenApi Proxy = toOpenApi (Proxy @(ReqBody' '[Required, Strict] cts a :> api)) -instance RoutesToPaths rest => RoutesToPaths (ReqBodyCustomError' mods list tag a :> rest) where +instance (RoutesToPaths rest) => RoutesToPaths (ReqBodyCustomError' mods list tag a :> rest) where getRoutes = getRoutes @rest diff --git a/libs/extended/src/Servant/API/Extended/Endpath.hs b/libs/extended/src/Servant/API/Extended/Endpath.hs index 773230e8509..6e5d5dc40ef 100644 --- a/libs/extended/src/Servant/API/Extended/Endpath.hs +++ b/libs/extended/src/Servant/API/Extended/Endpath.hs @@ -22,5 +22,5 @@ instance (HasServer api context, HasContextEntry (context .++ DefaultErrorFormat hoistServerWithContext _ proxyCtx f s = hoistServerWithContext (Proxy @api) proxyCtx f s -- Endpath :> route -instance RoutesToPaths route => RoutesToPaths (Endpath :> route) where +instance (RoutesToPaths route) => RoutesToPaths (Endpath :> route) where getRoutes = getRoutes @route diff --git a/libs/extended/src/System/Logger/Extended.hs b/libs/extended/src/System/Logger/Extended.hs index 2b45c3f746c..16db69a8119 100644 --- a/libs/extended/src/System/Logger/Extended.hs +++ b/libs/extended/src/System/Logger/Extended.hs @@ -107,8 +107,9 @@ data StructuredJSONOutput = StructuredJSONOutput {lvl :: Maybe Level, msgs :: [T structuredJSONRenderer :: Renderer structuredJSONRenderer _sep _dateFmt _lvlThreshold logElems = let structuredJSON = toStructuredJSONOutput logElems - in fromEncoding . toEncoding $ - object + in fromEncoding + . toEncoding + $ object ( [ "level" Aeson..= lvl structuredJSON, "msgs" Aeson..= msgs structuredJSON ] @@ -164,8 +165,8 @@ netStringsToLogFormat False = Plain -- remove this function and rename 'mkLoggerNew' to 'mkLogger' mkLogger :: Log.Level -> Maybe (Last Bool) -> Maybe (Last LogFormat) -> IO Log.Logger mkLogger lvl useNetstrings logFormat = do - mkLoggerNew lvl $ - maybe + mkLoggerNew lvl + $ maybe Plain getLast ((fmap netStringsToLogFormat <$> useNetstrings) <> logFormat) @@ -210,8 +211,8 @@ canonicalizeWhitespace rndrRaw delim df lvl = B.lazyByteString . nl2sp . B.toLazyByteString . rndrRaw delim df lvl where nl2sp :: L.ByteString -> L.ByteString - nl2sp = L.concatMap $ - \c -> + nl2sp = L.concatMap + $ \c -> if isSpace c then " " else L.singleton c diff --git a/libs/extended/test/Test/System/Logger/ExtendedSpec.hs b/libs/extended/test/Test/System/Logger/ExtendedSpec.hs index 753ba59ada7..055c09f68d4 100644 --- a/libs/extended/test/Test/System/Logger/ExtendedSpec.hs +++ b/libs/extended/test/Test/System/Logger/ExtendedSpec.hs @@ -39,12 +39,12 @@ spec = . setFormat Nothing -- date format, not having it makes it easier to test. $ defSettings - warn l $ - msg ("first message" :: ByteString) - . field "field1" ("val 1.1" :: ByteString) - . field "field2" ("val 2" :: ByteString) - . field "field1" ("val 1.2" :: ByteString) - . msg ("second message" :: ByteString) + warn l + $ msg ("first message" :: ByteString) + . field "field1" ("val 1.1" :: ByteString) + . field "field2" ("val 2" :: ByteString) + . field "field1" ("val 1.2" :: ByteString) + . msg ("second message" :: ByteString) info l $ msg ("just a message" :: ByteString) flush l diff --git a/libs/galley-types/src/Galley/Types/Conversations/One2One.hs b/libs/galley-types/src/Galley/Types/Conversations/One2One.hs index 2101a27a600..4bd74342316 100644 --- a/libs/galley-types/src/Galley/Types/Conversations/One2One.hs +++ b/libs/galley-types/src/Galley/Types/Conversations/One2One.hs @@ -44,7 +44,7 @@ namespace :: BaseProtocolTag -> UUID namespace BaseProtocolProteusTag = UUID.fromWords 0x9a51edb8 0x060c0d9a 0x0c2950a8 0x5d152982 namespace BaseProtocolMLSTag = UUID.fromWords 0x95589dd5 0xb04540dc 0xa6aadd9c 0x4fad1c2f -compareDomains :: Ord a => Qualified a -> Qualified a -> Ordering +compareDomains :: (Ord a) => Qualified a -> Qualified a -> Ordering compareDomains (Qualified a1 dom1) (Qualified a2 dom2) = compare (dom1, a1) (dom2, a2) diff --git a/libs/galley-types/src/Galley/Types/Teams.hs b/libs/galley-types/src/Galley/Types/Teams.hs index 715377e42bb..36442c5019c 100644 --- a/libs/galley-types/src/Galley/Types/Teams.hs +++ b/libs/galley-types/src/Galley/Types/Teams.hs @@ -104,11 +104,11 @@ newtype Defaults a = Defaults {_unDefaults :: a} deriving (Eq, Ord, Show, Enum, Bounded, Generic, Functor) deriving newtype (Arbitrary) -instance FromJSON a => FromJSON (Defaults a) where +instance (FromJSON a) => FromJSON (Defaults a) where parseJSON = withObject "default object" $ \ob -> Defaults <$> (ob .: "defaults") -instance ToJSON a => ToJSON (Defaults a) where +instance (ToJSON a) => ToJSON (Defaults a) where toJSON (Defaults x) = object ["defaults" .= toJSON x] @@ -133,9 +133,12 @@ data FeatureTeamSearchVisibilityAvailability instance FromJSON FeatureFlags where parseJSON = withObject "FeatureFlags" $ \obj -> FeatureFlags - <$> obj .: "sso" - <*> obj .: "legalhold" - <*> obj .: "teamSearchVisibility" + <$> obj + .: "sso" + <*> obj + .: "legalhold" + <*> obj + .: "teamSearchVisibility" <*> withImplicitLockStatusOrDefault obj "appLock" <*> (fromMaybe (ImplicitLockStatus (defFeatureStatus @ClassifiedDomainsConfig)) <$> (obj .:? "classifiedDomains")) <*> (fromMaybe (Defaults (defFeatureStatus @FileSharingConfig)) <$> (obj .:? "fileSharing")) @@ -233,13 +236,14 @@ makeLenses ''Defaults notTeamMember :: [UserId] -> [TeamMember] -> [UserId] notTeamMember uids tmms = - Set.toList $ - Set.fromList uids `Set.difference` Set.fromList (map (view userId) tmms) + Set.toList + $ Set.fromList uids + `Set.difference` Set.fromList (map (view userId) tmms) -isTeamMember :: Foldable m => UserId -> m TeamMember -> Bool +isTeamMember :: (Foldable m) => UserId -> m TeamMember -> Bool isTeamMember u = isJust . findTeamMember u -findTeamMember :: Foldable m => UserId -> m TeamMember -> Maybe TeamMember +findTeamMember :: (Foldable m) => UserId -> m TeamMember -> Maybe TeamMember findTeamMember u = find ((u ==) . view userId) isTeamOwner :: TeamMemberOptPerms -> Bool diff --git a/libs/galley-types/test/unit/Test/Galley/Roundtrip.hs b/libs/galley-types/test/unit/Test/Galley/Roundtrip.hs index b9d1fcc8568..4c3f1ecbb06 100644 --- a/libs/galley-types/test/unit/Test/Galley/Roundtrip.hs +++ b/libs/galley-types/test/unit/Test/Galley/Roundtrip.hs @@ -32,5 +32,6 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v diff --git a/libs/gundeck-types/src/Gundeck/Types/Common.hs b/libs/gundeck-types/src/Gundeck/Types/Common.hs index 388ac6b82ae..1158830d1c8 100644 --- a/libs/gundeck-types/src/Gundeck/Types/Common.hs +++ b/libs/gundeck-types/src/Gundeck/Types/Common.hs @@ -57,5 +57,5 @@ instance ToByteString URI where instance FromByteString URI where parser = takeByteString >>= parse . Bytes.unpack -parse :: MonadFail m => String -> m URI +parse :: (MonadFail m) => String -> m URI parse = maybe (fail "Invalid URI") (pure . URI) . Net.parseURI diff --git a/libs/gundeck-types/src/Gundeck/Types/Presence.hs b/libs/gundeck-types/src/Gundeck/Types/Presence.hs index 04aa78b28ca..7fb601ef08d 100644 --- a/libs/gundeck-types/src/Gundeck/Types/Presence.hs +++ b/libs/gundeck-types/src/Gundeck/Types/Presence.hs @@ -61,9 +61,15 @@ instance ToJSON Presence where instance FromJSON Presence where parseJSON = withObject "Presence" $ \o -> Presence - <$> o .: "user_id" - <*> o .: "device_id" - <*> o .: "resource" - <*> o .:? "client_id" - <*> o .:? "created_at" .!= 0 + <$> o + .: "user_id" + <*> o + .: "device_id" + <*> o + .: "resource" + <*> o + .:? "client_id" + <*> o + .:? "created_at" + .!= 0 <*> pure "" diff --git a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs index b8794553a45..d38aef521da 100644 --- a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs +++ b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs @@ -140,16 +140,23 @@ recipient u r = Recipient u r RecipientClientsAll instance FromJSON Recipient where parseJSON = withObject "Recipient" $ \p -> Recipient - <$> p .: "user_id" - <*> p .: "route" - <*> p .:? "clients" .!= RecipientClientsAll + <$> p + .: "user_id" + <*> p + .: "route" + <*> p + .:? "clients" + .!= RecipientClientsAll instance ToJSON Recipient where toJSON (Recipient u r c) = - object $ - "user_id" .= u - # "route" .= r - # "clients" .= c + object + $ "user_id" + .= u + # "route" + .= r + # "clients" + .= c # [] -- "All clients" is encoded in the API as an empty list. @@ -190,20 +197,30 @@ apsData lk la = ApsData lk la Nothing True instance ToJSON ApsData where toJSON (ApsData k a s b) = - object $ - "loc_key" .= k - # "loc_args" .= a - # "sound" .= s - # "badge" .= b + object + $ "loc_key" + .= k + # "loc_args" + .= a + # "sound" + .= s + # "badge" + .= b # [] instance FromJSON ApsData where parseJSON = withObject "ApsData" $ \o -> ApsData - <$> o .: "loc_key" - <*> o .:? "loc_args" .!= [] - <*> o .:? "sound" - <*> o .:? "badge" .!= True + <$> o + .: "loc_key" + <*> o + .:? "loc_args" + .!= [] + <*> o + .:? "sound" + <*> o + .:? "badge" + .!= True ----------------------------------------------------------------------------- -- Push @@ -269,36 +286,61 @@ newPush from to pload = singletonRecipient :: Recipient -> Range 1 1024 (Set Recipient) singletonRecipient = Range.unsafeRange . Set.singleton -singletonPayload :: ToJSONObject a => a -> List1 Object +singletonPayload :: (ToJSONObject a) => a -> List1 Object singletonPayload = List1.singleton . toJSONObject instance FromJSON Push where parseJSON = withObject "Push" $ \p -> Push - <$> p .: "recipients" - <*> p .:? "origin" - <*> p .:? "connections" .!= Set.empty - <*> p .:? "origin_connection" - <*> p .:? "transient" .!= False - <*> p .:? "native_include_origin" .!= True - <*> p .:? "native_encrypt" .!= True - <*> p .:? "native_aps" - <*> p .:? "native_priority" .!= HighPriority - <*> p .: "payload" + <$> p + .: "recipients" + <*> p + .:? "origin" + <*> p + .:? "connections" + .!= Set.empty + <*> p + .:? "origin_connection" + <*> p + .:? "transient" + .!= False + <*> p + .:? "native_include_origin" + .!= True + <*> p + .:? "native_encrypt" + .!= True + <*> p + .:? "native_aps" + <*> p + .:? "native_priority" + .!= HighPriority + <*> p + .: "payload" instance ToJSON Push where toJSON p = - object $ - "recipients" .= _pushRecipients p - # "origin" .= _pushOrigin p - # "connections" .= ifNot Set.null (_pushConnections p) - # "origin_connection" .= _pushOriginConnection p - # "transient" .= ifNot not (_pushTransient p) - # "native_include_origin" .= ifNot id (_pushNativeIncludeOrigin p) - # "native_encrypt" .= ifNot id (_pushNativeEncrypt p) - # "native_aps" .= _pushNativeAps p - # "native_priority" .= ifNot (== HighPriority) (_pushNativePriority p) - # "payload" .= _pushPayload p + object + $ "recipients" + .= _pushRecipients p + # "origin" + .= _pushOrigin p + # "connections" + .= ifNot Set.null (_pushConnections p) + # "origin_connection" + .= _pushOriginConnection p + # "transient" + .= ifNot not (_pushTransient p) + # "native_include_origin" + .= ifNot id (_pushNativeIncludeOrigin p) + # "native_encrypt" + .= ifNot id (_pushNativeEncrypt p) + # "native_aps" + .= _pushNativeAps p + # "native_priority" + .= ifNot (== HighPriority) (_pushNativePriority p) + # "payload" + .= _pushPayload p # [] where ifNot f a = if f a then Nothing else Just a diff --git a/libs/hscim/src/Web/Scim/Capabilities/MetaSchema.hs b/libs/hscim/src/Web/Scim/Capabilities/MetaSchema.hs index 77f876ef2ed..4bdaf265af3 100644 --- a/libs/hscim/src/Web/Scim/Capabilities/MetaSchema.hs +++ b/libs/hscim/src/Web/Scim/Capabilities/MetaSchema.hs @@ -54,7 +54,7 @@ data Supported a = Supported } deriving (Show, Eq, Generic) -instance ToJSON a => ToJSON (Supported a) where +instance (ToJSON a) => ToJSON (Supported a) where toJSON (Supported (ScimBool b) v) = case toJSON v of (Object o) -> Object $ KeyMap.insert "supported" (Bool b) o _ -> Object $ KeyMap.fromList [("supported", Bool b)] @@ -134,7 +134,7 @@ empty = } configServer :: - Monad m => + (Monad m) => Configuration -> ConfigSite (AsServerT (ScimHandler m)) configServer config = diff --git a/libs/hscim/src/Web/Scim/Class/Group.hs b/libs/hscim/src/Web/Scim/Class/Group.hs index 2b3f49734e1..83a3c3ac44b 100644 --- a/libs/hscim/src/Web/Scim/Class/Group.hs +++ b/libs/hscim/src/Web/Scim/Class/Group.hs @@ -171,7 +171,7 @@ class (Monad m, GroupTypes tag, AuthDB tag m) => GroupDB tag m where groupServer :: forall tag m. - GroupDB tag m => + (GroupDB tag m) => Maybe (AuthData tag) -> GroupSite tag (AsServerT (ScimHandler m)) groupServer authData = diff --git a/libs/hscim/src/Web/Scim/Client.hs b/libs/hscim/src/Web/Scim/Client.hs index fee613ac875..c80070fb038 100644 --- a/libs/hscim/src/Web/Scim/Client.hs +++ b/libs/hscim/src/Web/Scim/Client.hs @@ -74,28 +74,28 @@ type HasScimClient tag = ToHttpApiData (GroupId tag) ) -scimClients :: HasScimClient tag => ClientEnv -> Site tag (AsClientT IO) +scimClients :: (HasScimClient tag) => ClientEnv -> Site tag (AsClientT IO) scimClients env = genericClientHoist $ \x -> runClientM x env >>= either throwIO pure -- config spConfig :: forall tag. - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> IO MetaSchema.Configuration spConfig env = case config @tag (scimClients env) of ((r :<|> _) :<|> (_ :<|> _)) -> r getSchemas :: forall tag. - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> IO (ListResponse Value) getSchemas env = case config @tag (scimClients env) of ((_ :<|> r) :<|> (_ :<|> _)) -> r schema :: forall tag. - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Text -> IO Value @@ -103,7 +103,7 @@ schema env = case config @tag (scimClients env) of ((_ :<|> _) :<|> (r :<|> _)) resourceTypes :: forall tag. - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> IO (ListResponse ResourceType.Resource) resourceTypes env = case config @tag (scimClients env) of ((_ :<|> _) :<|> (_ :<|> r)) -> r @@ -111,7 +111,7 @@ resourceTypes env = case config @tag (scimClients env) of ((_ :<|> _) :<|> (_ :< -- users getUsers :: - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> Maybe Filter -> @@ -119,7 +119,7 @@ getUsers :: getUsers env tok = case users (scimClients env) tok of ((r :<|> (_ :<|> _)) :<|> (_ :<|> (_ :<|> _))) -> r getUser :: - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> UserId tag -> @@ -127,7 +127,7 @@ getUser :: getUser env tok = case users (scimClients env) tok of ((_ :<|> (r :<|> _)) :<|> (_ :<|> (_ :<|> _))) -> r postUser :: - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> User tag -> @@ -135,7 +135,7 @@ postUser :: postUser env tok = case users (scimClients env) tok of ((_ :<|> (_ :<|> r)) :<|> (_ :<|> (_ :<|> _))) -> r putUser :: - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> UserId tag -> @@ -144,7 +144,7 @@ putUser :: putUser env tok = case users (scimClients env) tok of ((_ :<|> (_ :<|> _)) :<|> (r :<|> (_ :<|> _))) -> r patchUser :: - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> UserId tag -> @@ -154,7 +154,7 @@ patchUser env tok = case users (scimClients env) tok of ((_ :<|> (_ :<|> _)) :<| deleteUser :: forall tag. - HasScimClient tag => + (HasScimClient tag) => ClientEnv -> Maybe (AuthData tag) -> UserId tag -> diff --git a/libs/hscim/src/Web/Scim/ContentType.hs b/libs/hscim/src/Web/Scim/ContentType.hs index 81aa5dd10e9..bf79c7df790 100644 --- a/libs/hscim/src/Web/Scim/ContentType.hs +++ b/libs/hscim/src/Web/Scim/ContentType.hs @@ -46,8 +46,8 @@ instance Accept SCIM where "application" // "json" ] -instance ToJSON a => MimeRender SCIM a where +instance (ToJSON a) => MimeRender SCIM a where mimeRender _ = mimeRender (Proxy @JSON) -instance FromJSON a => MimeUnrender SCIM a where +instance (FromJSON a) => MimeUnrender SCIM a where mimeUnrender _ = mimeUnrender (Proxy @JSON) diff --git a/libs/hscim/src/Web/Scim/Schema/Common.hs b/libs/hscim/src/Web/Scim/Schema/Common.hs index eb95b05d2b0..4bceab55c08 100644 --- a/libs/hscim/src/Web/Scim/Schema/Common.hs +++ b/libs/hscim/src/Web/Scim/Schema/Common.hs @@ -99,7 +99,7 @@ parseOptions = -- -- (FUTUREWORK: The "recursively" part is a bit of a waste and could be dropped, but we would -- have to spend more effort in making sure it is always called manually in nested parsers.) -jsonLower :: forall m. m ~ Either [Text] => Value -> m Value +jsonLower :: forall m. (m ~ Either [Text]) => Value -> m Value jsonLower (Object (KeyMap.toList -> olist)) = Object . KeyMap.fromList <$> (nubCI >> mapM lowerPair olist) where diff --git a/libs/hscim/src/Web/Scim/Schema/ListResponse.hs b/libs/hscim/src/Web/Scim/Schema/ListResponse.hs index 0b9c9ba58a5..78e9a044cf6 100644 --- a/libs/hscim/src/Web/Scim/Schema/ListResponse.hs +++ b/libs/hscim/src/Web/Scim/Schema/ListResponse.hs @@ -58,10 +58,10 @@ fromList list = where len = length list -instance FromJSON a => FromJSON (ListResponse a) where +instance (FromJSON a) => FromJSON (ListResponse a) where parseJSON = either (fail . show) (genericParseJSON parseOptions) . jsonLower -instance ToJSON a => ToJSON (ListResponse a) where +instance (ToJSON a) => ToJSON (ListResponse a) where toJSON ListResponse {..} = object [ "Resources" .= resources, diff --git a/libs/hscim/src/Web/Scim/Server.hs b/libs/hscim/src/Web/Scim/Server.hs index db8176ae12d..364f382b0fb 100644 --- a/libs/hscim/src/Web/Scim/Server.hs +++ b/libs/hscim/src/Web/Scim/Server.hs @@ -85,7 +85,7 @@ data Site tag route = Site siteServer :: forall tag m. - DB tag m => + (DB tag m) => Configuration -> Site tag (AsServerT (ScimHandler m)) siteServer conf = @@ -117,7 +117,7 @@ mkapp proxy api nt = app :: forall tag m. - App tag m (SiteAPI tag) => + (App tag m (SiteAPI tag)) => Configuration -> (forall a. ScimHandler m a -> Handler a) -> Application diff --git a/libs/hscim/src/Web/Scim/Test/Acceptance.hs b/libs/hscim/src/Web/Scim/Test/Acceptance.hs index c4eea4122a8..d6475eb1ad4 100644 --- a/libs/hscim/src/Web/Scim/Test/Acceptance.hs +++ b/libs/hscim/src/Web/Scim/Test/Acceptance.hs @@ -46,7 +46,7 @@ import Web.Scim.Schema.Meta import Web.Scim.Schema.UserTypes import Web.Scim.Test.Util -ignore :: Monad m => m a -> m () +ignore :: (Monad m) => m a -> m () ignore _ = pure () -- https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/use-scim-to-provision-users-and-groups#step-2-understand-the-azure-ad-scim-implementation diff --git a/libs/hscim/src/Web/Scim/Test/Util.hs b/libs/hscim/src/Web/Scim/Test/Util.hs index 601cdaab598..da75b438a47 100644 --- a/libs/hscim/src/Web/Scim/Test/Util.hs +++ b/libs/hscim/src/Web/Scim/Test/Util.hs @@ -83,17 +83,17 @@ import Web.Scim.Schema.User (UserTypes (..)) -- FUTUREWORK: make this a PR upstream. (while we're at it, we can also patch 'WaiSession' -- and 'request' to keep track of the 'SRequest', and add that to the error message here with -- the response.) -shouldRespondWith :: HasCallStack => WaiSession st SResponse -> ResponseMatcher -> WaiExpectation st +shouldRespondWith :: (HasCallStack) => WaiSession st SResponse -> ResponseMatcher -> WaiExpectation st shouldRespondWith action matcher = either (liftIO . expectationFailure) pure =<< doesRespondWith action matcher -doesRespondWith :: HasCallStack => WaiSession st SResponse -> ResponseMatcher -> WaiSession st (Either String ()) +doesRespondWith :: (HasCallStack) => WaiSession st SResponse -> ResponseMatcher -> WaiSession st (Either String ()) doesRespondWith action matcher = do r <- action let extmsg = " details: " <> show r <> "\n" pure $ maybe (Right ()) (Left . (<> extmsg)) (match r matcher) -shouldEventuallyRespondWith :: HasCallStack => WaiSession st SResponse -> ResponseMatcher -> WaiExpectation st +shouldEventuallyRespondWith :: (HasCallStack) => WaiSession st SResponse -> ResponseMatcher -> WaiExpectation st shouldEventuallyRespondWith action matcher = either (liftIO . expectationFailure) pure =<< Retry.retrying diff --git a/libs/hscim/test/Test/FilterSpec.hs b/libs/hscim/test/Test/FilterSpec.hs index 888d84480d6..9fc6588e7f3 100644 --- a/libs/hscim/test/Test/FilterSpec.hs +++ b/libs/hscim/test/Test/FilterSpec.hs @@ -32,7 +32,7 @@ import Web.Scim.Schema.User (NoUserExtra) import Web.Scim.Schema.UserTypes (UserTypes (supportedSchemas)) import Web.Scim.Test.Util (TestTag) -prop_roundtrip :: forall tag. UserTypes tag => Property +prop_roundtrip :: forall tag. (UserTypes tag) => Property prop_roundtrip = property $ do x <- forAll $ genFilter @tag tripping x renderFilter $ parseFilter (supportedSchemas @tag) @@ -45,7 +45,7 @@ spec = do ---------------------------------------------------------------------------- -- Generators -genValuePath :: forall tag. UserTypes tag => Gen ValuePath +genValuePath :: forall tag. (UserTypes tag) => Gen ValuePath genValuePath = ValuePath <$> genAttrPath @tag <*> genFilter @tag genCompValue :: Gen CompValue @@ -72,16 +72,16 @@ genSubAttr = SubAttr <$> genAttrName -- FUTUREWORK: we also may want to factor a bounded enum type out of the 'Schema' type for -- this: @data Schema = Buitin BuitinSchema | Custom Text; data BuiltinSchema = ... deriving -- (Bounded, Enum, ...)@ -genSchema :: forall tag. UserTypes tag => Gen Schema +genSchema :: forall tag. (UserTypes tag) => Gen Schema genSchema = Gen.element (supportedSchemas @tag) -genAttrPath :: forall tag. UserTypes tag => Gen AttrPath +genAttrPath :: forall tag. (UserTypes tag) => Gen AttrPath genAttrPath = AttrPath <$> Gen.maybe (genSchema @tag) <*> genAttrName <*> Gen.maybe genSubAttr genAttrName :: Gen AttrName genAttrName = AttrName <$> (cons <$> Gen.alpha <*> Gen.text (Range.constant 0 50) (Gen.choice [Gen.alphaNum, Gen.constant '-', Gen.constant '_'])) -genFilter :: forall tag. UserTypes tag => Gen Filter +genFilter :: forall tag. (UserTypes tag) => Gen Filter genFilter = Gen.choice [ FilterAttrCompare <$> (genAttrPath @tag) <*> genCompareOp <*> genCompValue diff --git a/libs/hscim/test/Test/Schema/PatchOpSpec.hs b/libs/hscim/test/Test/Schema/PatchOpSpec.hs index dc5323cfa9c..2e9a0415316 100644 --- a/libs/hscim/test/Test/Schema/PatchOpSpec.hs +++ b/libs/hscim/test/Test/Schema/PatchOpSpec.hs @@ -48,28 +48,28 @@ isSuccess :: Result a -> Bool isSuccess (Success _) = True isSuccess (Error _) = False -genPatchOp :: forall tag. UserTypes tag => Gen Value -> Gen (PatchOp tag) +genPatchOp :: forall tag. (UserTypes tag) => Gen Value -> Gen (PatchOp tag) genPatchOp genValue = PatchOp <$> Gen.list (Range.constant 0 20) ((genOperation @tag) genValue) -genSimplePatchOp :: forall tag. UserTypes tag => Gen (PatchOp tag) +genSimplePatchOp :: forall tag. (UserTypes tag) => Gen (PatchOp tag) genSimplePatchOp = genPatchOp @tag (String <$> Gen.text (Range.constant 0 20) Gen.unicode) -genOperation :: forall tag. UserTypes tag => Gen Value -> Gen Operation +genOperation :: forall tag. (UserTypes tag) => Gen Value -> Gen Operation genOperation genValue = Operation <$> Gen.enumBounded <*> Gen.maybe (genPath @tag) <*> Gen.maybe genValue -genPath :: forall tag. UserTypes tag => Gen Path +genPath :: forall tag. (UserTypes tag) => Gen Path genPath = Gen.choice [ IntoValuePath <$> (genValuePath @tag) <*> Gen.maybe genSubAttr, NormalPath <$> (genAttrPath @tag) ] -prop_roundtrip :: forall tag. UserTypes tag => Property +prop_roundtrip :: forall tag. (UserTypes tag) => Property prop_roundtrip = property $ do x <- forAll $ genPath @tag tripping x (encodeUtf8 . rPath) (parseOnly $ pPath (supportedSchemas @tag)) -prop_roundtrip_PatchOp :: forall tag. UserTypes tag => Property +prop_roundtrip_PatchOp :: forall tag. (UserTypes tag) => Property prop_roundtrip_PatchOp = property $ do -- Just some strings for now. However, should be constrained to what the -- PatchOp is operating on in the future... We need better typed PatchOp for diff --git a/libs/hscim/test/Test/Schema/Util.hs b/libs/hscim/test/Test/Schema/Util.hs index a03c84d1ea1..83099d72b5b 100644 --- a/libs/hscim/test/Test/Schema/Util.hs +++ b/libs/hscim/test/Test/Schema/Util.hs @@ -60,5 +60,5 @@ mk_prop_caseInsensitive gen = property $ do same@(Bool _) -> same same@Null -> same -keyTextL :: Functor f => (Text -> f Text) -> Key -> f Key +keyTextL :: (Functor f) => (Text -> f Text) -> Key -> f Key keyTextL f key = fmap Key.fromText (f (Key.toText key)) diff --git a/libs/imports/src/Imports.hs b/libs/imports/src/Imports.hs index 91841bbdd8c..ef162e09846 100644 --- a/libs/imports/src/Imports.hs +++ b/libs/imports/src/Imports.hs @@ -241,37 +241,37 @@ type LByteString = Data.ByteString.Lazy.ByteString ---------------------------------------------------------------------------- -- Lifted functions from Prelude -putChar :: MonadIO m => Char -> m () +putChar :: (MonadIO m) => Char -> m () putChar = liftIO . P.putChar -putStr :: MonadIO m => String -> m () +putStr :: (MonadIO m) => String -> m () putStr = liftIO . P.putStr -putStrLn :: MonadIO m => String -> m () +putStrLn :: (MonadIO m) => String -> m () putStrLn = liftIO . P.putStrLn print :: (Show a, MonadIO m) => a -> m () print = liftIO . P.print -getChar :: MonadIO m => m Char +getChar :: (MonadIO m) => m Char getChar = liftIO P.getChar -getLine :: MonadIO m => m String +getLine :: (MonadIO m) => m String getLine = liftIO P.getLine -getContents :: MonadIO m => m String +getContents :: (MonadIO m) => m String getContents = liftIO P.getContents -interact :: MonadIO m => (String -> String) -> m () +interact :: (MonadIO m) => (String -> String) -> m () interact = liftIO . P.interact -readFile :: MonadIO m => FilePath -> m String +readFile :: (MonadIO m) => FilePath -> m String readFile = liftIO . P.readFile -writeFile :: MonadIO m => FilePath -> String -> m () +writeFile :: (MonadIO m) => FilePath -> String -> m () writeFile = fmap liftIO . P.writeFile -appendFile :: MonadIO m => FilePath -> String -> m () +appendFile :: (MonadIO m) => FilePath -> String -> m () appendFile = fmap liftIO . P.appendFile readIO :: (Read a, MonadIO m) => String -> m a diff --git a/libs/metrics-core/src/Data/Metrics/AWS.hs b/libs/metrics-core/src/Data/Metrics/AWS.hs index 437ad2f0628..23c84697456 100644 --- a/libs/metrics-core/src/Data/Metrics/AWS.hs +++ b/libs/metrics-core/src/Data/Metrics/AWS.hs @@ -31,8 +31,8 @@ gaugeTokenRemaing mbRemaining = do {-# NOINLINE awsAuthTokenSecsRemaining #-} awsAuthTokenSecsRemaining :: Prom.Gauge awsAuthTokenSecsRemaining = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "aws_auth.token_secs_remaining", Prom.metricHelp = "Number of seconds left before AWS Auth expires" diff --git a/libs/metrics-core/src/Data/Metrics/GC.hs b/libs/metrics-core/src/Data/Metrics/GC.hs index 88b907badb0..d8b1a63f9a6 100644 --- a/libs/metrics-core/src/Data/Metrics/GC.hs +++ b/libs/metrics-core/src/Data/Metrics/GC.hs @@ -34,20 +34,20 @@ secondInMicroseconds = 1000000 spawnGCMetricsCollector :: IO () spawnGCMetricsCollector = whenM getRTSStatsEnabled . void $ do allocatedBytesGauge <- - register $ - gauge (Info "gc_bytes_allocated_total" "Bytes allocated since the start of the server") + register + $ gauge (Info "gc_bytes_allocated_total" "Bytes allocated since the start of the server") bytesUsedMaxGauge <- - register $ - gauge (Info "gc_bytes_used_max" "Maximum amount of memory living on the heap after the last major GC") + register + $ gauge (Info "gc_bytes_used_max" "Maximum amount of memory living on the heap after the last major GC") bytesUsedCurrentGauge <- - register $ - gauge (Info "gc_bytes_used_current" "Number of bytes in active use as of the last GC") + register + $ gauge (Info "gc_bytes_used_current" "Number of bytes in active use as of the last GC") gcSecondsCPUGauge <- - register $ - gauge (Info "gc_seconds_cpu" "CPU time spent on last GC") + register + $ gauge (Info "gc_seconds_cpu" "CPU time spent on last GC") gcSecondsWallGauge <- - register $ - gauge (Info "gc_seconds_wall" "Wall clock time spent on last GC") + register + $ gauge (Info "gc_seconds_wall" "Wall clock time spent on last GC") -- Spawn a daemon thread that will continually report GC stats to prometheus -- It will restart if it ever crashes. create $ \_threadId -> forever $ do diff --git a/libs/metrics-wai/src/Data/Metrics/Middleware/Prometheus.hs b/libs/metrics-wai/src/Data/Metrics/Middleware/Prometheus.hs index c9806e60788..f1f7c1ca562 100644 --- a/libs/metrics-wai/src/Data/Metrics/Middleware/Prometheus.hs +++ b/libs/metrics-wai/src/Data/Metrics/Middleware/Prometheus.hs @@ -32,7 +32,7 @@ import Network.Wai.Routing.Route (Routes, prepare) -- | Adds a prometheus metrics endpoint at @/i/metrics@ -- This middleware requires your servers 'Routes' because it does some normalization -- (e.g. removing params from calls) -waiPrometheusMiddleware :: Monad m => Routes a m b -> Wai.Middleware +waiPrometheusMiddleware :: (Monad m) => Routes a m b -> Wai.Middleware waiPrometheusMiddleware routes = Promth.prometheus conf . instrument (normalizeWaiRequestRoute paths) where diff --git a/libs/metrics-wai/src/Data/Metrics/Servant.hs b/libs/metrics-wai/src/Data/Metrics/Servant.hs index b8ec0984997..6d1df7d26ff 100644 --- a/libs/metrics-wai/src/Data/Metrics/Servant.hs +++ b/libs/metrics-wai/src/Data/Metrics/Servant.hs @@ -77,7 +77,7 @@ conf = Promth.prometheusInstrumentApp = False } -routesToPaths :: forall routes. RoutesToPaths routes => Paths +routesToPaths :: forall routes. (RoutesToPaths routes) => Paths routesToPaths = Paths (meltTree (getRoutes @routes)) class RoutesToPaths routes where @@ -122,19 +122,19 @@ instance getRoutes = getRoutes @rest instance - RoutesToPaths rest => + (RoutesToPaths rest) => RoutesToPaths (QueryParam' mods name a :> rest) where getRoutes = getRoutes @rest -instance RoutesToPaths rest => RoutesToPaths (MultipartForm tag a :> rest) where +instance (RoutesToPaths rest) => RoutesToPaths (MultipartForm tag a :> rest) where getRoutes = getRoutes @rest -instance RoutesToPaths api => RoutesToPaths (QueryFlag a :> api) where +instance (RoutesToPaths api) => RoutesToPaths (QueryFlag a :> api) where getRoutes = getRoutes @api instance - RoutesToPaths rest => + (RoutesToPaths rest) => RoutesToPaths (Description desc :> rest) where getRoutes = getRoutes @rest diff --git a/libs/metrics-wai/src/Data/Metrics/Test.hs b/libs/metrics-wai/src/Data/Metrics/Test.hs index 95016f23a5f..04eceadff35 100644 --- a/libs/metrics-wai/src/Data/Metrics/Test.hs +++ b/libs/metrics-wai/src/Data/Metrics/Test.hs @@ -53,8 +53,8 @@ pathsConsistencyCheck (Paths forest) = mconcat $ go [] <$> forest [] -> Nothing [_] -> Nothing bad@(_ : _ : _) -> - Just $ - SiteConsistencyError (either decode decode <$> prefix) bad + Just + $ SiteConsistencyError (either decode decode <$> prefix) bad captureVars :: Tree.Tree (Either ByteString any) -> Maybe (Text, Int) captureVars (Tree.Node (Left root) trees) = Just (decode root, weight trees) captureVars (Tree.Node (Right _) _) = Nothing diff --git a/libs/metrics-wai/src/Data/Metrics/WaiRoute.hs b/libs/metrics-wai/src/Data/Metrics/WaiRoute.hs index cd8a993c2cb..b4ca4c01ded 100644 --- a/libs/metrics-wai/src/Data/Metrics/WaiRoute.hs +++ b/libs/metrics-wai/src/Data/Metrics/WaiRoute.hs @@ -25,5 +25,5 @@ import Data.Metrics.Types import Imports import Network.Wai.Route.Tree as Tree -treeToPaths :: HasCallStack => Tree a -> Paths +treeToPaths :: (HasCallStack) => Tree a -> Paths treeToPaths = either error id . mkTree . fmap (Tree.segments . path) . Tree.toList diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency.hs index 29ac503809d..8cdf9f6600a 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency.hs @@ -40,13 +40,13 @@ data ConcurrencySafety = Safe | Unsafe type Concurrency :: ConcurrencySafety -> (Type -> Type) -> Type -> Type data Concurrency (safe :: ConcurrencySafety) m a where UnsafePooledMapConcurrentlyN :: - Foldable t => + (Foldable t) => Int -> (a -> m b) -> t a -> Concurrency safe m [b] UnsafePooledMapConcurrentlyN_ :: - Foldable t => + (Foldable t) => Int -> (a -> m b) -> t a -> @@ -108,7 +108,7 @@ unsafePooledForConcurrentlyN_ n as f = pooledMapConcurrentlyN :: forall r' r t a b. - r' ~ '[Final IO] => + (r' ~ '[Final IO]) => (Member (Concurrency 'Safe) r, Subsume r' r, Foldable t) => -- | Max. number of threads. Should not be less than 1. Int -> @@ -124,7 +124,7 @@ pooledMapConcurrentlyN n f as = pooledMapConcurrentlyN_ :: forall r' r t a b. - r' ~ '[Final IO] => + (r' ~ '[Final IO]) => (Member (Concurrency 'Safe) r, Subsume r' r, Foldable t) => -- | Max. number of threads. Should not be less than 1. Int -> @@ -140,7 +140,7 @@ pooledMapConcurrentlyN_ n f as = pooledForConcurrentlyN :: forall r' r t a b. - r' ~ '[Final IO] => + (r' ~ '[Final IO]) => (Member (Concurrency 'Safe) r, Subsume r' r, Foldable t) => -- | Max. number of threads. Should not be less than 1. Int -> @@ -156,7 +156,7 @@ pooledForConcurrentlyN n as f = pooledForConcurrentlyN_ :: forall r' r t a b. - r' ~ '[Final IO] => + (r' ~ '[Final IO]) => (Member (Concurrency 'Safe) r, Subsume r' r, Foldable t) => -- | Max. number of threads. Should not be less than 1. Int -> diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency/IO.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency/IO.hs index d5887bce411..471a0c75512 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency/IO.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Concurrency/IO.hs @@ -10,7 +10,7 @@ import Wire.Sem.Concurrency (Concurrency (..), ConcurrencySafety (Safe)) -- | Safely perform concurrency that wraps only IO effects. performConcurrency :: - Member (Final IO) r => + (Member (Final IO) r) => Sem (Concurrency 'Safe ': r) a -> Sem r a performConcurrency = unsafelyPerformConcurrency @@ -21,7 +21,7 @@ performConcurrency = unsafelyPerformConcurrency -- obscure bugs. See the notes on 'Concurrency' to get a better understanding -- of what can go wrong here. unsafelyPerformConcurrency :: - Member (Final IO) r => + (Member (Final IO) r) => Sem (Concurrency safe ': r) a -> Sem r a unsafelyPerformConcurrency = interpretFinal @IO $ \case diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Delay.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Delay.hs index 7b1395b8ed0..00e6457d08c 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Delay.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Delay.hs @@ -10,7 +10,7 @@ data Delay m a where makeSem ''Delay -runDelay :: Member (Embed IO) r => Sem (Delay ': r) a -> Sem r a +runDelay :: (Member (Embed IO) r) => Sem (Delay ': r) a -> Sem r a runDelay = interpret $ \case Delay i -> threadDelay i diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Jwk.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Jwk.hs index 913e5cbf7b7..6ce9454879f 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Jwk.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Jwk.hs @@ -15,7 +15,7 @@ data Jwk m a where makeSem ''Jwk -interpretJwk :: Members '[Embed IO] r => Sem (Jwk ': r) a -> Sem r a +interpretJwk :: (Members '[Embed IO] r) => Sem (Jwk ': r) a -> Sem r a interpretJwk = interpret $ \(Get fp) -> liftIO $ readJwk fp readJwk :: FilePath -> IO (Maybe JWK) diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Logger.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Logger.hs index 8a3f96560c6..ff619d5a1cb 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Logger.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Logger.hs @@ -33,22 +33,22 @@ data Logger msg m a where -- TODO(sandy): Inline this definition --- no TH makeSem ''Logger -trace :: Member (Logger msg) r => msg -> Sem r () +trace :: (Member (Logger msg) r) => msg -> Sem r () trace = log Trace -debug :: Member (Logger msg) r => msg -> Sem r () +debug :: (Member (Logger msg) r) => msg -> Sem r () debug = log Debug -info :: Member (Logger msg) r => msg -> Sem r () +info :: (Member (Logger msg) r) => msg -> Sem r () info = log Info -warn :: Member (Logger msg) r => msg -> Sem r () +warn :: (Member (Logger msg) r) => msg -> Sem r () warn = log Warn -err :: Member (Logger msg) r => msg -> Sem r () +err :: (Member (Logger msg) r) => msg -> Sem r () err = log Error -fatal :: Member (Logger msg) r => msg -> Sem r () +fatal :: (Member (Logger msg) r) => msg -> Sem r () fatal = log Fatal -------------------------------------------------------------------------------- @@ -56,7 +56,7 @@ fatal = log Fatal mapLogger :: forall msg msg' r a. - Member (Logger msg') r => + (Member (Logger msg') r) => (msg -> msg') -> Sem (Logger msg ': r) a -> Sem r a diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Logger/TinyLog.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Logger/TinyLog.hs index 76889f09b3a..231485fe45c 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Logger/TinyLog.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Logger/TinyLog.hs @@ -38,7 +38,7 @@ import Wire.Sem.Logger import Wire.Sem.Logger.Level loggerToTinyLog :: - Member (Embed IO) r => + (Member (Embed IO) r) => Log.Logger -> Sem (Logger (Log.Msg -> Log.Msg) ': r) a -> Sem r a @@ -48,7 +48,7 @@ loggerToTinyLog tinylog = interpret $ \case -- | Log the request ID along with the message loggerToTinyLogReqId :: - Member (Embed IO) r => + (Member (Embed IO) r) => RequestId -> Log.Logger -> Sem (TinyLog ': r) a -> @@ -58,7 +58,7 @@ loggerToTinyLogReqId r tinylog = . mapLogger (Log.field "request" (unRequestId r) .) . raiseUnder @TinyLog -stringLoggerToTinyLog :: Member (Logger (Log.Msg -> Log.Msg)) r => Sem (Logger String ': r) a -> Sem r a +stringLoggerToTinyLog :: (Member (Logger (Log.Msg -> Log.Msg)) r) => Sem (Logger String ': r) a -> Sem r a stringLoggerToTinyLog = mapLogger @String Log.msg discardTinyLogs :: Sem (Logger (Log.Msg -> Log.Msg) ': r) a -> Sem r a @@ -69,6 +69,6 @@ newtype LogRecorder = LogRecorder {recordedLogs :: IORef [(Level, LByteString)]} newLogRecorder :: IO LogRecorder newLogRecorder = LogRecorder <$> newIORef [] -recordLogs :: Member (Embed IO) r => LogRecorder -> Sem (TinyLog ': r) a -> Sem r a +recordLogs :: (Member (Embed IO) r) => LogRecorder -> Sem (TinyLog ': r) a -> Sem r a recordLogs LogRecorder {..} = interpret $ \(Log lvl msg) -> modifyIORef' recordedLogs (++ [(lvl, Log.render (Log.renderDefault ", ") msg)]) diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Input.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Input.hs index b8c43249f9d..6e3c2dcb688 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Input.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Input.hs @@ -27,7 +27,7 @@ import Polysemy.Input import Wire.Sem.Now nowToInput :: - Member (Input UTCTime) r => + (Member (Input UTCTime) r) => Sem (Now ': r) a -> Sem r a nowToInput = interpret $ \case diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Spec.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Spec.hs index 0ded935d5f1..b94f638fe93 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Spec.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Now/Spec.hs @@ -30,7 +30,7 @@ import Test.QuickCheck import qualified Wire.Sem.Now as E propsForInterpreter :: - PropConstraints r f => + (PropConstraints r f) => String -> (forall a. Sem r a -> IO (f a)) -> Spec @@ -42,15 +42,15 @@ propsForInterpreter interpreter lower = do -- A regular type synonym doesn't work due to dreaded impredicative -- polymorphism. class - (Functor f, Member E.Now r, Member (Input ()) r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Functor f, Member E.Now r, Member (Input ()) r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f instance - (Functor f, Member E.Now r, Member (Input ()) r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Functor f, Member E.Now r, Member (Input ()) r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f prop_nowNow :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f Bool -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -62,8 +62,8 @@ prop_nowNow = -- results! And we can't keep it empty, because that triggers a crash in -- @polysemy-check@. Thus @Input ()@, which isn't beautiful, but works fine. prepropLaw @'[Input ()] $ do - pure $ - simpleLaw + pure + $ simpleLaw (liftA2 (<=) E.get E.get) ( pure True ) diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Random.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Random.hs index da054b545ed..0d563a187af 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Random.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Random.hs @@ -36,6 +36,6 @@ data Random m a where Bytes :: Int -> Random m ByteString Uuid :: Random m UUID ScimTokenId :: Random m ScimTokenId - LiftRandom :: (forall mr. MonadRandom mr => mr a) -> Random m a + LiftRandom :: (forall mr. (MonadRandom mr) => mr a) -> Random m a makeSem ''Random diff --git a/libs/polysemy-wire-zoo/src/Wire/Sem/Random/IO.hs b/libs/polysemy-wire-zoo/src/Wire/Sem/Random/IO.hs index e64815799f4..5095decee8c 100644 --- a/libs/polysemy-wire-zoo/src/Wire/Sem/Random/IO.hs +++ b/libs/polysemy-wire-zoo/src/Wire/Sem/Random/IO.hs @@ -28,7 +28,7 @@ import Polysemy import Wire.Sem.Random (Random (..)) randomToIO :: - Member (Embed IO) r => + (Member (Embed IO) r) => Sem (Random ': r) a -> Sem r a randomToIO = interpret $ \case diff --git a/libs/polysemy-wire-zoo/test/Test/IntersperseSpec.hs b/libs/polysemy-wire-zoo/test/Test/IntersperseSpec.hs index 14e56e9acf2..85f5c8fdd85 100644 --- a/libs/polysemy-wire-zoo/test/Test/IntersperseSpec.hs +++ b/libs/polysemy-wire-zoo/test/Test/IntersperseSpec.hs @@ -22,8 +22,8 @@ spec = do it "should poll from async-written channel" $ do result <- liftIO test let desired = - S.fromList $ - mconcat + S.fromList + $ mconcat [ fmap ("loaded: " <>) ["hello", "world", "last"], fmap (show @Int) [1 .. 4], ["finished"] @@ -33,21 +33,22 @@ spec = do -- Example showing how intersperse lays out actions it "should stick code before every action" $ do let result = - fst $ - run $ - runTraceList $ - outputToTrace show $ - evalState @Int 0 $ - intersperse ((output =<< get) <* modify (+ 1)) $ do - -- 0 - trace "start" - pure () - -- 1 - trace "middle" - -- 2 - _ <- get - -- 3 - trace "end" + fst + $ run + $ runTraceList + $ outputToTrace show + $ evalState @Int 0 + $ intersperse ((output =<< get) <* modify (+ 1)) + $ do + -- 0 + trace "start" + pure () + -- 1 + trace "middle" + -- 2 + _ <- get + -- 3 + trace "end" result `shouldBe` ["0", "start", "1", "middle", "2", "3", "end"] pull :: (Member (Embed IO) r, Member Trace r) => MVar String -> Sem r () @@ -68,11 +69,12 @@ test :: IO (Set String) test = fmap S.fromList $ do chan <- newEmptyMVar @_ @String _ <- async $ push chan - fmap fst $ - runM $ - runTraceList $ - intersperse (pull chan) $ do - for_ [1 .. 4] $ \i -> do - trace $ show @Int i - liftIO $ threadDelay 1e5 - trace "finished" + fmap fst + $ runM + $ runTraceList + $ intersperse (pull chan) + $ do + for_ [1 .. 4] $ \i -> do + trace $ show @Int i + liftIO $ threadDelay 1e5 + trace "finished" diff --git a/libs/ropes/src/Ropes/Nexmo.hs b/libs/ropes/src/Ropes/Nexmo.hs index 9f1900a86f4..89f589a556c 100644 --- a/libs/ropes/src/Ropes/Nexmo.hs +++ b/libs/ropes/src/Ropes/Nexmo.hs @@ -79,8 +79,10 @@ data Credentials = Credentials instance FromJSON Credentials where parseJSON = withObject "credentials" $ \o -> Credentials - <$> o .: "key" - <*> o .: "secret" + <$> o + .: "key" + <*> o + .: "secret" -- * SMS related @@ -137,8 +139,10 @@ instance Exception MessageErrorResponse instance FromJSON MessageErrorResponse where parseJSON = withObject "message-error-response" $ \o -> MessageErrorResponse - <$> o .: "status" - <*> o .:? "error-text" + <$> o + .: "status" + <*> o + .:? "error-text" newtype ParseError = ParseError String deriving (Eq, Show, Typeable) @@ -228,8 +232,10 @@ instance Exception CallErrorResponse instance FromJSON CallErrorResponse where parseJSON = withObject "call-error-response" $ \o -> CallErrorResponse - <$> o .: "status" - <*> o .:? "error-text" + <$> o + .: "status" + <*> o + .:? "error-text" -- * Internal call parsers @@ -321,9 +327,9 @@ sendFeedback cr mgr fb = httpLbs req mgr >>= parseResponse -- You must _always_ specify a timestamp nexmoTimeFormat = formatTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" parseResponse res = - unless (responseStatus res == status200) $ - throwIO $ - FeedbackErrorResponse (decodeUtf8 . toStrict . responseBody $ res) + unless (responseStatus res == status200) + $ throwIO + $ FeedbackErrorResponse (decodeUtf8 . toStrict . responseBody $ res) sendMessage :: Credentials -> Manager -> Message -> IO MessageResponse sendMessage cr mgr msg = N.head <$> sendMessages cr mgr (msg :| []) diff --git a/libs/ropes/src/Ropes/Twilio.hs b/libs/ropes/src/Ropes/Twilio.hs index e9a935b7302..15c8ca8c040 100644 --- a/libs/ropes/src/Ropes/Twilio.hs +++ b/libs/ropes/src/Ropes/Twilio.hs @@ -93,10 +93,14 @@ instance Exception ErrorResponse instance FromJSON ErrorResponse where parseJSON = withObject "error-response" $ \o -> ErrorResponse - <$> o .: "status" - <*> o .: "message" - <*> o .:? "code" - <*> o .:? "more_info" + <$> o + .: "status" + <*> o + .: "message" + <*> o + .:? "code" + <*> o + .:? "more_info" newtype ParseError = ParseError String deriving (Eq, Show, Typeable) @@ -135,14 +139,18 @@ data PhoneType instance FromJSON LookupResult where parseJSON = withObject "LookupResult" $ \o -> LookupResult - <$> o .: "phone_number" - <*> o .:? "carrier" + <$> o + .: "phone_number" + <*> o + .:? "carrier" instance FromJSON CarrierInfo where parseJSON = withObject "CarrierInfo" $ \o -> CarrierInfo - <$> o .:? "name" - <*> o .:? "type" + <$> o + .:? "name" + <*> o + .:? "type" instance FromJSON PhoneType where parseJSON = withText "PhoneType" $ \case @@ -153,7 +161,7 @@ instance FromJSON PhoneType where -- * Functions -tryTwilio :: MonadIO m => IO a -> ExceptT ErrorResponse m a +tryTwilio :: (MonadIO m) => IO a -> ExceptT ErrorResponse m a tryTwilio = ExceptT . liftIO . try sendMessage :: Credentials -> Manager -> Message -> IO MessageId diff --git a/libs/schema-profunctor/src/Data/Schema.hs b/libs/schema-profunctor/src/Data/Schema.hs index e2dd11a7853..1b20ad93689 100644 --- a/libs/schema-profunctor/src/Data/Schema.hs +++ b/libs/schema-profunctor/src/Data/Schema.hs @@ -138,7 +138,7 @@ newtype SchemaOut v a b = SchemaOut (a -> Maybe v) -- The following instance is correct because `Ap Maybe v` is a -- near-semiring when v is a monoid -instance Monoid v => Alternative (SchemaOut v a) where +instance (Monoid v) => Alternative (SchemaOut v a) where empty = mempty (<|>) = (<>) @@ -153,7 +153,7 @@ instance Monoid (SchemaOut v a b) where -- -- This is used for schema documentation types, to support different behaviours -- for composing schemas sequentially vs alternatively. -class Monoid m => NearSemiRing m where +class (Monoid m) => NearSemiRing m where zero :: m add :: m -> m -> m @@ -162,7 +162,7 @@ newtype SchemaDoc doc a b = SchemaDoc {getDoc :: doc} deriving (Applicative) via (Const doc) deriving (Profunctor, Choice) via Joker (Const doc) -instance NearSemiRing doc => Alternative (SchemaDoc doc a) where +instance (NearSemiRing doc) => Alternative (SchemaDoc doc a) where empty = zero (<|>) = add @@ -240,11 +240,11 @@ instance (NearSemiRing doc, Monoid v') => Alternative (SchemaP doc v v' a) where -- /Note/: this is a more general instance than the 'Alternative' one, -- since it works for arbitrary v' -instance Semigroup doc => Semigroup (SchemaP doc v v' a b) where +instance (Semigroup doc) => Semigroup (SchemaP doc v v' a b) where SchemaP d1 i1 o1 <> SchemaP d2 i2 o2 = SchemaP (d1 <> d2) (i1 <> i2) (o1 <> o2) -instance Monoid doc => Monoid (SchemaP doc v v' a b) where +instance (Monoid doc) => Monoid (SchemaP doc v v' a b) where mempty = SchemaP mempty mempty mempty instance Profunctor (SchemaP doc v v') where @@ -282,7 +282,7 @@ schemaIn (SchemaP _ (SchemaIn i) _) = i schemaOut :: SchemaP ss v m a b -> a -> Maybe m schemaOut (SchemaP _ _ (SchemaOut o)) = o -class Functor f => FieldFunctor doc f where +class (Functor f) => FieldFunctor doc f where parseFieldF :: (A.Value -> A.Parser a) -> A.Object -> Text -> A.Parser (f a) mkDocF :: doc -> doc @@ -290,14 +290,14 @@ instance FieldFunctor doc Identity where parseFieldF f obj key = Identity <$> A.explicitParseField f obj (Key.fromText key) mkDocF = id -instance HasOpt doc => FieldFunctor doc Maybe where +instance (HasOpt doc) => FieldFunctor doc Maybe where parseFieldF f obj key = A.explicitParseFieldMaybe f obj (Key.fromText key) mkDocF = mkOpt -- | A schema for a one-field JSON object. field :: forall doc' doc a b. - HasField doc' doc => + (HasField doc' doc) => Text -> SchemaP doc' A.Value A.Value a b -> SchemaP doc A.Object [A.Pair] a b @@ -366,7 +366,7 @@ fieldOver l name = fmap runIdentity . fieldOverF l name -- documentation of the field. fieldWithDocModifier :: forall doc' doc a b. - HasField doc' doc => + (HasField doc' doc) => Text -> (doc' -> doc') -> SchemaP doc' A.Value A.Value a b -> @@ -396,7 +396,7 @@ fieldWithDocModifierF :: fieldWithDocModifierF name modify sch = fieldF @doc' @doc name (over doc modify sch) -- | Change the input type of a schema. -(.=) :: Profunctor p => (a -> a') -> p a' b -> p a b +(.=) :: (Profunctor p) => (a -> a') -> p a' b -> p a b (.=) = lmap -- | Change the input and output types of a schema via a prism. @@ -408,7 +408,7 @@ tag f = rmap runIdentity . f . rmap Identity -- This can be used to convert a combination of schemas obtained using -- 'field' into a single schema for a JSON object. object :: - HasObject doc doc' => + (HasObject doc doc') => Text -> SchemaP doc A.Object [A.Pair] a b -> SchemaP doc' A.Value A.Value a b @@ -418,7 +418,7 @@ object = objectOver id -- -- Just like 'fieldOver', but for 'object'. objectOver :: - HasObject doc doc' => + (HasObject doc doc') => Lens v v' A.Value A.Object -> Text -> SchemaP doc v' [A.Pair] a b -> @@ -433,7 +433,7 @@ objectOver l name sch = SchemaP (SchemaDoc s) (SchemaIn r) (SchemaOut w) -- | Like 'object', but apply an arbitrary function to the -- documentation of the resulting object. objectWithDocModifier :: - HasObject doc doc' => + (HasObject doc doc') => Text -> (doc' -> doc') -> ObjectSchema doc a -> @@ -446,14 +446,14 @@ objectWithDocModifier name modify sch = over doc modify (object name sch) -- schema. If the inner schema is unnamed, it gets "inlined" in the -- larger scheme definition, and otherwise it gets "referenced". This -- combinator makes it possible to choose one of the two options. -unnamed :: HasObject doc doc' => SchemaP doc' v m a b -> SchemaP doc v m a b +unnamed :: (HasObject doc doc') => SchemaP doc' v m a b -> SchemaP doc v m a b unnamed = over doc unmkObject -- | Attach a name to a schema. -- -- This only affects the documentation portion of a schema, and not -- the parsing or serialisation. -named :: HasObject doc doc' => Text -> SchemaP doc v m a b -> SchemaP doc' v m a b +named :: (HasObject doc doc') => Text -> SchemaP doc v m a b -> SchemaP doc' v m a b named name = over doc (mkObject name) -- | A schema for a JSON array. @@ -524,7 +524,7 @@ setMinItems :: (HasMinItems doc (Maybe Integer)) => Integer -> ValueSchema doc a setMinItems m = doc . minItems ?~ m -- | Ad-hoc class for types corresponding to JSON primitive types. -class A.ToJSON a => With a where +class (A.ToJSON a) => With a where with :: String -> (a -> A.Parser b) -> A.Value -> A.Parser b instance With Text where @@ -574,7 +574,7 @@ enum name sch = SchemaP (SchemaDoc d) (SchemaIn i) (SchemaOut o) -- -- This is most commonly used for optional fields, and it will cause the field -- to be omitted from the output of the serialiser. -maybe_ :: Monoid w => SchemaP d v w a b -> SchemaP d v w (Maybe a) b +maybe_ :: (Monoid w) => SchemaP d v w a b -> SchemaP d v w (Maybe a) b maybe_ = maybeWithDefault mempty -- | A schema for 'Maybe', producing the given default value on serialisation. @@ -623,8 +623,8 @@ dispatch sch = mkSchema d i o -- | A schema for a textual value. text :: Text -> ValueSchema NamedSwaggerDoc Text text name = - named name $ - mkSchema + named name + $ mkSchema (pure d) (A.withText (T.unpack name) pure) (pure . A.String) @@ -641,15 +641,16 @@ parsedText name parser = text name `withParser` (either fail pure . parser) -- | A schema for an arbitrary JSON object. jsonObject :: ValueSchema SwaggerDoc A.Object jsonObject = - unnamed . object "Object" $ - mkSchema mempty pure (pure . (^.. ifolded . withIndex)) + unnamed + . object "Object" + $ mkSchema mempty pure (pure . (^.. ifolded . withIndex)) -- | A schema for an arbitrary JSON value. jsonValue :: ValueSchema SwaggerDoc A.Value jsonValue = mkSchema mempty pure Just -- | A schema for a null value. -null_ :: Monoid d => ValueSchemaP d () () +null_ :: (Monoid d) => ValueSchemaP d () () null_ = mkSchema mempty i o where i x = guard (x == A.Null) @@ -662,7 +663,7 @@ null_ = mkSchema mempty i o -- -- The serialiser behaves similarly, but in the other direction. nullable :: - Monoid d => + (Monoid d) => ValueSchema d a -> ValueSchema d (Maybe a) nullable s = @@ -687,14 +688,14 @@ instance Applicative WithDeclare where WithDeclare d1 s1 <*> WithDeclare d2 s2 = WithDeclare (d1 >> d2) (s1 s2) -instance Semigroup s => Semigroup (WithDeclare s) where +instance (Semigroup s) => Semigroup (WithDeclare s) where WithDeclare d1 s1 <> WithDeclare d2 s2 = WithDeclare (d1 >> d2) (s1 <> s2) -instance Monoid s => Monoid (WithDeclare s) where +instance (Monoid s) => Monoid (WithDeclare s) where mempty = WithDeclare (pure ()) mempty -instance NearSemiRing s => NearSemiRing (WithDeclare s) where +instance (NearSemiRing s) => NearSemiRing (WithDeclare s) where zero = WithDeclare (pure ()) zero add (WithDeclare d1 s1) (WithDeclare d2 s2) = WithDeclare (d1 >> d2) (add s1 s2) @@ -745,17 +746,17 @@ instance HasName SwaggerDoc where instance HasName NamedSwaggerDoc where getName = S._namedSchemaName . extract -class Monoid doc => HasField ndoc doc | ndoc -> doc where +class (Monoid doc) => HasField ndoc doc | ndoc -> doc where mkField :: Text -> ndoc -> doc -class Monoid doc => HasObject doc ndoc | doc -> ndoc, ndoc -> doc where +class (Monoid doc) => HasObject doc ndoc | doc -> ndoc, ndoc -> doc where mkObject :: Text -> doc -> ndoc unmkObject :: ndoc -> doc -class Monoid doc => HasArray ndoc doc | ndoc -> doc where +class (Monoid doc) => HasArray ndoc doc | ndoc -> doc where mkArray :: ndoc -> doc -class Monoid doc => HasMap ndoc doc | ndoc -> doc where +class (Monoid doc) => HasMap ndoc doc | ndoc -> doc where mkMap :: ndoc -> doc class HasOpt doc where @@ -764,7 +765,7 @@ class HasOpt doc where class HasEnum a doc where mkEnum :: Text -> [A.Value] -> doc -instance HasSchemaRef doc => HasField doc SwaggerDoc where +instance (HasSchemaRef doc) => HasField doc SwaggerDoc where mkField name = fmap f . schemaRef where f ref = @@ -779,7 +780,7 @@ instance HasObject SwaggerDoc NamedSwaggerDoc where unmkObject (WithDeclare d (S.NamedSchema (Just n) s)) = WithDeclare (d *> S.declare [(n, s)]) s -instance HasSchemaRef ndoc => HasArray ndoc SwaggerDoc where +instance (HasSchemaRef ndoc) => HasArray ndoc SwaggerDoc where mkArray = fmap f . schemaRef where f :: S.Referenced S.Schema -> S.Schema @@ -788,7 +789,7 @@ instance HasSchemaRef ndoc => HasArray ndoc SwaggerDoc where & S.type_ ?~ S.OpenApiArray & S.items ?~ S.OpenApiItemsObject ref -instance HasSchemaRef ndoc => HasMap ndoc SwaggerDoc where +instance (HasSchemaRef ndoc) => HasMap ndoc SwaggerDoc where mkMap = fmap f . schemaRef where f :: S.Referenced S.Schema -> S.Schema @@ -821,10 +822,11 @@ mkSwaggerEnum :: [A.Value] -> NamedSwaggerDoc mkSwaggerEnum ty name labels = - pure . S.NamedSchema (Just name) $ - mempty - & S.type_ ?~ ty - & S.enum_ ?~ labels + pure + . S.NamedSchema (Just name) + $ mempty + & S.type_ ?~ ty + & S.enum_ ?~ labels instance HasOpt SwaggerDoc where mkOpt = (S.schema . S.required) .~ [] @@ -846,24 +848,24 @@ class ToSchema a where newtype Schema a = Schema {getSchema :: a} deriving (Generic) -schemaToSwagger :: forall a. ToSchema a => Proxy a -> Declare S.NamedSchema +schemaToSwagger :: forall a. (ToSchema a) => Proxy a -> Declare S.NamedSchema schemaToSwagger _ = runDeclare (schemaDoc (schema @a)) instance (Typeable a, ToSchema a) => S.ToSchema (Schema a) where declareNamedSchema _ = schemaToSwagger (Proxy @a) -- | JSON serialiser for an instance of 'ToSchema'. -schemaToJSON :: forall a. ToSchema a => a -> A.Value +schemaToJSON :: forall a. (ToSchema a) => a -> A.Value schemaToJSON = fromMaybe A.Null . schemaOut (schema @a) -instance ToSchema a => A.ToJSON (Schema a) where +instance (ToSchema a) => A.ToJSON (Schema a) where toJSON = schemaToJSON . getSchema -- | JSON parser for an instance of 'ToSchema'. -schemaParseJSON :: forall a. ToSchema a => A.Value -> A.Parser a +schemaParseJSON :: forall a. (ToSchema a) => A.Value -> A.Parser a schemaParseJSON = schemaIn schema -instance ToSchema a => A.FromJSON (Schema a) where +instance (ToSchema a) => A.FromJSON (Schema a) where parseJSON = fmap Schema . schemaParseJSON instance ToSchema Text where schema = genericToSchema @@ -899,7 +901,7 @@ instance ToSchema Natural where schema = genericToSchema declareSwaggerSchema :: SchemaP (WithDeclare d) v w a b -> Declare d declareSwaggerSchema = runDeclare . schemaDoc -swaggerDoc :: forall a. S.ToSchema a => NamedSwaggerDoc +swaggerDoc :: forall a. (S.ToSchema a) => NamedSwaggerDoc swaggerDoc = unrunDeclare (S.declareNamedSchema (Proxy @a)) genericToSchema :: forall a. (S.ToSchema a, A.ToJSON a, A.FromJSON a) => ValueSchema NamedSwaggerDoc a @@ -920,7 +922,7 @@ instance S.HasSchema SwaggerDoc S.Schema where instance S.HasSchema NamedSwaggerDoc S.Schema where schema = declared . S.schema -instance S.HasSchema d S.Schema => S.HasSchema (SchemaP d v w a b) S.Schema where +instance (S.HasSchema d S.Schema) => S.HasSchema (SchemaP d v w a b) S.Schema where schema = doc . S.schema instance S.HasDescription NamedSwaggerDoc (Maybe Text) where @@ -929,11 +931,11 @@ instance S.HasDescription NamedSwaggerDoc (Maybe Text) where instance S.HasDeprecated NamedSwaggerDoc (Maybe Bool) where deprecated = declared . S.schema . S.deprecated -instance {-# OVERLAPPABLE #-} S.HasDescription s a => S.HasDescription (WithDeclare s) a where +instance {-# OVERLAPPABLE #-} (S.HasDescription s a) => S.HasDescription (WithDeclare s) a where description = declared . S.description -instance {-# OVERLAPPABLE #-} S.HasDeprecated s a => S.HasDeprecated (WithDeclare s) a where +instance {-# OVERLAPPABLE #-} (S.HasDeprecated s a) => S.HasDeprecated (WithDeclare s) a where deprecated = declared . S.deprecated -instance {-# OVERLAPPABLE #-} S.HasExample s a => S.HasExample (WithDeclare s) a where +instance {-# OVERLAPPABLE #-} (S.HasExample s a) => S.HasExample (WithDeclare s) a where example = declared . S.example diff --git a/libs/schema-profunctor/test/unit/Test/Data/Schema.hs b/libs/schema-profunctor/test/unit/Test/Data/Schema.hs index d29b69b2365..ae9ae8b2484 100644 --- a/libs/schema-profunctor/test/unit/Test/Data/Schema.hs +++ b/libs/schema-profunctor/test/unit/Test/Data/Schema.hs @@ -73,24 +73,24 @@ tests = testFooToJSON :: TestTree testFooToJSON = - testCase "toJSON Foo" $ - assertEqual + testCase "toJSON Foo" + $ assertEqual "toJSON should match handwritten JSON" exampleFooJSON (toJSON exampleFoo) testFooFromJSON :: TestTree testFooFromJSON = - testCase "fromJSON Foo" $ - assertEqual + testCase "fromJSON Foo" + $ assertEqual "fromJSON should match example" (Success exampleFoo) (fromJSON exampleFooJSON) testFooFromJSONFailure :: TestTree testFooFromJSONFailure = - testCase "fromJSON Foo failure" $ - case fromJSON @Foo exampleFooInvalidJSON of + testCase "fromJSON Foo failure" + $ case fromJSON @Foo exampleFooInvalidJSON of Success _ -> assertFailure "fromJSON should fail" Error err -> do assertBool @@ -121,80 +121,80 @@ testFooSchema = testBarAToJSON :: TestTree testBarAToJSON = - testCase "toJSON BarA" $ - assertEqual + testCase "toJSON BarA" + $ assertEqual "toJSON should match handwritten JSON" exampleBarAJSON (toJSON exampleBarA) testBarAFromJSON :: TestTree testBarAFromJSON = - testCase "fromJSON BarA" $ - assertEqual + testCase "fromJSON BarA" + $ assertEqual "fromJSON should match example" (Success exampleBarA) (fromJSON exampleBarAJSON) testBarBToJSON :: TestTree testBarBToJSON = - testCase "toJSON BarB" $ - assertEqual + testCase "toJSON BarB" + $ assertEqual "toJSON should match handwritten JSON" exampleBarBJSON (toJSON exampleBarB) testBarBFromJSON :: TestTree testBarBFromJSON = - testCase "fromJSON BarB" $ - assertEqual + testCase "fromJSON BarB" + $ assertEqual "fromJSON should match example" (Success exampleBarB) (fromJSON exampleBarBJSON) testAccessToJSON :: TestTree testAccessToJSON = - testCase "toJSON Access" $ - assertEqual + testCase "toJSON Access" + $ assertEqual "toJSON should match handwritten JSON" "link" (toJSON Link) testAccessFromJSON :: TestTree testAccessFromJSON = - testCase "fromJSON Access" $ - assertEqual + testCase "fromJSON Access" + $ assertEqual "fromJSON should match example" (Success Link) (fromJSON "link") testUser1ToJSON :: TestTree testUser1ToJSON = - testCase "toJSON User" $ - assertEqual + testCase "toJSON User" + $ assertEqual "toJSON should match handwritten JSON" exampleUser1JSON (encode exampleUser1) testUser1FromJSON :: TestTree testUser1FromJSON = - testCase "fromJSON User" $ - assertEqual + testCase "fromJSON User" + $ assertEqual "fromJSON should match example" (Just exampleUser1) (decode exampleUser1JSON) testUser2ToJSON :: TestTree testUser2ToJSON = - testCase "toJSON User" $ - assertEqual + testCase "toJSON User" + $ assertEqual "toJSON should match handwritten JSON" exampleUser2JSON (encode exampleUser2) testUser2FromJSON :: TestTree testUser2FromJSON = - testCase "fromJSON User" $ - assertEqual + testCase "fromJSON User" + $ assertEqual "fromJSON should match example" (Just exampleUser2) (decode exampleUser2JSON) @@ -210,40 +210,40 @@ testUserSchema = testTaggedObjectToJSON :: TestTree testTaggedObjectToJSON = - testCase "toJSON TaggedObject" $ - assertEqual + testCase "toJSON TaggedObject" + $ assertEqual "toJSON should match handwritten JSON" exampleTaggedObjectJSON (toJSON exampleTaggedObject) testTaggedObjectFromJSON :: TestTree testTaggedObjectFromJSON = - testCase "fromJSON TaggedObject" $ - assertEqual + testCase "fromJSON TaggedObject" + $ assertEqual "fromJSON should match example" (Success exampleTaggedObject) (fromJSON exampleTaggedObjectJSON) testTaggedObject2ToJSON :: TestTree testTaggedObject2ToJSON = - testCase "toJSON TaggedObject 2" $ - assertEqual + testCase "toJSON TaggedObject 2" + $ assertEqual "toJSON should match handwritten JSON" exampleTaggedObject2JSON (toJSON exampleTaggedObject2) testTaggedObject2FromJSON :: TestTree testTaggedObject2FromJSON = - testCase "fromJSON TaggedObject 2" $ - assertEqual + testCase "fromJSON TaggedObject 2" + $ assertEqual "fromJSON should match example" (Success exampleTaggedObject2) (fromJSON exampleTaggedObject2JSON) testTaggedObject3FromJSON :: TestTree testTaggedObject3FromJSON = - testCase "fromJSON TaggedObject failure" $ - case fromJSON @TaggedObject exampleTaggedObject3JSON of + testCase "fromJSON TaggedObject failure" + $ case fromJSON @TaggedObject exampleTaggedObject3JSON of Success _ -> assertFailure "fromJSON should fail" Error err -> do assertBool @@ -297,9 +297,10 @@ testRefField :: TestTree testRefField = testCase "Reference in a field" $ do let (defs, _) = S.runDeclare (S.declareSchemaRef (Proxy @Named)) mempty - assertBool "Referenced schema should be declared" $ - not . nullOf (ix "Name") $ - defs + assertBool "Referenced schema should be declared" + $ not + . nullOf (ix "Name") + $ defs testRmClientWrong :: TestTree testRmClientWrong = @@ -366,10 +367,10 @@ data A = A {thing :: Text, other :: Int} instance ToSchema A where schema = - object "A" $ - A - <$> thing .= field "thing" schema - <*> other .= field "other" schema + object "A" + $ A + <$> thing .= field "thing" schema + <*> other .= field "other" schema newtype B = B {bThing :: Int} deriving (Eq, Show) @@ -402,10 +403,10 @@ instance ToSchema Foo where (doc . description ?~ "A Foo object") . object "Foo" $ Foo - <$> fooA .= field "a" schema - <* (thing . fooA) .= optional (field "a_thing" (unnamed schema)) - <*> fooB .= field "b" schema - <*> fooStr .= field "str" (unnamed schema) + <$> fooA .= field "a" schema + <* (thing . fooA) .= optional (field "a_thing" (unnamed schema)) + <*> fooB .= field "b" schema + <*> fooStr .= field "str" (unnamed schema) data Bar = BarA A | BarB B deriving (Eq, Show) @@ -423,9 +424,9 @@ _BarB = prism' BarB $ \case instance ToSchema Bar where schema = - named "Bar" $ - tag _BarA (unnamed schema) - <> tag _BarB (unnamed schema) + named "Bar" + $ tag _BarA (unnamed schema) + <> tag _BarB (unnamed schema) exampleBarA :: Bar exampleBarA = BarA (A "cthulhu" 711) @@ -445,11 +446,11 @@ data Access = Public | Private | Link | Code instance ToSchema Access where schema = - enum @Text "Access" $ - element "public" Public - <> element "private" Private - <> element "link" Link - <> element "code" Code + enum @Text "Access" + $ element "public" Public + <> element "private" Private + <> element "link" Link + <> element "code" Code -- optional fields @@ -463,11 +464,11 @@ data User = User instance ToSchema User where schema = - object "User" $ - User - <$> userName .= field "name" schema - <*> userHandle .= maybe_ (optField "handle" schema) - <*> userExpire .= maybe_ (optField "expire" schema) + object "User" + $ User + <$> userName .= field "name" schema + <*> userHandle .= maybe_ (optField "handle" schema) + <*> userExpire .= maybe_ (optField "expire" schema) exampleUser1 :: User exampleUser1 = User "Alice" (Just "alice") Nothing @@ -511,12 +512,12 @@ instance ToSchema Tag where instance ToSchema TaggedObject where schema = - object "TaggedObject" $ - uncurry TO - <$> (toTag &&& toObj) - .= bind - (fst .= field "tag" schema) - (snd .= fieldOver _1 "obj" (objectOver _1 "UntaggedObject" untaggedSchema)) + object "TaggedObject" + $ uncurry TO + <$> (toTag &&& toObj) + .= bind + (fst .= field "tag" schema) + (snd .= fieldOver _1 "obj" (objectOver _1 "UntaggedObject" untaggedSchema)) where untaggedSchema = dispatch $ \case Tag1 -> tag _Obj1 (field "tag1_data" schema) @@ -574,15 +575,15 @@ passwordSchema = schema `withParser` validate -- this is "wrong", because it succeeds even if password validation fails rmClientSchema :: ValueSchema NamedSwaggerDoc RmClient rmClientSchema = - object "RmClient" $ - RmClient - <$> rmPassword .= optional (field "password" (maybeWithDefault Null passwordSchema)) + object "RmClient" + $ RmClient + <$> rmPassword .= optional (field "password" (maybeWithDefault Null passwordSchema)) instance ToSchema RmClient where schema = - object "RmClient" $ - RmClient - <$> rmPassword .= maybe_ (optField "password" passwordSchema) + object "RmClient" + $ RmClient + <$> rmPassword .= maybe_ (optField "password" passwordSchema) -- examples from documentation (only type-checked) @@ -597,17 +598,17 @@ data DetailTag = NameTag | AgeTag tagSchema :: ValueSchema NamedSwaggerDoc DetailTag tagSchema = - enum @Text "Detail Tag" $ - mconcat [element "name" NameTag, element "age" AgeTag] + enum @Text "Detail Tag" + $ mconcat [element "name" NameTag, element "age" AgeTag] detailSchema :: ValueSchema NamedSwaggerDoc Detail detailSchema = - object "Detail" $ - fromTagged - <$> toTagged - .= bind - (fst .= field "tag" tagSchema) - (snd .= fieldOver _1 "value" untaggedSchema) + object "Detail" + $ fromTagged + <$> toTagged + .= bind + (fst .= field "tag" tagSchema) + (snd .= fieldOver _1 "value" untaggedSchema) where toTagged :: Detail -> (DetailTag, Detail) toTagged d@(Name _) = (NameTag, d) @@ -622,11 +623,11 @@ detailSchema = userSchemaWithDefaultName' :: ValueSchema NamedSwaggerDoc User userSchemaWithDefaultName' = - object "User" $ - User - <$> (getOptText . userName) .= maybe_ (fromMaybe "" <$> optField "name" schema) - <*> userHandle .= maybe_ (optField "handle" schema) - <*> userExpire .= maybe_ (optField "expire" schema) + object "User" + $ User + <$> (getOptText . userName) .= maybe_ (fromMaybe "" <$> optField "name" schema) + <*> userHandle .= maybe_ (optField "handle" schema) + <*> userExpire .= maybe_ (optField "expire" schema) where getOptText :: Text -> Maybe Text getOptText "" = Nothing @@ -634,8 +635,8 @@ userSchemaWithDefaultName' = userSchemaWithDefaultName :: ValueSchema NamedSwaggerDoc User userSchemaWithDefaultName = - object "User" $ - User - <$> userName .= (field "name" schema <|> pure "") - <*> userHandle .= maybe_ (optField "handle" schema) - <*> userExpire .= maybe_ (optField "expire" schema) + object "User" + $ User + <$> userName .= (field "name" schema <|> pure "") + <*> userHandle .= maybe_ (optField "handle" schema) + <*> userExpire .= maybe_ (optField "expire" schema) diff --git a/libs/ssl-util/src/Ssl/Util.hs b/libs/ssl-util/src/Ssl/Util.hs index 9f9d8ece4e4..2b72d1c0b9b 100644 --- a/libs/ssl-util/src/Ssl/Util.hs +++ b/libs/ssl-util/src/Ssl/Util.hs @@ -134,20 +134,20 @@ verifyFingerprint hash fprs ssl = do case mfpr of Nothing -> throwIO PinInvalidPubKey Just fp -> do - unless (any (constEqBytes fp) fprs) $ - throwIO PinFingerprintMismatch + unless (any (constEqBytes fp) fprs) + $ throwIO PinFingerprintMismatch vok <- SSL.getVerifyResult ssl unless vok $ do -- Check if the certificate is self-signed. self <- verifyX509 cert pkey - unless (self == VerifySuccess) $ - throwIO PinInvalidCert + unless (self == VerifySuccess) + $ throwIO PinInvalidCert -- For completeness, perform a date check as well. now <- getCurrentTime notBefore <- X509.getNotBefore cert notAfter <- X509.getNotAfter cert - unless (now >= notBefore && now <= notAfter) $ - throwIO PinInvalidCert + unless (now >= notBefore && now <= notAfter) + $ throwIO PinInvalidCert -- [Note: Hostname verification] @@ -156,7 +156,7 @@ verifyFingerprint hash fprs ssl = do -- | Compute a simple (non-standard) fingerprint of an RSA -- public key for use with 'verifyRsaFingerprint' with the given -- 'Digest'. -rsaFingerprint :: RSAKey k => Digest -> k -> IO ByteString +rsaFingerprint :: (RSAKey k) => Digest -> k -> IO ByteString rsaFingerprint d k = fmap (digestLBS d . toLazyByteString) $ do let s = rsaSize k n <- integerToMPI (rsaN k) diff --git a/libs/tasty-cannon/src/Test/Tasty/Cannon.hs b/libs/tasty-cannon/src/Test/Tasty/Cannon.hs index 9775bb718f7..19cb0561a48 100644 --- a/libs/tasty-cannon/src/Test/Tasty/Cannon.hs +++ b/libs/tasty-cannon/src/Test/Tasty/Cannon.hs @@ -103,20 +103,20 @@ data WebSocket = WebSocket wsAppThread :: Async () } -connect :: MonadIO m => Cannon -> UserId -> ConnId -> m WebSocket +connect :: (MonadIO m) => Cannon -> UserId -> ConnId -> m WebSocket connect can uid = connectAsMaybeClient can uid Nothing -connectAsClient :: MonadIO m => Cannon -> UserId -> ClientId -> ConnId -> m WebSocket +connectAsClient :: (MonadIO m) => Cannon -> UserId -> ClientId -> ConnId -> m WebSocket connectAsClient can uid client = connectAsMaybeClient can uid (Just client) -connectAsMaybeClient :: MonadIO m => Cannon -> UserId -> Maybe ClientId -> ConnId -> m WebSocket +connectAsMaybeClient :: (MonadIO m) => Cannon -> UserId -> Maybe ClientId -> ConnId -> m WebSocket connectAsMaybeClient can uid client conn = liftIO $ do nchan <- newTChanIO latch <- newEmptyMVar wsapp <- run can uid client conn (clientApp nchan latch) pure $ WebSocket nchan latch wsapp -close :: MonadIO m => WebSocket -> m () +close :: (MonadIO m) => WebSocket -> m () close ws = liftIO $ do putMVar (wsCloseLatch ws) () void $ waitCatch (wsAppThread ws) @@ -166,10 +166,10 @@ bracketAsClientN c us f = go [] us -- Random Connection IDs -connectR :: MonadIO m => Cannon -> UserId -> m WebSocket +connectR :: (MonadIO m) => Cannon -> UserId -> m WebSocket connectR can uid = randomConnId >>= connect can uid -connectAsClientR :: MonadIO m => Cannon -> UserId -> ClientId -> m WebSocket +connectAsClientR :: (MonadIO m) => Cannon -> UserId -> ClientId -> m WebSocket connectAsClientR can uid clientId = randomConnId >>= connectAsClient can uid clientId bracketR :: (MonadIO m, MonadMask m) => Cannon -> UserId -> (WebSocket -> m a) -> m a @@ -271,7 +271,7 @@ instance Show RegistrationTimeout where show (RegistrationTimeout s) = "Failed to find a registration after " ++ show s ++ " retries.\n" -await :: MonadIO m => Timeout -> WebSocket -> m (Maybe Notification) +await :: (MonadIO m) => Timeout -> WebSocket -> m (Maybe Notification) await t = liftIO . timeout t . atomically . readTChan . wsChan -- | 'await' a 'Notification' on the 'WebSocket'. If it satisfies the 'Assertion', return it. @@ -372,7 +372,7 @@ assertNoEvent t ww = do ----------------------------------------------------------------------------- -- Unpacking Notifications -unpackPayload :: FromJSON a => Notification -> List1 a +unpackPayload :: (FromJSON a) => Notification -> List1 a unpackPayload = fmap decodeEvent . ntfPayload where decodeEvent o = case fromJSON (Object o) of @@ -382,7 +382,7 @@ unpackPayload = fmap decodeEvent . ntfPayload ----------------------------------------------------------------------------- -- Randomness -randomConnId :: MonadIO m => m ConnId +randomConnId :: (MonadIO m) => m ConnId randomConnId = liftIO $ do r <- randomIO :: IO Word32 pure . ConnId $ C.pack $ show r @@ -392,12 +392,12 @@ randomConnId = liftIO $ do -- | Start a client thread in 'Async' that opens a web socket to a Cannon, wait -- for the connection to register with Gundeck, and return the 'Async' thread. -run :: MonadIO m => Cannon -> UserId -> Maybe ClientId -> ConnId -> WS.ClientApp () -> m (Async ()) +run :: (MonadIO m) => Cannon -> UserId -> Maybe ClientId -> ConnId -> WS.ClientApp () -> m (Async ()) run cannon@(($ Http.defaultRequest) -> ca) uid client connId app = liftIO $ do latch <- newEmptyMVar wsapp <- - async $ - WS.runClientWith + async + $ WS.runClientWith caHost caPort caPath @@ -406,7 +406,7 @@ run cannon@(($ Http.defaultRequest) -> ca) uid client connId app = liftIO $ do ( \conn -> putMVar latch () >> app conn ) - `onException` tryPutMVar latch () + `onException` tryPutMVar latch () takeMVar latch stat <- poll wsapp case stat of diff --git a/libs/types-common-journal/src/Data/Proto.hs b/libs/types-common-journal/src/Data/Proto.hs index b0a7de0c4b8..64fed865650 100644 --- a/libs/types-common-journal/src/Data/Proto.hs +++ b/libs/types-common-journal/src/Data/Proto.hs @@ -20,5 +20,5 @@ module Data.Proto where import Data.Time.Clock.POSIX import Imports -now :: MonadIO m => m Int64 +now :: (MonadIO m) => m Int64 now = liftIO $ round . utcTimeToPOSIXSeconds <$> getCurrentTime diff --git a/libs/types-common/src/Data/Code.hs b/libs/types-common/src/Data/Code.hs index ef70a0aeb52..3b2e107bbdf 100644 --- a/libs/types-common/src/Data/Code.hs +++ b/libs/types-common/src/Data/Code.hs @@ -125,7 +125,9 @@ data KeyValuePair = KeyValuePair instance ToSchema KeyValuePair where schema = - object "KeyValuePair" $ - KeyValuePair - <$> key .= field "key" schema - <*> code .= field "code" schema + object "KeyValuePair" + $ KeyValuePair + <$> key + .= field "key" schema + <*> code + .= field "code" schema diff --git a/libs/types-common/src/Data/CommaSeparatedList.hs b/libs/types-common/src/Data/CommaSeparatedList.hs index 36f072914be..6109d362cc9 100644 --- a/libs/types-common/src/Data/CommaSeparatedList.hs +++ b/libs/types-common/src/Data/CommaSeparatedList.hs @@ -37,11 +37,11 @@ newtype CommaSeparatedList a = CommaSeparatedList {fromCommaSeparatedList :: [a] deriving (Functor, Foldable, Traversable) deriving newtype (Bounds, Semigroup, Monoid) -instance FromByteString (List a) => FromHttpApiData (CommaSeparatedList a) where +instance (FromByteString (List a)) => FromHttpApiData (CommaSeparatedList a) where parseUrlPiece t = CommaSeparatedList . fromList <$> Bifunctor.first Text.pack (runParser parser $ encodeUtf8 t) -instance ToByteString (List a) => ToHttpApiData (CommaSeparatedList a) where +instance (ToByteString (List a)) => ToHttpApiData (CommaSeparatedList a) where toQueryParam (CommaSeparatedList l) = decodeUtf8With lenientDecode $ toStrict $ toByteString $ builder $ List l instance ToParamSchema (CommaSeparatedList a) where @@ -51,4 +51,5 @@ instance ToParamSchema (CommaSeparatedList a) where instance (ToParamSchema a, ToParamSchema (Range n m [a])) => ToParamSchema (Range n m (CommaSeparatedList a)) where toParamSchema _ = toParamSchema (Proxy @(Range n m [a])) - & items ?~ OpenApiItemsArray [Inline $ toParamSchema (Proxy @a)] + & items + ?~ OpenApiItemsArray [Inline $ toParamSchema (Proxy @a)] diff --git a/libs/types-common/src/Data/Domain.hs b/libs/types-common/src/Data/Domain.hs index ed74cd230a3..94f9483ef28 100644 --- a/libs/types-common/src/Data/Domain.hs +++ b/libs/types-common/src/Data/Domain.hs @@ -69,8 +69,12 @@ newtype Domain = Domain {_domainText :: Text} instance ToSchema Domain where schema = - domainText .= parsedText "Domain" mkDomain - & doc . S.schema . S.example ?~ "example.com" + domainText + .= parsedText "Domain" mkDomain + & doc + . S.schema + . S.example + ?~ "example.com" domainText :: Domain -> Text domainText = _domainText @@ -93,13 +97,13 @@ instance ToHttpApiData Domain where domainParser :: Atto.Parser Domain domainParser = do parts <- domainLabel `Atto.sepBy1` Atto.char '.' - when (length parts < 2) $ - fail "Invalid domain name: cannot be dotless domain" - when (isDigit (BS.Char8.head (last parts))) $ - fail "Invalid domain name: last label cannot start with digit" + when (length parts < 2) + $ fail "Invalid domain name: cannot be dotless domain" + when (isDigit (BS.Char8.head (last parts))) + $ fail "Invalid domain name: last label cannot start with digit" let bs = BS.intercalate "." parts - when (BS.length bs > 253) $ - fail "Invalid domain name: too long" + when (BS.length bs > 253) + $ fail "Invalid domain name: too long" case Text.E.decodeUtf8' bs of Left err -> fail $ "Invalid UTF-8 in Domain: " <> show err Right txt -> pure . Domain $ Text.toCaseFold txt @@ -107,8 +111,8 @@ domainParser = do domainLabel :: Atto.Parser ByteString domainLabel = do match <- BS.Char8.cons <$> alphaNum <*> takeUpToWhile 62 isAlphaNumHyphen - when (BS.Char8.last match == '-') $ - fail "Invalid domain label: last character is a hyphen" + when (BS.Char8.last match == '-') + $ fail "Invalid domain label: last character is a hyphen" pure match alphaNum = Atto.satisfy isAlphaNum "alphanumeric character" isAlphaNum = Atto.inClass "A-Za-z0-9" diff --git a/libs/types-common/src/Data/ETag.hs b/libs/types-common/src/Data/ETag.hs index c042a042f43..948435e7c62 100644 --- a/libs/types-common/src/Data/ETag.hs +++ b/libs/types-common/src/Data/ETag.hs @@ -67,7 +67,7 @@ data Digest = MD5 | SHA1 -- of arbitrary types to a 'Builder', concatenating them, and applying the hash -- function on the result. data Opaque (d :: Digest) where - Opaque :: ToByteString a => a -> Opaque d + Opaque :: (ToByteString a) => a -> Opaque d instance ToByteString (Opaque 'MD5) where builder (Opaque x) = @@ -80,11 +80,11 @@ instance ToByteString (Opaque 'SHA1) where instance Semigroup (Opaque d) where Opaque a <> Opaque b = Opaque (builder a <> builder b) -opaqueMD5 :: ToByteString a => a -> Opaque 'MD5 +opaqueMD5 :: (ToByteString a) => a -> Opaque 'MD5 opaqueMD5 = Opaque {-# INLINE opaqueMD5 #-} -opaqueSHA1 :: ToByteString a => a -> Opaque 'SHA1 +opaqueSHA1 :: (ToByteString a) => a -> Opaque 'SHA1 opaqueSHA1 = Opaque {-# INLINE opaqueSHA1 #-} @@ -103,11 +103,11 @@ data ETag a | WeakETag !a deriving (Eq, Show) -instance ToByteString a => ToByteString (ETag a) where +instance (ToByteString a) => ToByteString (ETag a) where builder (StrictETag v) = byteString "\"" <> builder v <> byteString "\"" builder (WeakETag v) = byteString "W/\"" <> builder v <> byteString "\"" -instance FromByteString a => FromByteString (ETag a) where +instance (FromByteString a) => FromByteString (ETag a) where parser = do w <- optional (string "W/") v <- char '"' *> takeWhile (/= '"') <* char '"' @@ -115,7 +115,7 @@ instance FromByteString a => FromByteString (ETag a) where Left e -> fail e Right a -> pure $ maybe (StrictETag a) (const $ WeakETag a) w -instance Semigroup a => Semigroup (ETag a) where +instance (Semigroup a) => Semigroup (ETag a) where StrictETag a <> StrictETag b = StrictETag (a <> b) StrictETag a <> WeakETag b = WeakETag (a <> b) WeakETag a <> StrictETag b = WeakETag (a <> b) diff --git a/libs/types-common/src/Data/Id.hs b/libs/types-common/src/Data/Id.hs index 2f57ba3d920..703b1e113d5 100644 --- a/libs/types-common/src/Data/Id.hs +++ b/libs/types-common/src/Data/Id.hs @@ -235,7 +235,7 @@ instance A.ToJSONKey (Id a) where instance A.FromJSONKey (Id a) where fromJSONKey = A.FromJSONKeyTextParser idFromText -randomId :: MonadIO m => m (Id a) +randomId :: (MonadIO m) => m (Id a) randomId = Id <$> liftIO nextRandom idFromText :: Text -> A.Parser (Id a) @@ -332,11 +332,13 @@ instance ToSchema ClientId where where s :: ValueSchemaP NamedSwaggerDoc ClientId Text s = - clientToText .= schema - & doc . S.description - ?~ "A 64-bit unsigned integer, represented as a hexadecimal numeral. \ - \Any valid hexadecimal numeral is accepted, but the backend will only \ - \produce representations with lowercase digits and no leading zeros" + clientToText + .= schema + & doc + . S.description + ?~ "A 64-bit unsigned integer, represented as a hexadecimal numeral. \ + \Any valid hexadecimal numeral is accepted, but the backend will only \ + \produce representations with lowercase digits and no leading zeros" parseClientId :: Text -> A.Parser ClientId parseClientId = either fail pure . runParser parser . encodeUtf8 @@ -420,8 +422,10 @@ newtype RequestId = RequestId instance ToSchema RequestId where schema = - RequestId . encodeUtf8 - <$> (decodeUtf8 . unRequestId) .= text "RequestId" + RequestId + . encodeUtf8 + <$> (decodeUtf8 . unRequestId) + .= text "RequestId" instance ToJSON RequestId where toJSON (RequestId r) = A.String (decodeUtf8 r) @@ -444,7 +448,7 @@ newtype IdObject a = IdObject {fromIdObject :: a} deriving (Eq, Show, Generic) deriving (ToJSON, FromJSON, S.ToSchema) via Schema (IdObject a) -instance ToSchema a => ToSchema (IdObject a) where +instance (ToSchema a) => ToSchema (IdObject a) where schema = idObjectSchema (IdObject <$> fromIdObject .= schema) idObjectSchema :: ValueSchemaP NamedSwaggerDoc a b -> ValueSchemaP NamedSwaggerDoc a b diff --git a/libs/types-common/src/Data/Json/Util.hs b/libs/types-common/src/Data/Json/Util.hs index 87ac386a7c4..0940e9e5caa 100644 --- a/libs/types-common/src/Data/Json/Util.hs +++ b/libs/types-common/src/Data/Json/Util.hs @@ -106,11 +106,11 @@ instance ToSchema UTCTimeMillis where schema = UTCTimeMillis <$> showUTCTimeMillis - .= ( utcTimeTextSchema "UTCTimeMillis" - & doc . S.schema - %~ (S.format ?~ "yyyy-mm-ddThh:MM:ss.qqqZ") - . (S.example ?~ "2021-05-12T10:52:02.671Z") - ) + .= ( utcTimeTextSchema "UTCTimeMillis" + & doc . S.schema + %~ (S.format ?~ "yyyy-mm-ddThh:MM:ss.qqqZ") + . (S.example ?~ "2021-05-12T10:52:02.671Z") + ) utcTimeTextSchema :: Text -> ValueSchemaP NamedSwaggerDoc Text UTCTime utcTimeTextSchema name = @@ -174,8 +174,9 @@ instance S.ToParamSchema A.Object where instance ToSchema A.Object where schema = - named "Object" $ - id .= jsonObject + named "Object" + $ id + .= jsonObject ----------------------------------------------------------------------------- -- toJSONFieldName diff --git a/libs/types-common/src/Data/LegalHold.hs b/libs/types-common/src/Data/LegalHold.hs index 247684fee78..674e775fb07 100644 --- a/libs/types-common/src/Data/LegalHold.hs +++ b/libs/types-common/src/Data/LegalHold.hs @@ -39,12 +39,12 @@ data UserLegalHoldStatus instance ToSchema UserLegalHoldStatus where schema = - (S.schema . description ?~ desc) $ - enum @Text "UserLegalHoldStatus" $ - element "enabled" UserLegalHoldEnabled - <> element "pending" UserLegalHoldPending - <> element "disabled" UserLegalHoldDisabled - <> element "no_consent" UserLegalHoldNoConsent + (S.schema . description ?~ desc) + $ enum @Text "UserLegalHoldStatus" + $ element "enabled" UserLegalHoldEnabled + <> element "pending" UserLegalHoldPending + <> element "disabled" UserLegalHoldDisabled + <> element "no_consent" UserLegalHoldNoConsent where desc = "states whether a user is under legal hold, " diff --git a/libs/types-common/src/Data/List1.hs b/libs/types-common/src/Data/List1.hs index 8a1d31555d2..21be4f47f70 100644 --- a/libs/types-common/src/Data/List1.hs +++ b/libs/types-common/src/Data/List1.hs @@ -64,10 +64,11 @@ head :: List1 a -> a head = N.head . toNonEmpty {-# INLINE head #-} -instance ToSchema a => ToSchema (List1 a) where +instance (ToSchema a) => ToSchema (List1 a) where schema = - named "List1" $ - toNonEmpty S..= fmap List1 (nonEmptyArray S.schema) + named "List1" + $ toNonEmpty + S..= fmap List1 (nonEmptyArray S.schema) instance Swagger.ToParamSchema (List1 a) where toParamSchema _ = diff --git a/libs/types-common/src/Data/Misc.hs b/libs/types-common/src/Data/Misc.hs index 837c24d18c2..832c939339b 100644 --- a/libs/types-common/src/Data/Misc.hs +++ b/libs/types-common/src/Data/Misc.hs @@ -239,10 +239,10 @@ instance ToSchema HttpsUrl where schema = (decodeUtf8 . toByteString') .= parsedText "HttpsUrl" (runParser parser . encodeUtf8) - & doc' + & doc' . S.schema . S.example - ?~ toJSON ("https://example.com" :: Text) + ?~ toJSON ("https://example.com" :: Text) instance Cql HttpsUrl where ctype = Tagged BlobColumn @@ -288,10 +288,10 @@ instance ToSchema (Fingerprint Rsa) where schema = (decodeUtf8 . B64.encode . fingerprintBytes) .= parsedText "Fingerprint" (runParser p . encodeUtf8) - & doc' + & doc' . S.schema . S.example - ?~ toJSON ("ioy3GeIjgQRsobf2EKGO3O8mq/FofFxHRqy0T4ERIZ8=" :: Text) + ?~ toJSON ("ioy3GeIjgQRsobf2EKGO3O8mq/FofFxHRqy0T4ERIZ8=" :: Text) where p :: Chars.Parser (Fingerprint Rsa) p = do @@ -307,8 +307,8 @@ instance Cql (Fingerprint a) where instance Arbitrary (Fingerprint Rsa) where arbitrary = - pure $ - Fingerprint + pure + $ Fingerprint "\138\140\183\EM\226#\129\EOTl\161\183\246\DLE\161\142\220\239&\171\241h|\\GF\172\180O\129\DC1!\159" -------------------------------------------------------------------------------- @@ -341,9 +341,9 @@ newtype PlainTextPassword' (minLen :: Nat) = PlainTextPassword' {fromPlainTextPassword' :: Range minLen (1024 :: Nat) Text} deriving stock (Eq, Generic) -deriving via (Schema (PlainTextPassword' tag)) instance ToSchema (PlainTextPassword' tag) => FromJSON (PlainTextPassword' tag) +deriving via (Schema (PlainTextPassword' tag)) instance (ToSchema (PlainTextPassword' tag)) => FromJSON (PlainTextPassword' tag) -deriving via (Schema (PlainTextPassword' tag)) instance ToSchema (PlainTextPassword' tag) => ToJSON (PlainTextPassword' tag) +deriving via (Schema (PlainTextPassword' tag)) instance (ToSchema (PlainTextPassword' tag)) => ToJSON (PlainTextPassword' tag) deriving via (Schema (PlainTextPassword' tag)) instance (KnownNat tag, ToSchema (PlainTextPassword' tag)) => S.ToSchema (PlainTextPassword' tag) @@ -368,12 +368,12 @@ newtype FutureWork label payload = FutureWork payload ------------------------------------------------------------------------------- -- | Same as 'read' but works on 'Text' -readT :: Read a => Text -> Maybe a +readT :: (Read a) => Text -> Maybe a readT = readMaybe . Text.unpack {-# INLINE readT #-} -- | Same as 'show' but works on 'Text' -showT :: Show a => a -> Text +showT :: (Show a) => a -> Text showT = Text.pack . show {-# INLINE showT #-} diff --git a/libs/types-common/src/Data/Nonce.hs b/libs/types-common/src/Data/Nonce.hs index 50d84f7c655..ca5c502f1ed 100644 --- a/libs/types-common/src/Data/Nonce.hs +++ b/libs/types-common/src/Data/Nonce.hs @@ -84,7 +84,7 @@ instance FromHttpApiData Nonce where . fromStrict . encodeUtf8 -randomNonce :: MonadIO m => m Nonce +randomNonce :: (MonadIO m) => m Nonce randomNonce = Nonce <$> liftIO nextRandom isValidBase64UrlEncodedUUID :: ByteString -> Bool diff --git a/libs/types-common/src/Data/Qualified.hs b/libs/types-common/src/Data/Qualified.hs index 1c1ba088e10..9b0ee9f044a 100644 --- a/libs/types-common/src/Data/Qualified.hs +++ b/libs/types-common/src/Data/Qualified.hs @@ -131,25 +131,25 @@ foldQualified loc f g q -- Note that the local values are returned as unqualified values, as a (probably -- insignificant) optimisation. Use 'partitionQualifiedAndTag' to get them as -- 'Local' values. -partitionQualified :: Foldable f => Local x -> f (Qualified a) -> ([a], [Remote a]) +partitionQualified :: (Foldable f) => Local x -> f (Qualified a) -> ([a], [Remote a]) partitionQualified loc = - foldMap $ - foldQualified loc (\l -> ([tUnqualified l], mempty)) (\r -> (mempty, [r])) + foldMap + $ foldQualified loc (\l -> ([tUnqualified l], mempty)) (\r -> (mempty, [r])) -partitionQualifiedAndTag :: Foldable f => Local x -> f (Qualified a) -> ([Local a], [Remote a]) +partitionQualifiedAndTag :: (Foldable f) => Local x -> f (Qualified a) -> ([Local a], [Remote a]) partitionQualifiedAndTag loc = first (map (qualifyAs loc)) . partitionQualified loc -- | Index a list of qualified values by domain. -indexQualified :: Foldable f => f (Qualified a) -> Map Domain [a] +indexQualified :: (Foldable f) => f (Qualified a) -> Map Domain [a] indexQualified = foldr add mempty where add :: Qualified a -> Map Domain [a] -> Map Domain [a] add (Qualified x domain) = Map.insertWith (<>) domain [x] -- | Bucket a list of qualified values by domain. -bucketQualified :: Foldable f => f (Qualified a) -> [Qualified [a]] +bucketQualified :: (Foldable f) => f (Qualified a) -> [Qualified [a]] bucketQualified = map (\(d, a) -> Qualified a d) . Map.assocs . indexQualified bucketRemote :: (Functor f, Foldable f) => f (Remote a) -> [Remote [a]] @@ -166,40 +166,42 @@ isLocal loc = foldQualified loc (const True) (const False) deprecatedSchema :: (S.HasDeprecated doc (Maybe Bool), S.HasDescription doc (Maybe Text)) => Text -> ValueSchema doc a -> ValueSchema doc a deprecatedSchema new = - over doc $ - (description ?~ ("Deprecated, use " <> new)) - . (deprecated ?~ True) + over doc + $ (description ?~ ("Deprecated, use " <> new)) + . (deprecated ?~ True) qualifiedSchema :: - HasSchemaRef doc => + (HasSchemaRef doc) => Text -> Text -> ValueSchema doc a -> ValueSchema NamedSwaggerDoc (Qualified a) qualifiedSchema name fieldName sch = - object ("Qualified_" <> name) $ - qualifiedObjectSchema fieldName sch + object ("Qualified_" <> name) + $ qualifiedObjectSchema fieldName sch qualifiedObjectSchema :: - HasSchemaRef d => + (HasSchemaRef d) => Text -> ValueSchema d a -> ObjectSchema SwaggerDoc (Qualified a) qualifiedObjectSchema fieldName sch = flip Qualified - <$> qDomain .= field "domain" schema - <*> qUnqualified .= field fieldName sch + <$> qDomain + .= field "domain" schema + <*> qUnqualified + .= field fieldName sch -instance KnownIdTag t => ToSchema (Qualified (Id t)) where +instance (KnownIdTag t) => ToSchema (Qualified (Id t)) where schema = qualifiedSchema (idTagName (idTagValue @t) <> "Id") "id" schema instance ToSchema (Qualified Handle) where schema = qualifiedSchema "Handle" "handle" schema -instance KnownIdTag t => ToJSON (Qualified (Id t)) where +instance (KnownIdTag t) => ToJSON (Qualified (Id t)) where toJSON = schemaToJSON -instance KnownIdTag t => FromJSON (Qualified (Id t)) where +instance (KnownIdTag t) => FromJSON (Qualified (Id t)) where parseJSON = schemaParseJSON instance (Typeable t, KnownIdTag t) => S.ToSchema (Qualified (Id t)) where @@ -217,5 +219,5 @@ instance S.ToSchema (Qualified Handle) where ---------------------------------------------------------------------- -- ARBITRARY -instance Arbitrary a => Arbitrary (Qualified a) where +instance (Arbitrary a) => Arbitrary (Qualified a) where arbitrary = Qualified <$> arbitrary <*> arbitrary diff --git a/libs/types-common/src/Data/Range.hs b/libs/types-common/src/Data/Range.hs index d7a92f08d11..d318f23d263 100644 --- a/libs/types-common/src/Data/Range.hs +++ b/libs/types-common/src/Data/Range.hs @@ -109,7 +109,7 @@ instance (Show a, Num a, Within a n m, KnownNat n, KnownNat m) => Bounded (Range instance NFData (Range n m a) where rnf (Range a) = seq a () -instance ToJSON a => ToJSON (Range n m a) where +instance (ToJSON a) => ToJSON (Range n m a) where toJSON = toJSON . fromRange instance forall a n m. (KnownNat n, KnownNat m, Within a n m, FromJSON a) => FromJSON (Range n m a) where @@ -135,47 +135,48 @@ untypedRangedSchema :: untypedRangedSchema n m sch = (sch `withParser` check) & doc %~ rangedSchemaDocModifier (Proxy @b) n m where check x = - x <$ guard (within x n m) + x + <$ guard (within x n m) <|> fail (errorMsg n m "") -class Bounds a => HasRangedSchemaDocModifier d a where +class (Bounds a) => HasRangedSchemaDocModifier d a where rangedSchemaDocModifier :: Proxy a -> Integer -> Integer -> d -> d -listRangedSchemaDocModifier :: S.HasSchema d S.Schema => Integer -> Integer -> d -> d +listRangedSchemaDocModifier :: (S.HasSchema d S.Schema) => Integer -> Integer -> d -> d listRangedSchemaDocModifier n m = S.schema %~ ((S.minItems ?~ n) . (S.maxItems ?~ m)) -stringRangedSchemaDocModifier :: S.HasSchema d S.Schema => Integer -> Integer -> d -> d +stringRangedSchemaDocModifier :: (S.HasSchema d S.Schema) => Integer -> Integer -> d -> d stringRangedSchemaDocModifier n m = S.schema %~ ((S.minLength ?~ n) . (S.maxLength ?~ m)) -numRangedSchemaDocModifier :: S.HasSchema d S.Schema => Integer -> Integer -> d -> d +numRangedSchemaDocModifier :: (S.HasSchema d S.Schema) => Integer -> Integer -> d -> d numRangedSchemaDocModifier n m = S.schema %~ ((S.minimum_ ?~ fromIntegral n) . (S.maximum_ ?~ fromIntegral m)) -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d [a] where rangedSchemaDocModifier _ = listRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d [a] where rangedSchemaDocModifier _ = listRangedSchemaDocModifier -- Sets are similar to lists, so use that as our defininition -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d (Set a) where rangedSchemaDocModifier _ = listRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d (Set a) where rangedSchemaDocModifier _ = listRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Text where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Text where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d String where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d String where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d (AsciiText c) where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d (AsciiText c) where rangedSchemaDocModifier _ = stringRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Int where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Int where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Int32 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Int32 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Integer where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Integer where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Word where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Word where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Word8 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Word8 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Word16 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Word16 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Word32 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Word32 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier -instance S.HasSchema d S.Schema => HasRangedSchemaDocModifier d Word64 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier +instance (S.HasSchema d S.Schema) => HasRangedSchemaDocModifier d Word64 where rangedSchemaDocModifier _ = numRangedSchemaDocModifier instance (KnownNat n, KnownNat m, Within a n m, ToSchema a, HasRangedSchemaDocModifier NamedSwaggerDoc a) => ToSchema (Range n m a) where schema = fromRange .= rangedSchema schema @@ -214,26 +215,34 @@ instance (KnownNat n, KnownNat m) => ToParamSchema (Range n m Word64) where toPa instance (ToParamSchema a, KnownNat n, KnownNat m) => ToParamSchema (Range n m [a]) where toParamSchema _ = toParamSchema (Proxy @[a]) - & S.minItems ?~ fromKnownNat (Proxy @n) - & S.maxItems ?~ fromKnownNat (Proxy @m) + & S.minItems + ?~ fromKnownNat (Proxy @n) + & S.maxItems + ?~ fromKnownNat (Proxy @m) instance (KnownNat n, KnownNat m) => ToParamSchema (Range n m String) where toParamSchema _ = toParamSchema (Proxy @String) - & S.maxLength ?~ fromKnownNat (Proxy @n) - & S.minLength ?~ fromKnownNat (Proxy @m) + & S.maxLength + ?~ fromKnownNat (Proxy @n) + & S.minLength + ?~ fromKnownNat (Proxy @m) instance (KnownNat n, KnownNat m) => ToParamSchema (Range n m T.Text) where toParamSchema _ = toParamSchema (Proxy @T.Text) - & S.maxLength ?~ fromKnownNat (Proxy @n) - & S.minLength ?~ fromKnownNat (Proxy @m) + & S.maxLength + ?~ fromKnownNat (Proxy @n) + & S.minLength + ?~ fromKnownNat (Proxy @m) instance (KnownNat n, KnownNat m) => ToParamSchema (Range n m TL.Text) where toParamSchema _ = toParamSchema (Proxy @TL.Text) - & S.maxLength ?~ fromKnownNat (Proxy @n) - & S.minLength ?~ fromKnownNat (Proxy @m) + & S.maxLength + ?~ fromKnownNat (Proxy @n) + & S.minLength + ?~ fromKnownNat (Proxy @m) instance (KnownNat n, S.ToSchema a, KnownNat m) => S.ToSchema (Range n m a) where declareNamedSchema _ = @@ -246,7 +255,7 @@ instance (KnownNat n, KnownNat m, Within a n m, FromHttpApiData a) => FromHttpAp type Within a (n :: Nat) (m :: Nat) = (Bounds a, n <= m) -mk :: Bounds a => a -> Nat -> Nat -> Maybe (Range n m a) +mk :: (Bounds a) => a -> Nat -> Nat -> Maybe (Range n m a) mk a n m = if within a (toInteger n) (toInteger m) then Just (Range a) @@ -263,7 +272,7 @@ errorMsg n m = . shows m . showString "]" -checkedEitherMsg :: forall a n m. (KnownNat n, KnownNat m) => Within a n m => String -> a -> Either String (Range n m a) +checkedEitherMsg :: forall a n m. (KnownNat n, KnownNat m) => (Within a n m) => String -> a -> Either String (Range n m a) checkedEitherMsg msg x = do let sn = natVal (Proxy @n) sm = natVal (Proxy @m) @@ -271,7 +280,7 @@ checkedEitherMsg msg x = do Nothing -> Left $ showString msg . showString ": " . errorMsg sn sm $ "" Just r -> Right r -checkedEither :: forall a n m. (KnownNat n, KnownNat m) => Within a n m => a -> Either String (Range n m a) +checkedEither :: forall a n m. (KnownNat n, KnownNat m) => (Within a n m) => a -> Either String (Range n m a) checkedEither x = do let sn = natVal (Proxy @n) sm = natVal (Proxy @m) @@ -300,10 +309,10 @@ unsafeRange x = fromMaybe msg (checked x) rcast :: (n <= m, m <= m', n >= n') => Range n m a -> Range n' m' a rcast (Range a) = Range a -rnil :: Monoid a => Range 0 0 a +rnil :: (Monoid a) => Range 0 0 a rnil = Range mempty -rcons, (<|) :: n <= m => a -> Range n m [a] -> Range n (m + 1) [a] +rcons, (<|) :: (n <= m) => a -> Range n m [a] -> Range n (m + 1) [a] rcons a (Range aa) = Range (a : aa) infixr 5 <| @@ -322,8 +331,10 @@ rsingleton = Range . pure rangedNumToParamSchema :: forall a n m. (ToParamSchema a, Num a, KnownNat n, KnownNat m) => Proxy (Range n m a) -> Schema rangedNumToParamSchema _ = toParamSchema (Proxy @a) - & S.minimum_ ?~ fromKnownNat (Proxy @n) - & S.maximum_ ?~ fromKnownNat (Proxy @m) + & S.minimum_ + ?~ fromKnownNat (Proxy @n) + & S.maximum_ + ?~ fromKnownNat (Proxy @m) ----------------------------------------------------------------------------- @@ -397,7 +408,7 @@ instance Bounds (HashMap k a) where instance Bounds (HashSet a) where within x y z = rangeCheck (length (take (fromIntegral z + 1) (HashSet.toList x))) y z -instance Bounds a => Bounds (Maybe a) where +instance (Bounds a) => Bounds (Maybe a) where within Nothing _ _ = True within (Just x) y z = within x y z @@ -420,7 +431,7 @@ instance (KnownNat n, KnownNat m, Within a n m, FromByteString a) => FromByteStr where msg = fail (errorMsg (natVal (Proxy @n)) (natVal (Proxy @m)) "") -instance ToByteString a => ToByteString (Range n m a) where +instance (ToByteString a) => ToByteString (Range n m a) where builder = builder . fromRange ---------------------------------------------------------------------------- @@ -430,7 +441,7 @@ instance ToByteString a => ToByteString (Range n m a) where newtype Ranged m n a = Ranged {fromRanged :: a} deriving stock (Show) -instance Arbitrary (Range m n a) => Arbitrary (Ranged m n a) where +instance (Arbitrary (Range m n a)) => Arbitrary (Ranged m n a) where arbitrary = Ranged . fromRange <$> arbitrary @(Range m n a) instance @@ -497,7 +508,8 @@ genRange :: Gen a -> Gen (Range n m b) genRange pack_ gc = - unsafeRange @b @n @m . pack_ + unsafeRange @b @n @m + . pack_ <$> grange (fromKnownNat (Proxy @n)) (fromKnownNat (Proxy @m)) diff --git a/libs/types-common/src/Data/SizedHashMap.hs b/libs/types-common/src/Data/SizedHashMap.hs index 81494390103..b7070a6b2fc 100644 --- a/libs/types-common/src/Data/SizedHashMap.hs +++ b/libs/types-common/src/Data/SizedHashMap.hs @@ -44,7 +44,7 @@ size (SizedHashMap s _) = s empty :: forall k v. SizedHashMap k v empty = SizedHashMap 0 M.empty -insert :: forall k v. Hashable k => k -> v -> SizedHashMap k v -> SizedHashMap k v +insert :: forall k v. (Hashable k) => k -> v -> SizedHashMap k v -> SizedHashMap k v insert k v (SizedHashMap n hm) = SizedHashMap n' hm' where n' = if M.member k hm then n else n + 1 @@ -59,10 +59,10 @@ elems (SizedHashMap _ hm) = M.elems hm toList :: forall k v. SizedHashMap k v -> [(k, v)] toList (SizedHashMap _ hm) = M.toList hm -lookup :: forall k v. Hashable k => k -> SizedHashMap k v -> Maybe v +lookup :: forall k v. (Hashable k) => k -> SizedHashMap k v -> Maybe v lookup k (SizedHashMap _ hm) = M.lookup k hm -delete :: forall k v. Hashable k => k -> SizedHashMap k v -> SizedHashMap k v +delete :: forall k v. (Hashable k) => k -> SizedHashMap k v -> SizedHashMap k v delete k (SizedHashMap n hm) = SizedHashMap n' hm' where n' = if M.member k hm then n - 1 else n diff --git a/libs/types-common/src/Data/Text/Ascii.hs b/libs/types-common/src/Data/Text/Ascii.hs index 0fac4b07e2f..2becd787845 100644 --- a/libs/types-common/src/Data/Text/Ascii.hs +++ b/libs/types-common/src/Data/Text/Ascii.hs @@ -138,36 +138,36 @@ class AsciiChars c where -- | Note: Assumes UTF8 encoding. If the bytestring is known to -- be in a different encoding, 'validate' the text after decoding it with -- the correct encoding instead of using this instance. -instance AsciiChars c => FromByteString (AsciiText c) where +instance (AsciiChars c) => FromByteString (AsciiText c) where parser = parseBytes validate -- | Note: 'fromString' is a partial function that will 'error' when given -- a string containing characters not in the set @c@. It is only intended to be used -- via the @OverloadedStrings@ extension, i.e. for known ASCII string literals. -instance AsciiChars c => IsString (AsciiText c) where +instance (AsciiChars c) => IsString (AsciiText c) where fromString = unsafeString validate -instance AsciiChars c => ToSchema (AsciiText c) where +instance (AsciiChars c) => ToSchema (AsciiText c) where schema = toText .= parsedText "ASCII" validate -instance AsciiChars c => ToJSON (AsciiText c) where +instance (AsciiChars c) => ToJSON (AsciiText c) where toJSON = schemaToJSON -instance AsciiChars c => FromJSON (AsciiText c) where +instance (AsciiChars c) => FromJSON (AsciiText c) where parseJSON = schemaParseJSON instance (Typeable c, AsciiChars c) => S.ToSchema (AsciiText c) where declareNamedSchema = schemaToSwagger -instance AsciiChars c => Cql (AsciiText c) where +instance (AsciiChars c) => Cql (AsciiText c) where ctype = Tagged AsciiColumn toCql = CqlAscii . toText fromCql = fmap (unsafeFromText . fromAscii) . fromCql -fromAsciiChars :: AsciiChars c => [AsciiChar c] -> AsciiText c +fromAsciiChars :: (AsciiChars c) => [AsciiChar c] -> AsciiText c fromAsciiChars = fromString . map toChar -fromChar :: AsciiChars c => c -> Char -> Maybe (AsciiChar c) +fromChar :: (AsciiChars c) => c -> Char -> Maybe (AsciiChar c) fromChar c char | contains c char = Just (AsciiChar char) | otherwise = Nothing @@ -249,9 +249,12 @@ instance AsciiChars Base64 where isAsciiLower c || isAsciiUpper c || isDigit c - || c == '+' - || c == '/' - || c == '=' + || c + == '+' + || c + == '/' + || c + == '=' {-# INLINE contains #-} validateBase64 :: Text -> Either String AsciiBase64 @@ -297,9 +300,12 @@ instance AsciiChars Base64Url where isAsciiLower c || isAsciiUpper c || isDigit c - || c == '-' - || c == '_' - || c == '=' + || c + == '-' + || c + == '_' + || c + == '=' {-# INLINE contains #-} validateBase64Url :: Text -> Either String AsciiBase64Url @@ -379,13 +385,13 @@ widenChar (AsciiChar t) = AsciiChar t -- | Construct 'AsciiText' from a known ASCII 'Text'. -- This is a total function but unsafe because the text is not checked -- for non-ASCII characters. -unsafeFromText :: AsciiChars c => Text -> AsciiText c +unsafeFromText :: (AsciiChars c) => Text -> AsciiText c unsafeFromText = AsciiText -- | Construct 'AsciiText' from a known ASCII 'ByteString'. -- This is a total function but unsafe because the bytestring is not checked -- for non-ASCII characters. -unsafeFromByteString :: AsciiChars c => ByteString -> AsciiText c +unsafeFromByteString :: (AsciiChars c) => ByteString -> AsciiText c unsafeFromByteString = AsciiText . decodeLatin1 -------------------------------------------------------------------------------- diff --git a/libs/types-common/src/Data/UUID/Tagged.hs b/libs/types-common/src/Data/UUID/Tagged.hs index 5f573d38dfb..172fd78d9a6 100644 --- a/libs/types-common/src/Data/UUID/Tagged.hs +++ b/libs/types-common/src/Data/UUID/Tagged.hs @@ -58,9 +58,9 @@ data V5 instance Version V5 where versionValue = 5 -mk :: forall v. Version v => D.UUID -> UUID v -mk u = UUID $ - case D.toWords u of +mk :: forall v. (Version v) => D.UUID -> UUID v +mk u = UUID + $ case D.toWords u of (x0, x1, x2, x3) -> D.fromWords x0 @@ -87,8 +87,8 @@ addv4 :: UUID V4 -> UUID V4 -> UUID V4 addv4 (UUID a) (UUID b) = let (x0, x1, x2, x3) = D.toWords a (y0, y1, y2, y3) = D.toWords b - in UUID $ - D.fromWords + in UUID + $ D.fromWords (x0 + y0) (retainVersion 4 (x1 + y1)) (retainVariant 2 (x2 + y2)) diff --git a/libs/types-common/src/Util/Options.hs b/libs/types-common/src/Util/Options.hs index f9beac14583..de2e0b76ae1 100644 --- a/libs/types-common/src/Util/Options.hs +++ b/libs/types-common/src/Util/Options.hs @@ -59,16 +59,18 @@ instance FromByteString AWSEndpoint where awsPort <- case urlPort url of Just p -> pure p Nothing -> - pure $ - if secure + pure + $ if secure then 443 else 80 pure $ AWSEndpoint awsHost secure awsPort instance FromJSON AWSEndpoint where parseJSON = - withText "AWSEndpoint" $ - either fail pure . runParser parser . encodeUtf8 + withText "AWSEndpoint" + $ either fail pure + . runParser parser + . encodeUtf8 urlPort :: URIRef Absolute -> Maybe Int urlPort u = do @@ -102,7 +104,7 @@ loadSecret (FilePathSecrets p) = do -- instead of the command line. getOptions :: forall a. - FromJSON a => + (FromJSON a) => -- | Program description String -> -- | CLI parser for the options (if there is no config) @@ -112,8 +114,8 @@ getOptions :: IO a getOptions desc mp defaultPath = do (path, mOpts) <- - execParser $ - info + execParser + $ info (optsOrConfigFile <**> helper) (header desc <> fullDesc) exists <- doesFileExist path @@ -122,10 +124,10 @@ getOptions desc mp defaultPath = do (True, _) -> do decodeFileEither path >>= \case Left e -> - fail $ - show e - <> " while attempting to decode " - <> path + fail + $ show e + <> " while attempting to decode " + <> path Right o -> pure o -- config doesn't exist, take options from command line (False, Just opts) -> pure opts @@ -150,7 +152,7 @@ parseAWSEndpoint = readerAsk >>= maybe (error "Could not parse AWS endpoint") pu discoUrlParser :: Parser Text discoUrlParser = - textOption $ - long "disco-url" - <> metavar "URL" - <> help "klabautermann url" + textOption + $ long "disco-url" + <> metavar "URL" + <> help "klabautermann url" diff --git a/libs/types-common/src/Util/Test.hs b/libs/types-common/src/Util/Test.hs index 33a185e713c..6b34dceb3b1 100644 --- a/libs/types-common/src/Util/Test.hs +++ b/libs/types-common/src/Util/Test.hs @@ -33,9 +33,9 @@ instance IsOption IntegrationConfigFile where optionName = pure "integration-config" optionHelp = pure "Integration config file to read from" optionCLParser = - fmap IntegrationConfigFile $ - strOption $ - ( short (untag (pure 'i' :: Tagged IntegrationConfigFile Char)) + fmap IntegrationConfigFile + $ strOption + $ ( short (untag (pure 'i' :: Tagged IntegrationConfigFile Char)) <> long (untag (optionName :: Tagged IntegrationConfigFile String)) <> help (untag (optionHelp :: Tagged IntegrationConfigFile String)) ) diff --git a/libs/types-common/src/Wire/Arbitrary.hs b/libs/types-common/src/Wire/Arbitrary.hs index 59c4504eedf..516ea477dd2 100644 --- a/libs/types-common/src/Wire/Arbitrary.hs +++ b/libs/types-common/src/Wire/Arbitrary.hs @@ -88,10 +88,10 @@ customSizedOpts = nonEmptyListOf' :: Gen a -> Gen (NonEmpty a) nonEmptyListOf' g = (:|) <$> g <*> listOf' g -setOf' :: Ord a => Gen a -> Gen (Set a) +setOf' :: (Ord a) => Gen a -> Gen (Set a) setOf' g = Set.fromList <$> Generic.listOf' g -mapOf' :: Ord k => Gen k -> Gen v -> Gen (Map k v) +mapOf' :: (Ord k) => Gen k -> Gen v -> Gen (Map k v) mapOf' genK genV = Map.fromList <$> Generic.listOf' (liftA2 (,) genK genV) -------------------------------------------------------------------------------- @@ -116,7 +116,7 @@ deriving via (GenericUniform CountryCode) instance Arbitrary CountryCode -- we cannot rely on swagger-ui to generate nice examples. So far, this is only -- required for maps as swagger2 doesn't have a good way to specify the type of -- keys. -generateExample :: Arbitrary a => a +generateExample :: (Arbitrary a) => a generateExample = let (MkGen f) = arbitrary in f (mkQCGen 42) 42 diff --git a/libs/types-common/test/Main.hs b/libs/types-common/test/Main.hs index 045e49e5e7e..6b3743ad713 100644 --- a/libs/types-common/test/Main.hs +++ b/libs/types-common/test/Main.hs @@ -31,8 +31,8 @@ import Test.Tasty main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Properties.tests, SizedHashMap.tests, diff --git a/libs/types-common/test/Test/Domain.hs b/libs/types-common/test/Test/Domain.hs index 87c93cbac9f..e3164ea2b5d 100644 --- a/libs/types-common/test/Test/Domain.hs +++ b/libs/types-common/test/Test/Domain.hs @@ -67,10 +67,10 @@ testDomainSerialization = case mkDomain h of Left _ -> pure () Right parsed -> assertFailure $ "invalid domain parsed successfully: " <> show (h, parsed), - testProperty "Arbitrary DomainText generates valid domains" $ - \(DomainText x) -> + testProperty "Arbitrary DomainText generates valid domains" + $ \(DomainText x) -> isRight $ mkDomain x, - testProperty "parsing a domain normalizes it" $ - \(DomainText x) -> + testProperty "parsing a domain normalizes it" + $ \(DomainText x) -> (domainText <$> mkDomain x) === Right (Text.toCaseFold x) ] diff --git a/libs/types-common/test/Test/Handle.hs b/libs/types-common/test/Test/Handle.hs index 0f6bc8b3352..72dbec953ea 100644 --- a/libs/types-common/test/Test/Handle.hs +++ b/libs/types-common/test/Test/Handle.hs @@ -65,10 +65,10 @@ testHandleSerialization = case parseHandleEither h of Left _ -> pure () Right parsed -> assertFailure $ "invalid handle parsed successfully: " <> show (h, parsed), - testProperty "roundtrip for Handle" $ - \(x :: Handle) -> + testProperty "roundtrip for Handle" + $ \(x :: Handle) -> parseHandleEither (fromHandle x) === Right x, - testProperty "roundtrip for BadHandle" $ - \(x :: BadHandle) -> + testProperty "roundtrip for BadHandle" + $ \(x :: BadHandle) -> property . isLeft . parseHandleEither $ fromBadHandle x ] diff --git a/libs/types-common/test/Test/Properties.hs b/libs/types-common/test/Test/Properties.hs index fbd1de60122..c71526a7a18 100644 --- a/libs/types-common/test/Test/Properties.hs +++ b/libs/types-common/test/Test/Properties.hs @@ -56,62 +56,62 @@ tests = "Properties" [ testGroup "Ascii" - [ testProperty "validate (toText x) == Right x" $ - \(a :: Ascii) -> Ascii.validate (Ascii.toText a) == Right a, - testProperty "unsafeFromByteString (toByteString x) == x" $ - \(encodeBase64 -> a) -> Ascii.unsafeFromByteString (toByteString' a) == a, + [ testProperty "validate (toText x) == Right x" + $ \(a :: Ascii) -> Ascii.validate (Ascii.toText a) == Right a, + testProperty "unsafeFromByteString (toByteString x) == x" + $ \(encodeBase64 -> a) -> Ascii.unsafeFromByteString (toByteString' a) == a, -- (unsafeFromByteString occasionally fails on Ascii strings) - testProperty "validate (toText x <> \"𝄞\") /= Right x" $ - \(a :: Ascii) -> Ascii.validate (Ascii.toText a <> "𝄞") /= Right a + testProperty "validate (toText x <> \"𝄞\") /= Right x" + $ \(a :: Ascii) -> Ascii.validate (Ascii.toText a <> "𝄞") /= Right a ], testGroup "Ascii (Printable)" - [ testProperty "contains Printable c ==> contains Standard c" $ - \(c :: Char) -> Ascii.contains Ascii.Printable c ==> Ascii.contains Ascii.Standard c + [ testProperty "contains Printable c ==> contains Standard c" + $ \(c :: Char) -> Ascii.contains Ascii.Printable c ==> Ascii.contains Ascii.Standard c ], testGroup "Ascii (Base16)" - [ testProperty "validate (toText (encode x)) == Right (encode x)" $ - \(s :: String) -> + [ testProperty "validate (toText (encode x)) == Right (encode x)" + $ \(s :: String) -> let a = Ascii.encodeBase16 (C8.pack s) in Ascii.validate (Ascii.toText a) == Right a, - testProperty "decode . encode = id" $ - \(s :: String) -> + testProperty "decode . encode = id" + $ \(s :: String) -> let bs = C8.pack s in Ascii.decodeBase16 (Ascii.encodeBase16 bs) == Just bs, - testProperty "contains Base16 c ==> contains Standard c" $ - \(c :: Char) -> Ascii.contains Ascii.Base16 c ==> Ascii.contains Ascii.Standard c + testProperty "contains Base16 c ==> contains Standard c" + $ \(c :: Char) -> Ascii.contains Ascii.Base16 c ==> Ascii.contains Ascii.Standard c ], testGroup "Ascii (Base64)" - [ testProperty "validate (toText (encode x)) == Right (encode x)" $ - \(s :: String) -> + [ testProperty "validate (toText (encode x)) == Right (encode x)" + $ \(s :: String) -> let a = Ascii.encodeBase64 (C8.pack s) in Ascii.validate (Ascii.toText a) == Right a, - testProperty "decode . encode = id" $ - \(s :: String) -> + testProperty "decode . encode = id" + $ \(s :: String) -> let bs = C8.pack s in Ascii.decodeBase64 (Ascii.encodeBase64 bs) == Just bs, - testProperty "contains Base64 c ==> contains Standard c" $ - \(c :: Char) -> Ascii.contains Ascii.Base64 c ==> Ascii.contains Ascii.Standard c + testProperty "contains Base64 c ==> contains Standard c" + $ \(c :: Char) -> Ascii.contains Ascii.Base64 c ==> Ascii.contains Ascii.Standard c ], testGroup "Ascii (Base64Url)" - [ testProperty "validate (toText (encode x)) == Right (encode x)" $ - \(s :: String) -> + [ testProperty "validate (toText (encode x)) == Right (encode x)" + $ \(s :: String) -> let a = Ascii.encodeBase64Url (C8.pack s) in Ascii.validate (Ascii.toText a) == Right a, - testProperty "decode . encode = id" $ - \(s :: String) -> + testProperty "decode . encode = id" + $ \(s :: String) -> let bs = C8.pack s in Ascii.decodeBase64Url (Ascii.encodeBase64Url bs) == Just bs, - testProperty "contains Base64Url c ==> contains Standard c" $ - \(c :: Char) -> Ascii.contains Ascii.Base64Url c ==> Ascii.contains Ascii.Standard c + testProperty "contains Base64Url c ==> contains Standard c" + $ \(c :: Char) -> Ascii.contains Ascii.Base64Url c ==> Ascii.contains Ascii.Standard c ], testGroup "Base64ByteStringL" - [ testProperty "validate (Aeson.decode . Aeson.encode) == pure . id" $ - \(Util.Base64ByteStringL . L.pack -> s) -> + [ testProperty "validate (Aeson.decode . Aeson.encode) == pure . id" + $ \(Util.Base64ByteStringL . L.pack -> s) -> (Aeson.eitherDecode . Aeson.encode) s == Right s, -- the property only considers valid 'String's, and it does not document the encoding very -- well, so here are some unit tests (see @@ -126,8 +126,8 @@ tests = ], testGroup "UTCTimeMillis" - [ testProperty "validate (Aeson.decode . Aeson.encode) == pure . id" $ - \(t :: Util.UTCTimeMillis) -> do + [ testProperty "validate (Aeson.decode . Aeson.encode) == pure . id" + $ \(t :: Util.UTCTimeMillis) -> do (Aeson.eitherDecode . Aeson.encode) t === Right t, -- (we could test @show x == show y ==> x == y@, but that kind of follows from the above.) @@ -137,36 +137,36 @@ tests = (BS.fromByteString' . cs . BS.toByteString') t === Just t, -- - let toUTCTimeMillisSlow :: HasCallStack => UTCTime -> Maybe UTCTime + let toUTCTimeMillisSlow :: (HasCallStack) => UTCTime -> Maybe UTCTime toUTCTimeMillisSlow t = parseExact formatRounded where parseExact = parseTimeM True defaultTimeLocale "%FT%T%QZ" formatRounded = formatTime defaultTimeLocale format t format = "%FT%T." ++ formatMillis t ++ "Z" formatMillis = Imports.take 3 . formatTime defaultTimeLocale "%q" - in testProperty "toUTCTimeMillis" $ - \(t :: UTCTime) -> + in testProperty "toUTCTimeMillis" + $ \(t :: UTCTime) -> Just (Util.fromUTCTimeMillis $ Util.toUTCTimeMillis t) == toUTCTimeMillisSlow t, let testcase (t1, t2) = testCase (show (t1, t2)) $ make t1 @=? make t2 make = Util.readUTCTimeMillis - in testGroup "validate Eq" $ - testcase - <$> [ ("1918-04-14T09:58:58.457Z", "1918-04-14T09:58:58.457Z"), - ("1918-04-14T09:58:58.4574Z", "1918-04-14T09:58:58.457Z"), - ("1918-04-14T09:58:58.4579Z", "1918-04-14T09:58:58.457Z") - ], + in testGroup "validate Eq" + $ testcase + <$> [ ("1918-04-14T09:58:58.457Z", "1918-04-14T09:58:58.457Z"), + ("1918-04-14T09:58:58.4574Z", "1918-04-14T09:58:58.457Z"), + ("1918-04-14T09:58:58.4579Z", "1918-04-14T09:58:58.457Z") + ], let testcase (t1, t2) = testCase (show (t1, t2)) $ process t1 @=? Just t2 process = fmap show . Util.readUTCTimeMillis - in testGroup "validate Eq" $ - testcase - <$> [ ("1918-04-14T09:58:58.457Z", "1918-04-14T09:58:58.457Z"), - ("1918-04-14T09:58:58.4574Z", "1918-04-14T09:58:58.457Z"), - ("1918-04-14T09:58:58.4579Z", "1918-04-14T09:58:58.457Z"), - -- client parsers require *exactly* three digits: - ("1918-04-14T09:58:58Z", "1918-04-14T09:58:58.000Z"), - ("1918-04-14T09:58:58.1Z", "1918-04-14T09:58:58.100Z"), - ("1918-04-14T09:58:58.12Z", "1918-04-14T09:58:58.120Z") - ] + in testGroup "validate Eq" + $ testcase + <$> [ ("1918-04-14T09:58:58.457Z", "1918-04-14T09:58:58.457Z"), + ("1918-04-14T09:58:58.4574Z", "1918-04-14T09:58:58.457Z"), + ("1918-04-14T09:58:58.4579Z", "1918-04-14T09:58:58.457Z"), + -- client parsers require *exactly* three digits: + ("1918-04-14T09:58:58Z", "1918-04-14T09:58:58.000Z"), + ("1918-04-14T09:58:58.1Z", "1918-04-14T09:58:58.100Z"), + ("1918-04-14T09:58:58.12Z", "1918-04-14T09:58:58.120Z") + ] ], testGroup "Handle" @@ -174,38 +174,38 @@ tests = ], testGroup "UUID" - [ testProperty "decode . encode = id" $ - \t (x :: UUID) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: UUID) -> roundtrip t x === Right x ], testGroup "ClientId" - [ testProperty "decode . encode = id" $ - \t (x :: ClientId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: ClientId) -> roundtrip t x === Right x ], testGroup "AssetId" - [ testProperty "decode . encode = id" $ - \t (x :: AssetId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: AssetId) -> roundtrip t x === Right x ], testGroup "ConvId" - [ testProperty "decode . encode = id" $ - \t (x :: ConvId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: ConvId) -> roundtrip t x === Right x ], testGroup "InvitationId" - [ testProperty "decode . encode = id" $ - \t (x :: InvitationId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: InvitationId) -> roundtrip t x === Right x ], testGroup "UserId" - [ testProperty "decode . encode = id" $ - \t (x :: UserId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: UserId) -> roundtrip t x === Right x ], testGroup "Id NoId" - [ testProperty "decode . encode = id" $ - \t (x :: Id NoId) -> roundtrip t x === Right x + [ testProperty "decode . encode = id" + $ \t (x :: Id NoId) -> roundtrip t x === Right x ], testGroup "Domain" @@ -214,8 +214,8 @@ tests = ], testGroup "Nonce" - [ testProperty "decode . encode = id" $ - \(x :: Nonce) -> bsRoundtrip x, + [ testProperty "decode . encode = id" + $ \(x :: Nonce) -> bsRoundtrip x, jsonRoundtrip @Nonce ] ] @@ -234,16 +234,18 @@ jsonRoundtrip = testProperty msg trip where msg = "json round trip: " <> show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (Aeson.parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (Aeson.parseEither parseJSON . toJSON) v jsonKeyRoundtrip :: forall a. (Arbitrary a, Typeable a, ToJSONKey a, FromJSONKey a, Show a, Ord a) => TestTree jsonKeyRoundtrip = testProperty msg trip where msg = "json key round trip: " <> show (typeRep @a) trip (v :: Map a Int) = - counterexample (show $ toJSON v) $ - Right v === (Aeson.parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (Aeson.parseEither parseJSON . toJSON) v newtype Tag' = Tag' Tag deriving (Eq, Show) diff --git a/libs/types-common/test/Test/Qualified.hs b/libs/types-common/test/Test/Qualified.hs index 35fae2dbb5a..e88b716296d 100644 --- a/libs/types-common/test/Test/Qualified.hs +++ b/libs/types-common/test/Test/Qualified.hs @@ -51,5 +51,6 @@ jsonRoundtrip = testProperty msg trip where msg = "jsonRoundTrip @(" <> show (typeRep @a) <> ")" trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (Aeson.parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (Aeson.parseEither parseJSON . toJSON) v diff --git a/libs/wai-utilities/src/Network/Wai/Utilities/Error.hs b/libs/wai-utilities/src/Network/Wai/Utilities/Error.hs index ba7bdcf90fd..d39a75f75d2 100644 --- a/libs/wai-utilities/src/Network/Wai/Utilities/Error.hs +++ b/libs/wai-utilities/src/Network/Wai/Utilities/Error.hs @@ -57,17 +57,19 @@ data ErrorData = FederationErrorData instance ToJSON ErrorData where toJSON (FederationErrorData d p) = - object $ - [ "type" .= ("federation" :: Text), - "domain" .= d, - "path" .= p - ] + object + $ [ "type" .= ("federation" :: Text), + "domain" .= d, + "path" .= p + ] instance FromJSON ErrorData where parseJSON = withObject "ErrorData" $ \o -> FederationErrorData - <$> o .: "domain" - <*> o .: "path" + <$> o + .: "domain" + <*> o + .: "path" -- | Assumes UTF-8 encoding. byteStringError :: Status -> LByteString -> LByteString -> Error @@ -75,13 +77,13 @@ byteStringError s l m = mkError s (decodeUtf8 l) (decodeUtf8 m) instance ToJSON Error where toJSON (Error c l m md inner) = - object $ - [ "code" .= statusCode c, - "label" .= l, - "message" .= m - ] - ++ maybe [] dataFields md - ++ ["inner" .= e | e <- toList inner] + object + $ [ "code" .= statusCode c, + "label" .= l, + "message" .= m + ] + ++ maybe [] dataFields md + ++ ["inner" .= e | e <- toList inner] where dataFields :: ErrorData -> [Pair] dataFields d = ["data" .= d] @@ -90,13 +92,17 @@ instance FromJSON Error where parseJSON = withObject "Error" $ \o -> Error <$> (toEnum <$> o .: "code") - <*> o .: "label" - <*> o .: "message" - <*> o .:? "data" - <*> o .:? "inner" + <*> o + .: "label" + <*> o + .: "message" + <*> o + .:? "data" + <*> o + .:? "inner" -- FIXME: This should not live here. infixl 5 !>> -(!>>) :: Monad m => ExceptT a m r -> (a -> b) -> ExceptT b m r +(!>>) :: (Monad m) => ExceptT a m r -> (a -> b) -> ExceptT b m r (!>>) = flip fmapLT diff --git a/libs/wai-utilities/src/Network/Wai/Utilities/JSONResponse.hs b/libs/wai-utilities/src/Network/Wai/Utilities/JSONResponse.hs index c2ab383a42e..78deb3a5723 100644 --- a/libs/wai-utilities/src/Network/Wai/Utilities/JSONResponse.hs +++ b/libs/wai-utilities/src/Network/Wai/Utilities/JSONResponse.hs @@ -48,10 +48,12 @@ data JSONResponse = JSONResponse instance ToSchema JSONResponse where schema = - object "JSONResponse" $ - JSONResponse - <$> status .= field "status" (toEnum <$> (fromEnum .= schema)) - <*> value .= field "value" jsonValue + object "JSONResponse" + $ JSONResponse + <$> status + .= field "status" (toEnum <$> (fromEnum .= schema)) + <*> value + .= field "value" jsonValue instance Exception JSONResponse diff --git a/libs/wai-utilities/src/Network/Wai/Utilities/Response.hs b/libs/wai-utilities/src/Network/Wai/Utilities/Response.hs index 3b82467372c..ce838ff5463 100644 --- a/libs/wai-utilities/src/Network/Wai/Utilities/Response.hs +++ b/libs/wai-utilities/src/Network/Wai/Utilities/Response.hs @@ -39,7 +39,7 @@ plain = responseLBS status200 [plainContent] plainContent :: Header plainContent = (hContentType, "text/plain; charset=UTF-8") -json :: ToJSON a => a -> Response +json :: (ToJSON a) => a -> Response json = responseLBS status200 [jsonContent] . encode jsonContent :: Header diff --git a/libs/wai-utilities/src/Network/Wai/Utilities/Server.hs b/libs/wai-utilities/src/Network/Wai/Utilities/Server.hs index 95657f59dd5..138b88cb53f 100644 --- a/libs/wai-utilities/src/Network/Wai/Utilities/Server.hs +++ b/libs/wai-utilities/src/Network/Wai/Utilities/Server.hs @@ -104,28 +104,32 @@ data Server = Server defaultServer :: String -> Word16 -> Logger -> Server defaultServer h p l = Server h p l Nothing -newSettings :: MonadIO m => Server -> m Settings +newSettings :: (MonadIO m) => Server -> m Settings newSettings (Server h p l t) = do pure $ setHost (fromString h) - . setPort (fromIntegral p) - . setBeforeMainLoop logStart - . setOnOpen (const $ connStart >> pure True) - . setOnClose (const connEnd) - . setTimeout (fromMaybe 300 t) + . setPort (fromIntegral p) + . setBeforeMainLoop logStart + . setOnOpen (const $ connStart >> pure True) + . setOnClose (const connEnd) + . setTimeout (fromMaybe 300 t) $ defaultSettings where connStart = Prom.incGauge netConnections connEnd = Prom.decGauge netConnections logStart = - Log.info l . msg $ - val "Listening on " +++ h +++ ':' +++ p + Log.info l + . msg + $ val "Listening on " + +++ h + +++ ':' + +++ p {-# NOINLINE netConnections #-} netConnections :: Prom.Gauge netConnections = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "net.connections", Prom.metricHelp = "Number of active connections" @@ -160,7 +164,7 @@ runSettingsWithCleanup cleanup s app (fromMaybe defaultShutdownTime -> secs) = d defaultShutdownTime :: Int defaultShutdownTime = 30 -compile :: Monad m => Routes a m b -> Tree (App m) +compile :: (Monad m) => Routes a m b -> Tree (App m) compile routes = Route.prepare (Route.renderer predicateError >> routes) where predicateError e = pure (encode $ Wai.mkError (P.status e) "client-error" (format e), [jsonContent]) @@ -175,18 +179,18 @@ compile routes = Route.prepare (Route.renderer predicateError >> routes) bs -> LT.decodeUtf8With lenientDecode . toLazyByteString $ mconcat bs <> messageStr t labelStr [] = Nothing labelStr ls = - Just $ - char7 '[' - <> byteString (C.intercalate "," ls) - <> char7 ']' - <> char7 ' ' + Just + $ char7 '[' + <> byteString (C.intercalate "," ls) + <> char7 ']' + <> char7 ' ' sourceStr s = char7 '\'' <> byteString s <> char7 '\'' <> char7 ' ' reasonStr NotAvailable = "required" reasonStr TypeError = "invalid" messageStr (Just t) = char7 ':' <> char7 ' ' <> byteString t messageStr Nothing = mempty -route :: MonadIO m => Tree (App m) -> Request -> Continue IO -> m ResponseReceived +route :: (MonadIO m) => Tree (App m) -> Request -> Continue IO -> m ResponseReceived route rt rq k = Route.routeWith (Route.Config $ errorRs' noEndpoint) rt rq (liftIO . k) where noEndpoint = Wai.mkError status404 "no-endpoint" "The requested endpoint does not exist" @@ -201,12 +205,12 @@ requestIdMiddleware logger reqIdHeaderName origApp req responder = Just _ -> origApp req responder Nothing -> do reqId <- Text.encodeUtf8 . UUID.toText <$> UUID.nextRandom - unless (req.rawPathInfo `elem` ["/i/status", "/i/metrics", "/api-version"]) $ - Log.info logger $ - msg ("generated a new request id for local request" :: ByteString) - . field "request" reqId - . field "method" (requestMethod req) - . field "path" (rawPathInfo req) + unless (req.rawPathInfo `elem` ["/i/status", "/i/metrics", "/api-version"]) + $ Log.info logger + $ msg ("generated a new request id for local request" :: ByteString) + . field "request" reqId + . field "method" (requestMethod req) + . field "path" (rawPathInfo req) let reqWithId = req {requestHeaders = (reqIdHeaderName, reqId) : req.requestHeaders} origApp reqWithId responder @@ -238,28 +242,33 @@ catchErrorsWithRequestId getRequestId l app req k = -- | Standard handlers for turning exceptions into appropriate -- 'Error' responses. -errorHandlers :: Applicative m => [Handler m (Either Wai.Error JSONResponse)] +errorHandlers :: (Applicative m) => [Handler m (Either Wai.Error JSONResponse)] errorHandlers = -- a Wai.Error can be converted to a JSONResponse, but doing so here would -- prevent us from logging the error cleanly later [ Handler $ \(x :: JSONResponse) -> pure (Right x), Handler $ \(x :: Wai.Error) -> pure (Left x), Handler $ \(_ :: InvalidRequest) -> - pure . Left $ - Wai.mkError status400 "client-error" "Invalid Request", + pure + . Left + $ Wai.mkError status400 "client-error" "Invalid Request", Handler $ \(_ :: TimeoutThread) -> - pure . Left $ - Wai.mkError status408 "client-error" "Request Timeout", + pure + . Left + $ Wai.mkError status408 "client-error" "Request Timeout", Handler $ \case ZlibException (-3) -> - pure . Left $ - Wai.mkError status400 "client-error" "Invalid request body compression" + pure + . Left + $ Wai.mkError status400 "client-error" "Invalid request body compression" ZlibException _ -> - pure . Left $ - Wai.mkError status500 "server-error" "Server Error", + pure + . Left + $ Wai.mkError status500 "server-error" "Server Error", Handler $ \(e :: SomeException) -> - pure . Left $ - Wai.mkError status500 "server-error" ("Server Error. " <> LT.pack (displayException e)) + pure + . Left + $ Wai.mkError status500 "server-error" ("Server Error. " <> LT.pack (displayException e)) ] {-# INLINE errorHandlers #-} @@ -379,7 +388,7 @@ lazyResponseBody rs = case responseToStream rs of -- | Send an 'Error' response. onError :: - MonadIO m => + (MonadIO m) => Logger -> Maybe ByteString -> Request -> @@ -399,8 +408,8 @@ onError g mReqId r k e = liftIO $ do {-# NOINLINE netErrors #-} netErrors :: Prom.Counter netErrors = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "net.errors", Prom.metricHelp = "Number of exceptions caught by catchErrors middleware" @@ -426,14 +435,14 @@ logError' g mr e = liftIO $ doLog g (logErrorMsgWithRequest mr e) | statusCode (Error.code e) >= 500 = Log.err | otherwise = Log.debug -logJSONResponse :: MonadIO m => Logger -> Maybe ByteString -> JSONResponse -> m () +logJSONResponse :: (MonadIO m) => Logger -> Maybe ByteString -> JSONResponse -> m () logJSONResponse g mReqId e = do let r = fromMaybe "N/A" mReqId - liftIO $ - doLog g $ - field "request" r - . field "code" status - . field "value" (encode e.value) + liftIO + $ doLog g + $ field "request" r + . field "code" status + . field "value" (encode e.value) where status = statusCode e.status doLog @@ -468,16 +477,17 @@ restrict l u = fmap $ \x -> else Fail (setMessage (emsg v) . setReason TypeError $ e400) where emsg v = - LBS.toStrict . toLazyByteString $ - byteString "outside range [" - <> intDec l - <> byteString ", " - <> intDec u - <> byteString "]: " - <> intDec v + LBS.toStrict + . toLazyByteString + $ byteString "outside range [" + <> intDec l + <> byteString ", " + <> intDec u + <> byteString "]: " + <> intDec v flushRequestBody :: Request -> IO () flushRequestBody req = do bs <- getRequestBodyChunk req - unless (BS.null bs) $ - flushRequestBody req + unless (BS.null bs) + $ flushRequestBody req diff --git a/libs/wai-utilities/src/Network/Wai/Utilities/ZAuth.hs b/libs/wai-utilities/src/Network/Wai/Utilities/ZAuth.hs index c70d65f7a67..5733203a0bd 100644 --- a/libs/wai-utilities/src/Network/Wai/Utilities/ZAuth.hs +++ b/libs/wai-utilities/src/Network/Wai/Utilities/ZAuth.hs @@ -66,11 +66,11 @@ instance FromByteString ZAuthType where _ -> fail $ "Invalid ZAuth type: " ++ show t -- | A token type is present if the request was authenticated. -zauthType :: HasHeaders r => Predicate r Error ZAuthType +zauthType :: (HasHeaders r) => Predicate r Error ZAuthType zauthType = zheader "Z-Type" -- | Require a specific token type to be used. -zauth :: HasHeaders r => ZAuthType -> Predicate r Error () +zauth :: (HasHeaders r) => ZAuthType -> Predicate r Error () zauth t = do r <- zauthType pure $ case r of @@ -79,24 +79,24 @@ zauth t = do -- | A zauth user ID is present if 'zauthType' is either 'ZAuthAccess' -- or 'ZAuthUser'. -zauthUserId :: HasHeaders r => Predicate r Error UserId +zauthUserId :: (HasHeaders r) => Predicate r Error UserId zauthUserId = zheader "Z-User" -- | A zauth connection ID is present if 'zauthType' is 'ZAuthAccess'. -zauthConnId :: HasHeaders r => Predicate r Error ConnId +zauthConnId :: (HasHeaders r) => Predicate r Error ConnId zauthConnId = zheader "Z-Connection" -- | A zauth bot ID is present if 'zauthType' is 'ZAuthBot'. -zauthBotId :: HasHeaders r => Predicate r Error BotId +zauthBotId :: (HasHeaders r) => Predicate r Error BotId zauthBotId = zheader "Z-Bot" -- | A zauth conversation ID is present if 'zauthType' is 'ZAuthBot'. -zauthConvId :: HasHeaders r => Predicate r Error ConvId +zauthConvId :: (HasHeaders r) => Predicate r Error ConvId zauthConvId = zheader "Z-Conversation" -- | A provider ID is present if 'zauthType' is either 'ZAuthBot' -- or 'ZAuthProvider'. -zauthProviderId :: HasHeaders r => Predicate r Error ProviderId +zauthProviderId :: (HasHeaders r) => Predicate r Error ProviderId zauthProviderId = zheader "Z-Provider" -- Extra Predicate Combinators ------------------------------------------------ diff --git a/libs/wire-api-federation/src/Wire/API/Federation/API.hs b/libs/wire-api-federation/src/Wire/API/Federation/API.hs index 89ba99b4e6a..bf33723b172 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/API.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/API.hs @@ -79,13 +79,13 @@ type HasFedEndpoint comp api name = (HasUnsafeFedEndpoint comp api name) -- you to forget about some federated calls. type HasUnsafeFedEndpoint comp api name = 'Just api ~ LookupEndpoint (FedApi comp) name -nameVal :: forall {k} (name :: k). IsNamed name => Text +nameVal :: forall {k} (name :: k). (IsNamed name) => Text nameVal = nameVal' @k @name class IsNamed (name :: k) where nameVal' :: Text -instance KnownSymbol name => IsNamed (name :: Symbol) where +instance (KnownSymbol name) => IsNamed (name :: Symbol) where nameVal' = Text.pack (symbolVal (Proxy @name)) instance (IsNamed name, SingI v) => IsNamed (Versioned (v :: Version) name) where @@ -136,7 +136,7 @@ fedClientIn :: fedClientIn = clientIn (Proxy @api) (Proxy @m) sendBundle :: - KnownComponent c => + (KnownComponent c) => PayloadBundle c -> FedQueueClient c () sendBundle bundle = do diff --git a/libs/wire-api-federation/src/Wire/API/Federation/BackendNotifications.hs b/libs/wire-api-federation/src/Wire/API/Federation/BackendNotifications.hs index 43849c716da..f4ce399fd28 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/BackendNotifications.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/BackendNotifications.hs @@ -48,15 +48,20 @@ data BackendNotification = BackendNotification instance ToSchema BackendNotification where schema = - object "BackendNotification" $ - BackendNotification - <$> ownDomain .= field "ownDomain" schema - <*> targetComponent .= field "targetComponent" schema - <*> path .= field "path" schema + object "BackendNotification" + $ BackendNotification + <$> ownDomain + .= field "ownDomain" schema + <*> targetComponent + .= field "targetComponent" schema + <*> path + .= field "path" schema <*> (TL.decodeUtf8 . rawJsonBytes . body) - .= field "body" (RawJson . TL.encodeUtf8 <$> schema) - <*> bodyVersions .= maybe_ (optField "bodyVersions" schema) - <*> (.requestId) .= maybe_ (optField "requestId" schema) + .= field "body" (RawJson . TL.encodeUtf8 <$> schema) + <*> bodyVersions + .= maybe_ (optField "bodyVersions" schema) + <*> (.requestId) + .= maybe_ (optField "requestId" schema) -- | Convert a federation endpoint to a backend notification to be enqueued to a -- RabbitMQ queue. @@ -95,9 +100,10 @@ newtype PayloadBundle (c :: Component) = PayloadBundle instance ToSchema (PayloadBundle c) where schema = - object "PayloadBundle" $ - PayloadBundle - <$> notifications .= field "notifications" (nonEmptyArray schema) + object "PayloadBundle" + $ PayloadBundle + <$> notifications + .= field "notifications" (nonEmptyArray schema) toBundle :: forall {k} (tag :: k). @@ -140,7 +146,7 @@ sendNotification env component path body = case someComponent component of withoutFirstSlash (Text.stripPrefix "/" -> Just t) = t withoutFirstSlash t = t - go :: forall c. KnownComponent c => Proxy c -> IO (Either FederatorClientError ()) + go :: forall c. (KnownComponent c) => Proxy c -> IO (Either FederatorClientError ()) go _ = lowerCodensity . runExceptT @@ -176,8 +182,8 @@ ensureQueue chan queue = do Q.queueExclusive = False, Q.queueAutoDelete = False, Q.queueHeaders = - Q.FieldTable $ - Map.fromList + Q.FieldTable + $ Map.fromList -- single-active-consumer is used because it is order -- preserving, especially into databases and to remote servers, -- exactly what we are doing here! diff --git a/libs/wire-api-federation/src/Wire/API/Federation/Component.hs b/libs/wire-api-federation/src/Wire/API/Federation/Component.hs index 1a5b91e6bd3..aef5cc95980 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/Component.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/Component.hs @@ -49,7 +49,7 @@ instance KnownComponent 'Cargohold where componentVal = Cargohold data SomeComponent where - SomeComponent :: KnownComponent c => Proxy c -> SomeComponent + SomeComponent :: (KnownComponent c) => Proxy c -> SomeComponent someComponent :: Component -> SomeComponent someComponent Brig = SomeComponent (Proxy @'Brig) diff --git a/libs/wire-api-federation/src/Wire/API/Federation/Domain.hs b/libs/wire-api-federation/src/Wire/API/Federation/Domain.hs index 5a8e8a5bb16..e9d128fe670 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/Domain.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/Domain.hs @@ -37,19 +37,19 @@ type OriginDomainHeaderName = "Wire-Origin-Domain" :: Symbol data OriginDomainHeader -instance RoutesToPaths api => RoutesToPaths (OriginDomainHeader :> api) where +instance (RoutesToPaths api) => RoutesToPaths (OriginDomainHeader :> api) where getRoutes = getRoutes @api type instance SpecialiseToVersion v (OriginDomainHeader :> api) = OriginDomainHeader :> SpecialiseToVersion v api -instance HasClient m api => HasClient m (OriginDomainHeader :> api) where +instance (HasClient m api) => HasClient m (OriginDomainHeader :> api) where type Client m (OriginDomainHeader :> api) = Client m api clientWithRoute pm _ req = clientWithRoute pm (Proxy @api) req hoistClientMonad pm _ = hoistClientMonad pm (Proxy @api) -instance HasClientAlgebra m api => HasClientAlgebra m (OriginDomainHeader :> api) where +instance (HasClientAlgebra m api) => HasClientAlgebra m (OriginDomainHeader :> api) where joinClient = joinClient @m @api bindClient = bindClient @m @api @@ -65,7 +65,7 @@ instance route _pa = route (Proxy @(OriginDomainHeaderHasServer :> api)) hoistServerWithContext _ pc nt s = hoistServerWithContext (Proxy :: Proxy api) pc nt . s -originDomainHeaderName :: IsString a => a +originDomainHeaderName :: (IsString a) => a originDomainHeaderName = fromString $ symbolVal (Proxy @OriginDomainHeaderName) instance (HasOpenApi api) => HasOpenApi (OriginDomainHeader :> api) where diff --git a/libs/wire-api-federation/src/Wire/API/Federation/Endpoint.hs b/libs/wire-api-federation/src/Wire/API/Federation/Endpoint.hs index f24085139cb..910a6c2d4b1 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/Endpoint.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/Endpoint.hs @@ -33,7 +33,7 @@ import Wire.API.Routes.Named data Versioned v name -instance {-# OVERLAPPING #-} RenderableSymbol a => RenderableSymbol (Versioned v a) where +instance {-# OVERLAPPING #-} (RenderableSymbol a) => RenderableSymbol (Versioned v a) where renderSymbol = renderSymbol @a type family FedPath (name :: k) :: Symbol diff --git a/libs/wire-api-federation/src/Wire/API/Federation/Error.hs b/libs/wire-api-federation/src/Wire/API/Federation/Error.hs index 830a9f062fc..4afd13b6780 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/Error.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/Error.hs @@ -278,8 +278,8 @@ federationRemoteResponseError target path status body = ) & either (const Nothing) (\dom -> Just (Wai.FederationErrorData dom path)), Wai.innerError = - Just $ - fromMaybe + Just + $ fromMaybe ( Wai.mkError status "unknown-error" diff --git a/libs/wire-api-federation/src/Wire/API/Federation/HasNotificationEndpoint.hs b/libs/wire-api-federation/src/Wire/API/Federation/HasNotificationEndpoint.hs index 7fba640ee90..cbc16a0d769 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/HasNotificationEndpoint.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/HasNotificationEndpoint.hs @@ -59,7 +59,7 @@ type HasFedPath t = KnownSymbol (NotificationPath t) type HasVersionRange t = MkVersionRange (NotificationMods t) -fedPath :: forall t. HasFedPath t => String +fedPath :: forall t. (HasFedPath t) => String fedPath = symbolVal (Proxy @(NotificationPath t)) -- | Build a version range using any 'Until' and 'From' combinators present in @@ -84,9 +84,9 @@ instance where mkVersionRange = mkVersionRange @mods <> rangeUntilVersion (demote @v) -instance {-# OVERLAPPABLE #-} MkVersionRange mods => MkVersionRange (m ': mods) where +instance {-# OVERLAPPABLE #-} (MkVersionRange mods) => MkVersionRange (m ': mods) where mkVersionRange = mkVersionRange @mods -- | The federation API version range this endpoint is supported in. -versionRange :: forall t. HasVersionRange t => VersionRange +versionRange :: forall t. (HasVersionRange t) => VersionRange versionRange = mkVersionRange @(NotificationMods t) diff --git a/libs/wire-api-federation/src/Wire/API/Federation/Version.hs b/libs/wire-api-federation/src/Wire/API/Federation/Version.hs index 06089028de5..4ec020b7b70 100644 --- a/libs/wire-api-federation/src/Wire/API/Federation/Version.hs +++ b/libs/wire-api-federation/src/Wire/API/Federation/Version.hs @@ -67,10 +67,11 @@ intToVersion intV = find (\v -> versionInt v == intV) [minBound ..] instance ToSchema Version where schema = - enum @Integer "Version" . mconcat $ - [ element 0 V0, - element 1 V1 - ] + enum @Integer "Version" + . mconcat + $ [ element 0 V0, + element 1 V1 + ] supportedVersions :: Set Version supportedVersions = Set.fromList [minBound .. maxBound] @@ -82,17 +83,17 @@ data VersionInfo = VersionInfo instance ToSchema VersionInfo where schema = - objectWithDocModifier "VersionInfo" (S.schema . S.example ?~ toJSON example) $ - VersionInfo - -- if the supported_versions field does not exist, assume an old backend - -- that only supports V0 - <$> vinfoSupported - .= fmap - (fromMaybe [0]) - (optField "supported_versions" (array schema)) - -- legacy field to support older versions of the backend with broken - -- version negotiation - <* const [0 :: Int, 1] .= field "supported" (array schema) + objectWithDocModifier "VersionInfo" (S.schema . S.example ?~ toJSON example) + $ VersionInfo + -- if the supported_versions field does not exist, assume an old backend + -- that only supports V0 + <$> vinfoSupported + .= fmap + (fromMaybe [0]) + (optField "supported_versions" (array schema)) + -- legacy field to support older versions of the backend with broken + -- version negotiation + <* const [0 :: Int, 1] .= field "supported" (array schema) where example :: VersionInfo example = @@ -135,11 +136,12 @@ makeLenses ''VersionRange instance ToSchema VersionRange where schema = - object "VersionRange" $ - VersionRange - <$> _fromVersion .= field "from" schema - <*> (versionFromUpperBound . _toVersionExcl) - .= maybe_ (versionToUpperBound <$> optFieldWithDocModifier "until_excl" desc schema) + object "VersionRange" + $ VersionRange + <$> _fromVersion + .= field "from" schema + <*> (versionFromUpperBound . _toVersionExcl) + .= maybe_ (versionToUpperBound <$> optFieldWithDocModifier "until_excl" desc schema) where desc = description ?~ "exlusive upper version bound" @@ -176,14 +178,14 @@ enumVersionRange = -- remote versions are given as integers as the range of versions supported by -- the remote backend can include a version unknown to the local backend. If -- there is no version in common, the return value is 'Nothing'. -latestCommonVersion :: Foldable f => VersionRange -> f Int -> Maybe Version +latestCommonVersion :: (Foldable f) => VersionRange -> f Int -> Maybe Version latestCommonVersion localVersions = safeMaximum . filter (inVersionRange localVersions) . mapMaybe intToVersion . toList -safeMaximum :: Ord a => [a] -> Maybe a +safeMaximum :: (Ord a) => [a] -> Maybe a safeMaximum [] = Nothing safeMaximum as = Just (maximum as) diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/API/BrigSpec.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/API/BrigSpec.hs index f43bac1a895..7d40bbbdfd6 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/API/BrigSpec.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/API/BrigSpec.hs @@ -41,8 +41,9 @@ jsonRoundTrip = prop msg trip where msg = show (typeRep (Proxy @a)) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v jsonGoldenTest :: (Eq a, Show a, FromJSON a) => String -> Value -> a -> Spec jsonGoldenTest name val expected = diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MLSMessageSendingStatus.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MLSMessageSendingStatus.hs index 27fba120068..88dd7165622 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MLSMessageSendingStatus.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MLSMessageSendingStatus.hs @@ -54,7 +54,10 @@ failed1 = failed2 :: [Qualified UserId] failed2 = let domain = Domain "golden.example.com" - in flip Qualified domain . Id . fromJust . UUID.fromString + in flip Qualified domain + . Id + . fromJust + . UUID.fromString <$> [ "00000000-0000-0000-0000-000200000008", "00000000-0000-0000-0000-000100000007" ] diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MessageSendResponse.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MessageSendResponse.hs index dc4c094613d..40b78cca9ad 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MessageSendResponse.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/MessageSendResponse.hs @@ -120,8 +120,8 @@ failedToConfirm = testObject_MessageSendResponse1 :: MessageSendResponse testObject_MessageSendResponse1 = - MessageSendResponse $ - Right + MessageSendResponse + $ Right MessageSendingStatus { mssTime = toUTCTimeMillis (read "1864-04-12 12:22:43.673 UTC"), mssMissingClients = missing, @@ -136,8 +136,10 @@ testObject_MessageSendResponse2 = MessageSendResponse . Left $ MessageNotSentLeg testObject_MessageSendResponse3 :: MessageSendResponse testObject_MessageSendResponse3 = - MessageSendResponse . Left . MessageNotSentClientMissing $ - MessageSendingStatus + MessageSendResponse + . Left + . MessageNotSentClientMissing + $ MessageSendingStatus { mssTime = toUTCTimeMillis (read "1864-04-12 12:22:43.673 UTC"), mssMissingClients = missing, mssRedundantClients = redundant, diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs index 5d7d956cb02..ba2c5e02e54 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs @@ -79,7 +79,7 @@ testFromJSONFailure path = do Right x -> assertFailure $ show (typeRep @a) <> ": FromJSON of " <> path <> ": expected failure, got " <> show x Left _ -> pure () -assertRight :: Show a => Either a b -> IO b +assertRight :: (Show a) => Either a b -> IO b assertRight = \case Left a -> assertFailure $ "Expected Right, got Left: " <> show a diff --git a/libs/wire-api/src/Wire/API/Asset.hs b/libs/wire-api/src/Wire/API/Asset.hs index 4148a1d4832..acf15e2ffe8 100644 --- a/libs/wire-api/src/Wire/API/Asset.hs +++ b/libs/wire-api/src/Wire/API/Asset.hs @@ -105,14 +105,14 @@ data Asset' key = Asset } deriving stock (Eq, Show, Generic, Functor) -deriving via Schema (Asset' key) instance ToSchema (Asset' key) => (ToJSON (Asset' key)) +deriving via Schema (Asset' key) instance (ToSchema (Asset' key)) => (ToJSON (Asset' key)) -deriving via Schema (Asset' key) instance ToSchema (Asset' key) => (FromJSON (Asset' key)) +deriving via Schema (Asset' key) instance (ToSchema (Asset' key)) => (FromJSON (Asset' key)) deriving via Schema (Asset' key) instance (Typeable key, ToSchema (Asset' key)) => (S.ToSchema (Asset' key)) -- Generate expiry time with millisecond precision -instance Arbitrary key => Arbitrary (Asset' key) where +instance (Arbitrary key) => Arbitrary (Asset' key) where arbitrary = Asset <$> arbitrary <*> (fmap milli <$> arbitrary) <*> arbitrary where milli = fromUTCTimeMillis . toUTCTimeMillis @@ -122,17 +122,20 @@ mkAsset k = Asset k Nothing Nothing instance ToSchema Asset where schema = - object "Asset" $ - Asset - <$> _assetKey - .= ( Qualified - <$> qUnqualified .= field "key" schema - <*> qDomain .= field "domain" schema - ) + object "Asset" + $ Asset + <$> _assetKey + .= ( Qualified + <$> qUnqualified + .= field "key" schema + <*> qDomain + .= field "domain" schema + ) <*> (fmap toUTCTimeMillis . _assetExpires) - .= maybe_ - (optField "expires" (fromUTCTimeMillis <$> schema)) - <*> _assetToken .= maybe_ (optField "token" schema) + .= maybe_ + (optField "expires" (fromUTCTimeMillis <$> schema)) + <*> _assetToken + .= maybe_ (optField "token" schema) -------------------------------------------------------------------------------- -- AssetKey @@ -178,7 +181,10 @@ instance ToSchema AssetKey where schema = assetKeyToText .= parsedText "AssetKey" (runParser parser . T.encodeUtf8) - & doc' . S.schema . S.example ?~ toJSON ("3-1-47de4580-ae51-4650-acbb-d10c028cb0ac" :: Text) + & doc' + . S.schema + . S.example + ?~ toJSON ("3-1-47de4580-ae51-4650-acbb-d10c028cb0ac" :: Text) instance S.ToParamSchema AssetKey where toParamSchema _ = S.toParamSchema (Proxy @Text) @@ -205,8 +211,11 @@ instance ToSchema AssetToken where schema = AssetToken <$> assetTokenAscii - .= schema - & doc' . S.schema . S.example ?~ toJSON ("aGVsbG8" :: Text) + .= schema + & doc' + . S.schema + . S.example + ?~ toJSON ("aGVsbG8" :: Text) instance S.ToParamSchema AssetToken where toParamSchema _ = S.toParamSchema (Proxy @Text) @@ -223,8 +232,10 @@ newtype NewAssetToken = NewAssetToken instance ToSchema NewAssetToken where schema = - object "NewAssetToken" $ - NewAssetToken <$> newAssetToken .= field "token" schema + object "NewAssetToken" + $ NewAssetToken + <$> newAssetToken + .= field "token" schema -------------------------------------------------------------------------------- -- Body Construction @@ -297,10 +308,12 @@ defAssetSettings = AssetSettings False Nothing instance ToSchema AssetSettings where schema = - object "AssetSettings" $ - AssetSettings - <$> _setAssetPublic .= (fromMaybe False <$> optField "public" schema) - <*> _setAssetRetention .= maybe_ (optField "retention" schema) + object "AssetSettings" + $ AssetSettings + <$> _setAssetPublic + .= (fromMaybe False <$> optField "public" schema) + <*> _setAssetRetention + .= maybe_ (optField "retention" schema) -------------------------------------------------------------------------------- -- AssetRetention @@ -366,8 +379,8 @@ retentionToTextRep AssetExpiring = "expiring" instance ToSchema AssetRetention where schema = - enum @Text "AssetRetention" $ - foldMap + enum @Text "AssetRetention" + $ foldMap (\value -> element (retentionToTextRep value) value) [minBound .. maxBound] @@ -397,8 +410,10 @@ instance FromHttpApiData (AssetLocation Absolute) where instance S.ToParamSchema (AssetLocation r) where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.format ?~ "url" + & S.type_ + ?~ S.OpenApiString + & S.format + ?~ "url" -- | An asset as returned by the download API: if the asset is local, only a -- URL is returned, and if it is remote the content of the asset is streamed. diff --git a/libs/wire-api/src/Wire/API/Bot.hs b/libs/wire-api/src/Wire/API/Bot.hs index 6c82112f721..1832e5960c5 100644 --- a/libs/wire-api/src/Wire/API/Bot.hs +++ b/libs/wire-api/src/Wire/API/Bot.hs @@ -54,12 +54,16 @@ addBot = AddBot instance ToSchema AddBot where schema = - object "AddBot" $ - AddBot - <$> _addBotService .= field "service" schema - <*> _addBotConv .= field "conversation" schema - <*> _addBotId .= field "bot" schema - <*> _addBotClient .= field "client" schema + object "AddBot" + $ AddBot + <$> _addBotService + .= field "service" schema + <*> _addBotConv + .= field "conversation" schema + <*> _addBotId + .= field "bot" schema + <*> _addBotClient + .= field "client" schema -- RemoveBot ------------------------------------------------------------------ @@ -74,10 +78,12 @@ removeBot = RemoveBot instance ToSchema RemoveBot where schema = - object "RemoveBot" $ - RemoveBot - <$> _rmBotConv .= field "conversation" schema - <*> _rmBotId .= field "bot" schema + object "RemoveBot" + $ RemoveBot + <$> _rmBotConv + .= field "conversation" schema + <*> _rmBotId + .= field "bot" schema makeLenses ''AddBot makeLenses ''RemoveBot diff --git a/libs/wire-api/src/Wire/API/Bot/Service.hs b/libs/wire-api/src/Wire/API/Bot/Service.hs index 05554f34da6..6b483970552 100644 --- a/libs/wire-api/src/Wire/API/Bot/Service.hs +++ b/libs/wire-api/src/Wire/API/Bot/Service.hs @@ -53,12 +53,17 @@ newService ref url tok fps = Service ref url tok fps True instance ToSchema Service where schema = - object "BotService" $ - Service - <$> _serviceRef .= field "ref" schema - <*> _serviceUrl .= field "base_url" schema - <*> _serviceToken .= field "auth_token" schema - <*> _serviceFingerprints .= field "fingerprints" (array schema) - <*> _serviceEnabled .= field "enabled" schema + object "BotService" + $ Service + <$> _serviceRef + .= field "ref" schema + <*> _serviceUrl + .= field "base_url" schema + <*> _serviceToken + .= field "auth_token" schema + <*> _serviceFingerprints + .= field "fingerprints" (array schema) + <*> _serviceEnabled + .= field "enabled" schema makeLenses ''Service diff --git a/libs/wire-api/src/Wire/API/Call/Config.hs b/libs/wire-api/src/Wire/API/Call/Config.hs index a4eb530ae5c..26e5f4c03d9 100644 --- a/libs/wire-api/src/Wire/API/Call/Config.hs +++ b/libs/wire-api/src/Wire/API/Call/Config.hs @@ -144,18 +144,18 @@ rtcConfiguration = RTCConfiguration instance ToSchema RTCConfiguration where schema = - objectWithDocModifier "RTCConfiguration" (description ?~ "A subset of the WebRTC 'RTCConfiguration' dictionary") $ - RTCConfiguration - <$> _rtcConfIceServers - .= fieldWithDocModifier "ice_servers" (description ?~ "Array of 'RTCIceServer' objects") (nonEmptyArray schema) + objectWithDocModifier "RTCConfiguration" (description ?~ "A subset of the WebRTC 'RTCConfiguration' dictionary") + $ RTCConfiguration + <$> _rtcConfIceServers + .= fieldWithDocModifier "ice_servers" (description ?~ "Array of 'RTCIceServer' objects") (nonEmptyArray schema) <*> _rtcConfSftServers - .= maybe_ (optFieldWithDocModifier "sft_servers" (description ?~ "Array of 'SFTServer' objects (optional)") (nonEmptyArray schema)) + .= maybe_ (optFieldWithDocModifier "sft_servers" (description ?~ "Array of 'SFTServer' objects (optional)") (nonEmptyArray schema)) <*> _rtcConfTTL - .= fieldWithDocModifier "ttl" (description ?~ "Number of seconds after which the configuration should be refreshed (advisory)") schema + .= fieldWithDocModifier "ttl" (description ?~ "Number of seconds after which the configuration should be refreshed (advisory)") schema <*> _rtcConfSftServersAll - .= maybe_ (optFieldWithDocModifier "sft_servers_all" (description ?~ "Array of all SFT servers") (array schema)) + .= maybe_ (optFieldWithDocModifier "sft_servers_all" (description ?~ "Array of all SFT servers") (array schema)) <*> _rtcConfIsFederating - .= maybe_ (optFieldWithDocModifier "is_federating" (description ?~ "True if the client should connect to an SFT in the sft_servers_all and request it to federate") schema) + .= maybe_ (optFieldWithDocModifier "is_federating" (description ?~ "True if the client should connect to an SFT in the sft_servers_all and request it to federate") schema) -------------------------------------------------------------------------------- -- SFTServer @@ -169,10 +169,10 @@ newtype SFTServer = SFTServer instance ToSchema SFTServer where schema = - objectWithDocModifier "SftServer" (description ?~ "Inspired by WebRTC 'RTCIceServer' object, contains details of SFT servers") $ - SFTServer - <$> (pure . _sftURL) - .= fieldWithDocModifier "urls" (description ?~ "Array containing exactly one SFT server address of the form 'https://:'") (withParser (array schema) p) + objectWithDocModifier "SftServer" (description ?~ "Inspired by WebRTC 'RTCIceServer' object, contains details of SFT servers") + $ SFTServer + <$> (pure . _sftURL) + .= fieldWithDocModifier "urls" (description ?~ "Array containing exactly one SFT server address of the form 'https://:'") (withParser (array schema) p) where p :: [HttpsUrl] -> A.Parser HttpsUrl p [url] = pure url @@ -195,14 +195,14 @@ data AuthSFTServer = AuthSFTServer instance ToSchema AuthSFTServer where schema = - objectWithDocModifier "SftServer" (description ?~ "Inspired by WebRTC 'RTCIceServer' object, contains details of SFT servers") $ - AuthSFTServer - <$> (pure . _authURL) - .= fieldWithDocModifier "urls" (description ?~ "Array containing exactly one SFT server address of the form 'https://:'") (withParser (array schema) p) + objectWithDocModifier "SftServer" (description ?~ "Inspired by WebRTC 'RTCIceServer' object, contains details of SFT servers") + $ AuthSFTServer + <$> (pure . _authURL) + .= fieldWithDocModifier "urls" (description ?~ "Array containing exactly one SFT server address of the form 'https://:'") (withParser (array schema) p) <*> _authUsername - .= maybe_ (optFieldWithDocModifier "username" (description ?~ "String containing the SFT username") schema) + .= maybe_ (optFieldWithDocModifier "username" (description ?~ "String containing the SFT username") schema) <*> _authCredential - .= maybe_ (optFieldWithDocModifier "credential" (description ?~ "String containing the SFT credential") schema) + .= maybe_ (optFieldWithDocModifier "credential" (description ?~ "String containing the SFT credential") schema) where p :: [HttpsUrl] -> A.Parser HttpsUrl p [url] = pure url @@ -234,14 +234,14 @@ rtcIceServer = RTCIceServer instance ToSchema RTCIceServer where schema = - objectWithDocModifier "RTCIceServer" (description ?~ "A subset of the WebRTC 'RTCIceServer' object") $ - RTCIceServer - <$> _iceURLs - .= fieldWithDocModifier "urls" (description ?~ "Array of TURN server addresses of the form 'turn::'") (nonEmptyArray schema) + objectWithDocModifier "RTCIceServer" (description ?~ "A subset of the WebRTC 'RTCIceServer' object") + $ RTCIceServer + <$> _iceURLs + .= fieldWithDocModifier "urls" (description ?~ "Array of TURN server addresses of the form 'turn::'") (nonEmptyArray schema) <*> _iceUsername - .= fieldWithDocModifier "username" (description ?~ "Username to use for authenticating against the given TURN servers") schema + .= fieldWithDocModifier "username" (description ?~ "Username to use for authenticating against the given TURN servers") schema <*> _iceCredential - .= fieldWithDocModifier "credential" (description ?~ "Password to use for authenticating against the given TURN servers") schema + .= fieldWithDocModifier "credential" (description ?~ "Password to use for authenticating against the given TURN servers") schema -------------------------------------------------------------------------------- -- TurnURI @@ -329,8 +329,8 @@ instance BC.FromByteString Scheme where instance ToSchema Scheme where schema = - enum @Text "Scheme" $ - mconcat + enum @Text "Scheme" + $ mconcat [ element "turn" SchemeTurn, element "turns" SchemeTurns ] @@ -349,20 +349,20 @@ data TurnHostTag = TurnHostIpTag | TurnHostNameTag tagSchema :: ValueSchema NamedSwaggerDoc TurnHostTag tagSchema = - enum @Text "TurnHostTag" $ - mconcat + enum @Text "TurnHostTag" + $ mconcat [ element "TurnHostIp" TurnHostIpTag, element "TurnHostName" TurnHostNameTag ] turnHostSchema :: ValueSchema NamedSwaggerDoc TurnHost turnHostSchema = - object "TurnHost" $ - fromTagged - <$> toTagged - .= bind - (fst .= field "tag" tagSchema) - (snd .= fieldOver _1 "contents" untaggedSchema) + object "TurnHost" + $ fromTagged + <$> toTagged + .= bind + (fst .= field "tag" tagSchema) + (snd .= fieldOver _1 "contents" untaggedSchema) where toTagged :: TurnHost -> (TurnHostTag, TurnHost) toTagged d@(TurnHostIp _) = (TurnHostIpTag, d) @@ -441,8 +441,8 @@ instance BC.FromByteString Transport where instance ToSchema Transport where schema = - enum @Text "Transport" $ - mconcat + enum @Text "Transport" + $ mconcat [ element "udp" TransportUDP, element "tcp" TransportTCP ] @@ -497,7 +497,7 @@ instance BC.ToByteString SFTUsername where <> shortByteString ".r=" <> byteString (view (re utf8) (_suRandom su)) where - boolToWord :: Num a => Bool -> a + boolToWord :: (Num a) => Bool -> a boolToWord False = 0 boolToWord True = 1 @@ -627,20 +627,26 @@ limitServers uris limit = limitServers' [] limit uris isUdp :: TurnURI -> Bool isUdp uri = - _turiScheme uri == SchemeTurn - && ( _turiTransport uri == Just TransportUDP + _turiScheme uri + == SchemeTurn + && ( _turiTransport uri + == Just TransportUDP || isNothing (_turiTransport uri) ) isTcp :: TurnURI -> Bool isTcp uri = - _turiScheme uri == SchemeTurn - && _turiTransport uri == Just TransportTCP + _turiScheme uri + == SchemeTurn + && _turiTransport uri + == Just TransportTCP isTls :: TurnURI -> Bool isTls uri = - _turiScheme uri == SchemeTurns - && _turiTransport uri == Just TransportTCP + _turiScheme uri + == SchemeTurns + && _turiTransport uri + == Just TransportTCP makeLenses ''RTCConfiguration makeLenses ''RTCIceServer diff --git a/libs/wire-api/src/Wire/API/Connection.hs b/libs/wire-api/src/Wire/API/Connection.hs index 7c0fa5bbfdd..65f3942a816 100644 --- a/libs/wire-api/src/Wire/API/Connection.hs +++ b/libs/wire-api/src/Wire/API/Connection.hs @@ -84,10 +84,12 @@ data UserConnectionList = UserConnectionList instance ToSchema UserConnectionList where schema = - object "UserConnectionList" $ - UserConnectionList - <$> clConnections .= field "connections" (array schema) - <*> clHasMore .= fieldWithDocModifier "has_more" (description ?~ "Indicator that the server has more connections than returned.") schema + object "UserConnectionList" + $ UserConnectionList + <$> clConnections + .= field "connections" (array schema) + <*> clHasMore + .= fieldWithDocModifier "has_more" (description ?~ "Indicator that the server has more connections than returned.") schema -------------------------------------------------------------------------------- -- UserConnection @@ -111,17 +113,22 @@ data UserConnection = UserConnection instance ToSchema UserConnection where schema = - object "UserConnection" $ - UserConnection - <$> ucFrom .= field "from" schema - <*> ucTo .= field "qualified_to" schema + object "UserConnection" + $ UserConnection + <$> ucFrom + .= field "from" schema + <*> ucTo + .= field "qualified_to" schema <* (qUnqualified . ucTo) - .= optional (field "to" (deprecatedSchema "qualified_to" schema)) - <*> ucStatus .= field "status" schema - <*> ucLastUpdate .= field "last_update" schema - <*> ucConvId .= maybe_ (optField "qualified_conversation" schema) + .= optional (field "to" (deprecatedSchema "qualified_to" schema)) + <*> ucStatus + .= field "status" schema + <*> ucLastUpdate + .= field "last_update" schema + <*> ucConvId + .= maybe_ (optField "qualified_conversation" schema) <* (fmap qUnqualified . ucConvId) - .= maybe_ (optField "conversation" (deprecatedSchema "qualified_conversation" schema)) + .= maybe_ (optField "conversation" (deprecatedSchema "qualified_conversation" schema)) -------------------------------------------------------------------------------- -- Relation @@ -193,8 +200,8 @@ relationDropHistory = \case instance ToSchema Relation where schema = - enum @Text "Relation" $ - mconcat + enum @Text "Relation" + $ mconcat [ element "accepted" Accepted, element "blocked" Blocked, element "pending" Pending, @@ -278,10 +285,12 @@ data ConnectionRequest = ConnectionRequest instance ToSchema ConnectionRequest where schema = - object "ConnectionRequest" $ - ConnectionRequest - <$> crUser .= fieldWithDocModifier "user" (description ?~ "user ID of the user to request a connection with") schema - <*> crName .= fieldWithDocModifier "name" (description ?~ "Name of the (pending) conversation being initiated (1 - 256) characters)") schema + object "ConnectionRequest" + $ ConnectionRequest + <$> crUser + .= fieldWithDocModifier "user" (description ?~ "user ID of the user to request a connection with") schema + <*> crName + .= fieldWithDocModifier "name" (description ?~ "Name of the (pending) conversation being initiated (1 - 256) characters)") schema -- | Payload type for "please change the status of this connection". newtype ConnectionUpdate = ConnectionUpdate @@ -293,6 +302,7 @@ newtype ConnectionUpdate = ConnectionUpdate instance ToSchema ConnectionUpdate where schema = - object "ConnectionUpdate" $ - ConnectionUpdate - <$> cuStatus .= fieldWithDocModifier "status" (description ?~ "New relation status") schema + object "ConnectionUpdate" + $ ConnectionUpdate + <$> cuStatus + .= fieldWithDocModifier "status" (description ?~ "New relation status") schema diff --git a/libs/wire-api/src/Wire/API/Conversation.hs b/libs/wire-api/src/Wire/API/Conversation.hs index 1165445df2f..46e35bca345 100644 --- a/libs/wire-api/src/Wire/API/Conversation.hs +++ b/libs/wire-api/src/Wire/API/Conversation.hs @@ -268,7 +268,7 @@ cnvReceiptMode = cnvmReceiptMode . cnvMetadata instance ToSchema Conversation where schema = conversationSchema Nothing -instance SingI v => ToSchema (Versioned v Conversation) where +instance (SingI v) => ToSchema (Versioned v Conversation) where schema = Versioned <$> unVersioned .= conversationSchema (Just (demote @v)) conversationObjectSchema :: Maybe Version -> ObjectSchema SwaggerDoc Conversation @@ -305,7 +305,7 @@ data CreateGroupConversation = CreateGroupConversation instance ToSchema CreateGroupConversation where schema = createGroupConversationSchema Nothing -instance SingI v => ToSchema (Versioned v CreateGroupConversation) where +instance (SingI v) => ToSchema (Versioned v CreateGroupConversation) where schema = Versioned <$> unVersioned .= createGroupConversationSchema (Just (demote @v)) createGroupConversationSchema :: Maybe Version -> ValueSchema NamedSwaggerDoc CreateGroupConversation @@ -314,14 +314,14 @@ createGroupConversationSchema v = "CreateGroupConversation" (description ?~ "A created group-conversation object extended with a list of failed-to-add users") $ CreateGroupConversation - <$> cgcConversation .= conversationObjectSchema v - <*> (toFlatList . cgcFailedToAdd) - .= field "failed_to_add" (fromFlatList <$> array schema) + <$> cgcConversation .= conversationObjectSchema v + <*> (toFlatList . cgcFailedToAdd) + .= field "failed_to_add" (fromFlatList <$> array schema) where toFlatList :: Map Domain (Set a) -> [Qualified a] toFlatList m = (\(d, s) -> flip Qualified d <$> Set.toList s) =<< Map.assocs m - fromFlatList :: Ord a => [Qualified a] -> Map Domain (Set a) + fromFlatList :: (Ord a) => [Qualified a] -> Map Domain (Set a) fromFlatList = fmap Set.fromList . indexQualified -- | Limited view of a 'Conversation'. Is used to inform users with an invite @@ -343,9 +343,9 @@ instance ToSchema ConversationCoverView where "ConversationCoverView" (description ?~ "Limited view of Conversation.") $ ConversationCoverView - <$> cnvCoverConvId .= field "id" schema - <*> cnvCoverName .= optField "name" (maybeWithDefault A.Null schema) - <*> cnvCoverHasPassword .= field "has_password" schema + <$> cnvCoverConvId .= field "id" schema + <*> cnvCoverName .= optField "name" (maybeWithDefault A.Null schema) + <*> cnvCoverHasPassword .= field "has_password" schema data ConversationList a = ConversationList { convList :: [a], @@ -375,7 +375,7 @@ instance ToSchema (Versioned 'V2 (ConversationList Conversation)) where conversationListSchema :: forall a. - ConversationListItem a => + (ConversationListItem a) => ValueSchema NamedSwaggerDoc a -> ValueSchema NamedSwaggerDoc (ConversationList a) conversationListSchema sch = @@ -383,12 +383,12 @@ conversationListSchema sch = "ConversationList" (description ?~ "Object holding a list of " <> convListItemName (Proxy @a)) $ ConversationList - <$> convList .= field "conversations" (array sch) - <*> convHasMore - .= fieldWithDocModifier - "has_more" - (description ?~ "Indicator that the server has more conversations than returned") - schema + <$> convList .= field "conversations" (array sch) + <*> convHasMore + .= fieldWithDocModifier + "has_more" + (description ?~ "Indicator that the server has more conversations than returned") + schema type ConversationPagingName = "ConversationIds" @@ -422,7 +422,7 @@ instance ToSchema ListConversations where "ListConversations" (description ?~ "A request to list some of a user's conversations, including remote ones. Maximum 1000 qualified conversation IDs") $ ListConversations - <$> (fromRange . lcQualifiedIds) .= field "qualified_ids" (rangedSchema (array schema)) + <$> (fromRange . lcQualifiedIds) .= field "qualified_ids" (rangedSchema (array schema)) data ConversationsResponse = ConversationsResponse { crFound :: [Conversation], @@ -442,14 +442,14 @@ conversationsResponseSchema v = ("ConversationsResponse" <> foldMap (Text.toUpper . versionText) v) (description ?~ "Response object for getting metadata of a list of conversations") $ ConversationsResponse - <$> crFound .= field "found" (array (conversationSchema v)) - <*> crNotFound .= fieldWithDocModifier "not_found" notFoundDoc (array schema) - <*> crFailed .= fieldWithDocModifier "failed" failedDoc (array schema) + <$> crFound .= field "found" (array (conversationSchema v)) + <*> crNotFound .= fieldWithDocModifier "not_found" notFoundDoc (array schema) + <*> crFailed .= fieldWithDocModifier "failed" failedDoc (array schema) instance ToSchema ConversationsResponse where schema = conversationsResponseSchema Nothing -instance SingI v => ToSchema (Versioned v ConversationsResponse) where +instance (SingI v) => ToSchema (Versioned v ConversationsResponse) where schema = Versioned <$> unVersioned .= conversationsResponseSchema (Just (demote @v)) -------------------------------------------------------------------------------- @@ -471,14 +471,14 @@ data Access instance ToSchema Access where schema = - (S.schema . description ?~ "How users can join conversations") $ - enum @Text "Access" $ - mconcat - [ element "private" PrivateAccess, - element "invite" InviteAccess, - element "link" LinkAccess, - element "code" CodeAccess - ] + (S.schema . description ?~ "How users can join conversations") + $ enum @Text "Access" + $ mconcat + [ element "private" PrivateAccess, + element "invite" InviteAccess, + element "link" LinkAccess, + element "code" CodeAccess + ] -- | AccessRoles define who can join conversations. The roles are -- "supersets", i.e. Activated includes Team and NonActivated includes @@ -553,19 +553,19 @@ toAccessRoleLegacy :: Set AccessRole -> AccessRoleLegacy toAccessRoleLegacy accessRoles = do fromMaybe NonActivatedAccessRole $ find (allMember accessRoles . fromAccessRoleLegacy) [minBound ..] where - allMember :: Ord a => Set a -> Set a -> Bool + allMember :: (Ord a) => Set a -> Set a -> Bool allMember rhs lhs = all (`Set.member` lhs) rhs instance ToSchema AccessRole where schema = - (S.schema . description ?~ desc) $ - enum @Text "AccessRole" $ - mconcat - [ element "team_member" TeamMemberAccessRole, - element "non_team_member" NonTeamMemberAccessRole, - element "guest" GuestAccessRole, - element "service" ServiceAccessRole - ] + (S.schema . description ?~ desc) + $ enum @Text "AccessRole" + $ mconcat + [ element "team_member" TeamMemberAccessRole, + element "non_team_member" NonTeamMemberAccessRole, + element "guest" GuestAccessRole, + element "service" ServiceAccessRole + ] where desc = "Which users/services can join conversations.\ @@ -578,15 +578,15 @@ instance ToSchema AccessRole where instance ToSchema AccessRoleLegacy where schema = - (S.schema . S.deprecated ?~ True) $ - (S.schema . description ?~ desc) $ - enum @Text "AccessRoleLegacy" $ - mconcat - [ element "private" PrivateAccessRole, - element "team" TeamAccessRole, - element "activated" ActivatedAccessRole, - element "non_activated" NonActivatedAccessRole - ] + (S.schema . S.deprecated ?~ True) + $ (S.schema . description ?~ desc) + $ enum @Text "AccessRoleLegacy" + $ mconcat + [ element "private" PrivateAccessRole, + element "team" TeamAccessRole, + element "activated" ActivatedAccessRole, + element "non_activated" NonActivatedAccessRole + ] where desc = "Which users can join conversations (deprecated, use `access_role_v2` instead).\ @@ -614,8 +614,8 @@ data ConvType instance ToSchema ConvType where schema = - enum @Integer "ConvType" $ - mconcat + enum @Integer "ConvType" + $ mconcat [ element 0 RegularConv, element 1 SelfConv, element 2 One2OneConv, @@ -637,8 +637,9 @@ newtype ReceiptMode = ReceiptMode {unReceiptMode :: Int32} instance ToSchema ReceiptMode where schema = - (S.schema . description ?~ "Conversation receipt mode") $ - ReceiptMode <$> unReceiptMode .= schema + (S.schema . description ?~ "Conversation receipt mode") + $ ReceiptMode + <$> unReceiptMode .= schema -------------------------------------------------------------------------------- -- create @@ -665,8 +666,8 @@ data NewConv = NewConv instance ToSchema NewConv where schema = - newConvSchema Nothing $ - maybe_ (optField "access_role" (set schema)) + newConvSchema Nothing + $ maybe_ (optField "access_role" (set schema)) instance ToSchema (Versioned 'V2 NewConv) where schema = Versioned <$> unVersioned .= newConvSchema (Just V2) accessRolesSchemaOptV2 @@ -680,49 +681,49 @@ newConvSchema v sch = ("NewConv" <> foldMap (Text.toUpper . versionText) v) (description ?~ "JSON object to create a new conversation. When using 'qualified_users' (preferred), you can omit 'users'") $ NewConv - <$> newConvUsers - .= ( fieldWithDocModifier - "users" - ( (deprecated ?~ True) - . (description ?~ usersDesc) - ) - (array schema) - <|> pure [] - ) - <*> newConvQualifiedUsers - .= ( fieldWithDocModifier - "qualified_users" - (description ?~ qualifiedUsersDesc) - (array schema) - <|> pure [] - ) - <*> newConvName .= maybe_ (optField "name" schema) - <*> (Set.toList . newConvAccess) - .= (fromMaybe mempty <$> optField "access" (Set.fromList <$> array schema)) - <*> newConvAccessRoles .= sch - <*> newConvTeam - .= maybe_ - ( optFieldWithDocModifier - "team" - (description ?~ "Team information of this conversation") - schema - ) - <*> newConvMessageTimer - .= maybe_ - ( optFieldWithDocModifier - "message_timer" - (description ?~ "Per-conversation message timer") - schema - ) - <*> newConvReceiptMode .= maybe_ (optField "receipt_mode" schema) - <*> newConvUsersRole - .= ( fieldWithDocModifier "conversation_role" (description ?~ usersRoleDesc) schema - <|> pure roleNameWireAdmin - ) - <*> newConvProtocol - .= fmap - (fromMaybe BaseProtocolProteusTag) - (optField "protocol" schema) + <$> newConvUsers + .= ( fieldWithDocModifier + "users" + ( (deprecated ?~ True) + . (description ?~ usersDesc) + ) + (array schema) + <|> pure [] + ) + <*> newConvQualifiedUsers + .= ( fieldWithDocModifier + "qualified_users" + (description ?~ qualifiedUsersDesc) + (array schema) + <|> pure [] + ) + <*> newConvName .= maybe_ (optField "name" schema) + <*> (Set.toList . newConvAccess) + .= (fromMaybe mempty <$> optField "access" (Set.fromList <$> array schema)) + <*> newConvAccessRoles .= sch + <*> newConvTeam + .= maybe_ + ( optFieldWithDocModifier + "team" + (description ?~ "Team information of this conversation") + schema + ) + <*> newConvMessageTimer + .= maybe_ + ( optFieldWithDocModifier + "message_timer" + (description ?~ "Per-conversation message timer") + schema + ) + <*> newConvReceiptMode .= maybe_ (optField "receipt_mode" schema) + <*> newConvUsersRole + .= ( fieldWithDocModifier "conversation_role" (description ?~ usersRoleDesc) schema + <|> pure roleNameWireAdmin + ) + <*> newConvProtocol + .= fmap + (fromMaybe BaseProtocolProteusTag) + (optField "protocol" schema) where usersDesc = "List of user IDs (excluding the requestor) to be \ @@ -732,12 +733,12 @@ newConvSchema v sch = \to be part of this conversation" usersRoleDesc :: Text usersRoleDesc = - Text.pack $ - "The conversation permissions the users \ - \added in this request should have. \ - \Optional, defaults to '" - <> show roleNameWireAdmin - <> "' if unset." + Text.pack + $ "The conversation permissions the users \ + \added in this request should have. \ + \Optional, defaults to '" + <> show roleNameWireAdmin + <> "' if unset." newtype ConvTeamInfo = ConvTeamInfo { cnvTeamId :: TeamId @@ -757,14 +758,14 @@ instance ToSchema ConvTeamInfo where "ConvTeamInfo" (description ?~ "Team information") $ ConvTeamInfo - <$> cnvTeamId .= field "teamid" schema - <* const () - .= fieldWithDocModifier - "managed" - (description ?~ managedDesc) - (c (False :: Bool)) + <$> cnvTeamId .= field "teamid" schema + <* const () + .= fieldWithDocModifier + "managed" + (description ?~ managedDesc) + (c (False :: Bool)) where - c :: ToJSON a => a -> ValueSchema SwaggerDoc () + c :: (ToJSON a) => a -> ValueSchema SwaggerDoc () c val = mkSchema mempty (const (pure ())) (const (pure (toJSON val))) -------------------------------------------------------------------------------- @@ -781,12 +782,12 @@ data Invite = Invite -- Deprecated, use InviteQualified (and maybe rename?) instance ToSchema Invite where schema = - object "Invite" $ - Invite - <$> (toNonEmpty . invUsers) - .= fmap List1 (field "users" (nonEmptyArray schema)) - <*> invRoleName - .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) + object "Invite" + $ Invite + <$> (toNonEmpty . invUsers) + .= fmap List1 (field "users" (nonEmptyArray schema)) + <*> invRoleName + .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) data InviteQualified = InviteQualified { invQUsers :: NonEmpty (Qualified UserId), @@ -799,11 +800,11 @@ data InviteQualified = InviteQualified instance ToSchema InviteQualified where schema = - object "InviteQualified" $ - InviteQualified - <$> invQUsers .= field "qualified_users" (nonEmptyArray schema) - <*> invQRoleName - .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) + object "InviteQualified" + $ InviteQualified + <$> invQUsers .= field "qualified_users" (nonEmptyArray schema) + <*> invQRoleName + .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) newInvite :: List1 UserId -> Invite newInvite us = Invite us roleNameWireAdmin @@ -820,13 +821,13 @@ newtype ConversationRename = ConversationRename instance ToSchema ConversationRename where schema = - object "ConversationRename" $ - ConversationRename - <$> cupName - .= fieldWithDocModifier - "name" - (description ?~ desc) - (unnamed (schema @Text)) + object "ConversationRename" + $ ConversationRename + <$> cupName + .= fieldWithDocModifier + "name" + (description ?~ desc) + (unnamed (schema @Text)) where desc = "The new conversation name" @@ -840,10 +841,10 @@ data ConversationAccessData = ConversationAccessData conversationAccessDataSchema :: Maybe Version -> ValueSchema NamedSwaggerDoc ConversationAccessData conversationAccessDataSchema v = - object ("ConversationAccessData" <> foldMap (Text.toUpper . versionText) v) $ - ConversationAccessData - <$> cupAccess .= field "access" (set schema) - <*> cupAccessRoles .= accessRolesVersionedSchema v + object ("ConversationAccessData" <> foldMap (Text.toUpper . versionText) v) + $ ConversationAccessData + <$> cupAccess .= field "access" (set schema) + <*> cupAccessRoles .= accessRolesVersionedSchema v instance ToSchema ConversationAccessData where schema = conversationAccessDataSchema Nothing @@ -860,9 +861,9 @@ data ConversationReceiptModeUpdate = ConversationReceiptModeUpdate instance ToSchema ConversationReceiptModeUpdate where schema = - objectWithDocModifier "ConversationReceiptModeUpdate" (description ?~ desc) $ - ConversationReceiptModeUpdate - <$> cruReceiptMode .= field "receipt_mode" (unnamed schema) + objectWithDocModifier "ConversationReceiptModeUpdate" (description ?~ desc) + $ ConversationReceiptModeUpdate + <$> cruReceiptMode .= field "receipt_mode" (unnamed schema) where desc = "Contains conversation receipt mode to update to. Receipt mode tells \ @@ -883,7 +884,7 @@ instance ToSchema ConversationMessageTimerUpdate where "ConversationMessageTimerUpdate" (description ?~ "Contains conversation properties to update") $ ConversationMessageTimerUpdate - <$> cupMessageTimer .= optField "message_timer" (maybeWithDefault A.Null schema) + <$> cupMessageTimer .= optField "message_timer" (maybeWithDefault A.Null schema) data ConversationJoin = ConversationJoin { cjUsers :: NonEmpty (Qualified UserId), @@ -899,8 +900,8 @@ instance ToSchema ConversationJoin where "ConversationJoin" (description ?~ "The action of some users joining a conversation") $ ConversationJoin - <$> cjUsers .= field "users" (nonEmptyArray schema) - <*> cjRole .= field "role" schema + <$> cjUsers .= field "users" (nonEmptyArray schema) + <*> cjRole .= field "role" schema data ConversationMemberUpdate = ConversationMemberUpdate { cmuTarget :: Qualified UserId, @@ -916,8 +917,8 @@ instance ToSchema ConversationMemberUpdate where "ConversationMemberUpdate" (description ?~ "The action of promoting/demoting a member of a conversation") $ ConversationMemberUpdate - <$> cmuTarget .= field "target" schema - <*> cmuUpdate .= field "update" schema + <$> cmuTarget .= field "target" schema + <*> cmuUpdate .= field "update" schema data ConversationRemoveMembers = ConversationRemoveMembers { crmTargets :: NonEmpty (Qualified UserId), @@ -933,8 +934,8 @@ instance ToSchema ConversationRemoveMembers where "ConversationRemoveMembers" (description ?~ "The action of removing members from a conversation") $ ConversationRemoveMembers - <$> crmTargets .= field "targets" (nonEmptyArray schema) - <*> crmReason .= field "reason" schema + <$> crmTargets .= field "targets" (nonEmptyArray schema) + <*> crmReason .= field "reason" schema -- | The id of the MLS self conversation for a given user mlsSelfConvId :: UserId -> ConvId diff --git a/libs/wire-api/src/Wire/API/Conversation/Action.hs b/libs/wire-api/src/Wire/API/Conversation/Action.hs index a929faaed3d..b7b42a9e8ef 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Action.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Action.hs @@ -113,15 +113,16 @@ instance S.ToSchema SomeConversationAction where (toJSON ConversationUpdateProtocolTag, protocolTag) ] <&> \(t, a) -> - S.Inline $ - mempty - & S.type_ ?~ S.OpenApiObject - & S.properties . at "tag" ?~ S.Inline (mempty & S.type_ ?~ S.OpenApiString & S.enum_ ?~ [t]) - & S.properties . at "action" ?~ a - & S.required .~ ["tag", "action"] - pure $ - S.NamedSchema (Just "SomeConversationAction") $ - mempty & S.oneOf ?~ schemas + S.Inline + $ mempty + & S.type_ ?~ S.OpenApiObject + & S.properties . at "tag" ?~ S.Inline (mempty & S.type_ ?~ S.OpenApiString & S.enum_ ?~ [t]) + & S.properties . at "action" ?~ a + & S.required .~ ["tag", "action"] + pure + $ S.NamedSchema (Just "SomeConversationAction") + $ mempty + & S.oneOf ?~ schemas conversationActionSchema :: forall tag. Sing tag -> ValueSchema NamedSwaggerDoc (ConversationAction tag) conversationActionSchema SConversationJoinTag = schema @ConversationJoin diff --git a/libs/wire-api/src/Wire/API/Conversation/Action/Tag.hs b/libs/wire-api/src/Wire/API/Conversation/Action/Tag.hs index 2ebac9c3605..93310463b49 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Action/Tag.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Action/Tag.hs @@ -47,8 +47,8 @@ instance Arbitrary ConversationActionTag where instance ToSchema ConversationActionTag where schema = - enum @Text "ConversationActionTag" $ - mconcat + enum @Text "ConversationActionTag" + $ mconcat [ element "ConversationJoinTag" ConversationJoinTag, element "ConversationLeaveTag" ConversationLeaveTag, element "ConversationRemoveMembersTag" ConversationRemoveMembersTag, diff --git a/libs/wire-api/src/Wire/API/Conversation/Bot.hs b/libs/wire-api/src/Wire/API/Conversation/Bot.hs index f46a83869d4..cd6bdf5383a 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Bot.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Bot.hs @@ -51,11 +51,14 @@ data AddBot = AddBot instance ToSchema AddBot where schema = - object "AddBot" $ - AddBot - <$> addBotProvider .= field "provider" schema - <*> addBotService .= field "service" schema - <*> addBotLocale .= maybe_ (optField "locale" schema) + object "AddBot" + $ AddBot + <$> addBotProvider + .= field "provider" schema + <*> addBotService + .= field "service" schema + <*> addBotLocale + .= maybe_ (optField "locale" schema) data AddBotResponse = AddBotResponse { rsAddBotId :: BotId, @@ -71,14 +74,20 @@ data AddBotResponse = AddBotResponse instance ToSchema AddBotResponse where schema = - object "AddBotResponse" $ - AddBotResponse - <$> rsAddBotId .= field "id" schema - <*> rsAddBotClient .= field "client" schema - <*> rsAddBotName .= field "name" schema - <*> rsAddBotColour .= field "accent_id" schema - <*> rsAddBotAssets .= field "assets" (array schema) - <*> rsAddBotEvent .= field "event" schema + object "AddBotResponse" + $ AddBotResponse + <$> rsAddBotId + .= field "id" schema + <*> rsAddBotClient + .= field "client" schema + <*> rsAddBotName + .= field "name" schema + <*> rsAddBotColour + .= field "accent_id" schema + <*> rsAddBotAssets + .= field "assets" (array schema) + <*> rsAddBotEvent + .= field "event" schema -------------------------------------------------------------------------------- -- RemoveBot @@ -94,9 +103,10 @@ newtype RemoveBotResponse = RemoveBotResponse instance ToSchema RemoveBotResponse where schema = - object "RemoveBotResponse" $ - RemoveBotResponse - <$> rsRemoveBotEvent .= field "event" schema + object "RemoveBotResponse" + $ RemoveBotResponse + <$> rsRemoveBotEvent + .= field "event" schema -------------------------------------------------------------------------------- -- UpdateBotPrekeys @@ -110,6 +120,7 @@ newtype UpdateBotPrekeys = UpdateBotPrekeys instance ToSchema UpdateBotPrekeys where schema = - object "UpdateBotPrekeys" $ - UpdateBotPrekeys - <$> updateBotPrekeyList .= field "prekeys" (array schema) + object "UpdateBotPrekeys" + $ UpdateBotPrekeys + <$> updateBotPrekeyList + .= field "prekeys" (array schema) diff --git a/libs/wire-api/src/Wire/API/Conversation/Code.hs b/libs/wire-api/src/Wire/API/Conversation/Code.hs index 51a142ddd09..73ab075d31f 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Code.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Code.hs @@ -60,7 +60,8 @@ instance ToSchema CreateConversationCodeRequest where "CreateConversationCodeRequest" (description ?~ "Request body for creating a conversation code") $ CreateConversationCodeRequest - <$> (.password) .= maybe_ (optFieldWithDocModifier "password" desc schema) + <$> (.password) + .= maybe_ (optFieldWithDocModifier "password" desc schema) where desc = description ?~ "Password for accessing the conversation via guest link. Set to null or omit for no password." @@ -78,8 +79,10 @@ instance ToSchema JoinConversationByCode where "JoinConversationByCode" (description ?~ "Request body for joining a conversation by code") $ JoinConversationByCode - <$> (.code) .= conversationCodeObjectSchema - <*> (.password) .= maybe_ (optField "password" schema) + <$> (.code) + .= conversationCodeObjectSchema + <*> (.password) + .= maybe_ (optField "password" schema) data ConversationCode = ConversationCode { conversationKey :: Code.Key, @@ -94,22 +97,22 @@ conversationCodeObjectSchema :: ObjectSchema SwaggerDoc ConversationCode conversationCodeObjectSchema = ConversationCode <$> conversationKey - .= fieldWithDocModifier - "key" - (description ?~ "Stable conversation identifier") - schema - <*> conversationCode - .= fieldWithDocModifier - "code" - (description ?~ "Conversation code (random)") - schema - <*> conversationUri - .= maybe_ - ( optFieldWithDocModifier - "uri" - (description ?~ "Full URI (containing key/code) to join a conversation") - schema - ) + .= fieldWithDocModifier + "key" + (description ?~ "Stable conversation identifier") + schema + <*> conversationCode + .= fieldWithDocModifier + "code" + (description ?~ "Conversation code (random)") + schema + <*> conversationUri + .= maybe_ + ( optFieldWithDocModifier + "uri" + (description ?~ "Full URI (containing key/code) to join a conversation") + schema + ) instance ToSchema ConversationCode where schema = @@ -132,8 +135,10 @@ instance ToSchema ConversationCodeInfo where "ConversationCodeInfo" (description ?~ "Contains conversation properties to update") $ ConversationCodeInfo - <$> (.code) .= conversationCodeObjectSchema - <*> (.hasPassword) .= fieldWithDocModifier "has_password" (description ?~ "Whether the conversation has a password") schema + <$> (.code) + .= conversationCodeObjectSchema + <*> (.hasPassword) + .= fieldWithDocModifier "has_password" (description ?~ "Whether the conversation has a password") schema mkConversationCodeInfo :: Bool -> Code.Key -> Code.Value -> HttpsUrl -> ConversationCodeInfo mkConversationCodeInfo hasPw k v (HttpsUrl prefix) = diff --git a/libs/wire-api/src/Wire/API/Conversation/Member.hs b/libs/wire-api/src/Wire/API/Conversation/Member.hs index f07f619b3e5..ad2ad1265d1 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Member.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Member.hs @@ -60,18 +60,18 @@ data ConvMembers = ConvMembers instance ToSchema ConvMembers where schema = - objectWithDocModifier "ConvMembers" (description ?~ "Users of a conversation") $ - ConvMembers - <$> cmSelf - .= fieldWithDocModifier - "self" - (description ?~ "The user ID of the requestor") - schema - <*> cmOthers - .= fieldWithDocModifier - "others" - (description ?~ "All other current users of this conversation") - (array schema) + objectWithDocModifier "ConvMembers" (description ?~ "Users of a conversation") + $ ConvMembers + <$> cmSelf + .= fieldWithDocModifier + "self" + (description ?~ "The user ID of the requestor") + schema + <*> cmOthers + .= fieldWithDocModifier + "others" + (description ?~ "All other current users of this conversation") + (array schema) -------------------------------------------------------------------------------- -- Members @@ -107,31 +107,31 @@ defMember uid = instance ToSchema Member where schema = - object "Member" $ - Member - <$> memId .= field "qualified_id" schema - <* (qUnqualified . memId) - .= optional (field "id" (deprecatedSchema "qualified_id" schema)) - <*> memService .= optField "service" (maybeWithDefault A.Null schema) - -- Remove ... - <* const () .= optional (field "status" (c (0 :: Int))) - <* const () .= optional (field "status_ref" (c ("0.0" :: Text))) - <* const () - .= optional - ( field - "status_time" - (c ("1970-01-01T00:00:00.000Z" :: Text)) - ) - -- ... until here - <*> memOtrMutedStatus .= optField "otr_muted_status" (maybeWithDefault A.Null schema) - <*> memOtrMutedRef .= optField "otr_muted_ref" (maybeWithDefault A.Null schema) - <*> memOtrArchived .= (fromMaybe False <$> optField "otr_archived" schema) - <*> memOtrArchivedRef .= optField "otr_archived_ref" (maybeWithDefault A.Null schema) - <*> memHidden .= (field "hidden" schema <|> pure False) - <*> memHiddenRef .= optField "hidden_ref" (maybeWithDefault A.Null schema) - <*> memConvRoleName .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) + object "Member" + $ Member + <$> memId .= field "qualified_id" schema + <* (qUnqualified . memId) + .= optional (field "id" (deprecatedSchema "qualified_id" schema)) + <*> memService .= optField "service" (maybeWithDefault A.Null schema) + -- Remove ... + <* const () .= optional (field "status" (c (0 :: Int))) + <* const () .= optional (field "status_ref" (c ("0.0" :: Text))) + <* const () + .= optional + ( field + "status_time" + (c ("1970-01-01T00:00:00.000Z" :: Text)) + ) + -- ... until here + <*> memOtrMutedStatus .= optField "otr_muted_status" (maybeWithDefault A.Null schema) + <*> memOtrMutedRef .= optField "otr_muted_ref" (maybeWithDefault A.Null schema) + <*> memOtrArchived .= (fromMaybe False <$> optField "otr_archived" schema) + <*> memOtrArchivedRef .= optField "otr_archived_ref" (maybeWithDefault A.Null schema) + <*> memHidden .= (field "hidden" schema <|> pure False) + <*> memHiddenRef .= optField "hidden_ref" (maybeWithDefault A.Null schema) + <*> memConvRoleName .= (fromMaybe roleNameWireAdmin <$> optField "conversation_role" schema) where - c :: ToJSON a => a -> ValueSchema SwaggerDoc () + c :: (ToJSON a) => a -> ValueSchema SwaggerDoc () c val = mkSchema mempty (const (pure ())) (const (pure (toJSON val))) -- | The semantics of the possible different values is entirely up to clients, @@ -160,13 +160,13 @@ defOtherMember uid = instance ToSchema OtherMember where schema = - object "OtherMember" $ - OtherMember - <$> omQualifiedId .= field "qualified_id" schema - <* (qUnqualified . omQualifiedId) .= optional (field "id" schema) - <*> omService .= maybe_ (optFieldWithDocModifier "service" (description ?~ desc) schema) - <*> omConvRoleName .= (field "conversation_role" schema <|> pure roleNameWireAdmin) - <* const (0 :: Int) .= optional (fieldWithDocModifier "status" ((deprecated ?~ True) . (description ?~ "deprecated")) schema) -- TODO: remove + object "OtherMember" + $ OtherMember + <$> omQualifiedId .= field "qualified_id" schema + <* (qUnqualified . omQualifiedId) .= optional (field "id" schema) + <*> omService .= maybe_ (optFieldWithDocModifier "service" (description ?~ desc) schema) + <*> omConvRoleName .= (field "conversation_role" schema <|> pure roleNameWireAdmin) + <* const (0 :: Int) .= optional (fieldWithDocModifier "status" ((deprecated ?~ True) . (description ?~ "deprecated")) schema) -- TODO: remove where desc = "The reference to the owning service, if the member is a 'bot'." @@ -197,12 +197,12 @@ instance ToSchema MemberUpdate where (`withParser` (either fail pure . validateMemberUpdate)) . object "MemberUpdate" $ MemberUpdate - <$> mupOtrMuteStatus .= maybe_ (optField "otr_muted_status" schema) - <*> mupOtrMuteRef .= maybe_ (optField "otr_muted_ref" schema) - <*> mupOtrArchive .= maybe_ (optField "otr_archived" schema) - <*> mupOtrArchiveRef .= maybe_ (optField "otr_archived_ref" schema) - <*> mupHidden .= maybe_ (optField "hidden" schema) - <*> mupHiddenRef .= maybe_ (optField "hidden_ref" schema) + <$> mupOtrMuteStatus .= maybe_ (optField "otr_muted_status" schema) + <*> mupOtrMuteRef .= maybe_ (optField "otr_muted_ref" schema) + <*> mupOtrArchive .= maybe_ (optField "otr_archived" schema) + <*> mupOtrArchiveRef .= maybe_ (optField "otr_archived_ref" schema) + <*> mupHidden .= maybe_ (optField "hidden" schema) + <*> mupHiddenRef .= maybe_ (optField "hidden_ref" schema) instance Arbitrary MemberUpdate where arbitrary = @@ -241,7 +241,7 @@ instance ToSchema OtherMemberUpdate where "OtherMemberUpdate" (description ?~ "Update user properties of other members relative to a conversation") $ OtherMemberUpdate - <$> omuConvRoleName .= maybe_ (optField "conversation_role" schema) + <$> omuConvRoleName .= maybe_ (optField "conversation_role" schema) validateOtherMemberUpdate :: OtherMemberUpdate -> Either String OtherMemberUpdate validateOtherMemberUpdate u diff --git a/libs/wire-api/src/Wire/API/Conversation/Protocol.hs b/libs/wire-api/src/Wire/API/Conversation/Protocol.hs index c0060347b7b..a4eb8b87165 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Protocol.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Protocol.hs @@ -77,8 +77,10 @@ arbitraryActiveData = do if epoch == Epoch 0 then pure Nothing else - fmap Just $ - ActiveMLSConversationData epoch <$> arbitrary <*> arbitrary + fmap Just + $ ActiveMLSConversationData epoch + <$> arbitrary + <*> arbitrary instance Arbitrary ConversationMLSData where arbitrary = ConversationMLSData <$> arbitrary <*> arbitraryActiveData @@ -226,8 +228,8 @@ protocolValidAction (ProtocolMLS _) _ = True instance ToSchema ProtocolTag where schema = - enum @Text "Protocol" $ - mconcat + enum @Text "Protocol" + $ mconcat [ element "proteus" ProtocolProteusTag, element "mls" ProtocolMLSTag, element "mixed" ProtocolMixedTag diff --git a/libs/wire-api/src/Wire/API/Conversation/Role.hs b/libs/wire-api/src/Wire/API/Conversation/Role.hs index edb97c23f42..fad42a063ac 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Role.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Role.hs @@ -144,12 +144,16 @@ instance S.ToSchema ConversationRole where actionsSchema <- S.declareSchema (Proxy @[Action]) let convRoleSchema :: S.Schema = mempty - & S.properties . at "conversation_role" ?~ conversationRoleSchema - & S.properties . at "actions" - ?~ S.Inline - ( actionsSchema - & description ?~ "The set of actions allowed for this role" - ) + & S.properties + . at "conversation_role" + ?~ conversationRoleSchema + & S.properties + . at "actions" + ?~ S.Inline + ( actionsSchema + & description + ?~ "The set of actions allowed for this role" + ) pure (S.NamedSchema (Just "ConversationRole") convRoleSchema) instance ToJSON ConversationRole where @@ -211,7 +215,8 @@ instance ToJSON ConversationRolesList where instance FromJSON ConversationRolesList where parseJSON = A.withObject "ConversationRolesList" $ \o -> ConversationRolesList - <$> o A..: "conversation_roles" + <$> o + A..: "conversation_roles" -------------------------------------------------------------------------------- -- RoleName @@ -226,8 +231,10 @@ newtype RoleName = RoleName {fromRoleName :: Text} instance ToSchema RoleName where schema = - (S.schema . description ?~ desc) $ - RoleName <$> fromRoleName .= text "RoleName" + (S.schema . description ?~ desc) + $ RoleName + <$> fromRoleName + .= text "RoleName" where desc = "Role name, between 2 and 128 chars, 'wire_' prefix \ @@ -241,7 +248,8 @@ deriving instance Cql RoleName instance Arbitrary RoleName where arbitrary = - RoleName . fromRange + RoleName + . fromRange <$> genRangeText @2 @128 genChar where genChar = QC.elements $ ['a' .. 'z'] <> ['0' .. '9'] <> ['_'] diff --git a/libs/wire-api/src/Wire/API/Conversation/Typing.hs b/libs/wire-api/src/Wire/API/Conversation/Typing.hs index 076dbde5e47..dbd5287ad23 100644 --- a/libs/wire-api/src/Wire/API/Conversation/Typing.hs +++ b/libs/wire-api/src/Wire/API/Conversation/Typing.hs @@ -35,11 +35,11 @@ data TypingStatus instance ToSchema TypingStatus where schema = - object "TypingData" $ - field "status" typingStatusSchema + object "TypingData" + $ field "status" typingStatusSchema typingStatusSchema :: ValueSchema NamedSwaggerDoc TypingStatus typingStatusSchema = - enum @Text "TypingStatus" $ - element "started" StartedTyping - <> element "stopped" StoppedTyping + enum @Text "TypingStatus" + $ element "started" StartedTyping + <> element "stopped" StoppedTyping diff --git a/libs/wire-api/src/Wire/API/CustomBackend.hs b/libs/wire-api/src/Wire/API/CustomBackend.hs index f7c12e0140d..d9af54a26e0 100644 --- a/libs/wire-api/src/Wire/API/CustomBackend.hs +++ b/libs/wire-api/src/Wire/API/CustomBackend.hs @@ -40,7 +40,9 @@ data CustomBackend = CustomBackend instance ToSchema CustomBackend where schema = - objectWithDocModifier "CustomBackend" (description ?~ "Description of a custom backend") $ - CustomBackend - <$> backendConfigJsonUrl .= fieldWithDocModifier "config_json_url" (description ?~ "the location of the custom backend's config.json file") schema - <*> backendWebappWelcomeUrl .= fieldWithDocModifier "webapp_welcome_url" (description ?~ "the location of the custom webapp") schema + objectWithDocModifier "CustomBackend" (description ?~ "Description of a custom backend") + $ CustomBackend + <$> backendConfigJsonUrl + .= fieldWithDocModifier "config_json_url" (description ?~ "the location of the custom backend's config.json file") schema + <*> backendWebappWelcomeUrl + .= fieldWithDocModifier "webapp_welcome_url" (description ?~ "the location of the custom webapp") schema diff --git a/libs/wire-api/src/Wire/API/Deprecated.hs b/libs/wire-api/src/Wire/API/Deprecated.hs index c68120be996..6a584f5582a 100644 --- a/libs/wire-api/src/Wire/API/Deprecated.hs +++ b/libs/wire-api/src/Wire/API/Deprecated.hs @@ -35,23 +35,23 @@ data Deprecated deriving (Typeable) -- All of these instances are very similar to the instances -- for Summary. These don't impact the API directly, but are -- for marking the deprecated flag in the openapi output. -instance HasLink sub => HasLink (Deprecated :> sub :: Type) where +instance (HasLink sub) => HasLink (Deprecated :> sub :: Type) where type MkLink (Deprecated :> sub) a = MkLink sub a toLink = let simpleToLink toA _ = toLink toA (Proxy :: Proxy sub) in simpleToLink -instance HasOpenApi api => HasOpenApi (Deprecated :> api :: Type) where +instance (HasOpenApi api) => HasOpenApi (Deprecated :> api :: Type) where toOpenApi _ = toOpenApi (Proxy @api) & allOperations . deprecated ?~ True -instance HasServer api ctx => HasServer (Deprecated :> api) ctx where +instance (HasServer api ctx) => HasServer (Deprecated :> api) ctx where type ServerT (Deprecated :> api) m = ServerT api m route _ = route $ Proxy @api hoistServerWithContext _ pc nt s = hoistServerWithContext (Proxy @api) pc nt s -instance HasClient m api => HasClient m (Deprecated :> api) where +instance (HasClient m api) => HasClient m (Deprecated :> api) where type Client m (Deprecated :> api) = Client m api clientWithRoute pm _ = clientWithRoute pm (Proxy :: Proxy api) hoistClientMonad pm _ f cl = hoistClientMonad pm (Proxy :: Proxy api) f cl diff --git a/libs/wire-api/src/Wire/API/Error.hs b/libs/wire-api/src/Wire/API/Error.hs index 7f6dab367dd..40a7de99cd7 100644 --- a/libs/wire-api/src/Wire/API/Error.hs +++ b/libs/wire-api/src/Wire/API/Error.hs @@ -91,9 +91,13 @@ instance ToJSON DynError where dynErrorFromWai :: Wai.Error -> DynError dynErrorFromWai = DynError - <$> fromIntegral . HTTP.statusCode . Wai.code - <*> LT.toStrict . Wai.label - <*> LT.toStrict . Wai.message + <$> fromIntegral + . HTTP.statusCode + . Wai.code + <*> LT.toStrict + . Wai.label + <*> LT.toStrict + . Wai.message instance FromJSON DynError where parseJSON = fmap dynErrorFromWai . parseJSON @@ -137,16 +141,16 @@ mkDynError c l msg = (Text.pack (symbolVal l)) (Text.pack (symbolVal msg)) -dynError :: forall e. KnownError e => DynError +dynError :: forall e. (KnownError e) => DynError dynError = dynError' $ seSing @e staticErrorSchema :: SStaticError e -> ValueSchema NamedSwaggerDoc (SStaticError e) staticErrorSchema e@(SStaticError c l m) = - objectWithDocModifier "Error" addExample $ - SStaticError - <$> (c <$ (const code .= field "code" codeSchema)) - <*> (l <$ (const label .= field "label" labelSchema)) - <*> (m <$ (const message .= field "message" schema)) + objectWithDocModifier "Error" addExample + $ SStaticError + <$> (c <$ (const code .= field "code" codeSchema)) + <*> (l <$ (const label .= field "label" labelSchema)) + <*> (m <$ (const message .= field "message" schema)) where err = dynError' e label = eLabel err @@ -159,17 +163,17 @@ staticErrorSchema e@(SStaticError c l m) = codeSchema :: ValueSchema SwaggerDoc Natural codeSchema = unnamed $ enum @Natural "Status" (element code code) -instance KnownError e => ToSchema (SStaticError e) where +instance (KnownError e) => ToSchema (SStaticError e) where schema = staticErrorSchema seSing data CanThrow e data CanThrowMany e -instance RoutesToPaths api => RoutesToPaths (CanThrow err :> api) where +instance (RoutesToPaths api) => RoutesToPaths (CanThrow err :> api) where getRoutes = getRoutes @api -instance RoutesToPaths api => RoutesToPaths (CanThrowMany errs :> api) where +instance (RoutesToPaths api) => RoutesToPaths (CanThrowMany errs :> api) where getRoutes = getRoutes @api type instance @@ -194,7 +198,7 @@ instance where toOpenApi _ = addToOpenApi @e (toOpenApi (Proxy @api)) -instance HasClient m api => HasClient m (CanThrow e :> api) where +instance (HasClient m api) => HasClient m (CanThrow e :> api) where type Client m (CanThrow e :> api) = Client m api clientWithRoute pm _ = clientWithRoute pm $ Proxy @api hoistClientMonad pm _ = hoistClientMonad pm (Proxy @api) @@ -203,7 +207,7 @@ type instance SpecialiseToVersion v (CanThrowMany es :> api) = CanThrowMany es :> SpecialiseToVersion v api -instance HasOpenApi api => HasOpenApi (CanThrowMany '() :> api) where +instance (HasOpenApi api) => HasOpenApi (CanThrowMany '() :> api) where toOpenApi _ = toOpenApi (Proxy @api) instance @@ -223,18 +227,21 @@ type family DeclaredErrorEffects api :: EffectRow where errorResponseSwagger :: forall e. (Typeable e, KnownError e) => S.Response errorResponseSwagger = mempty - & S.description .~ (eMessage err <> " (label: `" <> eLabel err <> "`)") - -- Defaulting this to JSON, as openapi3 needs something to map a schema against. - -- This _should_ be overridden with the actual media types once we are at the - -- point of rendering out the schemas for MultiVerb. - -- Check the instance of `S.HasOpenApi (MultiVerb method (cs :: [Type]) as r)` - & S.content .~ singleton mediaType mediaTypeObject + & S.description + .~ (eMessage err <> " (label: `" <> eLabel err <> "`)") + -- Defaulting this to JSON, as openapi3 needs something to map a schema against. + -- This _should_ be overridden with the actual media types once we are at the + -- point of rendering out the schemas for MultiVerb. + -- Check the instance of `S.HasOpenApi (MultiVerb method (cs :: [Type]) as r)` + & S.content + .~ singleton mediaType mediaTypeObject where err = dynError @e mediaType = contentType $ Proxy @JSON mediaTypeObject = mempty - & S.schema ?~ S.Inline (S.toSchema (Proxy @(SStaticError e))) + & S.schema + ?~ S.Inline (S.toSchema (Proxy @(SStaticError e))) addErrorResponseToSwagger :: Int -> S.Response -> S.OpenApi -> S.OpenApi addErrorResponseToSwagger code resp = @@ -243,7 +250,7 @@ addErrorResponseToSwagger code resp = . S.responses . at code %~ Just - . addRef + . addRef where addRef :: Maybe (S.Referenced S.Response) -> S.Referenced S.Response addRef Nothing = S.Inline resp @@ -280,7 +287,7 @@ mapErrorS :: mapErrorS = mapError (Tagged @e' . unTagged) mapToRuntimeError :: - forall e e' r a. Member (Error e') r => e' -> Sem (ErrorS e ': r) a -> Sem r a + forall e e' r a. (Member (Error e') r) => e' -> Sem (ErrorS e ': r) a -> Sem r a mapToRuntimeError e' = mapError (const e') mapToDynamicError :: @@ -290,10 +297,10 @@ mapToDynamicError :: Sem r a mapToDynamicError = mapToRuntimeError (dynError @(MapError e)) -errorToWai :: forall e. KnownError (MapError e) => Wai.Error +errorToWai :: forall e. (KnownError (MapError e)) => Wai.Error errorToWai = dynErrorToWai (dynError @(MapError e)) -errorToResponse :: forall e. KnownError (MapError e) => JSONResponse +errorToResponse :: forall e. (KnownError (MapError e)) => JSONResponse errorToResponse = toResponse (dynError @(MapError e)) class APIError e where @@ -304,8 +311,8 @@ instance APIError Wai.Error where instance APIError DynError where toResponse (DynError c l m) = - toResponse $ - Wai.mkError (toEnum (fromIntegral c)) (LT.fromStrict l) (LT.fromStrict m) + toResponse + $ Wai.mkError (toEnum (fromIntegral c)) (LT.fromStrict l) (LT.fromStrict m) instance APIError (SStaticError e) where toResponse = toResponse . dynError' @@ -336,7 +343,7 @@ instance responseRender = responseRender @cs @(RespondWithStaticError (MapError e)) responseUnrender = responseUnrender @cs @(RespondWithStaticError (MapError e)) -instance KnownError (MapError e) => AsConstructor '[] (ErrorResponse e) where +instance (KnownError (MapError e)) => AsConstructor '[] (ErrorResponse e) where toConstructor _ = Nil fromConstructor _ = dynError @(MapError e) diff --git a/libs/wire-api/src/Wire/API/Error/Empty.hs b/libs/wire-api/src/Wire/API/Error/Empty.hs index 290c75c978d..1d1593c9e9e 100644 --- a/libs/wire-api/src/Wire/API/Error/Empty.hs +++ b/libs/wire-api/src/Wire/API/Error/Empty.hs @@ -33,15 +33,15 @@ data EmptyErrorForLegacyReasons s desc type instance ResponseType (EmptyErrorForLegacyReasons s desc) = () instance - KnownStatus s => + (KnownStatus s) => IsResponse cs (EmptyErrorForLegacyReasons s desc) where type ResponseStatus (EmptyErrorForLegacyReasons s desc) = s type ResponseBody (EmptyErrorForLegacyReasons s desc) = () responseRender _ () = - pure $ - addContentType @PlainText + pure + $ addContentType @PlainText Response { responseStatusCode = statusVal (Proxy @s), responseHeaders = mempty, @@ -52,13 +52,13 @@ instance responseUnrender _ output = guard (responseStatusCode output == statusVal (Proxy @s)) instance - KnownSymbol desc => + (KnownSymbol desc) => IsSwaggerResponse (EmptyErrorForLegacyReasons s desc) where responseSwagger = - pure $ - mempty - & S.description - .~ ( Text.pack (symbolVal (Proxy @desc)) - <> "(**Note**: This error has an empty body for legacy reasons)" - ) + pure + $ mempty + & S.description + .~ ( Text.pack (symbolVal (Proxy @desc)) + <> "(**Note**: This error has an empty body for legacy reasons)" + ) diff --git a/libs/wire-api/src/Wire/API/Error/Galley.hs b/libs/wire-api/src/Wire/API/Error/Galley.hs index 44722937b45..eb0db29b9d9 100644 --- a/libs/wire-api/src/Wire/API/Error/Galley.hs +++ b/libs/wire-api/src/Wire/API/Error/Galley.hs @@ -151,7 +151,7 @@ $(genSingletons [''GalleyError]) instance (Typeable (MapError e), KnownError (MapError e)) => IsSwaggerError (e :: GalleyError) where addToOpenApi = addStaticErrorToSwagger @(MapError e) -instance KnownError (MapError e) => APIError (Tagged (e :: GalleyError) ()) where +instance (KnownError (MapError e)) => APIError (Tagged (e :: GalleyError) ()) where toResponse _ = toResponse $ dynError @(MapError e) -- | Convenience synonym for an operation denied error with an unspecified permission. @@ -353,7 +353,7 @@ authenticationErrorToDyn ReAuthFailed = dynError @(MapError 'ReAuthFailed) authenticationErrorToDyn VerificationCodeAuthFailed = dynError @(MapError 'VerificationCodeAuthFailed) authenticationErrorToDyn VerificationCodeRequired = dynError @(MapError 'VerificationCodeRequired) -instance Member (Error DynError) r => ServerEffect (Error AuthenticationError) r where +instance (Member (Error DynError) r) => ServerEffect (Error AuthenticationError) r where interpretServerEffect = mapError authenticationErrorToDyn -------------------------------------------------------------------------------- @@ -402,7 +402,7 @@ type instance MapError 'MLSE2EIDMissingCrlProxy = 'StaticError 400 "mls-e2eid-mi type instance ErrorEffect TeamFeatureError = Error TeamFeatureError -instance Member (Error DynError) r => ServerEffect (Error TeamFeatureError) r where +instance (Member (Error DynError) r) => ServerEffect (Error TeamFeatureError) r where interpretServerEffect = mapError $ \case AppLockInactivityTimeoutTooLow -> dynError @(MapError 'AppLockInactivityTimeoutTooLow) LegalHoldFeatureFlagNotEnabled -> dynError @(MapError 'LegalHoldFeatureFlagNotEnabled) @@ -435,7 +435,7 @@ instance IsSwaggerError MLSProposalFailure where \for more details on the possible error responses of each type of \ \proposal." -instance Member (Error JSONResponse) r => ServerEffect (Error MLSProposalFailure) r where +instance (Member (Error JSONResponse) r) => ServerEffect (Error MLSProposalFailure) r where interpretServerEffect = mapError pfInner -------------------------------------------------------------------------------- @@ -460,34 +460,38 @@ nonFederatingBackendsStatus = HTTP.status409 nonFederatingBackendsToList :: NonFederatingBackends -> [Domain] nonFederatingBackendsToList (NonFederatingBackends a b) = [a, b] -nonFederatingBackendsFromList :: MonadFail m => [Domain] -> m NonFederatingBackends +nonFederatingBackendsFromList :: (MonadFail m) => [Domain] -> m NonFederatingBackends nonFederatingBackendsFromList [a, b] = pure (NonFederatingBackends a b) nonFederatingBackendsFromList domains = - fail $ - "Expected 2 backends, found " <> show (length domains) + fail + $ "Expected 2 backends, found " + <> show (length domains) instance ToSchema NonFederatingBackends where schema = - object "NonFederatingBackends" $ - withParser + object "NonFederatingBackends" + $ withParser (nonFederatingBackendsToList .= field "non_federating_backends" (array schema)) nonFederatingBackendsFromList instance IsSwaggerError NonFederatingBackends where addToOpenApi = - addErrorResponseToSwagger (HTTP.statusCode nonFederatingBackendsStatus) $ - mempty - & S.description .~ "Adding members to the conversation is not possible because the backends involved do not form a fully connected graph" - & S.content .~ singleton mediaType mediaTypeObject + addErrorResponseToSwagger (HTTP.statusCode nonFederatingBackendsStatus) + $ mempty + & S.description + .~ "Adding members to the conversation is not possible because the backends involved do not form a fully connected graph" + & S.content + .~ singleton mediaType mediaTypeObject where mediaType = contentType $ Proxy @JSON mediaTypeObject = mempty - & S.schema ?~ S.Inline (S.toSchema (Proxy @NonFederatingBackends)) + & S.schema + ?~ S.Inline (S.toSchema (Proxy @NonFederatingBackends)) type instance ErrorEffect NonFederatingBackends = Error NonFederatingBackends -instance Member (Error JSONResponse) r => ServerEffect (Error NonFederatingBackends) r where +instance (Member (Error JSONResponse) r) => ServerEffect (Error NonFederatingBackends) r where interpretServerEffect = mapError toResponse -------------------------------------------------------------------------------- @@ -511,27 +515,30 @@ unreachableBackendsStatus = HTTP.mkStatus 533 "Unreachable backends" instance ToSchema UnreachableBackends where schema = - object "UnreachableBackends" $ - UnreachableBackends - <$> (.backends) .= field "unreachable_backends" (array schema) + object "UnreachableBackends" + $ UnreachableBackends + <$> (.backends) + .= field "unreachable_backends" (array schema) instance IsSwaggerError UnreachableBackends where addToOpenApi = - addErrorResponseToSwagger (HTTP.statusCode unreachableBackendsStatus) $ - mempty - & S.description .~ "Some domains are unreachable" + addErrorResponseToSwagger (HTTP.statusCode unreachableBackendsStatus) + $ mempty + & S.description + .~ "Some domains are unreachable" -- Defaulting this to JSON, as openapi3 needs something to map a schema against. -- This _should_ be overridden with the actual media types once we are at the -- point of rendering out the schemas for MultiVerb. -- Check the instance of `S.HasOpenApi (MultiVerb method (cs :: [Type]) as r)` - & S.content .~ singleton mediaType mediaTypeObject + & S.content + .~ singleton mediaType mediaTypeObject where mediaType = contentType $ Proxy @JSON mediaTypeObject = mempty & S.schema ?~ S.Inline (S.toSchema (Proxy @UnreachableBackends)) type instance ErrorEffect UnreachableBackends = Error UnreachableBackends -instance Member (Error JSONResponse) r => ServerEffect (Error UnreachableBackends) r where +instance (Member (Error JSONResponse) r) => ServerEffect (Error UnreachableBackends) r where interpretServerEffect = mapError toResponse unreachableUsersToUnreachableBackends :: UnreachableUsers -> UnreachableBackends @@ -549,13 +556,13 @@ newtype UnreachableBackendsLegacy = UnreachableBackendsLegacy UnreachableBackend instance APIError UnreachableBackendsLegacy where toResponse _ = - toResponse $ - Wai.mkError + toResponse + $ Wai.mkError unreachableBackendsStatus "federation-connection-refused" "Some backends are unreachable" type instance ErrorEffect UnreachableBackendsLegacy = Error UnreachableBackendsLegacy -instance Member (Error JSONResponse) r => ServerEffect (Error UnreachableBackendsLegacy) r where +instance (Member (Error JSONResponse) r) => ServerEffect (Error UnreachableBackendsLegacy) r where interpretServerEffect = mapError toResponse diff --git a/libs/wire-api/src/Wire/API/Event/Conversation.hs b/libs/wire-api/src/Wire/API/Event/Conversation.hs index f06e8d62973..077bbb19873 100644 --- a/libs/wire-api/src/Wire/API/Event/Conversation.hs +++ b/libs/wire-api/src/Wire/API/Event/Conversation.hs @@ -144,8 +144,8 @@ data EventType instance ToSchema EventType where schema = - enum @Text "EventType" $ - mconcat + enum @Text "EventType" + $ mconcat [ element "conversation.member-join" MemberJoin, element "conversation.member-leave" MemberLeave, element "conversation.member-update" MemberStateUpdate, @@ -236,18 +236,18 @@ newtype SimpleMembers = SimpleMembers instance ToSchema SimpleMembers where schema = - object "SimpleMembers" $ - SimpleMembers - <$> mMembers .= field "users" (array schema) - <* (fmap smId . mMembers) - .= optional - ( fieldWithDocModifier - "user_ids" - ( (description ?~ "deprecated") - . (deprecated ?~ True) - ) - (array schema) - ) + object "SimpleMembers" + $ SimpleMembers + <$> mMembers .= field "users" (array schema) + <* (fmap smId . mMembers) + .= optional + ( fieldWithDocModifier + "user_ids" + ( (description ?~ "deprecated") + . (deprecated ?~ True) + ) + (array schema) + ) data SimpleMember = SimpleMember { smQualifiedId :: Qualified UserId, @@ -262,12 +262,12 @@ smId = qUnqualified . smQualifiedId instance ToSchema SimpleMember where schema = - object "SimpleMember" $ - SimpleMember - <$> smQualifiedId .= field "qualified_id" schema - <* smId .= optional (field "id" schema) - <*> smConvRoleName - .= (field "conversation_role" schema <|> pure roleNameWireAdmin) + object "SimpleMember" + $ SimpleMember + <$> smQualifiedId .= field "qualified_id" schema + <* smId .= optional (field "id" schema) + <*> smConvRoleName + .= (field "conversation_role" schema <|> pure roleNameWireAdmin) data Connect = Connect { cRecipient :: Qualified UserId, @@ -409,8 +409,10 @@ taggedEventDataSchema = memberLeaveSchema :: ValueSchema NamedSwaggerDoc (EdMemberLeftReason, QualifiedUserIdList) memberLeaveSchema = - object "QualifiedUserIdList with EdMemberLeftReason" $ - (,) <$> fst .= field "reason" schema <*> snd .= qualifiedUserIdListObjectSchema + object "QualifiedUserIdList with EdMemberLeftReason" + $ (,) + <$> fst .= field "reason" schema + <*> snd .= qualifiedUserIdListObjectSchema instance ToSchema Event where schema = object "Event" eventObjectSchema diff --git a/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs b/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs index 32e67dcfaf6..b212f169e07 100644 --- a/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs +++ b/libs/wire-api/src/Wire/API/Event/FeatureConfig.hs @@ -73,17 +73,20 @@ data EventType = Update instance ToSchema EventType where schema = - enum @Text "EventType" $ - mconcat + enum @Text "EventType" + $ mconcat [ element "feature-config.update" Update ] eventObjectSchema :: ObjectSchema SwaggerDoc Event eventObjectSchema = Event - <$> _eventType .= field "type" schema - <*> _eventFeatureName .= field "name" schema - <*> _eventData .= field "data" jsonValue + <$> _eventType + .= field "type" schema + <*> _eventFeatureName + .= field "name" schema + <*> _eventData + .= field "data" jsonValue instance ToSchema Event where schema = diff --git a/libs/wire-api/src/Wire/API/Event/Federation.hs b/libs/wire-api/src/Wire/API/Event/Federation.hs index 55130a9ec84..36184c3dc67 100644 --- a/libs/wire-api/src/Wire/API/Event/Federation.hs +++ b/libs/wire-api/src/Wire/API/Event/Federation.hs @@ -34,16 +34,18 @@ data EventType instance ToSchema EventType where schema = - enum @Text "EventType" $ - mconcat + enum @Text "EventType" + $ mconcat [ element "federation.delete" FederationDelete ] eventObjectSchema :: ObjectSchema SwaggerDoc Event eventObjectSchema = Event - <$> _eventType .= field "type" schema - <*> _eventDomain .= field "domain" schema + <$> _eventType + .= field "type" schema + <*> _eventDomain + .= field "domain" schema instance ToSchema Event where schema = object "Event" eventObjectSchema diff --git a/libs/wire-api/src/Wire/API/Event/LeaveReason.hs b/libs/wire-api/src/Wire/API/Event/LeaveReason.hs index e01e7ab0290..5a769266fd0 100644 --- a/libs/wire-api/src/Wire/API/Event/LeaveReason.hs +++ b/libs/wire-api/src/Wire/API/Event/LeaveReason.hs @@ -38,8 +38,8 @@ data EdMemberLeftReason instance ToSchema EdMemberLeftReason where schema = - enum @Text "EdMemberLeftReason" $ - mconcat + enum @Text "EdMemberLeftReason" + $ mconcat [ element "left" EdReasonLeft, element "user-deleted" EdReasonDeleted, element "removed" EdReasonRemoved diff --git a/libs/wire-api/src/Wire/API/Event/Team.hs b/libs/wire-api/src/Wire/API/Event/Team.hs index d5dac32eb39..eccaf068230 100644 --- a/libs/wire-api/src/Wire/API/Event/Team.hs +++ b/libs/wire-api/src/Wire/API/Event/Team.hs @@ -63,12 +63,16 @@ data Event = Event instance ToSchema Event where schema = - object "Event" $ - Event - <$> _eventTeam .= field "team" schema - <*> _eventTime .= field "time" utcTimeSchema - <*> _eventData .= fieldWithDocModifier "data" (description ?~ dataFieldDesc) schema - <* eventType .= field "version" schema + object "Event" + $ Event + <$> _eventTeam + .= field "team" schema + <*> _eventTime + .= field "time" utcTimeSchema + <*> _eventData + .= fieldWithDocModifier "data" (description ?~ dataFieldDesc) schema + <* eventType + .= field "version" schema where dataFieldDesc = "FUTUREWORK: this part of the docs is lying; we're working on it!" @@ -98,8 +102,10 @@ instance FromJSON Event where ty <- o .: "type" dt <- o .:? "data" Event - <$> o .: "team" - <*> o .: "time" + <$> o + .: "team" + <*> o + .: "time" <*> parseEventData ty dt instance Arbitrary Event where @@ -128,8 +134,8 @@ data EventType instance ToSchema EventType where schema = - enum @Text "EventType" $ - mconcat + enum @Text "EventType" + $ mconcat [ element "team.create" TeamCreate, element "team.delete" TeamDelete, element "team.update" TeamUpdate, @@ -157,18 +163,21 @@ data EventData -- FUTUREWORK: this is outright wrong; see "Wire.API.Event.Conversation" on how to do this properly. instance ToSchema EventData where schema = - object "EventData" $ - EdTeamCreate - <$> (undefined :: EventData -> Team) .= field "team" schema + object "EventData" + $ EdTeamCreate + <$> (undefined :: EventData -> Team) + .= field "team" schema instance ToJSON EventData where toJSON (EdTeamCreate tem) = toJSON tem toJSON EdTeamDelete = Null toJSON (EdMemberJoin usr) = A.object ["user" A..= usr] toJSON (EdMemberUpdate usr mPerm) = - A.object $ - "user" A..= usr - # "permissions" A..= mPerm + A.object + $ "user" + A..= usr + # "permissions" + A..= mPerm # [] toJSON (EdMemberLeave usr) = A.object ["user" A..= usr] toJSON (EdConvCreate cnv) = A.object ["conv" A..= cnv] diff --git a/libs/wire-api/src/Wire/API/FederationStatus.hs b/libs/wire-api/src/Wire/API/FederationStatus.hs index 3293084d641..059213ec259 100644 --- a/libs/wire-api/src/Wire/API/FederationStatus.hs +++ b/libs/wire-api/src/Wire/API/FederationStatus.hs @@ -26,10 +26,10 @@ newtype RemoteDomains = RemoteDomains instance ToSchema RemoteDomains where schema = - objectWithDocModifier "RemoteDomains" (description ?~ "A set of remote domains") $ - RemoteDomains - <$> (Set.map tDomain . rdDomains) - .= field "domains" (Set.map (flip toRemoteUnsafe ()) <$> set schema) + objectWithDocModifier "RemoteDomains" (description ?~ "A set of remote domains") + $ RemoteDomains + <$> (Set.map tDomain . rdDomains) + .= field "domains" (Set.map (flip toRemoteUnsafe ()) <$> set schema) -- | This value expresses if the requested remote domains are fully connected or not. -- If not the response will contain the first pair of domains found @@ -64,8 +64,13 @@ instance ToSchema FederationStatus where descr :: NamedSwaggerDoc descr = swaggerDoc @Text - & S.schema . S.description - ?~ "This value expresses if the requested remote domains are fully connected or not. \ - \If not, it contains exactly two remote domains which do not federate with each other." - & S.schema . S.example ?~ "{ \"status\": \"fully-connected\", \"not_connected\": [] }" - & S.schema . S.example ?~ "{ \"status\": \"non-fully-connected\", \"not_connected\": [\"d.example.com\", \"e.example.com\"] }" + & S.schema + . S.description + ?~ "This value expresses if the requested remote domains are fully connected or not. \ + \If not, it contains exactly two remote domains which do not federate with each other." + & S.schema + . S.example + ?~ "{ \"status\": \"fully-connected\", \"not_connected\": [] }" + & S.schema + . S.example + ?~ "{ \"status\": \"non-fully-connected\", \"not_connected\": [\"d.example.com\", \"e.example.com\"] }" diff --git a/libs/wire-api/src/Wire/API/Internal/BulkPush.hs b/libs/wire-api/src/Wire/API/Internal/BulkPush.hs index 0ffb9eec618..fa2dd023130 100644 --- a/libs/wire-api/src/Wire/API/Internal/BulkPush.hs +++ b/libs/wire-api/src/Wire/API/Internal/BulkPush.hs @@ -40,10 +40,12 @@ data PushTarget = PushTarget instance S.ToSchema PushTarget where schema = - S.object "PushTarget" $ - PushTarget - <$> ptUserId S..= S.field "user_id" S.schema - <*> ptConnId S..= S.field "conn_id" S.schema + S.object "PushTarget" + $ PushTarget + <$> ptUserId + S..= S.field "user_id" S.schema + <*> ptConnId + S..= S.field "conn_id" S.schema newtype BulkPushRequest = BulkPushRequest { fromBulkPushRequest :: [(Notification, [PushTarget])] @@ -57,16 +59,19 @@ newtype BulkPushRequest = BulkPushRequest instance S.ToSchema BulkPushRequest where schema = - S.object "BulkPushRequest" $ - BulkPushRequest - <$> fromBulkPushRequest S..= S.field "bulkpush_req" (S.array bulkpushReqItemSchema) + S.object "BulkPushRequest" + $ BulkPushRequest + <$> fromBulkPushRequest + S..= S.field "bulkpush_req" (S.array bulkpushReqItemSchema) where bulkpushReqItemSchema :: ValueSchema S.NamedSwaggerDoc (Notification, [PushTarget]) bulkpushReqItemSchema = - S.object "(Notification, [PushTarget])" $ - (,) - <$> fst S..= S.field "notification" S.schema - <*> snd S..= S.field "targets" (S.array S.schema) + S.object "(Notification, [PushTarget])" + $ (,) + <$> fst + S..= S.field "notification" S.schema + <*> snd + S..= S.field "targets" (S.array S.schema) data PushStatus = PushStatusOk | PushStatusGone deriving (Eq, Show, Bounded, Enum, Generic) @@ -74,8 +79,8 @@ data PushStatus = PushStatusOk | PushStatusGone instance S.ToSchema PushStatus where schema = - S.enum @Text "PushStatus" $ - mconcat + S.enum @Text "PushStatus" + $ mconcat [ S.element "push_status_ok" PushStatusOk, S.element "push_status_gone" PushStatusGone ] @@ -92,14 +97,18 @@ newtype BulkPushResponse = BulkPushResponse instance S.ToSchema BulkPushResponse where schema = - S.object "BulkPushResponse" $ - BulkPushResponse - <$> fromBulkPushResponse S..= S.field "bulkpush_resp" (S.array bulkPushResponseSchema) + S.object "BulkPushResponse" + $ BulkPushResponse + <$> fromBulkPushResponse + S..= S.field "bulkpush_resp" (S.array bulkPushResponseSchema) where bulkPushResponseSchema :: ValueSchema S.NamedSwaggerDoc (NotificationId, PushTarget, PushStatus) bulkPushResponseSchema = - S.object "(NotificationId, PushTarget, PushStatus)" $ - (,,) - <$> view _1 S..= S.field "notif_id" S.schema - <*> view _2 S..= S.field "target" S.schema - <*> view _3 S..= S.field "status" S.schema + S.object "(NotificationId, PushTarget, PushStatus)" + $ (,,) + <$> view _1 + S..= S.field "notif_id" S.schema + <*> view _2 + S..= S.field "target" S.schema + <*> view _3 + S..= S.field "status" S.schema diff --git a/libs/wire-api/src/Wire/API/Internal/Notification.hs b/libs/wire-api/src/Wire/API/Internal/Notification.hs index 7d43ef30962..b5d5c60d859 100644 --- a/libs/wire-api/src/Wire/API/Internal/Notification.hs +++ b/libs/wire-api/src/Wire/API/Internal/Notification.hs @@ -63,11 +63,14 @@ data Notification = Notification instance S.ToSchema Notification where schema = - S.object "Notification" $ - Notification - <$> ntfId S..= S.field "id" S.schema - <*> ntfTransient S..= (fromMaybe False <$> S.optField "transient" S.schema) - <*> (toNonEmpty . ntfPayload) S..= fmap List1 (S.field "payload" (S.nonEmptyArray S.jsonObject)) + S.object "Notification" + $ Notification + <$> ntfId + S..= S.field "id" S.schema + <*> ntfTransient + S..= (fromMaybe False <$> S.optField "transient" S.schema) + <*> (toNonEmpty . ntfPayload) + S..= fmap List1 (S.field "payload" (S.nonEmptyArray S.jsonObject)) -------------------------------------------------------------------------------- -- NotificationTarget @@ -86,8 +89,10 @@ target u = NotificationTarget u [] instance FromJSON NotificationTarget where parseJSON = withObject "NotificationTarget" $ \o -> NotificationTarget - <$> o .: "user" - <*> o .: "clients" + <$> o + .: "user" + <*> o + .: "clients" instance ToJSON NotificationTarget where toJSON (NotificationTarget u cs) = diff --git a/libs/wire-api/src/Wire/API/MLS/CipherSuite.hs b/libs/wire-api/src/Wire/API/MLS/CipherSuite.hs index 0a92ca9886e..9244f99909a 100644 --- a/libs/wire-api/src/Wire/API/MLS/CipherSuite.hs +++ b/libs/wire-api/src/Wire/API/MLS/CipherSuite.hs @@ -89,13 +89,15 @@ newtype CipherSuite = CipherSuite {cipherSuiteNumber :: Word16} instance ToSchema CipherSuite where schema = - named "CipherSuite" $ - cipherSuiteNumber .= fmap CipherSuite (unnamed schema) + named "CipherSuite" + $ cipherSuiteNumber + .= fmap CipherSuite (unnamed schema) instance S.ToParamSchema CipherSuite where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiNumber + & S.type_ + ?~ S.OpenApiNumber instance FromHttpApiData CipherSuite where parseUrlPiece = parseHeader . T.encodeUtf8 @@ -128,10 +130,12 @@ defCipherSuite = MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 instance S.ToSchema CipherSuiteTag where declareNamedSchema _ = - pure . S.named "CipherSuiteTag" $ - ( S.paramSchemaToSchema (Proxy @Word16) - & S.description ?~ "Index number of ciphersuite. See https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#table-5" - ) + pure + . S.named "CipherSuiteTag" + $ ( S.paramSchemaToSchema (Proxy @Word16) + & S.description + ?~ "Index number of ciphersuite. See https://messaginglayersecurity.rocks/mls-protocol/draft-ietf-mls-protocol.html#table-5" + ) instance ToSchema CipherSuiteTag where schema = @@ -173,7 +177,7 @@ tagCipherSuite MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = CipherSuite 0x5 tagCipherSuite MLS_128_X25519Kyber768Draft00_AES128GCM_SHA256_Ed25519 = CipherSuite 0xf031 data SomeHashAlgorithm where - SomeHashAlgorithm :: HashAlgorithm a => a -> SomeHashAlgorithm + SomeHashAlgorithm :: (HashAlgorithm a) => a -> SomeHashAlgorithm csHashAlgorithm :: CipherSuiteTag -> SomeHashAlgorithm csHashAlgorithm MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = SomeHashAlgorithm SHA256 @@ -294,7 +298,7 @@ data SignatureSchemeTag deriving (Arbitrary) via GenericUniform SignatureSchemeTag class IsSignatureScheme (ss :: SignatureSchemeTag) where - sign :: MonadRandom m => KeyPair ss -> ByteString -> m ByteString + sign :: (MonadRandom m) => KeyPair ss -> ByteString -> m ByteString instance IsSignatureScheme 'Ed25519 where sign (priv, pub) = pure . BA.convert . Ed25519.sign priv pub @@ -326,8 +330,8 @@ instance Cql SignatureSchemeTag where ctype = Tagged TextColumn toCql = CqlText . signatureSchemeName fromCql (CqlText name) = - note ("Unexpected signature scheme: " <> T.unpack name) $ - signatureSchemeFromName name + note ("Unexpected signature scheme: " <> T.unpack name) + $ signatureSchemeFromName name fromCql _ = Left "SignatureScheme: Text expected" signatureSchemeNumber :: SignatureSchemeTag -> Word16 @@ -343,16 +347,18 @@ signatureSchemeName Ecdsa_secp384r1_sha384 = "ecdsa_secp384r1_sha384" signatureSchemeName Ecdsa_secp521r1_sha512 = "ecdsa_secp521r1_sha512" signatureSchemeTag :: SignatureScheme -> Maybe SignatureSchemeTag -signatureSchemeTag (SignatureScheme n) = getAlt $ - flip foldMap [minBound .. maxBound] $ \s -> +signatureSchemeTag (SignatureScheme n) = getAlt + $ flip foldMap [minBound .. maxBound] + $ \s -> guard (signatureSchemeNumber s == n) $> s signatureSchemeFromName :: Text -> Maybe SignatureSchemeTag -signatureSchemeFromName name = getAlt $ - flip foldMap [minBound .. maxBound] $ \s -> +signatureSchemeFromName name = getAlt + $ flip foldMap [minBound .. maxBound] + $ \s -> guard (signatureSchemeName s == name) $> s -parseSignatureScheme :: MonadFail f => Text -> f SignatureSchemeTag +parseSignatureScheme :: (MonadFail f) => Text -> f SignatureSchemeTag parseSignatureScheme name = maybe (fail ("Unsupported signature scheme " <> T.unpack name)) diff --git a/libs/wire-api/src/Wire/API/MLS/CommitBundle.hs b/libs/wire-api/src/Wire/API/MLS/CommitBundle.hs index ccfe3006284..c72d97a509e 100644 --- a/libs/wire-api/src/Wire/API/MLS/CommitBundle.hs +++ b/libs/wire-api/src/Wire/API/MLS/CommitBundle.hs @@ -41,14 +41,14 @@ data CommitBundleF f = CommitBundleF deriving instance Show (CommitBundleF []) -instance Alternative f => Semigroup (CommitBundleF f) where +instance (Alternative f) => Semigroup (CommitBundleF f) where cb1 <> cb2 = CommitBundleF (cb1.commitMsg <|> cb2.commitMsg) (cb1.welcome <|> cb2.welcome) (cb1.groupInfo <|> cb2.groupInfo) -instance Alternative f => Monoid (CommitBundleF f) where +instance (Alternative f) => Monoid (CommitBundleF f) where mempty = CommitBundleF empty empty empty checkCommitBundleF :: CommitBundleF [] -> Either Text CommitBundle @@ -68,7 +68,7 @@ checkCommitBundleF cb = checkOpt _ [x] = pure (Just x) checkOpt name _ = Left ("Redundant occurrence of " <> name) -findMessageInStream :: Alternative f => RawMLS Message -> Either Text (CommitBundleF f) +findMessageInStream :: (Alternative f) => RawMLS Message -> Either Text (CommitBundleF f) findMessageInStream msg = case msg.value.content of MessagePublic mp -> case mp.content.value.content of FramedContentCommit _ -> pure (CommitBundleF (pure msg) empty empty) @@ -77,14 +77,15 @@ findMessageInStream msg = case msg.value.content of MessageGroupInfo gi -> pure (CommitBundleF empty empty (pure gi)) _ -> Left "unexpected message type" -findMessagesInStream :: Alternative f => [RawMLS Message] -> Either Text (CommitBundleF f) +findMessagesInStream :: (Alternative f) => [RawMLS Message] -> Either Text (CommitBundleF f) findMessagesInStream = getAp . foldMap (Ap . findMessageInStream) instance ParseMLS CommitBundle where parseMLS = do msgs <- parseMLSStream parseMLS - either (fail . T.unpack) pure $ - findMessagesInStream msgs >>= checkCommitBundleF + either (fail . T.unpack) pure + $ findMessagesInStream msgs + >>= checkCommitBundleF instance SerialiseMLS CommitBundle where serialiseMLS cb = do diff --git a/libs/wire-api/src/Wire/API/MLS/Credential.hs b/libs/wire-api/src/Wire/API/MLS/Credential.hs index d369727f3e1..143e14b36f5 100644 --- a/libs/wire-api/src/Wire/API/MLS/Credential.hs +++ b/libs/wire-api/src/Wire/API/MLS/Credential.hs @@ -103,11 +103,14 @@ cidQualifiedUser = fmap fst . cidQualifiedClient instance ToSchema ClientIdentity where schema = - object "ClientIdentity" $ - ClientIdentity - <$> ciDomain .= field "domain" schema - <*> ciUser .= field "user_id" schema - <*> ciClient .= field "client_id" schema + object "ClientIdentity" + $ ClientIdentity + <$> ciDomain + .= field "domain" schema + <*> ciUser + .= field "user_id" schema + <*> ciClient + .= field "client_id" schema instance S.ToParamSchema ClientIdentity where toParamSchema _ = mempty & S.type_ ?~ S.OpenApiString diff --git a/libs/wire-api/src/Wire/API/MLS/ECDSA.hs b/libs/wire-api/src/Wire/API/MLS/ECDSA.hs index 11d197c0369..addaab7b64c 100644 --- a/libs/wire-api/src/Wire/API/MLS/ECDSA.hs +++ b/libs/wire-api/src/Wire/API/MLS/ECDSA.hs @@ -30,7 +30,7 @@ import Wire.API.MLS.Serialisation -- | Decode an ECDSA signature. decodeSignature :: forall curve. - EllipticCurveECDSA curve => + (EllipticCurveECDSA curve) => Proxy curve -> ByteString -> Maybe (Signature curve) @@ -43,7 +43,7 @@ decodeSignature curve bs = do -- Encode an ECDSA signature. encodeSignature :: forall curve. - EllipticCurveECDSA curve => + (EllipticCurveECDSA curve) => Proxy curve -> Signature curve -> ByteString diff --git a/libs/wire-api/src/Wire/API/MLS/Epoch.hs b/libs/wire-api/src/Wire/API/MLS/Epoch.hs index 117e26abd28..c820310a4ed 100644 --- a/libs/wire-api/src/Wire/API/MLS/Epoch.hs +++ b/libs/wire-api/src/Wire/API/MLS/Epoch.hs @@ -38,5 +38,5 @@ instance ParseMLS Epoch where instance SerialiseMLS Epoch where serialiseMLS (Epoch n) = put n -addToEpoch :: Integral a => a -> Epoch -> Epoch +addToEpoch :: (Integral a) => a -> Epoch -> Epoch addToEpoch n (Epoch e) = Epoch (e + fromIntegral n) diff --git a/libs/wire-api/src/Wire/API/MLS/Group.hs b/libs/wire-api/src/Wire/API/MLS/Group.hs index afe0c3049ae..0f92a416320 100644 --- a/libs/wire-api/src/Wire/API/MLS/Group.hs +++ b/libs/wire-api/src/Wire/API/MLS/Group.hs @@ -45,7 +45,7 @@ instance ToSchema GroupId where schema = GroupId <$> unGroupId - .= named "GroupId" (Base64ByteString .= fmap fromBase64ByteString (unnamed schema)) + .= named "GroupId" (Base64ByteString .= fmap fromBase64ByteString (unnamed schema)) newtype GroupIdGen = GroupIdGen {unGroupIdGen :: Word32} deriving (Eq, Show, Generic, Ord) diff --git a/libs/wire-api/src/Wire/API/MLS/KeyPackage.hs b/libs/wire-api/src/Wire/API/MLS/KeyPackage.hs index eb736de6ea5..85e94720429 100644 --- a/libs/wire-api/src/Wire/API/MLS/KeyPackage.hs +++ b/libs/wire-api/src/Wire/API/MLS/KeyPackage.hs @@ -69,9 +69,9 @@ data KeyPackageUpload = KeyPackageUpload instance ToSchema KeyPackageUpload where schema = - object "KeyPackageUpload" $ - KeyPackageUpload - <$> keyPackages .= field "key_packages" (array rawKeyPackageSchema) + object "KeyPackageUpload" + $ KeyPackageUpload + <$> keyPackages .= field "key_packages" (array rawKeyPackageSchema) newtype KeyPackageData = KeyPackageData {kpData :: ByteString} deriving stock (Eq, Ord, Show) @@ -100,12 +100,12 @@ data KeyPackageBundleEntry = KeyPackageBundleEntry instance ToSchema KeyPackageBundleEntry where schema = - object "KeyPackageBundleEntry" $ - KeyPackageBundleEntry - <$> (.user) .= qualifiedObjectSchema "user" schema - <*> (.client) .= field "client" schema - <*> (.ref) .= field "key_package_ref" schema - <*> (.keyPackage) .= field "key_package" schema + object "KeyPackageBundleEntry" + $ KeyPackageBundleEntry + <$> (.user) .= qualifiedObjectSchema "user" schema + <*> (.client) .= field "client" schema + <*> (.ref) .= field "key_package_ref" schema + <*> (.keyPackage) .= field "key_package" schema newtype KeyPackageBundle = KeyPackageBundle {entries :: Set KeyPackageBundleEntry} deriving stock (Eq, Show) @@ -113,9 +113,9 @@ newtype KeyPackageBundle = KeyPackageBundle {entries :: Set KeyPackageBundleEntr instance ToSchema KeyPackageBundle where schema = - object "KeyPackageBundle" $ - KeyPackageBundle - <$> (.entries) .= field "key_packages" (set schema) + object "KeyPackageBundle" + $ KeyPackageBundle + <$> (.entries) .= field "key_packages" (set schema) newtype KeyPackageCount = KeyPackageCount {unKeyPackageCount :: Int} deriving newtype (Eq, Ord, Num, Show) @@ -123,8 +123,9 @@ newtype KeyPackageCount = KeyPackageCount {unKeyPackageCount :: Int} instance ToSchema KeyPackageCount where schema = - object "OwnKeyPackages" $ - KeyPackageCount <$> unKeyPackageCount .= field "count" schema + object "OwnKeyPackages" + $ KeyPackageCount + <$> unKeyPackageCount .= field "count" schema newtype DeleteKeyPackages = DeleteKeyPackages {unDeleteKeyPackages :: [KeyPackageRef]} @@ -133,12 +134,12 @@ newtype DeleteKeyPackages = DeleteKeyPackages instance ToSchema DeleteKeyPackages where schema = - object "DeleteKeyPackages" $ - DeleteKeyPackages - <$> unDeleteKeyPackages - .= field - "key_packages" - (untypedRangedSchema 1 1000 (array schema)) + object "DeleteKeyPackages" + $ DeleteKeyPackages + <$> unDeleteKeyPackages + .= field + "key_packages" + (untypedRangedSchema 1 1000 (array schema)) newtype KeyPackageRef = KeyPackageRef {unKeyPackageRef :: ByteString} deriving stock (Eq, Ord, Show) @@ -240,8 +241,8 @@ credentialIdentityAndKey (X509Credential certs) = do [] -> Left "Invalid x509 certificate chain" (c : _) -> pure c signed <- - first (\e -> "Failed to decode x509 certificate: " <> T.pack e) $ - X509.decodeSignedCertificate bs + first (\e -> "Failed to decode x509 certificate: " <> T.pack e) + $ X509.decodeSignedCertificate bs -- FUTUREWORK: verify signature let cert = X509.getCertificate signed certificateIdentityAndKey cert diff --git a/libs/wire-api/src/Wire/API/MLS/Keys.hs b/libs/wire-api/src/Wire/API/MLS/Keys.hs index 92afc2df664..a60b424d4c7 100644 --- a/libs/wire-api/src/Wire/API/MLS/Keys.hs +++ b/libs/wire-api/src/Wire/API/MLS/Keys.hs @@ -35,11 +35,12 @@ data MLSKeysByPurpose a = MLSKeysByPurpose deriving (Eq, Show, Functor, Foldable, Traversable) deriving (FromJSON, ToJSON, S.ToSchema) via Schema (MLSKeysByPurpose a) -instance ToSchema a => ToSchema (MLSKeysByPurpose a) where +instance (ToSchema a) => ToSchema (MLSKeysByPurpose a) where schema = - object "MLSKeysByPurpose" $ - MLSKeysByPurpose - <$> (.removal) .= field "removal" schema + object "MLSKeysByPurpose" + $ MLSKeysByPurpose + <$> (.removal) + .= field "removal" schema data MLSKeys a = MLSKeys { ed25519 :: a, @@ -50,14 +51,18 @@ data MLSKeys a = MLSKeys deriving (Eq, Show) deriving (FromJSON, ToJSON, S.ToSchema) via Schema (MLSKeys a) -instance ToSchema a => ToSchema (MLSKeys a) where +instance (ToSchema a) => ToSchema (MLSKeys a) where schema = - object "MLSKeys" $ - MLSKeys - <$> ed25519 .= field "ed25519" schema - <*> ecdsa_secp256r1_sha256 .= field "ecdsa_secp256r1_sha256" schema - <*> ecdsa_secp384r1_sha384 .= field "ecdsa_secp384r1_sha384" schema - <*> ecdsa_secp521r1_sha512 .= field "ecdsa_secp521r1_sha512" schema + object "MLSKeys" + $ MLSKeys + <$> ed25519 + .= field "ed25519" schema + <*> ecdsa_secp256r1_sha256 + .= field "ecdsa_secp256r1_sha256" schema + <*> ecdsa_secp384r1_sha384 + .= field "ecdsa_secp384r1_sha384" schema + <*> ecdsa_secp521r1_sha512 + .= field "ecdsa_secp521r1_sha512" schema data MLSPrivateKeys = MLSPrivateKeys { mlsKeyPair_ed25519 :: KeyPair Ed25519, @@ -93,12 +98,16 @@ data JWK = JWK instance ToSchema JWK where schema = - object "JWK" $ - JWK - <$> (.keyType) .= field "kty" schema - <*> (.curve) .= field "crv" schema - <*> (.pubX) .= field "x" base64URLSchema - <*> (.pubY) .= maybe_ (optField "y" base64URLSchema) + object "JWK" + $ JWK + <$> (.keyType) + .= field "kty" schema + <*> (.curve) + .= field "crv" schema + <*> (.pubX) + .= field "x" base64URLSchema + <*> (.pubY) + .= maybe_ (optField "y" base64URLSchema) type MLSPublicKeysJWK = MLSKeys JWK diff --git a/libs/wire-api/src/Wire/API/MLS/Message.hs b/libs/wire-api/src/Wire/API/MLS/Message.hs index 342bb739e23..3133b4f3019 100644 --- a/libs/wire-api/src/Wire/API/MLS/Message.hs +++ b/libs/wire-api/src/Wire/API/MLS/Message.hs @@ -383,15 +383,15 @@ data MLSMessageSendingStatus = MLSMessageSendingStatus instance ToSchema MLSMessageSendingStatus where schema = - object "MLSMessageSendingStatus" $ - MLSMessageSendingStatus - <$> mmssEvents - .= fieldWithDocModifier - "events" - (description ?~ "A list of events caused by sending the message.") - (array schema) + object "MLSMessageSendingStatus" + $ MLSMessageSendingStatus + <$> mmssEvents + .= fieldWithDocModifier + "events" + (description ?~ "A list of events caused by sending the message.") + (array schema) <*> mmssTime - .= fieldWithDocModifier - "time" - (description ?~ "The time of sending the message.") - schema + .= fieldWithDocModifier + "time" + (description ?~ "The time of sending the message.") + schema diff --git a/libs/wire-api/src/Wire/API/MLS/Serialisation.hs b/libs/wire-api/src/Wire/API/MLS/Serialisation.hs index 7ae47e8493a..ce797c0ee16 100644 --- a/libs/wire-api/src/Wire/API/MLS/Serialisation.hs +++ b/libs/wire-api/src/Wire/API/MLS/Serialisation.hs @@ -233,17 +233,17 @@ instance SerialiseMLS Word32 where serialiseMLS = put instance SerialiseMLS Word64 where serialiseMLS = put -- | Encode an MLS value to a lazy bytestring. -encodeMLS :: SerialiseMLS a => a -> LByteString +encodeMLS :: (SerialiseMLS a) => a -> LByteString encodeMLS = runPut . serialiseMLS -encodeMLS' :: SerialiseMLS a => a -> ByteString +encodeMLS' :: (SerialiseMLS a) => a -> ByteString encodeMLS' = LBS.toStrict . encodeMLS -- | Decode an MLS value from a lazy bytestring. Return an error message in case of failure. -decodeMLS :: ParseMLS a => LByteString -> Either Text a +decodeMLS :: (ParseMLS a) => LByteString -> Either Text a decodeMLS = decodeMLSWith parseMLS -decodeMLS' :: ParseMLS a => ByteString -> Either Text a +decodeMLS' :: (ParseMLS a) => ByteString -> Either Text a decodeMLS' = decodeMLS . LBS.fromStrict -- | Decode an MLS value from a lazy bytestring given a custom parser. @@ -286,11 +286,11 @@ rawMLSSchema name p = mlsSwagger :: Text -> S.NamedSchema mlsSwagger name = - S.NamedSchema (Just name) $ - mempty - & S.description - ?~ "This object can only be parsed in TLS format. \ - \Please refer to the MLS specification for details." + S.NamedSchema (Just name) + $ mempty + & S.description + ?~ "This object can only be parsed in TLS format. \ + \Please refer to the MLS specification for details." rawMLSFromText :: (ByteString -> Either Text a) -> Text -> Either String (RawMLS a) rawMLSFromText p txt = do @@ -298,13 +298,14 @@ rawMLSFromText p txt = do value <- first Text.unpack (p mlsData) pure $ RawMLS mlsData value -instance S.ToSchema a => S.ToSchema (RawMLS a) where +instance (S.ToSchema a) => S.ToSchema (RawMLS a) where declareNamedSchema _ = S.declareNamedSchema (Proxy @a) -instance ParseMLS a => FromJSON (RawMLS a) where +instance (ParseMLS a) => FromJSON (RawMLS a) where parseJSON = - Aeson.withText "Base64 MLS object" $ - either fail pure . rawMLSFromText decodeMLS' + Aeson.withText "Base64 MLS object" + $ either fail pure + . rawMLSFromText decodeMLS' -- | Parse an MLS object, but keep the raw bytes as well. parseRawMLS :: Get a -> Get (RawMLS a) @@ -318,16 +319,16 @@ parseRawMLS p = do -- construct RawMLS value pure $ RawMLS raw x -instance ParseMLS a => ParseMLS (RawMLS a) where +instance (ParseMLS a) => ParseMLS (RawMLS a) where parseMLS = parseRawMLS parseMLS instance SerialiseMLS (RawMLS a) where serialiseMLS = putByteString . raw -mkRawMLS :: SerialiseMLS a => a -> RawMLS a +mkRawMLS :: (SerialiseMLS a) => a -> RawMLS a mkRawMLS x = RawMLS (LBS.toStrict (runPut (serialiseMLS x))) x -traceMLS :: Show a => String -> Get a -> Get a +traceMLS :: (Show a) => String -> Get a -> Get a traceMLS l g = do begin <- bytesRead r <- g diff --git a/libs/wire-api/src/Wire/API/MLS/Servant.hs b/libs/wire-api/src/Wire/API/MLS/Servant.hs index 4807d82d930..e1061779bc8 100644 --- a/libs/wire-api/src/Wire/API/MLS/Servant.hs +++ b/libs/wire-api/src/Wire/API/MLS/Servant.hs @@ -30,10 +30,10 @@ data MLS instance Accept MLS where contentType _ = "message" // "mls" -instance {-# OVERLAPPABLE #-} ParseMLS a => MimeUnrender MLS a where +instance {-# OVERLAPPABLE #-} (ParseMLS a) => MimeUnrender MLS a where mimeUnrender _ = mimeUnrenderMLSWith parseMLS -instance {-# OVERLAPPABLE #-} SerialiseMLS a => MimeRender MLS a where +instance {-# OVERLAPPABLE #-} (SerialiseMLS a) => MimeRender MLS a where mimeRender _ = encodeMLS mimeUnrenderMLSWith :: Get a -> LByteString -> Either String a diff --git a/libs/wire-api/src/Wire/API/MLS/SubConversation.hs b/libs/wire-api/src/Wire/API/MLS/SubConversation.hs index ca8a5552f0f..3ad82bfb70b 100644 --- a/libs/wire-api/src/Wire/API/MLS/SubConversation.hs +++ b/libs/wire-api/src/Wire/API/MLS/SubConversation.hs @@ -87,11 +87,11 @@ publicSubConversationSchema v = ("PublicSubConversation" <> foldMap (T.toUpper . versionText) v) (description ?~ "An MLS subconversation") $ PublicSubConversation - <$> pscParentConvId .= field "parent_qualified_id" schema - <*> pscSubConvId .= field "subconv_id" schema - <*> pscGroupId .= field "group_id" schema - <*> pscActiveData .= optionalActiveMLSConversationDataSchema v - <*> pscMembers .= field "members" (array schema) + <$> pscParentConvId .= field "parent_qualified_id" schema + <*> pscSubConvId .= field "subconv_id" schema + <*> pscGroupId .= field "group_id" schema + <*> pscActiveData .= optionalActiveMLSConversationDataSchema v + <*> pscMembers .= field "members" (array schema) instance ToSchema PublicSubConversation where schema = publicSubConversationSchema Nothing @@ -131,12 +131,12 @@ makePrisms ''ConvOrSubChoice instance ToSchema ConvOrSubConvId where schema = - object "ConvOrSubConvId" $ - fromTagged - <$> toTagged - .= bind - (fst .= field "tag" tagSchema) - (snd .= fieldOver _1 "value" untaggedSchema) + object "ConvOrSubConvId" + $ fromTagged + <$> toTagged + .= bind + (fst .= field "tag" tagSchema) + (snd .= fieldOver _1 "value" untaggedSchema) where toTagged :: ConvOrSubConvId -> (ConvOrSubTag, ConvOrSubConvId) toTagged c@(Conv _) = (ConvTag, c) @@ -153,9 +153,9 @@ instance ToSchema ConvOrSubConvId where SubConvTag -> tag _SubConv - ( unnamed $ - object "" $ - ( (,) + ( unnamed + $ object "" + $ ( (,) <$> fst .= field "conv_id" schema <*> snd .= field "subconv_id" schema ) @@ -163,8 +163,8 @@ instance ToSchema ConvOrSubConvId where tagSchema :: ValueSchema NamedSwaggerDoc ConvOrSubTag tagSchema = - enum @Text "ConvOrSubTag" $ - mconcat + enum @Text "ConvOrSubTag" + $ mconcat [ element "conv" ConvTag, element "subconv" SubConvTag ] @@ -189,5 +189,5 @@ instance ToSchema DeleteSubConversationRequest where "DeleteSubConversationRequest" (description ?~ "Delete an MLS subconversation") $ DeleteSubConversationRequest - <$> dscGroupId .= field "group_id" schema - <*> dscEpoch .= field "epoch" schema + <$> dscGroupId .= field "group_id" schema + <*> dscEpoch .= field "epoch" schema diff --git a/libs/wire-api/src/Wire/API/MLS/Validation.hs b/libs/wire-api/src/Wire/API/MLS/Validation.hs index c2e92203c2d..e7cad60be61 100644 --- a/libs/wire-api/src/Wire/API/MLS/Validation.hs +++ b/libs/wire-api/src/Wire/API/MLS/Validation.hs @@ -109,15 +109,16 @@ validateCredential :: CipherSuiteTag -> ByteString -> Maybe ClientIdentity -> Cr validateCredential cs pkey mIdentity cred = do -- FUTUREWORK: check signature in the case of an x509 credential (identity, mkey) <- - either credentialError pure $ - credentialIdentityAndKey cred + either credentialError pure + $ credentialIdentityAndKey cred traverse_ (validateCredentialKey (csSignatureScheme cs) pkey) mkey - unless (maybe True (identity ==) mIdentity) $ - Left "client identity does not match credential identity" + unless (maybe True (identity ==) mIdentity) + $ Left "client identity does not match credential identity" where credentialError e = - Left $ - "Failed to parse identity: " <> e + Left + $ "Failed to parse identity: " + <> e validateCredentialKey :: SignatureSchemeTag -> ByteString -> X509.PubKey -> Either Text () validateCredentialKey Ed25519 pk1 (X509.PubKeyEd25519 pk2) = validateCredentialKeyBS pk1 (BA.convert pk2) @@ -131,13 +132,15 @@ validateCredentialKey Ecdsa_secp521r1_sha512 pk1 (X509.PubKeyEC pk2) = case pk2.pubkeyEC_pub of X509.SerializedPoint bs -> validateCredentialKeyBS pk1 bs validateCredentialKey ss _ _ = - Left $ - "Certificate signature scheme " <> T.pack (show ss) <> " does not match client's public key" + Left + $ "Certificate signature scheme " + <> T.pack (show ss) + <> " does not match client's public key" validateCredentialKeyBS :: ByteString -> ByteString -> Either Text () validateCredentialKeyBS pk1 pk2 = - note "Certificate public key does not match client's" $ - guard (pk1 == pk2) + note "Certificate public key does not match client's" + $ guard (pk1 == pk2) validateSource :: LeafNodeSourceTag -> LeafNodeSource -> Either Text () validateSource t s = do @@ -145,14 +148,14 @@ validateSource t s = do if t == t' then pure () else - Left $ - "Expected '" - <> t.name - <> "' source, got '" - <> t'.name - <> "'" + Left + $ "Expected '" + <> t.name + <> "' source, got '" + <> t'.name + <> "'" validateCapabilities :: CredentialTag -> Capabilities -> Either Text () validateCapabilities ctag caps = - unless (fromMLSEnum ctag `elem` caps.credentials) $ - Left "missing BasicCredential capability" + unless (fromMLSEnum ctag `elem` caps.credentials) + $ Left "missing BasicCredential capability" diff --git a/libs/wire-api/src/Wire/API/Message.hs b/libs/wire-api/src/Wire/API/Message.hs index 6b117791bc3..caef8fb1053 100644 --- a/libs/wire-api/src/Wire/API/Message.hs +++ b/libs/wire-api/src/Wire/API/Message.hs @@ -102,10 +102,14 @@ data MessageMetadata = MessageMetadata messageMetadataObjectSchema :: ObjectSchema SwaggerDoc MessageMetadata messageMetadataObjectSchema = MessageMetadata - <$> mmNativePush .= fmap (fromMaybe True) (optField "native_push" schema) - <*> mmTransient .= fmap (fromMaybe False) (optField "transient" schema) - <*> mmNativePriority .= maybe_ (optField "native_priority" schema) - <*> mmData .= maybe_ (optField "data" schema) + <$> mmNativePush + .= fmap (fromMaybe True) (optField "native_push" schema) + <*> mmTransient + .= fmap (fromMaybe False) (optField "transient" schema) + <*> mmNativePriority + .= maybe_ (optField "native_priority" schema) + <*> mmData + .= maybe_ (optField "data" schema) instance ToSchema MessageMetadata where schema = object "MessageMetadata" messageMetadataObjectSchema @@ -146,12 +150,16 @@ newOtrMessageMetadata msg = instance ToSchema NewOtrMessage where schema = - object "new-otr-message" $ - mk - <$> newOtrSender .= field "sender" schema - <*> newOtrRecipients .= field "recipients" schema - <*> newOtrMessageMetadata .= messageMetadataObjectSchema - <*> newOtrReportMissing .= maybe_ (optField "report_missing" (array schema)) + object "new-otr-message" + $ mk + <$> newOtrSender + .= field "sender" schema + <*> newOtrRecipients + .= field "recipients" schema + <*> newOtrMessageMetadata + .= messageMetadataObjectSchema + <*> newOtrReportMissing + .= maybe_ (optField "report_missing" (array schema)) where mk :: ClientId -> OtrRecipients -> MessageMetadata -> Maybe [UserId] -> NewOtrMessage mk cid rcpts mm = @@ -205,13 +213,13 @@ qualifiedNewOtrMetadata msg = instance S.ToSchema QualifiedNewOtrMessage where declareNamedSchema _ = - pure $ - S.NamedSchema (Just "QualifiedNewOtrMessage") $ - mempty - & S.description - ?~ "This object can only be parsed from Protobuf.\n\ - \The specification for the protobuf types is here: \n\ - \https://github.com/wireapp/generic-message-proto/blob/master/proto/otr.proto." + pure + $ S.NamedSchema (Just "QualifiedNewOtrMessage") + $ mempty + & S.description + ?~ "This object can only be parsed from Protobuf.\n\ + \The specification for the protobuf types is here: \n\ + \https://github.com/wireapp/generic-message-proto/blob/master/proto/otr.proto." instance FromProto QualifiedNewOtrMessage where fromProto bs = protolensToQualifiedNewOtrMessage =<< ProtoLens.decodeMessage bs @@ -223,8 +231,8 @@ protolensToQualifiedNewOtrMessage :: Proto.Otr.QualifiedNewOtrMessage -> Either protolensToQualifiedNewOtrMessage protoMsg = do recipients <- protolensOtrRecipientsToOtrRecipients $ view Proto.Otr.recipients protoMsg strat <- protolensToClientMismatchStrategy $ view Proto.Otr.maybe'clientMismatchStrategy protoMsg - pure $ - QualifiedNewOtrMessage + pure + $ QualifiedNewOtrMessage { qualifiedNewOtrSender = protolensToClientId $ view Proto.Otr.sender protoMsg, qualifiedNewOtrRecipients = recipients, qualifiedNewOtrNativePush = view Proto.Otr.nativePush protoMsg, @@ -240,13 +248,20 @@ protolensToClientId = ClientId . view Proto.Otr.client qualifiedNewOtrMessageToProto :: QualifiedNewOtrMessage -> Proto.Otr.QualifiedNewOtrMessage qualifiedNewOtrMessageToProto msg = ProtoLens.defMessage - & Proto.Otr.sender .~ clientIdToProtolens (qualifiedNewOtrSender msg) - & Proto.Otr.recipients .~ qualifiedOtrRecipientsToProtolens (qualifiedNewOtrRecipients msg) - & Proto.Otr.blob .~ qualifiedNewOtrData msg - & Proto.Otr.nativePush .~ qualifiedNewOtrNativePush msg - & Proto.Otr.maybe'nativePriority .~ fmap priorityToProtolens (qualifiedNewOtrNativePriority msg) - & Proto.Otr.transient .~ qualifiedNewOtrTransient msg - & Proto.Otr.maybe'clientMismatchStrategy ?~ clientMismatchStrategyToProtolens (qualifiedNewOtrClientMismatchStrategy msg) + & Proto.Otr.sender + .~ clientIdToProtolens (qualifiedNewOtrSender msg) + & Proto.Otr.recipients + .~ qualifiedOtrRecipientsToProtolens (qualifiedNewOtrRecipients msg) + & Proto.Otr.blob + .~ qualifiedNewOtrData msg + & Proto.Otr.nativePush + .~ qualifiedNewOtrNativePush msg + & Proto.Otr.maybe'nativePriority + .~ fmap priorityToProtolens (qualifiedNewOtrNativePriority msg) + & Proto.Otr.transient + .~ qualifiedNewOtrTransient msg + & Proto.Otr.maybe'clientMismatchStrategy + ?~ clientMismatchStrategyToProtolens (qualifiedNewOtrClientMismatchStrategy msg) mkQualifiedOtrPayload :: ClientId -> [(Qualified UserId, ClientId, ByteString)] -> ByteString -> ClientMismatchStrategy -> Proto.Otr.QualifiedNewOtrMessage mkQualifiedOtrPayload sender entries dat strat = @@ -276,7 +291,8 @@ mkQualifiedOtrPayload sender entries dat strat = clientIdToProtolens :: ClientId -> Proto.Otr.ClientId clientIdToProtolens cid = ProtoLens.defMessage - & Proto.Otr.client .~ (either error fst . Reader.hexadecimal $ clientToText cid) + & Proto.Otr.client + .~ (either error fst . Reader.hexadecimal $ clientToText cid) -------------------------------------------------------------------------------- -- Priority @@ -298,8 +314,8 @@ data Priority = LowPriority | HighPriority instance ToSchema Priority where schema = - enum @Text "Priority" $ - mconcat + enum @Text "Priority" + $ mconcat [ element "low" LowPriority, element "high" HighPriority ] @@ -395,20 +411,27 @@ qualifiedOtrRecipientsToProtolens (QualifiedOtrRecipients (QualifiedUserClientMa quEntry :: Domain -> Map UserId (Map ClientId ByteString) -> Proto.Otr.QualifiedUserEntry quEntry domain m = ProtoLens.defMessage - & Proto.Otr.domain .~ domainText domain - & Proto.Otr.entries .~ map (uncurry uEntry) (Map.assocs m) + & Proto.Otr.domain + .~ domainText domain + & Proto.Otr.entries + .~ map (uncurry uEntry) (Map.assocs m) uEntry :: UserId -> Map ClientId ByteString -> Proto.Otr.UserEntry uEntry uid m = ProtoLens.defMessage - & Proto.Otr.user . Proto.Otr.uuid .~ LBS.toStrict (UUID.toByteString (toUUID uid)) - & Proto.Otr.clients .~ map (uncurry cEntry) (Map.assocs m) + & Proto.Otr.user + . Proto.Otr.uuid + .~ LBS.toStrict (UUID.toByteString (toUUID uid)) + & Proto.Otr.clients + .~ map (uncurry cEntry) (Map.assocs m) cEntry :: ClientId -> ByteString -> Proto.Otr.ClientEntry cEntry cid msg = ProtoLens.defMessage - & Proto.Otr.client .~ clientIdToProtolens cid - & Proto.Otr.text .~ msg + & Proto.Otr.client + .~ clientIdToProtolens cid + & Proto.Otr.text + .~ msg parseMap :: (Applicative f, Ord k) => (a -> f k) -> (a -> f v) -> [a] -> f (Map k v) parseMap keyParser valueParser xs = Map.fromList <$> traverse (\x -> (,) <$> keyParser x <*> valueParser x) xs @@ -443,15 +466,17 @@ clientMismatchStrategyToProtolens = \case MismatchIgnoreOnly users -> Proto.Otr.QualifiedNewOtrMessage'IgnoreOnly ( ProtoLens.defMessage - & Proto.Otr.userIds .~ map qualifiedUserIdToProtolens (toList users) + & Proto.Otr.userIds + .~ map qualifiedUserIdToProtolens (toList users) ) MismatchReportOnly users -> Proto.Otr.QualifiedNewOtrMessage'ReportOnly ( ProtoLens.defMessage - & Proto.Otr.userIds .~ map qualifiedUserIdToProtolens (toList users) + & Proto.Otr.userIds + .~ map qualifiedUserIdToProtolens (toList users) ) -protolensToSetQualifiedUserIds :: ProtoLens.HasField s "userIds" [Proto.Otr.QualifiedUserId] => s -> Either String (Set (Qualified UserId)) +protolensToSetQualifiedUserIds :: (ProtoLens.HasField s "userIds" [Proto.Otr.QualifiedUserId]) => s -> Either String (Set (Qualified UserId)) protolensToSetQualifiedUserIds = fmap Set.fromList . mapM protolensToQualifiedUserId . view Proto.Otr.userIds protolensToQualifiedUserId :: Proto.Otr.QualifiedUserId -> Either String (Qualified UserId) @@ -463,8 +488,10 @@ protolensToQualifiedUserId protoQuid = qualifiedUserIdToProtolens :: Qualified UserId -> Proto.Otr.QualifiedUserId qualifiedUserIdToProtolens (Qualified uid domain) = ProtoLens.defMessage - & Proto.Otr.id .~ idToText uid - & Proto.Otr.domain .~ domainText domain + & Proto.Otr.id + .~ idToText uid + & Proto.Otr.domain + .~ domainText domain data ClientMismatch = ClientMismatch { cmismatchTime :: UTCTimeMillis, @@ -487,12 +514,16 @@ instance Arbitrary ClientMismatch where instance ToSchema ClientMismatch where schema = - object "ClientMismatch" $ - ClientMismatch - <$> cmismatchTime .= field "time" schema - <*> missingClients .= field "missing" schema - <*> redundantClients .= field "redundant" schema - <*> deletedClients .= field "deleted" schema + object "ClientMismatch" + $ ClientMismatch + <$> cmismatchTime + .= field "time" schema + <*> missingClients + .= field "missing" schema + <*> redundantClients + .= field "redundant" schema + <*> deletedClients + .= field "deleted" schema data MessageSendingStatus = MessageSendingStatus { mssTime :: UTCTimeMillis, @@ -511,12 +542,18 @@ instance ToSchema MessageSendingStatus where "MessageSendingStatus" (description ?~ combinedDesc) $ MessageSendingStatus - <$> mssTime .= field "time" schema - <*> mssMissingClients .= field "missing" schema - <*> mssRedundantClients .= field "redundant" schema - <*> mssDeletedClients .= field "deleted" schema - <*> mssFailedToSend .= field "failed_to_send" schema - <*> mssFailedToConfirmClients .= field "failed_to_confirm_clients" schema + <$> mssTime + .= field "time" schema + <*> mssMissingClients + .= field "missing" schema + <*> mssRedundantClients + .= field "redundant" schema + <*> mssDeletedClients + .= field "deleted" schema + <*> mssFailedToSend + .= field "failed_to_send" schema + <*> mssFailedToConfirmClients + .= field "failed_to_confirm_clients" schema where combinedDesc = "The Proteus message sending status. It has these fields:\n\ diff --git a/libs/wire-api/src/Wire/API/Message/Proto.hs b/libs/wire-api/src/Wire/API/Message/Proto.hs index b2b6f1a3832..d20ecd75ab6 100644 --- a/libs/wire-api/src/Wire/API/Message/Proto.hs +++ b/libs/wire-api/src/Wire/API/Message/Proto.hs @@ -68,7 +68,7 @@ instance Decode UserId fromUserId :: Id.UserId -> UserId fromUserId u = UserId {_user = putField u} -userId :: Functor f => (Id.UserId -> f Id.UserId) -> UserId -> f UserId +userId :: (Functor f) => (Id.UserId -> f Id.UserId) -> UserId -> f UserId userId f c = (\x -> c {_user = x}) <$> field f (_user c) -------------------------------------------------------------------------------- @@ -86,7 +86,7 @@ instance Decode ClientId newClientId :: Word64 -> ClientId newClientId c = ClientId {_client = putField c} -clientId :: Functor f => (Word64 -> f Word64) -> ClientId -> f ClientId +clientId :: (Functor f) => (Word64 -> f Word64) -> ClientId -> f ClientId clientId f c = (\x -> c {_client = x}) <$> field f (_client c) toClientId :: ClientId -> Id.ClientId @@ -115,10 +115,10 @@ clientEntry c t = _clientVal = putField t } -clientEntryId :: Functor f => (ClientId -> f ClientId) -> ClientEntry -> f ClientEntry +clientEntryId :: (Functor f) => (ClientId -> f ClientId) -> ClientEntry -> f ClientEntry clientEntryId f c = (\x -> c {_clientId = x}) <$> field f (_clientId c) -clientEntryMessage :: Functor f => (ByteString -> f ByteString) -> ClientEntry -> f ClientEntry +clientEntryMessage :: (Functor f) => (ByteString -> f ByteString) -> ClientEntry -> f ClientEntry clientEntryMessage f c = (\x -> c {_clientVal = x}) <$> field f (_clientVal c) -------------------------------------------------------------------------------- @@ -141,10 +141,10 @@ userEntry u c = _userVal = putField c } -userEntryId :: Functor f => (UserId -> f UserId) -> UserEntry -> f UserEntry +userEntryId :: (Functor f) => (UserId -> f UserId) -> UserEntry -> f UserEntry userEntryId f c = (\x -> c {_userId = x}) <$> field f (_userId c) -userEntryClients :: Functor f => ([ClientEntry] -> f [ClientEntry]) -> UserEntry -> f UserEntry +userEntryClients :: (Functor f) => ([ClientEntry] -> f [ClientEntry]) -> UserEntry -> f UserEntry userEntryClients f c = (\x -> c {_userVal = x}) <$> field f (_userVal c) -------------------------------------------------------------------------------- @@ -199,27 +199,27 @@ newOtrMessage c us = _newOtrReportMissing = putField [] } -newOtrMessageSender :: Functor f => (ClientId -> f ClientId) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageSender :: (Functor f) => (ClientId -> f ClientId) -> NewOtrMessage -> f NewOtrMessage newOtrMessageSender f c = (\x -> c {_newOtrSender = x}) <$> field f (_newOtrSender c) -newOtrMessageRecipients :: Functor f => ([UserEntry] -> f [UserEntry]) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageRecipients :: (Functor f) => ([UserEntry] -> f [UserEntry]) -> NewOtrMessage -> f NewOtrMessage newOtrMessageRecipients f c = (\x -> c {_newOtrRecipients = x}) <$> field f (_newOtrRecipients c) -newOtrMessageNativePush :: Functor f => (Bool -> f Bool) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageNativePush :: (Functor f) => (Bool -> f Bool) -> NewOtrMessage -> f NewOtrMessage newOtrMessageNativePush f c = let g x = Just <$> f (fromMaybe True x) in (\x -> c {_newOtrNativePush = x}) <$> field g (_newOtrNativePush c) -newOtrMessageTransient :: Functor f => (Bool -> f Bool) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageTransient :: (Functor f) => (Bool -> f Bool) -> NewOtrMessage -> f NewOtrMessage newOtrMessageTransient f c = let g x = Just <$> f (fromMaybe False x) in (\x -> c {_newOtrTransient = x}) <$> field g (_newOtrTransient c) -newOtrMessageData :: Functor f => (Maybe ByteString -> f (Maybe ByteString)) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageData :: (Functor f) => (Maybe ByteString -> f (Maybe ByteString)) -> NewOtrMessage -> f NewOtrMessage newOtrMessageData f c = (\x -> c {_newOtrData = x}) <$> field f (_newOtrData c) -newOtrMessageNativePriority :: Functor f => (Maybe Priority -> f (Maybe Priority)) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageNativePriority :: (Functor f) => (Maybe Priority -> f (Maybe Priority)) -> NewOtrMessage -> f NewOtrMessage newOtrMessageNativePriority f c = (\x -> c {_newOtrNativePriority = x}) <$> field f (_newOtrNativePriority c) -newOtrMessageReportMissing :: Functor f => ([UserId] -> f [UserId]) -> NewOtrMessage -> f NewOtrMessage +newOtrMessageReportMissing :: (Functor f) => ([UserId] -> f [UserId]) -> NewOtrMessage -> f NewOtrMessage newOtrMessageReportMissing f c = (\x -> c {_newOtrReportMissing = x}) <$> field f (_newOtrReportMissing c) diff --git a/libs/wire-api/src/Wire/API/Notification.hs b/libs/wire-api/src/Wire/API/Notification.hs index 83317eb5259..ed958bee81c 100644 --- a/libs/wire-api/src/Wire/API/Notification.hs +++ b/libs/wire-api/src/Wire/API/Notification.hs @@ -75,14 +75,19 @@ eventSchema = mkSchema sdoc Aeson.parseJSON (Just . Aeson.toJSON) sdoc :: NamedSwaggerDoc sdoc = swaggerDoc @Aeson.Object - & S.schema . S.title ?~ "Event" - & S.schema . S.description ?~ "A single notification event" - & S.schema . S.properties - .~ InsOrdHashMap.fromList - [ ( "type", - S.Inline (S.toSchema (Proxy @Text) & S.description ?~ "Event type") - ) - ] + & S.schema + . S.title + ?~ "Event" + & S.schema + . S.description + ?~ "A single notification event" + & S.schema + . S.properties + .~ InsOrdHashMap.fromList + [ ( "type", + S.Inline (S.toSchema (Proxy @Text) & S.description ?~ "Event type") + ) + ] isValidNotificationId :: NotificationId -> Bool isValidNotificationId (Id uuid) = @@ -106,12 +111,12 @@ queuedNotification = QueuedNotification instance ToSchema QueuedNotification where schema = - objectWithDocModifier "QueuedNotification" queuedNotificationDoc $ - QueuedNotification - <$> _queuedNotificationId - .= field "id" schema + objectWithDocModifier "QueuedNotification" queuedNotificationDoc + $ QueuedNotification + <$> _queuedNotificationId + .= field "id" schema <*> _queuedNotificationPayload - .= fieldWithDocModifier "payload" payloadDoc (nonEmptyArray eventSchema) + .= fieldWithDocModifier "payload" payloadDoc (nonEmptyArray eventSchema) where queuedNotificationDoc = description ?~ "A single notification" payloadDoc d = d & description ?~ "List of events" @@ -132,14 +137,14 @@ queuedNotificationList = QueuedNotificationList instance ToSchema QueuedNotificationList where schema = - objectWithDocModifier "QueuedNotificationList" queuedNotificationListDoc $ - QueuedNotificationList - <$> _queuedNotifications - .= fieldWithDocModifier "notifications" notificationsDoc (array schema) + objectWithDocModifier "QueuedNotificationList" queuedNotificationListDoc + $ QueuedNotificationList + <$> _queuedNotifications + .= fieldWithDocModifier "notifications" notificationsDoc (array schema) <*> _queuedHasMore - .= fmap (fromMaybe False) (optFieldWithDocModifier "has_more" hasMoreDoc schema) + .= fmap (fromMaybe False) (optFieldWithDocModifier "has_more" hasMoreDoc schema) <*> _queuedTime - .= maybe_ (optField "time" utcTimeSchema) + .= maybe_ (optField "time" utcTimeSchema) where queuedNotificationListDoc = description ?~ "Zero or more notifications" notificationsDoc = description ?~ "Notifications" diff --git a/libs/wire-api/src/Wire/API/Password.hs b/libs/wire-api/src/Wire/API/Password.hs index f9188b6dcfb..65496610d2e 100644 --- a/libs/wire-api/src/Wire/API/Password.hs +++ b/libs/wire-api/src/Wire/API/Password.hs @@ -124,16 +124,17 @@ fromScrypt scryptParams = -- | Generate a strong, random plaintext password of length 16 -- containing only alphanumeric characters, '+' and '/'. -genPassword :: MonadIO m => m PlainTextPassword8 +genPassword :: (MonadIO m) => m PlainTextPassword8 genPassword = - liftIO . fmap (plainTextPassword8Unsafe . Text.decodeUtf8 . B64.encode) $ - randBytes 12 + liftIO + . fmap (plainTextPassword8Unsafe . Text.decodeUtf8 . B64.encode) + $ randBytes 12 -- | Stretch a plaintext password so that it can be safely stored. -mkSafePassword :: MonadIO m => PlainTextPassword' t -> m Password +mkSafePassword :: (MonadIO m) => PlainTextPassword' t -> m Password mkSafePassword = fmap Password . hashPasswordScrypt . Text.encodeUtf8 . fromPlainTextPassword -mkSafePasswordArgon2id :: MonadIO m => PlainTextPassword' t -> m Password +mkSafePasswordArgon2id :: (MonadIO m) => PlainTextPassword' t -> m Password mkSafePasswordArgon2id = fmap Password . hashPasswordArgon2id . Text.encodeUtf8 . fromPlainTextPassword -- | Verify a plaintext password from user input against a stretched @@ -147,7 +148,7 @@ verifyPasswordWithStatus plain opaque = expected = fromPassword opaque in checkPassword actual expected -hashPasswordArgon2id :: MonadIO m => ByteString -> m Text +hashPasswordArgon2id :: (MonadIO m) => ByteString -> m Text hashPasswordArgon2id pwd = do salt <- newSalt $ fromIntegral defaultParams.saltLength let key = hashPasswordWithOptions defaultOptions pwd salt @@ -158,25 +159,25 @@ hashPasswordArgon2id pwd = do "t=" <> showT defaultOptions.iterations, "p=" <> showT defaultOptions.parallelism ] - pure $ - "$argon2" - <> Text.intercalate - "$" - [ variantToCode defaultOptions.variant, - "v=" <> versionToNum defaultOptions.version, - opts, - encodeWithoutPadding salt, - encodeWithoutPadding key - ] + pure + $ "$argon2" + <> Text.intercalate + "$" + [ variantToCode defaultOptions.variant, + "v=" <> versionToNum defaultOptions.version, + opts, + encodeWithoutPadding salt, + encodeWithoutPadding key + ] where encodeWithoutPadding = Text.dropWhileEnd (== '=') . Text.decodeUtf8 . B64.encode -hashPasswordScrypt :: MonadIO m => ByteString -> m Text +hashPasswordScrypt :: (MonadIO m) => ByteString -> m Text hashPasswordScrypt password = do salt <- newSalt $ fromIntegral defaultParams.saltLength let key = hashPasswordWithParams defaultParams password salt - pure $ - Text.intercalate + pure + $ Text.intercalate "|" [ showT defaultParams.rounds, showT defaultParams.blockSize, @@ -198,7 +199,7 @@ checkPassword actual expected = in (hashedKeyS `constEq` producedKeyS, PasswordStatusNeedsUpdate) Nothing -> (False, PasswordStatusNeedsUpdate) -newSalt :: MonadIO m => Int -> m ByteString +newSalt :: (MonadIO m) => Int -> m ByteString newSalt i = liftIO $ getRandomBytes i {-# INLINE newSalt #-} diff --git a/libs/wire-api/src/Wire/API/Properties.hs b/libs/wire-api/src/Wire/API/Properties.hs index 83c8ee1aa50..79a64ecad52 100644 --- a/libs/wire-api/src/Wire/API/Properties.hs +++ b/libs/wire-api/src/Wire/API/Properties.hs @@ -42,9 +42,11 @@ newtype PropertyKeysAndValues = PropertyKeysAndValues (Map PropertyKey PropertyV instance S.ToSchema PropertyKeysAndValues where declareNamedSchema _ = - pure $ - S.NamedSchema (Just "PropertyKeysAndValues") $ - mempty & S.type_ ?~ S.OpenApiObject + pure + $ S.NamedSchema (Just "PropertyKeysAndValues") + $ mempty + & S.type_ + ?~ S.OpenApiObject newtype PropertyKey = PropertyKey {propertyKeyName :: AsciiPrintable} @@ -65,8 +67,10 @@ newtype PropertyKey = PropertyKey instance S.ToParamSchema PropertyKey where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.format ?~ "printable" + & S.type_ + ?~ S.OpenApiString + & S.format + ?~ "printable" deriving instance C.Cql PropertyKey @@ -87,8 +91,11 @@ instance {-# OVERLAPPING #-} MimeRender JSON RawPropertyValue where instance S.ToSchema RawPropertyValue where declareNamedSchema _ = - pure . S.NamedSchema (Just "PropertyValue") $ - mempty & S.description ?~ "An arbitrary JSON value for a property" + pure + . S.NamedSchema (Just "PropertyValue") + $ mempty + & S.description + ?~ "An arbitrary JSON value for a property" -- | A property value together with its original serialisation. data PropertyValue = PropertyValue diff --git a/libs/wire-api/src/Wire/API/Provider.hs b/libs/wire-api/src/Wire/API/Provider.hs index 1fc5c34c114..b2bc87786c1 100644 --- a/libs/wire-api/src/Wire/API/Provider.hs +++ b/libs/wire-api/src/Wire/API/Provider.hs @@ -82,13 +82,18 @@ data Provider = Provider instance ToSchema Provider where schema = - object "Provider" $ - Provider - <$> providerId .= field "id" schema - <*> providerName .= field "name" schema - <*> providerEmail .= field "email" schema - <*> providerUrl .= field "url" schema - <*> providerDescr .= field "description" schema + object "Provider" + $ Provider + <$> providerId + .= field "id" schema + <*> providerName + .= field "name" schema + <*> providerEmail + .= field "email" schema + <*> providerUrl + .= field "url" schema + <*> providerDescr + .= field "description" schema -- | A provider profile as seen by regular users. -- Note: This is a placeholder that may evolve to contain only a subset of @@ -115,13 +120,18 @@ data NewProvider = NewProvider instance ToSchema NewProvider where schema = - object "NewProvider" $ - NewProvider - <$> newProviderName .= field "name" schema - <*> newProviderEmail .= field "email" schema - <*> newProviderUrl .= field "url" schema - <*> newProviderDescr .= field "description" schema - <*> newProviderPassword .= maybe_ (optField "password" schema) + object "NewProvider" + $ NewProvider + <$> newProviderName + .= field "name" schema + <*> newProviderEmail + .= field "email" schema + <*> newProviderUrl + .= field "url" schema + <*> newProviderDescr + .= field "description" schema + <*> newProviderPassword + .= maybe_ (optField "password" schema) -- | Response data upon registering a new provider. data NewProviderResponse = NewProviderResponse @@ -136,10 +146,12 @@ data NewProviderResponse = NewProviderResponse instance ToSchema NewProviderResponse where schema = - object "NewProviderResponse" $ - NewProviderResponse - <$> rsNewProviderId .= field "id" schema - <*> rsNewProviderPassword .= maybe_ (optField "password" schema) + object "NewProviderResponse" + $ NewProviderResponse + <$> rsNewProviderId + .= field "id" schema + <*> rsNewProviderPassword + .= maybe_ (optField "password" schema) -------------------------------------------------------------------------------- -- UpdateProvider @@ -156,11 +168,14 @@ data UpdateProvider = UpdateProvider instance ToSchema UpdateProvider where schema = - object "UpdateProvider" $ - UpdateProvider - <$> updateProviderName .= maybe_ (optField "name" schema) - <*> updateProviderUrl .= maybe_ (optField "url" schema) - <*> updateProviderDescr .= maybe_ (optField "description" schema) + object "UpdateProvider" + $ UpdateProvider + <$> updateProviderName + .= maybe_ (optField "name" schema) + <*> updateProviderUrl + .= maybe_ (optField "url" schema) + <*> updateProviderDescr + .= maybe_ (optField "description" schema) -------------------------------------------------------------------------------- -- ProviderActivationResponse @@ -175,9 +190,10 @@ newtype ProviderActivationResponse = ProviderActivationResponse instance ToSchema ProviderActivationResponse where schema = - object "ProviderActivationResponse" $ - ProviderActivationResponse - <$> activatedProviderIdentity .= field "email" schema + object "ProviderActivationResponse" + $ ProviderActivationResponse + <$> activatedProviderIdentity + .= field "email" schema -------------------------------------------------------------------------------- -- ProviderLogin @@ -193,10 +209,12 @@ data ProviderLogin = ProviderLogin instance ToSchema ProviderLogin where schema = - object "ProviderLogin" $ - ProviderLogin - <$> providerLoginEmail .= field "email" schema - <*> providerLoginPassword .= field "password" schema + object "ProviderLogin" + $ ProviderLogin + <$> providerLoginEmail + .= field "email" schema + <*> providerLoginPassword + .= field "password" schema -------------------------------------------------------------------------------- -- DeleteProvider @@ -210,9 +228,10 @@ newtype DeleteProvider = DeleteProvider instance ToSchema DeleteProvider where schema = - object "DeleteProvider" $ - DeleteProvider - <$> deleteProviderPassword .= field "password" schema + object "DeleteProvider" + $ DeleteProvider + <$> deleteProviderPassword + .= field "password" schema -------------------------------------------------------------------------------- -- Password Change/Reset @@ -225,9 +244,10 @@ newtype PasswordReset = PasswordReset {email :: Email} instance ToSchema PasswordReset where schema = - object "PasswordReset" $ - PasswordReset - <$> (.email) .= field "email" schema + object "PasswordReset" + $ PasswordReset + <$> (.email) + .= field "email" schema -- | The payload for completing a password reset. data CompletePasswordReset = CompletePasswordReset @@ -241,11 +261,14 @@ data CompletePasswordReset = CompletePasswordReset instance ToSchema CompletePasswordReset where schema = - object "CompletePasswordReset" $ - CompletePasswordReset - <$> key .= field "key" schema - <*> (.code) .= field "code" schema - <*> (.password) .= field "password" schema + object "CompletePasswordReset" + $ CompletePasswordReset + <$> key + .= field "key" schema + <*> (.code) + .= field "code" schema + <*> (.password) + .= field "password" schema -- | The payload for changing a password. data PasswordChange = PasswordChange @@ -258,10 +281,12 @@ data PasswordChange = PasswordChange instance ToSchema PasswordChange where schema = - object "PasswordChange" $ - PasswordChange - <$> oldPassword .= field "old_password" schema - <*> newPassword .= field "new_password" schema + object "PasswordChange" + $ PasswordChange + <$> oldPassword + .= field "old_password" schema + <*> newPassword + .= field "new_password" schema -- | The payload for updating an email address newtype EmailUpdate = EmailUpdate {email :: Email} @@ -271,6 +296,7 @@ newtype EmailUpdate = EmailUpdate {email :: Email} instance ToSchema EmailUpdate where schema = - object "EmailUpdate" $ - EmailUpdate - <$> (.email) .= field "email" schema + object "EmailUpdate" + $ EmailUpdate + <$> (.email) + .= field "email" schema diff --git a/libs/wire-api/src/Wire/API/Provider/Bot.hs b/libs/wire-api/src/Wire/API/Provider/Bot.hs index e8a1f5b1c4a..a06e2c0ef57 100644 --- a/libs/wire-api/src/Wire/API/Provider/Bot.hs +++ b/libs/wire-api/src/Wire/API/Provider/Bot.hs @@ -56,11 +56,14 @@ data BotConvView = BotConvView instance ToSchema BotConvView where schema = - object "BotConvView" $ - BotConvView - <$> _botConvId .= field "id" schema - <*> _botConvName .= maybe_ (optField "name" schema) - <*> _botConvMembers .= field "members" (array schema) + object "BotConvView" + $ BotConvView + <$> _botConvId + .= field "id" schema + <*> _botConvName + .= maybe_ (optField "name" schema) + <*> _botConvMembers + .= field "members" (array schema) botConvView :: ConvId -> Maybe Text -> [OtherMember] -> BotConvView botConvView = BotConvView @@ -81,12 +84,17 @@ data BotUserView = BotUserView instance ToSchema BotUserView where schema = - object "BotUserView" $ - BotUserView - <$> botUserViewId .= field "id" schema - <*> botUserViewName .= field "name" schema - <*> botUserViewColour .= field "accent_id" schema - <*> botUserViewHandle .= optField "handle" (maybeWithDefault A.Null schema) - <*> botUserViewTeam .= optField "team" (maybeWithDefault A.Null schema) + object "BotUserView" + $ BotUserView + <$> botUserViewId + .= field "id" schema + <*> botUserViewName + .= field "name" schema + <*> botUserViewColour + .= field "accent_id" schema + <*> botUserViewHandle + .= optField "handle" (maybeWithDefault A.Null schema) + <*> botUserViewTeam + .= optField "team" (maybeWithDefault A.Null schema) makeLenses ''BotConvView diff --git a/libs/wire-api/src/Wire/API/Provider/External.hs b/libs/wire-api/src/Wire/API/Provider/External.hs index 246b6aa5317..5dd09176517 100644 --- a/libs/wire-api/src/Wire/API/Provider/External.hs +++ b/libs/wire-api/src/Wire/API/Provider/External.hs @@ -57,22 +57,34 @@ data NewBotRequest = NewBotRequest instance FromJSON NewBotRequest where parseJSON = withObject "NewBotRequest" $ \o -> NewBotRequest - <$> o .: "id" - <*> o .: "client" - <*> o .: "origin" - <*> o .: "conversation" - <*> o .: "token" - <*> o .: "locale" + <$> o + .: "id" + <*> o + .: "client" + <*> o + .: "origin" + <*> o + .: "conversation" + <*> o + .: "token" + <*> o + .: "locale" instance ToJSON NewBotRequest where toJSON n = - object $ - "id" .= newBotId n - # "client" .= newBotClient n - # "origin" .= newBotOrigin n - # "conversation" .= newBotConv n - # "token" .= newBotToken n - # "locale" .= newBotLocale n + object + $ "id" + .= newBotId n + # "client" + .= newBotClient n + # "origin" + .= newBotOrigin n + # "conversation" + .= newBotConv n + # "token" + .= newBotToken n + # "locale" + .= newBotLocale n # [] -------------------------------------------------------------------------------- @@ -94,18 +106,28 @@ data NewBotResponse = NewBotResponse instance FromJSON NewBotResponse where parseJSON = withObject "NewBotResponse" $ \o -> NewBotResponse - <$> o .: "prekeys" - <*> o .: "last_prekey" - <*> o .:? "name" - <*> o .:? "accent_id" - <*> o .:? "assets" + <$> o + .: "prekeys" + <*> o + .: "last_prekey" + <*> o + .:? "name" + <*> o + .:? "accent_id" + <*> o + .:? "assets" instance ToJSON NewBotResponse where toJSON r = - object $ - "prekeys" .= rsNewBotPrekeys r - # "last_prekey" .= rsNewBotLastPrekey r - # "name" .= rsNewBotName r - # "accent_id" .= rsNewBotColour r - # "assets" .= rsNewBotAssets r + object + $ "prekeys" + .= rsNewBotPrekeys r + # "last_prekey" + .= rsNewBotLastPrekey r + # "name" + .= rsNewBotName r + # "accent_id" + .= rsNewBotColour r + # "assets" + .= rsNewBotAssets r # [] diff --git a/libs/wire-api/src/Wire/API/Provider/Service.hs b/libs/wire-api/src/Wire/API/Provider/Service.hs index 7b181183e1e..841b1926f55 100644 --- a/libs/wire-api/src/Wire/API/Provider/Service.hs +++ b/libs/wire-api/src/Wire/API/Provider/Service.hs @@ -90,10 +90,12 @@ data ServiceRef = ServiceRef instance ToSchema ServiceRef where schema = - object "ServiceRef" $ - ServiceRef - <$> _serviceRefId .= field "id" schema - <*> _serviceRefProvider .= field "provider" schema + object "ServiceRef" + $ ServiceRef + <$> _serviceRefId + .= field "id" schema + <*> _serviceRefProvider + .= field "provider" schema makeLenses ''ServiceRef @@ -118,11 +120,14 @@ data ServiceKey = ServiceKey instance ToSchema ServiceKey where schema = - object "ServiceKey" $ - ServiceKey - <$> serviceKeyType .= field "type" schema - <*> serviceKeySize .= field "size" schema - <*> serviceKeyPEM .= field "pem" schema + object "ServiceKey" + $ ServiceKey + <$> serviceKeyType + .= field "type" schema + <*> serviceKeySize + .= field "size" schema + <*> serviceKeyPEM + .= field "pem" schema -- | Other types may be supported in the future. data ServiceKeyType @@ -152,24 +157,26 @@ instance FromByteString ServiceKeyPEM where instance ToSchema ServiceKeyPEM where schema = - S.schema . S.example ?~ pem $ - (Text.decodeUtf8 . toByteString') + S.schema . S.example + ?~ pem + $ (Text.decodeUtf8 . toByteString') .= parsedText "ServiceKeyPEM" (runParser parser . Text.encodeUtf8) where pem = - A.String . Text.unlines $ - [ "-----BEGIN PUBLIC KEY-----", - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu+Kg/PHHU3atXrUbKnw0", - "G06FliXcNt3lMwl2os5twEDcPPFw/feGiAKymxp+7JqZDrseS5D9THGrW+OQRIPH", - "WvUBdiLfGrZqJO223DB6D8K2Su/odmnjZJ2z23rhXoEArTplu+Dg9K+c2LVeXTKV", - "VPOaOzgtAB21XKRiQ4ermqgi3/njr03rXyq/qNkuNd6tNcg+HAfGxfGvvCSYBfiS", - "bUKr/BeArYRcjzr/h5m1In6fG/if9GEI6m8dxHT9JbY53wiksowy6ajCuqskIFg8", - "7X883H+LA/d6X5CTiPv1VMxXdBUiGPuC9IT/6CNQ1/LFt0P37ax58+LGYlaFo7la", - "nQIDAQAB", - "-----END PUBLIC KEY-----" - ] + A.String + . Text.unlines + $ [ "-----BEGIN PUBLIC KEY-----", + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu+Kg/PHHU3atXrUbKnw0", + "G06FliXcNt3lMwl2os5twEDcPPFw/feGiAKymxp+7JqZDrseS5D9THGrW+OQRIPH", + "WvUBdiLfGrZqJO223DB6D8K2Su/odmnjZJ2z23rhXoEArTplu+Dg9K+c2LVeXTKV", + "VPOaOzgtAB21XKRiQ4ermqgi3/njr03rXyq/qNkuNd6tNcg+HAfGxfGvvCSYBfiS", + "bUKr/BeArYRcjzr/h5m1In6fG/if9GEI6m8dxHT9JbY53wiksowy6ajCuqskIFg8", + "7X883H+LA/d6X5CTiPv1VMxXdBUiGPuC9IT/6CNQ1/LFt0P37ax58+LGYlaFo7la", + "nQIDAQAB", + "-----END PUBLIC KEY-----" + ] instance Arbitrary ServiceKeyPEM where arbitrary = @@ -211,18 +218,28 @@ data Service = Service instance ToSchema Service where schema = - object "Service" $ - Service - <$> serviceId .= field "id" schema - <*> serviceName .= field "name" schema - <*> serviceSummary .= field "summary" schema - <*> serviceDescr .= field "description" schema - <*> serviceUrl .= field "base_url" schema - <*> serviceTokens .= field "auth_tokens" schema - <*> serviceKeys .= field "public_keys" schema - <*> serviceAssets .= field "assets" (array schema) - <*> serviceTags .= field "tags" (set schema) - <*> serviceEnabled .= field "enabled" schema + object "Service" + $ Service + <$> serviceId + .= field "id" schema + <*> serviceName + .= field "name" schema + <*> serviceSummary + .= field "summary" schema + <*> serviceDescr + .= field "description" schema + <*> serviceUrl + .= field "base_url" schema + <*> serviceTokens + .= field "auth_tokens" schema + <*> serviceKeys + .= field "public_keys" schema + <*> serviceAssets + .= field "assets" (array schema) + <*> serviceTags + .= field "tags" (set schema) + <*> serviceEnabled + .= field "enabled" schema -- | A /secret/ bearer token used to authenticate and authorise requests @towards@ -- a 'Service' via inclusion in the HTTP 'Authorization' header. @@ -258,16 +275,24 @@ data ServiceProfile = ServiceProfile instance ToSchema ServiceProfile where schema = - object "ServiceProfile" $ - ServiceProfile - <$> serviceProfileId .= field "id" schema - <*> serviceProfileProvider .= field "provider" schema - <*> serviceProfileName .= field "name" schema - <*> serviceProfileSummary .= field "summary" schema - <*> serviceProfileDescr .= field "description" schema - <*> serviceProfileAssets .= field "assets" (array schema) - <*> serviceProfileTags .= field "tags" (set schema) - <*> serviceProfileEnabled .= field "enabled" schema + object "ServiceProfile" + $ ServiceProfile + <$> serviceProfileId + .= field "id" schema + <*> serviceProfileProvider + .= field "provider" schema + <*> serviceProfileName + .= field "name" schema + <*> serviceProfileSummary + .= field "summary" schema + <*> serviceProfileDescr + .= field "description" schema + <*> serviceProfileAssets + .= field "assets" (array schema) + <*> serviceProfileTags + .= field "tags" (set schema) + <*> serviceProfileEnabled + .= field "enabled" schema -------------------------------------------------------------------------------- -- ServiceProfilePage @@ -282,10 +307,12 @@ data ServiceProfilePage = ServiceProfilePage instance ToSchema ServiceProfilePage where schema = - object "ServiceProfile" $ - ServiceProfilePage - <$> serviceProfilePageHasMore .= field "has_more" schema - <*> serviceProfilePageResults .= field "services" (array schema) + object "ServiceProfile" + $ ServiceProfilePage + <$> serviceProfilePageHasMore + .= field "has_more" schema + <*> serviceProfilePageResults + .= field "services" (array schema) -------------------------------------------------------------------------------- -- NewService @@ -307,16 +334,24 @@ data NewService = NewService instance ToSchema NewService where schema = - object "NewService" $ - NewService - <$> newServiceName .= field "name" schema - <*> newServiceSummary .= field "summary" schema - <*> newServiceDescr .= field "description" schema - <*> newServiceUrl .= field "base_url" schema - <*> newServiceKey .= field "public_key" schema - <*> newServiceToken .= maybe_ (optField "auth_token" schema) - <*> newServiceAssets .= field "assets" (array schema) - <*> newServiceTags .= field "tags" (fromRange .= rangedSchema (set schema)) + object "NewService" + $ NewService + <$> newServiceName + .= field "name" schema + <*> newServiceSummary + .= field "summary" schema + <*> newServiceDescr + .= field "description" schema + <*> newServiceUrl + .= field "base_url" schema + <*> newServiceKey + .= field "public_key" schema + <*> newServiceToken + .= maybe_ (optField "auth_token" schema) + <*> newServiceAssets + .= field "assets" (array schema) + <*> newServiceTags + .= field "tags" (fromRange .= rangedSchema (set schema)) -- | Response data upon adding a new service. data NewServiceResponse = NewServiceResponse @@ -332,10 +367,12 @@ data NewServiceResponse = NewServiceResponse instance ToSchema NewServiceResponse where schema = - object "NewServiceResponse" $ - NewServiceResponse - <$> rsNewServiceId .= field "id" schema - <*> rsNewServiceToken .= maybe_ (optField "auth_token" schema) + object "NewServiceResponse" + $ NewServiceResponse + <$> rsNewServiceId + .= field "id" schema + <*> rsNewServiceToken + .= maybe_ (optField "auth_token" schema) -------------------------------------------------------------------------------- -- UpdateService @@ -354,13 +391,18 @@ data UpdateService = UpdateService instance ToSchema UpdateService where schema = - object "UpdateService" $ - UpdateService - <$> updateServiceName .= maybe_ (optField "name" schema) - <*> updateServiceSummary .= maybe_ (optField "summary" schema) - <*> updateServiceDescr .= maybe_ (optField "description" schema) - <*> updateServiceAssets .= maybe_ (optField "assets" $ array schema) - <*> updateServiceTags .= maybe_ (optField "tags" (fromRange .= rangedSchema (set schema))) + object "UpdateService" + $ UpdateService + <$> updateServiceName + .= maybe_ (optField "name" schema) + <*> updateServiceSummary + .= maybe_ (optField "summary" schema) + <*> updateServiceDescr + .= maybe_ (optField "description" schema) + <*> updateServiceAssets + .= maybe_ (optField "assets" $ array schema) + <*> updateServiceTags + .= maybe_ (optField "tags" (fromRange .= rangedSchema (set schema))) -------------------------------------------------------------------------------- -- UpdateServiceConn @@ -380,13 +422,18 @@ data UpdateServiceConn = UpdateServiceConn instance ToSchema UpdateServiceConn where schema = - object "UpdateServiceConn" $ - UpdateServiceConn - <$> updateServiceConnPassword .= field "password" schema - <*> updateServiceConnUrl .= maybe_ (optField "base_url" schema) - <*> updateServiceConnKeys .= maybe_ (optField "public_keys" (fromRange .= rangedSchema (array schema))) - <*> updateServiceConnTokens .= maybe_ (optField "auth_tokens" (fromRange .= rangedSchema (array schema))) - <*> updateServiceConnEnabled .= maybe_ (optField "enabled" schema) + object "UpdateServiceConn" + $ UpdateServiceConn + <$> updateServiceConnPassword + .= field "password" schema + <*> updateServiceConnUrl + .= maybe_ (optField "base_url" schema) + <*> updateServiceConnKeys + .= maybe_ (optField "public_keys" (fromRange .= rangedSchema (array schema))) + <*> updateServiceConnTokens + .= maybe_ (optField "auth_tokens" (fromRange .= rangedSchema (array schema))) + <*> updateServiceConnEnabled + .= maybe_ (optField "enabled" schema) mkUpdateServiceConn :: PlainTextPassword6 -> UpdateServiceConn mkUpdateServiceConn pw = UpdateServiceConn pw Nothing Nothing Nothing Nothing @@ -403,9 +450,10 @@ newtype DeleteService = DeleteService instance ToSchema DeleteService where schema = - object "DeleteService" $ - DeleteService - <$> deleteServicePassword .= field "password" schema + object "DeleteService" + $ DeleteService + <$> deleteServicePassword + .= field "password" schema -------------------------------------------------------------------------------- -- UpdateServiceWhitelist @@ -421,11 +469,14 @@ data UpdateServiceWhitelist = UpdateServiceWhitelist instance ToSchema UpdateServiceWhitelist where schema = - object "UpdateServiceWhitelist" $ - UpdateServiceWhitelist - <$> updateServiceWhitelistProvider .= field "provider" schema - <*> updateServiceWhitelistService .= field "id" schema - <*> updateServiceWhitelistStatus .= field "whitelisted" schema + object "UpdateServiceWhitelist" + $ UpdateServiceWhitelist + <$> updateServiceWhitelistProvider + .= field "provider" schema + <*> updateServiceWhitelistService + .= field "id" schema + <*> updateServiceWhitelistStatus + .= field "whitelisted" schema data UpdateServiceWhitelistResp = UpdateServiceWhitelistRespChanged diff --git a/libs/wire-api/src/Wire/API/Provider/Service/Tag.hs b/libs/wire-api/src/Wire/API/Provider/Service/Tag.hs index 1df9b6a14bc..ec44311dece 100644 --- a/libs/wire-api/src/Wire/API/Provider/Service/Tag.hs +++ b/libs/wire-api/src/Wire/API/Provider/Service/Tag.hs @@ -238,7 +238,7 @@ instance (KnownNat n, KnownNat m, m <= n) => FromByteString (QueryAnyTags m n) w rs <- either fail pure (Range.checkedEither (Set.fromList ts)) pure $! QueryAnyTags rs -runPartial :: IsString i => Bool -> IResult i b -> Either Text b +runPartial :: (IsString i) => Bool -> IResult i b -> Either Text b runPartial alreadyRun result = case result of Fail _ _ e -> Left $ Text.pack e Partial f -> diff --git a/libs/wire-api/src/Wire/API/Push/V2/Token.hs b/libs/wire-api/src/Wire/API/Push/V2/Token.hs index 29560be5fe8..7b50f131bb5 100644 --- a/libs/wire-api/src/Wire/API/Push/V2/Token.hs +++ b/libs/wire-api/src/Wire/API/Push/V2/Token.hs @@ -71,10 +71,10 @@ newtype PushTokenList = PushTokenList instance ToSchema PushTokenList where schema = - objectWithDocModifier "PushTokenList" (description ?~ "List of Native Push Tokens") $ - PushTokenList - <$> pushTokens - .= fieldWithDocModifier "tokens" (description ?~ "Push tokens") (array schema) + objectWithDocModifier "PushTokenList" (description ?~ "List of Native Push Tokens") + $ PushTokenList + <$> pushTokens + .= fieldWithDocModifier "tokens" (description ?~ "Push tokens") (array schema) data PushToken = PushToken { _tokenTransport :: Transport, @@ -91,16 +91,16 @@ pushToken = PushToken instance ToSchema PushToken where schema = - objectWithDocModifier "PushToken" desc $ - PushToken - <$> _tokenTransport - .= fieldWithDocModifier "transport" transDesc schema + objectWithDocModifier "PushToken" desc + $ PushToken + <$> _tokenTransport + .= fieldWithDocModifier "transport" transDesc schema <*> _tokenApp - .= fieldWithDocModifier "app" appDesc schema + .= fieldWithDocModifier "app" appDesc schema <*> _token - .= fieldWithDocModifier "token" tokenDesc schema + .= fieldWithDocModifier "token" tokenDesc schema <*> _tokenClient - .= fieldWithDocModifier "client" clientIdDesc schema + .= fieldWithDocModifier "client" clientIdDesc schema where desc = description ?~ "Native Push Token" transDesc = description ?~ "Transport" @@ -123,8 +123,8 @@ data Transport instance ToSchema Transport where schema = - enum @Text "Transport" $ - mconcat + enum @Text "Transport" + $ mconcat [ element "GCM" GCM, element "APNS" APNS, element "APNS_SANDBOX" APNSSandbox, diff --git a/libs/wire-api/src/Wire/API/RawJson.hs b/libs/wire-api/src/Wire/API/RawJson.hs index 08529ded900..72190515f90 100644 --- a/libs/wire-api/src/Wire/API/RawJson.hs +++ b/libs/wire-api/src/Wire/API/RawJson.hs @@ -41,8 +41,9 @@ instance MimeRender JSON RawJson where instance Swagger.ToSchema RawJson where declareNamedSchema _ = - pure . Swagger.NamedSchema (Just "RawJson") $ - mempty - & Swagger.type_ ?~ Swagger.OpenApiObject - & Swagger.description - ?~ "Any JSON as plain string. The object structure is not specified in this schema." + pure + . Swagger.NamedSchema (Just "RawJson") + $ mempty + & Swagger.type_ ?~ Swagger.OpenApiObject + & Swagger.description + ?~ "Any JSON as plain string. The object structure is not specified in this schema." diff --git a/libs/wire-api/src/Wire/API/Routes/API.hs b/libs/wire-api/src/Wire/API/Routes/API.hs index 23ac38e6fed..ed77df72ba3 100644 --- a/libs/wire-api/src/Wire/API/Routes/API.hs +++ b/libs/wire-api/src/Wire/API/Routes/API.hs @@ -47,7 +47,7 @@ class ServiceAPI service (v :: Version) where type ServiceAPIRoutes service type SpecialisedAPIRoutes v service :: Type type SpecialisedAPIRoutes v service = SpecialiseToVersion v (ServiceAPIRoutes service) - serviceSwagger :: HasOpenApi (SpecialisedAPIRoutes v service) => S.OpenApi + serviceSwagger :: (HasOpenApi (SpecialisedAPIRoutes v service)) => S.OpenApi serviceSwagger = toOpenApi (Proxy @(SpecialisedAPIRoutes v service)) instance ServiceAPI VersionAPITag v where @@ -86,7 +86,7 @@ infixr 3 <@> -- type argument. hoistServerWithDomain :: forall api m n. - HasServer api '[Domain] => + (HasServer api '[Domain]) => (forall x. m x -> n x) -> ServerT api m -> ServerT api n @@ -94,7 +94,7 @@ hoistServerWithDomain = hoistServerWithContext (Proxy @api) (Proxy @'[Domain]) hoistAPIHandler :: forall api r n. - HasServer api '[Domain] => + (HasServer api '[Domain]) => (forall x. Sem r x -> n x) -> API api r -> ServerT api n diff --git a/libs/wire-api/src/Wire/API/Routes/Bearer.hs b/libs/wire-api/src/Wire/API/Routes/Bearer.hs index 64a1baed79f..40ffc4a43bc 100644 --- a/libs/wire-api/src/Wire/API/Routes/Bearer.hs +++ b/libs/wire-api/src/Wire/API/Routes/Bearer.hs @@ -30,7 +30,7 @@ import Wire.API.Routes.Version newtype Bearer a = Bearer {unBearer :: a} -instance FromHttpApiData a => FromHttpApiData (Bearer a) where +instance (FromHttpApiData a) => FromHttpApiData (Bearer a) where parseHeader h = case BS.splitAt 7 h of ("Bearer ", suffix) -> Bearer <$> parseHeader suffix _ -> Left "Invalid authorization scheme" @@ -47,12 +47,13 @@ type instance SpecialiseToVersion v (Bearer a :> api) = Bearer a :> SpecialiseToVersion v api -instance HasOpenApi api => HasOpenApi (Bearer a :> api) where +instance (HasOpenApi api) => HasOpenApi (Bearer a :> api) where toOpenApi _ = toOpenApi (Proxy @api) - & security <>~ [SecurityRequirement $ InsOrdHashMap.singleton "ZAuth" []] + & security + <>~ [SecurityRequirement $ InsOrdHashMap.singleton "ZAuth" []] -instance RoutesToPaths api => RoutesToPaths (Bearer a :> api) where +instance (RoutesToPaths api) => RoutesToPaths (Bearer a :> api) where getRoutes = getRoutes @api instance diff --git a/libs/wire-api/src/Wire/API/Routes/CSV.hs b/libs/wire-api/src/Wire/API/Routes/CSV.hs index 0345336c378..7e8095fb1b5 100644 --- a/libs/wire-api/src/Wire/API/Routes/CSV.hs +++ b/libs/wire-api/src/Wire/API/Routes/CSV.hs @@ -31,8 +31,8 @@ instance Accept CSV where instance ToSchema CSV where declareNamedSchema _ = - plain $ - mempty - & O.title ?~ "CSV" - & O.type_ ?~ O.OpenApiString - & O.format ?~ "text/csv" + plain + $ mempty + & O.title ?~ "CSV" + & O.type_ ?~ O.OpenApiString + & O.format ?~ "text/csv" diff --git a/libs/wire-api/src/Wire/API/Routes/ClientAlgebra.hs b/libs/wire-api/src/Wire/API/Routes/ClientAlgebra.hs index abc2b28e283..bae5c5bbc74 100644 --- a/libs/wire-api/src/Wire/API/Routes/ClientAlgebra.hs +++ b/libs/wire-api/src/Wire/API/Routes/ClientAlgebra.hs @@ -34,14 +34,14 @@ import Wire.API.Routes.MultiVerb -- type, and @m R@ is always an algebra over @m@. -- -- Minimal definition: 'joinClient' | 'bindClient'. -class HasClient m api => HasClientAlgebra m api where +class (HasClient m api) => HasClientAlgebra m api where joinClient :: m (Client m api) -> Client m api joinClient x = bindClient @m @api x id bindClient :: m a -> (a -> Client m api) -> Client m api bindClient x f = joinClient @m @api (fmap f x) -instance HasClient m (Verb method s cs a) => HasClientAlgebra m (Verb method s cs a) where +instance (HasClient m (Verb method s cs a)) => HasClientAlgebra m (Verb method s cs a) where joinClient = join bindClient = (>>=) diff --git a/libs/wire-api/src/Wire/API/Routes/Cookies.hs b/libs/wire-api/src/Wire/API/Routes/Cookies.hs index 2449f074c76..24629d0f12f 100644 --- a/libs/wire-api/src/Wire/API/Routes/Cookies.hs +++ b/libs/wire-api/src/Wire/API/Routes/Cookies.hs @@ -63,7 +63,7 @@ type instance SpecialiseToVersion v (Cookies cs :> api) = Cookies cs :> SpecialiseToVersion v api -instance HasOpenApi api => HasOpenApi (Cookies cs :> api) where +instance (HasOpenApi api) => HasOpenApi (Cookies cs :> api) where toOpenApi _ = toOpenApi (Proxy @api) class CookieArgs (cs :: [Type]) where @@ -103,7 +103,7 @@ instance mkCookieMap :: [(ByteString, ByteString)] -> CookieMap mkCookieMap = foldr (\(k, v) -> M.insertWith (<>) k (pure v)) mempty -instance CookieArgs cs => FromHttpApiData (CookieTuple cs) where +instance (CookieArgs cs) => FromHttpApiData (CookieTuple cs) where parseHeader = mkTuple . mkCookieMap . parseCookies parseUrlPiece = parseHeader . T.encodeUtf8 @@ -126,5 +126,5 @@ instance ) hoistServerWithContext _ ctx f = mapArgs @cs (hoistServerWithContext (Proxy @api) ctx f) -instance RoutesToPaths api => RoutesToPaths (Cookies cs :> api) where +instance (RoutesToPaths api) => RoutesToPaths (Cookies cs :> api) where getRoutes = getRoutes @api diff --git a/libs/wire-api/src/Wire/API/Routes/FederationDomainConfig.hs b/libs/wire-api/src/Wire/API/Routes/FederationDomainConfig.hs index 74257a99e66..a47c80d74e4 100644 --- a/libs/wire-api/src/Wire/API/Routes/FederationDomainConfig.hs +++ b/libs/wire-api/src/Wire/API/Routes/FederationDomainConfig.hs @@ -58,17 +58,17 @@ deriving via Schema FederationRestriction instance (ToJSON FederationRestriction tagSchema :: ValueSchema NamedSwaggerDoc FederationRestrictionTag tagSchema = - enum @Text "FederationRestrictionTag" $ - mconcat [element "allow_all" FederationRestrictionAllowAllTag, element "restrict_by_team" FederationRestrictionByTeamTag] + enum @Text "FederationRestrictionTag" + $ mconcat [element "allow_all" FederationRestrictionAllowAllTag, element "restrict_by_team" FederationRestrictionByTeamTag] instance ToSchema FederationRestriction where schema = - object "FederationRestriction" $ - fromTagged - <$> toTagged - .= bind - (fst .= field "tag" tagSchema) - (snd .= fieldOver _1 "value" untaggedSchema) + object "FederationRestriction" + $ fromTagged + <$> toTagged + .= bind + (fst .= field "tag" tagSchema) + (snd .= fieldOver _1 "value" untaggedSchema) where toTagged :: FederationRestriction -> (FederationRestrictionTag, FederationRestriction) toTagged d@(FederationRestrictionAllowAll) = (FederationRestrictionAllowAllTag, d) @@ -95,11 +95,14 @@ data FederationDomainConfig = FederationDomainConfig instance ToSchema FederationDomainConfig where schema = - object "FederationDomainConfig" $ - FederationDomainConfig - <$> domain .= field "domain" schema - <*> searchPolicy .= field "search_policy" schema - <*> restriction .= field "restriction" schema + object "FederationDomainConfig" + $ FederationDomainConfig + <$> domain + .= field "domain" schema + <*> searchPolicy + .= field "search_policy" schema + <*> restriction + .= field "restriction" schema data FederationDomainConfigs = FederationDomainConfigs { strategy :: FederationStrategy, @@ -124,9 +127,12 @@ instance ToSchema FederationDomainConfigs where "FederationDomainConfigs" (description ?~ "See https://docs.wire.com/understand/federation/backend-communication.html#configuring-remote-connections.") $ FederationDomainConfigs - <$> strategy .= field "strategy" schema - <*> remotes .= field "remotes" (array schema) - <*> updateInterval .= field "update_interval" schema + <$> strategy + .= field "strategy" schema + <*> remotes + .= field "remotes" (array schema) + <*> updateInterval + .= field "update_interval" schema data FederationStrategy = -- | Disable federation. @@ -142,8 +148,8 @@ data FederationStrategy instance ToSchema FederationStrategy where schema = - enum @Text "FederationStrategy" $ - mconcat + enum @Text "FederationStrategy" + $ mconcat [ element "allowNone" AllowNone, element "allowAll" AllowAll, element "allowDynamic" AllowDynamic @@ -158,6 +164,7 @@ newtype FederationRemoteTeam = FederationRemoteTeam instance ToSchema FederationRemoteTeam where schema = - object "FederationRemoteTeam" $ - FederationRemoteTeam - <$> teamId .= field "team_id" schema + object "FederationRemoteTeam" + $ FederationRemoteTeam + <$> teamId + .= field "team_id" schema diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs index 3de1d1705eb..365fdc5c73f 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs @@ -498,11 +498,14 @@ data NewKeyPackageRef = NewKeyPackageRef instance ToSchema NewKeyPackageRef where schema = - object "NewKeyPackageRef" $ - NewKeyPackageRef - <$> nkprUserId .= field "user_id" schema - <*> nkprClientId .= field "client_id" schema - <*> nkprConversation .= field "conversation" schema + object "NewKeyPackageRef" + $ NewKeyPackageRef + <$> nkprUserId + .= field "user_id" schema + <*> nkprClientId + .= field "client_id" schema + <*> nkprConversation + .= field "conversation" schema type MLSAPI = "mls" :> GetMLSClients @@ -591,7 +594,8 @@ newtype FoundInvitationCode = FoundInvitationCode {getFoundInvitationCode :: Use instance ToSchema FoundInvitationCode where schema = FoundInvitationCode - <$> getFoundInvitationCode .= object "FoundInvitationCode" (field "code" (schema @User.InvitationCode)) + <$> getFoundInvitationCode + .= object "FoundInvitationCode" (field "code" (schema @User.InvitationCode)) type SuspendTeam = Named @@ -785,7 +789,9 @@ type FederationRemotesAPIDescription = swaggerDoc :: OpenApi swaggerDoc = toOpenApi (Proxy @API) - & info . title .~ "Wire-Server internal brig API" + & info + . title + .~ "Wire-Server internal brig API" newtype BrigInternalClient a = BrigInternalClient (Servant.ClientM a) deriving newtype (Functor, Applicative, Monad, Servant.RunClient) diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Brig/Connection.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Brig/Connection.hs index 7f3d76810cf..9caad911e75 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Brig/Connection.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Brig/Connection.hs @@ -36,10 +36,12 @@ data ConnectionsStatusRequest = ConnectionsStatusRequest instance ToSchema ConnectionsStatusRequest where schema = - object "ConnectionsStatusRequest" $ - ConnectionsStatusRequest - <$> csrFrom .= field "from" (array schema) - <*> csrTo .= maybe_ (optField "to" (array schema)) + object "ConnectionsStatusRequest" + $ ConnectionsStatusRequest + <$> csrFrom + .= field "from" (array schema) + <*> csrTo + .= maybe_ (optField "to" (array schema)) data ConnectionsStatusRequestV2 = ConnectionsStatusRequestV2 { csrv2From :: ![UserId], @@ -51,11 +53,14 @@ data ConnectionsStatusRequestV2 = ConnectionsStatusRequestV2 instance ToSchema ConnectionsStatusRequestV2 where schema = - object "ConnectionsStatusRequestV2" $ - ConnectionsStatusRequestV2 - <$> csrv2From .= field "from" (array schema) - <*> csrv2To .= maybe_ (optField "to" (array schema)) - <*> csrv2Relation .= maybe_ (optField "relation" schema) + object "ConnectionsStatusRequestV2" + $ ConnectionsStatusRequestV2 + <$> csrv2From + .= field "from" (array schema) + <*> csrv2To + .= maybe_ (optField "to" (array schema)) + <*> csrv2Relation + .= maybe_ (optField "relation" schema) data ConnectionStatus = ConnectionStatus { csFrom :: !UserId, @@ -67,11 +72,14 @@ data ConnectionStatus = ConnectionStatus instance ToSchema ConnectionStatus where schema = - object "ConnectionStatus" $ - ConnectionStatus - <$> csFrom .= field "from" schema - <*> csTo .= field "to" schema - <*> csStatus .= field "status" schema + object "ConnectionStatus" + $ ConnectionStatus + <$> csFrom + .= field "from" schema + <*> csTo + .= field "to" schema + <*> csStatus + .= field "status" schema data ConnectionStatusV2 = ConnectionStatusV2 { csv2From :: !UserId, @@ -83,8 +91,11 @@ data ConnectionStatusV2 = ConnectionStatusV2 instance ToSchema ConnectionStatusV2 where schema = - object "ConnectionStatusV2" $ - ConnectionStatusV2 - <$> csv2From .= field "from" schema - <*> csv2To .= field "qualified_to" schema - <*> csv2Status .= field "status" schema + object "ConnectionStatusV2" + $ ConnectionStatusV2 + <$> csv2From + .= field "from" schema + <*> csv2To + .= field "qualified_to" schema + <*> csv2Status + .= field "status" schema diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Brig/EJPD.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Brig/EJPD.hs index 38bb517cb58..c3fce14574d 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Brig/EJPD.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Brig/EJPD.hs @@ -138,47 +138,73 @@ instance ToSchema EJPDResponseBody where instance ToSchema EJPDResponseItemRoot where schema = object "EJPDResponseItemRoot" do EJPDResponseItemRoot - <$> ejpdResponseRootUserId .= field "UserId" schema - <*> ejpdResponseRootTeamId .= maybe_ (optField "TeamId" schema) - <*> ejpdResponseRootName .= field "Name" schema - <*> ejpdResponseRootHandle .= maybe_ (optField "Handle" schema) - <*> ejpdResponseRootEmail .= maybe_ (optField "Email" schema) - <*> ejpdResponseRootPhone .= maybe_ (optField "Phone" schema) - <*> (Set.toList . ejpdResponseRootPushTokens) .= (Set.fromList <$> field "PushTokens" (array schema)) - <*> (fmap Set.toList . ejpdResponseRootContacts) .= (Set.fromList <$$> maybe_ (optField "Contacts" (array schema))) - <*> ejpdResponseRootTeamContacts .= maybe_ (optField "TeamContacts" schema) - <*> (fmap Set.toList . ejpdResponseRootConversations) .= (Set.fromList <$$> maybe_ (optField "Conversations" (array schema))) - <*> (fmap Set.toList . ejpdResponseRootAssets) .= (Set.fromList <$$> maybe_ (optField "Assets" (array schema))) + <$> ejpdResponseRootUserId + .= field "UserId" schema + <*> ejpdResponseRootTeamId + .= maybe_ (optField "TeamId" schema) + <*> ejpdResponseRootName + .= field "Name" schema + <*> ejpdResponseRootHandle + .= maybe_ (optField "Handle" schema) + <*> ejpdResponseRootEmail + .= maybe_ (optField "Email" schema) + <*> ejpdResponseRootPhone + .= maybe_ (optField "Phone" schema) + <*> (Set.toList . ejpdResponseRootPushTokens) + .= (Set.fromList <$> field "PushTokens" (array schema)) + <*> (fmap Set.toList . ejpdResponseRootContacts) + .= (Set.fromList <$$> maybe_ (optField "Contacts" (array schema))) + <*> ejpdResponseRootTeamContacts + .= maybe_ (optField "TeamContacts" schema) + <*> (fmap Set.toList . ejpdResponseRootConversations) + .= (Set.fromList <$$> maybe_ (optField "Conversations" (array schema))) + <*> (fmap Set.toList . ejpdResponseRootAssets) + .= (Set.fromList <$$> maybe_ (optField "Assets" (array schema))) instance ToSchema EJPDResponseItemLeaf where schema = object "EJPDResponseItemLeaf" do EJPDResponseItemLeaf - <$> ejpdResponseLeafUserId .= field "UserId" schema - <*> ejpdResponseLeafTeamId .= maybe_ (optField "TeamId" schema) - <*> ejpdResponseLeafName .= field "Name" schema - <*> ejpdResponseLeafHandle .= maybe_ (optField "Handle" schema) - <*> ejpdResponseLeafEmail .= maybe_ (optField "Email" schema) - <*> ejpdResponseLeafPhone .= maybe_ (optField "Phone" schema) - <*> (Set.toList . ejpdResponseLeafPushTokens) .= (Set.fromList <$> field "PushTokens" (array schema)) - <*> (fmap Set.toList . ejpdResponseLeafConversations) .= (Set.fromList <$$> maybe_ (optField "Conversations" (array schema))) - <*> (fmap Set.toList . ejpdResponseLeafAssets) .= (Set.fromList <$$> maybe_ (optField "Assets" (array schema))) + <$> ejpdResponseLeafUserId + .= field "UserId" schema + <*> ejpdResponseLeafTeamId + .= maybe_ (optField "TeamId" schema) + <*> ejpdResponseLeafName + .= field "Name" schema + <*> ejpdResponseLeafHandle + .= maybe_ (optField "Handle" schema) + <*> ejpdResponseLeafEmail + .= maybe_ (optField "Email" schema) + <*> ejpdResponseLeafPhone + .= maybe_ (optField "Phone" schema) + <*> (Set.toList . ejpdResponseLeafPushTokens) + .= (Set.fromList <$> field "PushTokens" (array schema)) + <*> (fmap Set.toList . ejpdResponseLeafConversations) + .= (Set.fromList <$$> maybe_ (optField "Conversations" (array schema))) + <*> (fmap Set.toList . ejpdResponseLeafAssets) + .= (Set.fromList <$$> maybe_ (optField "Assets" (array schema))) instance ToSchema EJPDContact where schema = object "EJDPContact" do EJPDContactFound - <$> ejpdContactRelation .= field "contact_relation" schema - <*> ejpdContactFound .= field "contact_item" schema + <$> ejpdContactRelation + .= field "contact_relation" schema + <*> ejpdContactFound + .= field "contact_item" schema instance ToSchema EJPDTeamContacts where schema = object "EJPDTeamContacts" do EJPDTeamContacts - <$> (Set.toList . ejpdTeamContacts) .= (Set.fromList <$> field "TeamContacts" (array schema)) - <*> ejpdTeamContactsListType .= field "ListType" schema + <$> (Set.toList . ejpdTeamContacts) + .= (Set.fromList <$> field "TeamContacts" (array schema)) + <*> ejpdTeamContactsListType + .= field "ListType" schema instance ToSchema EJPDConvInfo where schema = - object "EJPDConvInfo" $ - EJPDConvInfo - <$> ejpdConvName .= field "conv_name" schema - <*> ejpdConvId .= field "conv_id" schema + object "EJPDConvInfo" + $ EJPDConvInfo + <$> ejpdConvName + .= field "conv_name" schema + <*> ejpdConvId + .= field "conv_id" schema diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Cannon.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Cannon.hs index b8f1652bc7a..f0c68a51ac1 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Cannon.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Cannon.hs @@ -62,4 +62,6 @@ type API = swaggerDoc :: OpenApi swaggerDoc = toOpenApi (Proxy @API) - & info . title .~ "Wire-Server internal cannon API" + & info + . title + .~ "Wire-Server internal cannon API" diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs index 8e7a8991d31..b136e776e11 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs @@ -706,4 +706,6 @@ type IEJPDAPI = swaggerDoc :: OpenApi swaggerDoc = toOpenApi (Proxy @InternalAPI) - & info . title .~ "Wire-Server internal galley API" + & info + . title + .~ "Wire-Server internal galley API" diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/ConversationsIntra.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/ConversationsIntra.hs index a25baa28b23..1d5b7ec4b3f 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/ConversationsIntra.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/ConversationsIntra.hs @@ -30,8 +30,8 @@ data DesiredMembership = Included | Excluded instance ToSchema DesiredMembership where schema = - enum @Text "DesiredMembership" $ - mconcat + enum @Text "DesiredMembership" + $ mconcat [ element "included" Included, element "excluded" Excluded ] @@ -42,8 +42,8 @@ data Actor = LocalActor | RemoteActor instance ToSchema Actor where schema = - enum @Text "Actor" $ - mconcat + enum @Text "Actor" + $ mconcat [ element "local_actor" LocalActor, element "remote_actor" RemoteActor ] @@ -60,10 +60,15 @@ data UpsertOne2OneConversationRequest = UpsertOne2OneConversationRequest instance ToSchema UpsertOne2OneConversationRequest where schema = - object "UpsertOne2OneConversationRequest" $ - UpsertOne2OneConversationRequest - <$> (tUntagged . uooLocalUser) .= field "local_user" (qTagUnsafe <$> schema) - <*> (tUntagged . uooRemoteUser) .= field "remote_user" (qTagUnsafe <$> schema) - <*> uooActor .= field "actor" schema - <*> uooActorDesiredMembership .= field "actor_desired_membership" schema - <*> uooConvId .= field "conversation_id" schema + object "UpsertOne2OneConversationRequest" + $ UpsertOne2OneConversationRequest + <$> (tUntagged . uooLocalUser) + .= field "local_user" (qTagUnsafe <$> schema) + <*> (tUntagged . uooRemoteUser) + .= field "remote_user" (qTagUnsafe <$> schema) + <*> uooActor + .= field "actor" schema + <*> uooActorDesiredMembership + .= field "actor_desired_membership" schema + <*> uooConvId + .= field "conversation_id" schema diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs index 9f96c0b024c..d8b98194bba 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs @@ -37,9 +37,10 @@ newtype TeamFeatureNoConfigMultiRequest = TeamFeatureNoConfigMultiRequest instance ToSchema TeamFeatureNoConfigMultiRequest where schema = - object "TeamFeatureNoConfigMultiRequest" $ - TeamFeatureNoConfigMultiRequest - <$> teams .= field "teams" (array schema) + object "TeamFeatureNoConfigMultiRequest" + $ TeamFeatureNoConfigMultiRequest + <$> teams + .= field "teams" (array schema) newtype TeamFeatureNoConfigMultiResponse cfg = TeamFeatureNoConfigMultiResponse { teamsStatuses :: [TeamStatus cfg] @@ -49,9 +50,10 @@ newtype TeamFeatureNoConfigMultiResponse cfg = TeamFeatureNoConfigMultiResponse instance ToSchema (TeamFeatureNoConfigMultiResponse cfg) where schema = - object "TeamFeatureNoConfigMultiResponse" $ - TeamFeatureNoConfigMultiResponse - <$> teamsStatuses .= field "default_status" (array schema) + object "TeamFeatureNoConfigMultiResponse" + $ TeamFeatureNoConfigMultiResponse + <$> teamsStatuses + .= field "default_status" (array schema) data TeamStatus cfg = TeamStatus { team :: TeamId, @@ -62,7 +64,9 @@ data TeamStatus cfg = TeamStatus instance ToSchema (TeamStatus cfg) where schema = - object "TeamStatus" $ - TeamStatus - <$> team .= field "team" schema - <*> status .= field "status" schema + object "TeamStatus" + $ TeamStatus + <$> team + .= field "team" schema + <*> status + .= field "status" schema diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamsIntra.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamsIntra.hs index 0bc3ae5a593..4455ff0a6b9 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamsIntra.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamsIntra.hs @@ -53,8 +53,8 @@ data TeamStatus instance S.ToSchema TeamStatus where schema = - S.enum @Text "Access" $ - mconcat + S.enum @Text "Access" + $ mconcat [ S.element "active" Active, S.element "pending_delete" PendingDelete, S.element "deleted" Deleted, @@ -73,11 +73,14 @@ data TeamData = TeamData instance S.ToSchema TeamData where schema = - S.object "TeamData" $ - TeamData - <$> tdTeam S..= S.field "team" S.schema - <*> tdStatus S..= S.field "status" S.schema - <*> tdStatusTime S..= S.maybe_ (S.optField "status_time" utcTimeSchema) + S.object "TeamData" + $ TeamData + <$> tdTeam + S..= S.field "team" S.schema + <*> tdStatus + S..= S.field "status" S.schema + <*> tdStatusTime + S..= S.maybe_ (S.optField "status_time" utcTimeSchema) data TeamStatusUpdate = TeamStatusUpdate { tuStatus :: !TeamStatus, @@ -90,18 +93,24 @@ data TeamStatusUpdate = TeamStatusUpdate instance S.ToSchema TeamStatusUpdate where schema = - S.object "TeamStatusUpdate" $ - TeamStatusUpdate - <$> tuStatus S..= S.field "status" S.schema - <*> tuCurrency S..= S.maybe_ (S.optField "currency" currencyAlphaSchema) + S.object "TeamStatusUpdate" + $ TeamStatusUpdate + <$> tuStatus + S..= S.field "status" S.schema + <*> tuCurrency + S..= S.maybe_ (S.optField "currency" currencyAlphaSchema) where currencyAlphaSchema :: S.ValueSchema S.NamedSwaggerDoc Currency.Alpha currencyAlphaSchema = S.mkSchema docs parseJSON (pure . toJSON) where docs = S.swaggerDoc @Text - & Swagger.schema . Swagger.description ?~ "ISO 4217 alphabetic codes" - & Swagger.schema . Swagger.example ?~ "EUR" + & Swagger.schema + . Swagger.description + ?~ "ISO 4217 alphabetic codes" + & Swagger.schema + . Swagger.example + ?~ "EUR" newtype TeamName = TeamName {tnName :: Text} @@ -111,9 +120,10 @@ newtype TeamName = TeamName instance S.ToSchema TeamName where schema = - S.object "TeamName" $ - TeamName - <$> tnName S..= S.field "name" S.schema + S.object "TeamName" + $ TeamName + <$> tnName + S..= S.field "name" S.schema data GuardLegalholdPolicyConflicts = GuardLegalholdPolicyConflicts { glhProtectee :: LegalholdProtectee, @@ -125,7 +135,9 @@ data GuardLegalholdPolicyConflicts = GuardLegalholdPolicyConflicts instance S.ToSchema GuardLegalholdPolicyConflicts where schema = - S.object "GuardLegalholdPolicyConflicts" $ - GuardLegalholdPolicyConflicts - <$> glhProtectee S..= S.field "glhProtectee" S.schema - <*> glhUserClients S..= S.field "glhUserClients" S.schema + S.object "GuardLegalholdPolicyConflicts" + $ GuardLegalholdPolicyConflicts + <$> glhProtectee + S..= S.field "glhProtectee" S.schema + <*> glhUserClients + S..= S.field "glhUserClients" S.schema diff --git a/libs/wire-api/src/Wire/API/Routes/LowLevelStream.hs b/libs/wire-api/src/Wire/API/Routes/LowLevelStream.hs index f39080b54f7..31b63913006 100644 --- a/libs/wire-api/src/Wire/API/Routes/LowLevelStream.hs +++ b/libs/wire-api/src/Wire/API/Routes/LowLevelStream.hs @@ -79,7 +79,8 @@ instance env request respond - $ Route . responseStream status (contentHeader : extraHeaders) + $ Route + . responseStream status (contentHeader : extraHeaders) where method = reflectMethod (Proxy :: Proxy method) status = statusFromNat (Proxy :: Proxy status) @@ -96,24 +97,27 @@ instance toOpenApi _ = mempty & S.paths - . at "/" - ?~ ( mempty - & method - ?~ ( mempty - & S.responses . S.responses .~ fmap S.Inline responses - ) - ) + . at "/" + ?~ ( mempty + & method + ?~ ( mempty + & S.responses + . S.responses + .~ fmap S.Inline responses + ) + ) where method = S.openApiMethod (Proxy @method) responses = InsOrdHashMap.singleton (fromIntegral (natVal (Proxy @status))) $ mempty - & S.description .~ Text.pack (symbolVal (Proxy @desc)) + & S.description + .~ Text.pack (symbolVal (Proxy @desc)) & S.content - .~ InsOrdHashMap.singleton - (contentType $ Proxy @ctype) - (mempty & S.schema . _Just . S._Inline .~ S.toSchema (Proxy @ctype)) + .~ InsOrdHashMap.singleton + (contentType $ Proxy @ctype) + (mempty & S.schema . _Just . S._Inline .~ S.toSchema (Proxy @ctype)) instance RoutesToPaths (LowLevelStream method status headers desc ctype) where getRoutes = [] diff --git a/libs/wire-api/src/Wire/API/Routes/MultiTablePaging.hs b/libs/wire-api/src/Wire/API/Routes/MultiTablePaging.hs index 0fc48cdaf06..86aa6c1a173 100644 --- a/libs/wire-api/src/Wire/API/Routes/MultiTablePaging.hs +++ b/libs/wire-api/src/Wire/API/Routes/MultiTablePaging.hs @@ -67,12 +67,12 @@ type RequestSchemaConstraint name tables max def = (KnownNat max, KnownNat def, deriving via Schema (GetMultiTablePageRequest name tables max def) instance - RequestSchemaConstraint name tables max def => ToJSON (GetMultiTablePageRequest name tables max def) + (RequestSchemaConstraint name tables max def) => ToJSON (GetMultiTablePageRequest name tables max def) deriving via Schema (GetMultiTablePageRequest name tables max def) instance - RequestSchemaConstraint name tables max def => FromJSON (GetMultiTablePageRequest name tables max def) + (RequestSchemaConstraint name tables max def) => FromJSON (GetMultiTablePageRequest name tables max def) deriving via Schema (GetMultiTablePageRequest name tables max def) @@ -82,7 +82,7 @@ deriving via ) => S.ToSchema (GetMultiTablePageRequest name tables max def) -instance RequestSchemaConstraint name tables max def => ToSchema (GetMultiTablePageRequest name tables max def) where +instance (RequestSchemaConstraint name tables max def) => ToSchema (GetMultiTablePageRequest name tables max def) where schema = let addPagingStateDoc = description @@ -93,13 +93,15 @@ instance RequestSchemaConstraint name tables max def => ToSchema (GetMultiTableP ("GetPaginated_" <> textFromSymbol @name) (description ?~ "A request to list some or all of a user's " <> textFromSymbol @name <> ", including remote ones") $ GetMultiTablePageRequest - <$> gmtprSize .= (fromMaybe (toRange (Proxy @def)) <$> optFieldWithDocModifier "size" addSizeDoc schema) - <*> gmtprState .= maybe_ (optFieldWithDocModifier "paging_state" addPagingStateDoc schema) + <$> gmtprSize + .= (fromMaybe (toRange (Proxy @def)) <$> optFieldWithDocModifier "size" addSizeDoc schema) + <*> gmtprState + .= maybe_ (optFieldWithDocModifier "paging_state" addPagingStateDoc schema) -textFromNat :: forall n. KnownNat n => Text +textFromNat :: forall n. (KnownNat n) => Text textFromNat = Text.pack . show . natVal $ Proxy @n -textFromSymbol :: forall s. KnownSymbol s => Text +textFromSymbol :: forall s. (KnownSymbol s) => Text textFromSymbol = Text.pack . symbolVal $ Proxy @s -- | The result of a multi-table paginated query. Contains the list of results, @@ -117,13 +119,13 @@ type PageSchemaConstraints name resultsKey tables a = (KnownSymbol resultsKey, K deriving via (Schema (MultiTablePage name resultsKey tables a)) instance - PageSchemaConstraints name resultsKey tables a => + (PageSchemaConstraints name resultsKey tables a) => ToJSON (MultiTablePage name resultsKey tables a) deriving via (Schema (MultiTablePage name resultsKey tables a)) instance - PageSchemaConstraints name resultsKey tables a => + (PageSchemaConstraints name resultsKey tables a) => FromJSON (MultiTablePage name resultsKey tables a) deriving via @@ -137,11 +139,14 @@ instance ToSchema (MultiTablePage name resultsKey tables a) where schema = - object (textFromSymbol @name <> "_Page") $ - MultiTablePage - <$> mtpResults .= field (textFromSymbol @resultsKey) (array schema) - <*> mtpHasMore .= field "has_more" schema - <*> mtpPagingState .= field "paging_state" schema + object (textFromSymbol @name <> "_Page") + $ MultiTablePage + <$> mtpResults + .= field (textFromSymbol @resultsKey) (array schema) + <*> mtpHasMore + .= field "has_more" schema + <*> mtpPagingState + .= field "paging_state" schema -- | A type to be used as the @tables@ argument of 'GetMultiTablePageRequest' -- when the resources being paginated through are split into local and remote. diff --git a/libs/wire-api/src/Wire/API/Routes/MultiTablePaging/State.hs b/libs/wire-api/src/Wire/API/Routes/MultiTablePaging/State.hs index 1fae94b78b4..e14c63c1332 100644 --- a/libs/wire-api/src/Wire/API/Routes/MultiTablePaging/State.hs +++ b/libs/wire-api/src/Wire/API/Routes/MultiTablePaging/State.hs @@ -45,25 +45,25 @@ data MultiTablePagingState (name :: Symbol) tables = MultiTablePagingState deriving stock (Show, Eq) deriving (ToJSON, FromJSON, S.ToSchema) via Schema (MultiTablePagingState name tables) -encodePagingState :: PagingTable tables => MultiTablePagingState name tables -> ByteString +encodePagingState :: (PagingTable tables) => MultiTablePagingState name tables -> ByteString encodePagingState (MultiTablePagingState table state) = let encodedTable = encodePagingTable table encodedState = fromMaybe "" state in BS.cons encodedTable encodedState -parsePagingState :: PagingTable tables => ByteString -> Either String (MultiTablePagingState name tables) +parsePagingState :: (PagingTable tables) => ByteString -> Either String (MultiTablePagingState name tables) parsePagingState = AB.parseOnly pagingStateParser -pagingStateParser :: PagingTable tables => AB.Parser (MultiTablePagingState name tables) +pagingStateParser :: (PagingTable tables) => AB.Parser (MultiTablePagingState name tables) pagingStateParser = do table <- AB.anyWord8 >>= decodePagingTable state <- (AB.endOfInput $> Nothing) <|> (Just <$> AB.takeByteString <* AB.endOfInput) pure $ MultiTablePagingState table state -instance PagingTable tables => ToHttpApiData (MultiTablePagingState name tables) where +instance (PagingTable tables) => ToHttpApiData (MultiTablePagingState name tables) where toQueryParam = (Text.decodeUtf8 . Base64Url.encode) . encodePagingState -instance PagingTable tables => FromHttpApiData (MultiTablePagingState name tables) where +instance (PagingTable tables) => FromHttpApiData (MultiTablePagingState name tables) where parseQueryParam = mapLeft Text.pack . (parsePagingState <=< (Base64Url.decode . Text.encodeUtf8)) @@ -74,7 +74,7 @@ instance PagingTable tables => FromHttpApiData (MultiTablePagingState name table class PagingTable t where -- Using 'Word8' because 256 tables ought to be enough. encodePagingTable :: t -> Word8 - decodePagingTable :: MonadFail m => Word8 -> m t + decodePagingTable :: (MonadFail m) => Word8 -> m t instance (PagingTable tables, KnownSymbol name) => ToSchema (MultiTablePagingState name tables) where schema = diff --git a/libs/wire-api/src/Wire/API/Routes/MultiVerb.hs b/libs/wire-api/src/Wire/API/Routes/MultiVerb.hs index 7c4e6dcd5ab..933935c9bbc 100644 --- a/libs/wire-api/src/Wire/API/Routes/MultiVerb.hs +++ b/libs/wire-api/src/Wire/API/Routes/MultiVerb.hs @@ -155,7 +155,7 @@ class IsSwaggerResponse a where type family ResponseType a :: Type -class IsWaiBody (ResponseBody a) => IsResponse cs a where +class (IsWaiBody (ResponseBody a)) => IsResponse cs a where type ResponseStatus a :: Nat type ResponseBody a :: Type @@ -177,8 +177,9 @@ instance (AllMimeRender cs a, AllMimeUnrender cs a, KnownStatus s) => IsResponse where mkRenderOutput :: M.MediaType -> LByteString -> (M.MediaType, Response) mkRenderOutput c body = - (c,) . addContentType' c $ - Response + (c,) + . addContentType' c + $ Response { responseStatusCode = statusVal (Proxy @s), responseBody = body, responseHeaders = mempty, @@ -197,10 +198,10 @@ simpleResponseSwagger = do ref <- S.declareSchemaRef (Proxy @a) let resps :: InsOrdHashMap M.MediaType MediaTypeObject resps = InsOrdHashMap.fromList $ (,MediaTypeObject (pure ref) Nothing mempty mempty) <$> cs - pure $ - mempty - & S.description .~ Text.pack (symbolVal (Proxy @desc)) - & S.content .~ resps + pure + $ mempty + & S.description .~ Text.pack (symbolVal (Proxy @desc)) + & S.content .~ resps where cs :: [M.MediaType] cs = allMime $ Proxy @cs @@ -225,8 +226,9 @@ instance type ResponseBody (RespondAs ct s desc a) = LByteString responseRender _ x = - pure . addContentType @ct $ - Response + pure + . addContentType @ct + $ Response { responseStatusCode = statusVal (Proxy @s), responseBody = mimeRender (Proxy @ct) x, responseHeaders = mempty, @@ -235,16 +237,16 @@ instance responseUnrender _ output = do guard (responseStatusCode output == statusVal (Proxy @s)) - either UnrenderError UnrenderSuccess $ - mimeUnrender (Proxy @ct) (responseBody output) + either UnrenderError UnrenderSuccess + $ mimeUnrender (Proxy @ct) (responseBody output) -instance KnownStatus s => IsResponse cs (RespondAs '() s desc ()) where +instance (KnownStatus s) => IsResponse cs (RespondAs '() s desc ()) where type ResponseStatus (RespondAs '() s desc ()) = s type ResponseBody (RespondAs '() s desc ()) = () responseRender _ _ = - pure $ - Response + pure + $ Response { responseStatusCode = statusVal (Proxy @s), responseBody = (), responseHeaders = mempty, @@ -265,9 +267,9 @@ instance IsSwaggerResponse (RespondEmpty s desc) where responseSwagger = - pure $ - mempty - & S.description .~ Text.pack (symbolVal (Proxy @desc)) + pure + $ mempty + & S.description .~ Text.pack (symbolVal (Proxy @desc)) type instance ResponseType (RespondStreaming s desc framing ct) = SourceIO ByteString @@ -278,8 +280,9 @@ instance type ResponseStatus (RespondStreaming s desc framing ct) = s type ResponseBody (RespondStreaming s desc framing ct) = SourceIO ByteString responseRender _ x = - pure . addContentType @ct $ - Response + pure + . addContentType @ct + $ Response { responseStatusCode = statusVal (Proxy @s), responseBody = x, responseHeaders = mempty, @@ -290,11 +293,11 @@ instance guard (responseStatusCode resp == statusVal (Proxy @s)) pure $ responseBody resp -instance KnownSymbol desc => IsSwaggerResponse (RespondStreaming s desc framing ct) where +instance (KnownSymbol desc) => IsSwaggerResponse (RespondStreaming s desc framing ct) where responseSwagger = - pure $ - mempty - & S.description .~ Text.pack (symbolVal (Proxy @desc)) + pure + $ mempty + & S.description .~ Text.pack (symbolVal (Proxy @desc)) -- | This type adds response headers to a 'MultiVerb' response. -- @@ -333,7 +336,7 @@ instance ServantHeaders '[] '[] where constructHeaders Nil = [] extractHeaders _ = Just Nil -headerName :: forall name. KnownSymbol name => HTTP.HeaderName +headerName :: forall name. (KnownSymbol name) => HTTP.HeaderName headerName = CI.mk . Text.encodeUtf8 @@ -378,7 +381,7 @@ instance where constructHeader x = [(headerName @name, toHeader x)] -instance ServantHeader h name x => ServantHeader (OptHeader h) name (Maybe x) where +instance (ServantHeader h name x) => ServantHeader (OptHeader h) name (Maybe x) where constructHeader = foldMap (constructHeader @h) instance @@ -391,7 +394,7 @@ instance desc = Text.pack (symbolVal (Proxy @desc)) sch = pure $ Inline $ S.toParamSchema (Proxy @a) -instance ToResponseHeader h => ToResponseHeader (OptHeader h) where +instance (ToResponseHeader h) => ToResponseHeader (OptHeader h) where toResponseHeader _ = toResponseHeader (Proxy @h) type instance ResponseType (WithHeaders hs a r) = a @@ -535,7 +538,7 @@ class AsUnion (as :: [Type]) (r :: Type) where -- | Unions can be used directly as handler return types using this trivial -- instance. -instance rs ~ ResponseTypes as => AsUnion as (Union rs) where +instance (rs ~ ResponseTypes as) => AsUnion as (Union rs) where toUnion = id fromUnion = id @@ -553,7 +556,7 @@ class InjectAfter as bs where instance InjectAfter '[] bs where injectAfter = id -instance InjectAfter as bs => InjectAfter (a ': as) bs where +instance (InjectAfter as bs) => InjectAfter (a ': as) bs where injectAfter = S . injectAfter @as @bs class InjectBefore as bs where @@ -562,7 +565,7 @@ class InjectBefore as bs where instance InjectBefore '[] bs where injectBefore x = case x of {} -instance InjectBefore as bs => InjectBefore (a ': as) bs where +instance (InjectBefore as bs) => InjectBefore (a ': as) bs where injectBefore (Z x) = Z x injectBefore (S x) = S (injectBefore @as @bs x) @@ -584,7 +587,7 @@ class EitherFromUnion as bs where instance EitherFromUnion '[] bs where eitherFromUnion _ g = Right . g -instance EitherFromUnion as bs => EitherFromUnion (a ': as) bs where +instance (EitherFromUnion as bs) => EitherFromUnion (a ': as) bs where eitherFromUnion f _ (Z x) = Left (f (Z x)) eitherFromUnion f g (S x) = eitherFromUnion @as @bs (f . S) g x @@ -598,7 +601,7 @@ maybeToUnion _ Nothing = injectAfter @as @'[()] (Z (I ())) maybeFromUnion :: forall as a. - EitherFromUnion as '[()] => + (EitherFromUnion as '[()]) => (Union as -> a) -> (Union (as .++ '[()]) -> Maybe a) maybeFromUnion f = leftToMaybe . eitherFromUnion @as @'[()] f (const (Z (I ()))) @@ -767,11 +770,11 @@ instance -- pick out an element from the map, if any exist. -- These will all have the same schemas, and we are reapplying the content types. foldMap (\c -> InsOrdHashMap.fromList $ (,c) <$> cs) - . listToMaybe - . toList + . listToMaybe + . toList refResps = S.Inline . addMime <$> resps -class Typeable a => IsWaiBody a where +class (Typeable a) => IsWaiBody a where responseToWai :: ResponseF a -> Wai.Response instance IsWaiBody LByteString where @@ -799,9 +802,9 @@ instance IsWaiBody (SourceIO ByteString) where (\chunk -> output (byteString chunk) *> flush) (responseBody r) -data SomeResponse = forall a. IsWaiBody a => SomeResponse (ResponseF a) +data SomeResponse = forall a. (IsWaiBody a) => SomeResponse (ResponseF a) -addContentType :: forall ct a. Accept ct => ResponseF a -> ResponseF a +addContentType :: forall ct a. (Accept ct) => ResponseF a -> ResponseF a addContentType = addContentType' (contentType (Proxy @ct)) addContentType' :: M.MediaType -> ResponseF a -> ResponseF a @@ -819,8 +822,8 @@ someResponseToWai (SomeResponse r) = responseToWai r fromSomeResponse :: (Alternative m, Typeable a) => SomeResponse -> m (ResponseF a) fromSomeResponse (SomeResponse Response {..}) = do body <- maybe empty pure $ cast responseBody - pure $ - Response + pure + $ Response { responseBody = body, .. } @@ -828,7 +831,7 @@ fromSomeResponse (SomeResponse Response {..}) = do class HasAcceptCheck cs where acceptCheck' :: Proxy cs -> AcceptHeader -> DelayedIO () -instance AllMime cs => HasAcceptCheck cs where +instance (AllMime cs) => HasAcceptCheck cs where acceptCheck' = acceptCheck instance HasAcceptCheck '() where @@ -869,7 +872,7 @@ instance method = reflectMethod (Proxy @method) -- taken from Servant.Client.Core.HasClient -getResponseContentType :: RunClient m => Response -> m M.MediaType +getResponseContentType :: (RunClient m) => Response -> m M.MediaType getResponseContentType response = case lookup "Content-Type" (toList (responseHeaders response)) of Nothing -> pure $ "application" M.// "octet-stream" diff --git a/libs/wire-api/src/Wire/API/Routes/Named.hs b/libs/wire-api/src/Wire/API/Routes/Named.hs index 71e0ec307cb..286017ec568 100644 --- a/libs/wire-api/src/Wire/API/Routes/Named.hs +++ b/libs/wire-api/src/Wire/API/Routes/Named.hs @@ -42,7 +42,7 @@ newtype Named name x = Named {unnamed :: x} class RenderableSymbol a where renderSymbol :: Text -instance {-# OVERLAPPABLE #-} KnownSymbol a => RenderableSymbol a where +instance {-# OVERLAPPABLE #-} (KnownSymbol a) => RenderableSymbol a where renderSymbol = T.pack . show $ symbolVal (Proxy @a) instance {-# OVERLAPPING #-} (RenderableSymbol a, RenderableSymbol b) => RenderableSymbol '(a, b) where @@ -51,7 +51,9 @@ instance {-# OVERLAPPING #-} (RenderableSymbol a, RenderableSymbol b) => Rendera instance (HasOpenApi api, RenderableSymbol name) => HasOpenApi (Named name api) where toOpenApi _ = toOpenApi (Proxy @api) - & allOperations . description %~ (Just (dscr <> "\n\n") <>) + & allOperations + . description + %~ (Just (dscr <> "\n\n") <>) where dscr :: Text dscr = @@ -59,21 +61,21 @@ instance (HasOpenApi api, RenderableSymbol name) => HasOpenApi (Named name api) <> renderSymbol @name <> "]" -instance HasServer api ctx => HasServer (Named name api) ctx where +instance (HasServer api ctx) => HasServer (Named name api) ctx where type ServerT (Named name api) m = Named name (ServerT api m) route _ ctx action = route (Proxy @api) ctx (fmap unnamed action) hoistServerWithContext _ ctx f = fmap (hoistServerWithContext (Proxy @api) ctx f) -instance HasLink endpoint => HasLink (Named name endpoint) where +instance (HasLink endpoint) => HasLink (Named name endpoint) where type MkLink (Named name endpoint) a = MkLink endpoint a toLink toA _ = toLink toA (Proxy @endpoint) -instance RoutesToPaths api => RoutesToPaths (Named name api) where +instance (RoutesToPaths api) => RoutesToPaths (Named name api) where getRoutes = getRoutes @api -instance HasClient m api => HasClient m (Named n api) where +instance (HasClient m api) => HasClient m (Named n api) where type Client m (Named n api) = Client m api clientWithRoute pm _ req = clientWithRoute pm (Proxy @api) req hoistClientMonad pm _ f = hoistClientMonad pm (Proxy @api) f diff --git a/libs/wire-api/src/Wire/API/Routes/Public.hs b/libs/wire-api/src/Wire/API/Routes/Public.hs index 73b6de1b3f6..56ed85b1ea6 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public.hs @@ -115,7 +115,7 @@ class instance HasTokenType 'ZLocalAuthUser -instance HasContextEntry ctx Domain => IsZType 'ZLocalAuthUser ctx where +instance (HasContextEntry ctx Domain) => IsZType 'ZLocalAuthUser ctx where type ZHeader 'ZLocalAuthUser = "Z-User" type ZParam 'ZLocalAuthUser = UserId type ZQualifiedParam 'ZLocalAuthUser = Local UserId @@ -228,7 +228,7 @@ type ZHostValue = Text type ZOptHostHeader = Header' '[Servant.Optional, Strict] "Z-Host" ZHostValue -instance HasOpenApi api => HasOpenApi (ZHostOpt :> api) where +instance (HasOpenApi api) => HasOpenApi (ZHostOpt :> api) where toOpenApi _ = toOpenApi (Proxy @api) type instance SpecialiseToVersion v (ZHostOpt :> api) = ZHostOpt :> SpecialiseToVersion v api @@ -236,8 +236,11 @@ type instance SpecialiseToVersion v (ZHostOpt :> api) = ZHostOpt :> SpecialiseTo addZAuthSwagger :: OpenApi -> OpenApi addZAuthSwagger s = s - & S.components . S.securitySchemes <>~ SecurityDefinitions (InsOrdHashMap.singleton "ZAuth" secScheme) - & security <>~ [SecurityRequirement $ InsOrdHashMap.singleton "ZAuth" []] + & S.components + . S.securitySchemes + <>~ SecurityDefinitions (InsOrdHashMap.singleton "ZAuth" secScheme) + & security + <>~ [SecurityRequirement $ InsOrdHashMap.singleton "ZAuth" []] where secScheme = SecurityScheme @@ -249,19 +252,19 @@ type instance SpecialiseToVersion v (ZAuthServant t opts :> api) = ZAuthServant t opts :> SpecialiseToVersion v api -instance HasOpenApi api => HasOpenApi (ZAuthServant 'ZAuthUser _opts :> api) where +instance (HasOpenApi api) => HasOpenApi (ZAuthServant 'ZAuthUser _opts :> api) where toOpenApi _ = addZAuthSwagger (toOpenApi (Proxy @api)) -instance HasOpenApi api => HasOpenApi (ZAuthServant 'ZLocalAuthUser opts :> api) where +instance (HasOpenApi api) => HasOpenApi (ZAuthServant 'ZLocalAuthUser opts :> api) where toOpenApi _ = addZAuthSwagger (toOpenApi (Proxy @api)) -instance HasLink endpoint => HasLink (ZAuthServant usr opts :> endpoint) where +instance (HasLink endpoint) => HasLink (ZAuthServant usr opts :> endpoint) where type MkLink (ZAuthServant _ _ :> endpoint) a = MkLink endpoint a toLink toA _ = toLink toA (Proxy @endpoint) instance {-# OVERLAPPABLE #-} - HasOpenApi api => + (HasOpenApi api) => HasOpenApi (ZAuthServant ztype _opts :> api) where toOpenApi _ = toOpenApi (Proxy @api) @@ -319,10 +322,10 @@ instance hoistServerWithContext _ pc nt s = hoistServerWithContext (Proxy :: Proxy api) pc nt . s -instance RoutesToPaths api => RoutesToPaths (ZAuthServant ztype opts :> api) where +instance (RoutesToPaths api) => RoutesToPaths (ZAuthServant ztype opts :> api) where getRoutes = getRoutes @api -instance RoutesToPaths api => RoutesToPaths (ZHostOpt :> api) where +instance (RoutesToPaths api) => RoutesToPaths (ZHostOpt :> api) where getRoutes = getRoutes @api -- FUTUREWORK: Make a PR to the servant-swagger package with this instance @@ -341,19 +344,21 @@ instance where toOpenApi _ = addScopeDescription @scope (toOpenApi (Proxy @api)) -addScopeDescription :: forall scope. OAuth.IsOAuthScope scope => OpenApi -> OpenApi +addScopeDescription :: forall scope. (OAuth.IsOAuthScope scope) => OpenApi -> OpenApi addScopeDescription = allOperations . description %~ Just - . ( <> - "\nOAuth scope: `" - <> ( decodeUtf8With lenientDecode . toStrict . toByteString $ - OAuth.toOAuthScope @scope - ) - <> "`" - ) - . fold + . ( <> + "\nOAuth scope: `" + <> ( decodeUtf8With lenientDecode + . toStrict + . toByteString + $ OAuth.toOAuthScope @scope + ) + <> "`" + ) + . fold instance (HasServer api ctx) => HasServer (DescriptionOAuthScope scope :> api) ctx where type ServerT (DescriptionOAuthScope scope :> api) m = ServerT api m @@ -361,5 +366,5 @@ instance (HasServer api ctx) => HasServer (DescriptionOAuthScope scope :> api) c route _ = route (Proxy @api) hoistServerWithContext _ = hoistServerWithContext (Proxy @api) -instance RoutesToPaths api => RoutesToPaths (DescriptionOAuthScope scope :> api) where +instance (RoutesToPaths api) => RoutesToPaths (DescriptionOAuthScope scope :> api) where getRoutes = getRoutes @api diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Brig.hs b/libs/wire-api/src/Wire/API/Routes/Public/Brig.hs index b90650fe891..f1fc474b7fa 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Brig.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Brig.hs @@ -623,10 +623,10 @@ instance ToSchema DeprecatedMatchingResult where "DeprecatedMatchingResult" (S.deprecated ?~ True) $ DeprecatedMatchingResult - <$ const [] - .= field "results" (array (null_ @SwaggerDoc)) + <$ const [] + .= field "results" (array (null_ @SwaggerDoc)) <* const [] - .= field "auto-connects" (array (null_ @SwaggerDoc)) + .= field "auto-connects" (array (null_ @SwaggerDoc)) data ActivationRespWithStatus = ActivationResp ActivationResponse diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Cargohold.hs b/libs/wire-api/src/Wire/API/Routes/Public/Cargohold.hs index a1dc8001504..d9c7ca0ed3e 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Cargohold.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Cargohold.hs @@ -59,12 +59,12 @@ type instance SpecialiseToVersion v ((tag :: PrincipalTag) :> api) = SpecialiseToVersion v (ApplyPrincipalPath tag api) -instance HasServer (ApplyPrincipalPath tag api) ctx => HasServer (tag :> api) ctx where +instance (HasServer (ApplyPrincipalPath tag api) ctx) => HasServer (tag :> api) ctx where type ServerT (tag :> api) m = ServerT (ApplyPrincipalPath tag api) m route _ = route (Proxy @(ApplyPrincipalPath tag api)) hoistServerWithContext _ = hoistServerWithContext (Proxy @(ApplyPrincipalPath tag api)) -instance RoutesToPaths (ApplyPrincipalPath tag api) => RoutesToPaths (tag :> api) where +instance (RoutesToPaths (ApplyPrincipalPath tag api)) => RoutesToPaths (tag :> api) where getRoutes = getRoutes @(ApplyPrincipalPath tag api) type AssetLocationHeader r = diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Galley/Messaging.hs b/libs/wire-api/src/Wire/API/Routes/Public/Galley/Messaging.hs index e079e33110d..d4b81661b79 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Galley/Messaging.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Galley/Messaging.hs @@ -131,7 +131,7 @@ data MessageNotSent a via (GenericAsUnion (MessageNotSentResponses a) (MessageNotSent a)) deriving anyclass (GSOP.Generic) -instance S.ToSchema a => S.ToSchema (MessageNotSent a) +instance (S.ToSchema a) => S.ToSchema (MessageNotSent a) type MessageNotSentResponses a = '[ ErrorResponse 'ConvNotFound, diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Spar.hs b/libs/wire-api/src/Wire/API/Routes/Public/Spar.hs index 107ed1de9a5..e1f92b07998 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Spar.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Spar.hs @@ -167,8 +167,8 @@ data ScimSite tag route = ScimSite users :: route :- Header "Authorization" (Scim.Auth.AuthData tag) - :> "Users" - :> ToServantApi (Scim.User.UserSite tag) + :> "Users" + :> ToServantApi (Scim.User.UserSite tag) } deriving (Generic) diff --git a/libs/wire-api/src/Wire/API/Routes/Version/Wai.hs b/libs/wire-api/src/Wire/API/Routes/Version/Wai.hs index cd797101f11..9d7f7cfd5f8 100644 --- a/libs/wire-api/src/Wire/API/Routes/Version/Wai.hs +++ b/libs/wire-api/src/Wire/API/Routes/Version/Wai.hs @@ -44,13 +44,19 @@ versionMiddleware disabledAPIVersions app req k = case parseVersion (removeVersi where err :: Text -> IO ResponseReceived err v = - k . errorRs' . mkError HTTP.status404 "unsupported-version" $ - "Version " <> fromStrict v <> " is not supported" + k + . errorRs' + . mkError HTTP.status404 "unsupported-version" + $ "Version " + <> fromStrict v + <> " is not supported" errint :: IO ResponseReceived errint = - k . errorRs' . mkError HTTP.status404 "unsupported-version" $ - "Internal APIs (`/i/...`) are not under version control" + k + . errorRs' + . mkError HTTP.status404 "unsupported-version" + $ "Internal APIs (`/i/...`) are not under version control" data ParseVersionError = NoVersion | BadVersion Text | InternalApisAreUnversioned @@ -59,8 +65,8 @@ parseVersion req = do (version, pinfo) <- case pathInfo req of [] -> throwError NoVersion (x : xs) -> do - unless (looksLikeVersion x) $ - throwError NoVersion + unless (looksLikeVersion x) + $ throwError NoVersion case xs of ("i" : _) -> throwError InternalApisAreUnversioned ("api-internal" : _) -> throwError InternalApisAreUnversioned diff --git a/libs/wire-api/src/Wire/API/Routes/Versioned.hs b/libs/wire-api/src/Wire/API/Routes/Versioned.hs index 7707e3441e6..405ec783e00 100644 --- a/libs/wire-api/src/Wire/API/Routes/Versioned.hs +++ b/libs/wire-api/src/Wire/API/Routes/Versioned.hs @@ -39,7 +39,7 @@ data VersionedReqBody' v (mods :: [Type]) (ct :: [Type]) (a :: Type) type VersionedReqBody v = VersionedReqBody' v '[Required, Strict] -instance RoutesToPaths rest => RoutesToPaths (VersionedReqBody' v mods ct a :> rest) where +instance (RoutesToPaths rest) => RoutesToPaths (VersionedReqBody' v mods ct a :> rest) where getRoutes = getRoutes @rest instance @@ -78,7 +78,7 @@ data VersionedRespond v (s :: Nat) (desc :: Symbol) (a :: Type) type instance ResponseType (VersionedRespond v s desc a) = a instance - IsResponse cs (Respond s desc (Versioned v a)) => + (IsResponse cs (Respond s desc (Versioned v a))) => IsResponse cs (VersionedRespond v s desc a) where type ResponseStatus (VersionedRespond v s desc a) = ResponseStatus (Respond s desc a) @@ -106,9 +106,9 @@ newtype Versioned (v :: Version) a = Versioned {unVersioned :: a} instance Functor (Versioned v) where fmap f (Versioned a) = Versioned (f a) -deriving via Schema (Versioned v a) instance ToSchema (Versioned v a) => FromJSON (Versioned v a) +deriving via Schema (Versioned v a) instance (ToSchema (Versioned v a)) => FromJSON (Versioned v a) -deriving via Schema (Versioned v a) instance ToSchema (Versioned v a) => ToJSON (Versioned v a) +deriving via Schema (Versioned v a) instance (ToSchema (Versioned v a)) => ToJSON (Versioned v a) -- add version suffix to swagger schema to prevent collisions instance (SingI v, ToSchema (Versioned v a), Typeable a, Typeable v) => S.ToSchema (Versioned v a) where diff --git a/libs/wire-api/src/Wire/API/Routes/WebSocket.hs b/libs/wire-api/src/Wire/API/Routes/WebSocket.hs index 0405b58d094..420b4799228 100644 --- a/libs/wire-api/src/Wire/API/Routes/WebSocket.hs +++ b/libs/wire-api/src/Wire/API/Routes/WebSocket.hs @@ -43,8 +43,10 @@ instance HasServer WebSocketPending ctx where hoistServerWithContext _ _ nat svr = nat . svr route Proxy _ app = leafRouter $ \env request respond -> - runResourceT $ - runDelayed app env request >>= liftIO . go request respond + runResourceT + $ runDelayed app env request + >>= liftIO + . go request respond where go request respond (Route app') = websocketsOr defaultConnectionOptions (runApp app') (backupApp respond) request (respond . Route) @@ -54,8 +56,8 @@ instance HasServer WebSocketPending ctx where runApp a c = void (runHandler $ a c) backupApp respond _ _ = - respond $ - FailFatal + respond + $ FailFatal ServerError { errHTTPCode = 426, errReasonPhrase = "Upgrade Required", diff --git a/libs/wire-api/src/Wire/API/ServantProto.hs b/libs/wire-api/src/Wire/API/ServantProto.hs index 6e2dbd6140b..aba4621c91f 100644 --- a/libs/wire-api/src/Wire/API/ServantProto.hs +++ b/libs/wire-api/src/Wire/API/ServantProto.hs @@ -43,7 +43,7 @@ class ToProto a where instance Accept Proto where contentTypes _ = ("application" // "x-protobuf") :| [] -instance FromProto a => MimeUnrender Proto a where +instance (FromProto a) => MimeUnrender Proto a where mimeUnrender _ bs = fromProto (LBS.toStrict bs) -- | This wrapper can be used to get the raw protobuf representation of a type. @@ -54,8 +54,8 @@ data RawProto a = RawProto rpValue :: a } -instance FromProto a => FromProto (RawProto a) where +instance (FromProto a) => FromProto (RawProto a) where fromProto x = fmap (RawProto x) (fromProto x) -instance ToSchema a => ToSchema (RawProto a) where +instance (ToSchema a) => ToSchema (RawProto a) where declareNamedSchema _ = declareNamedSchema (Proxy @a) diff --git a/libs/wire-api/src/Wire/API/SwaggerHelper.hs b/libs/wire-api/src/Wire/API/SwaggerHelper.hs index fa4310dea83..0a8019673b7 100644 --- a/libs/wire-api/src/Wire/API/SwaggerHelper.hs +++ b/libs/wire-api/src/Wire/API/SwaggerHelper.hs @@ -67,16 +67,16 @@ cleanupSwagger = if "Invalid " `T.isPrefixOf` desc && resp - ^? _Inline - . links + ^? _Inline + . links == pure mempty - && resp - ^? _Inline - . content + && resp + ^? _Inline + . content == pure mempty - && resp - ^? _Inline - . headers + && resp + ^? _Inline + . headers == pure mempty then resps else insert code resp resps @@ -86,16 +86,16 @@ cleanupSwagger = if " not found" `T.isSuffixOf` desc && resp - ^? _Inline - . links + ^? _Inline + . links == pure mempty - && resp - ^? _Inline - . content + && resp + ^? _Inline + . content == pure mempty - && resp - ^? _Inline - . headers + && resp + ^? _Inline + . headers == pure mempty then resps else insert code resp resps diff --git a/libs/wire-api/src/Wire/API/SwaggerServant.hs b/libs/wire-api/src/Wire/API/SwaggerServant.hs index 5c3918cf39c..8ea0729a504 100644 --- a/libs/wire-api/src/Wire/API/SwaggerServant.hs +++ b/libs/wire-api/src/Wire/API/SwaggerServant.hs @@ -37,12 +37,12 @@ data OmitDocs instance HasOpenApi (OmitDocs :> a) where toOpenApi _ = mempty -instance HasServer api ctx => HasServer (OmitDocs :> api) ctx where +instance (HasServer api ctx) => HasServer (OmitDocs :> api) ctx where type ServerT (OmitDocs :> api) m = ServerT api m route _ = route (Proxy :: Proxy api) hoistServerWithContext _ pc nt s = hoistServerWithContext (Proxy :: Proxy api) pc nt s -instance RoutesToPaths api => RoutesToPaths (OmitDocs :> api) where +instance (RoutesToPaths api) => RoutesToPaths (OmitDocs :> api) where getRoutes = getRoutes @api diff --git a/libs/wire-api/src/Wire/API/SystemSettings.hs b/libs/wire-api/src/Wire/API/SystemSettings.hs index d07d7152a44..0e1b3d84b27 100644 --- a/libs/wire-api/src/Wire/API/SystemSettings.hs +++ b/libs/wire-api/src/Wire/API/SystemSettings.hs @@ -44,7 +44,8 @@ instance ToSchema SystemSettingsPublic where settingsPublicObjectSchema :: ObjectSchema SwaggerDoc SystemSettingsPublic settingsPublicObjectSchema = SystemSettingsPublic - <$> sspSetRestrictUserCreation .= fieldWithDocModifier "setRestrictUserCreation" (description ?~ "Do not allow certain user creation flows") schema + <$> sspSetRestrictUserCreation + .= fieldWithDocModifier "setRestrictUserCreation" (description ?~ "Do not allow certain user creation flows") schema data SystemSettingsInternal = SystemSettingsInternal { ssiSetEnableMls :: !Bool @@ -60,7 +61,8 @@ instance ToSchema SystemSettingsInternal where settingsInternalObjectSchema :: ObjectSchema SwaggerDoc SystemSettingsInternal settingsInternalObjectSchema = SystemSettingsInternal - <$> ssiSetEnableMls .= fieldWithDocModifier "setEnableMls" (description ?~ "Whether MLS is enabled or not") schema + <$> ssiSetEnableMls + .= fieldWithDocModifier "setEnableMls" (description ?~ "Whether MLS is enabled or not") schema data SystemSettings = SystemSettings { ssPublic :: !SystemSettingsPublic, @@ -72,7 +74,9 @@ data SystemSettings = SystemSettings instance ToSchema SystemSettings where schema = - object "SystemSettings" $ - SystemSettings - <$> ssPublic .= settingsPublicObjectSchema - <*> ssInternal .= settingsInternalObjectSchema + object "SystemSettings" + $ SystemSettings + <$> ssPublic + .= settingsPublicObjectSchema + <*> ssInternal + .= settingsInternalObjectSchema diff --git a/libs/wire-api/src/Wire/API/Team.hs b/libs/wire-api/src/Wire/API/Team.hs index 13c09ab567b..b03725c400f 100644 --- a/libs/wire-api/src/Wire/API/Team.hs +++ b/libs/wire-api/src/Wire/API/Team.hs @@ -108,21 +108,30 @@ newTeam tid uid nme ico tb = Team tid uid nme ico Nothing tb DefaultIcon instance ToSchema Team where schema = - objectWithDocModifier "Team" desc $ - Team - <$> _teamId .= field "id" schema - <*> _teamCreator .= field "creator" schema - <*> _teamName .= field "name" schema - <*> _teamIcon .= field "icon" schema - <*> _teamIconKey .= maybe_ (optField "icon_key" schema) - <*> _teamBinding .= (fromMaybe Binding <$> optFieldWithDocModifier "binding" bindingDesc schema) - <*> _teamSplashScreen .= (fromMaybe DefaultIcon <$> optField "splash_screen" schema) + objectWithDocModifier "Team" desc + $ Team + <$> _teamId + .= field "id" schema + <*> _teamCreator + .= field "creator" schema + <*> _teamName + .= field "name" schema + <*> _teamIcon + .= field "icon" schema + <*> _teamIconKey + .= maybe_ (optField "icon_key" schema) + <*> _teamBinding + .= (fromMaybe Binding <$> optFieldWithDocModifier "binding" bindingDesc schema) + <*> _teamSplashScreen + .= (fromMaybe DefaultIcon <$> optField "splash_screen" schema) where desc = description ?~ "`binding` is deprecated, and should be ignored. The non-binding teams API is not used (and will not be supported from API version V4 onwards), and `binding` will always be `true`." bindingDesc v = v - & description ?~ "Deprecated, please ignore." - & deprecated ?~ True + & description + ?~ "Deprecated, please ignore." + & deprecated + ?~ True -- | How a team "binds" its members (users) -- @@ -149,9 +158,9 @@ data TeamBinding instance ToSchema TeamBinding where schema = - over doc (deprecated ?~ True) $ - enum @Bool "TeamBinding" $ - mconcat [element True Binding, element False NonBinding] + over doc (deprecated ?~ True) + $ enum @Bool "TeamBinding" + $ mconcat [element True Binding, element False NonBinding] -------------------------------------------------------------------------------- -- TeamList @@ -169,10 +178,12 @@ newTeamList = TeamList instance ToSchema TeamList where schema = - object "TeamList" $ - TeamList - <$> _teamListTeams .= field "teams" (array schema) - <*> _teamListHasMore .= field "has_more" schema + object "TeamList" + $ TeamList + <$> _teamListTeams + .= field "teams" (array schema) + <*> _teamListHasMore + .= field "has_more" schema -------------------------------------------------------------------------------- -- NewTeam @@ -205,9 +216,10 @@ newtype NonBindingNewTeam = NonBindingNewTeam (NewTeam (Range 1 127 [TeamMember] instance ToSchema NonBindingNewTeam where schema = - object "NonBindingNewTeam" $ - NonBindingNewTeam - <$> unwrap .= newTeamObjectSchema sch + object "NonBindingNewTeam" + $ NonBindingNewTeam + <$> unwrap + .= newTeamObjectSchema sch where unwrap (NonBindingNewTeam nt) = nt @@ -229,10 +241,14 @@ newNewTeam nme ico = NewTeam nme ico Nothing Nothing newTeamObjectSchema :: ValueSchema SwaggerDoc a -> ObjectSchema SwaggerDoc (NewTeam a) newTeamObjectSchema sch = NewTeam - <$> _newTeamName .= fieldWithDocModifier "name" (description ?~ "team name") schema - <*> _newTeamIcon .= fieldWithDocModifier "icon" (description ?~ "team icon (asset ID)") schema - <*> _newTeamIconKey .= maybe_ (optFieldWithDocModifier "icon_key" (description ?~ "team icon asset key") schema) - <*> _newTeamMembers .= maybe_ (optFieldWithDocModifier "members" (description ?~ "initial team member ids (between 1 and 127)") sch) + <$> _newTeamName + .= fieldWithDocModifier "name" (description ?~ "team name") schema + <*> _newTeamIcon + .= fieldWithDocModifier "icon" (description ?~ "team icon (asset ID)") schema + <*> _newTeamIconKey + .= maybe_ (optFieldWithDocModifier "icon_key" (description ?~ "team icon asset key") schema) + <*> _newTeamMembers + .= maybe_ (optFieldWithDocModifier "members" (description ?~ "initial team member ids (between 1 and 127)") sch) -------------------------------------------------------------------------------- -- TeamUpdateData @@ -289,10 +305,14 @@ instance ToSchema TeamUpdateData where (`withParser` validateTeamUpdateData) . object "TeamUpdateData" $ TeamUpdateData - <$> _nameUpdate .= maybe_ (optField "name" schema) - <*> _iconUpdate .= maybe_ (optField "icon" schema) - <*> _iconKeyUpdate .= maybe_ (optField "icon_key" schema) - <*> _splashScreenUpdate .= maybe_ (optField "splash_screen" schema) + <$> _nameUpdate + .= maybe_ (optField "name" schema) + <*> _iconUpdate + .= maybe_ (optField "icon" schema) + <*> _iconKeyUpdate + .= maybe_ (optField "icon_key" schema) + <*> _splashScreenUpdate + .= maybe_ (optField "splash_screen" schema) -------------------------------------------------------------------------------- -- TeamDeleteData @@ -315,10 +335,12 @@ newTeamDeleteDataWithCode = TeamDeleteData instance ToSchema TeamDeleteData where schema = - object "TeamDeleteData" $ - TeamDeleteData - <$> _tdAuthPassword .= optField "password" (maybeWithDefault Null schema) - <*> _tdVerificationCode .= maybe_ (optField "verification_code" schema) + object "TeamDeleteData" + $ TeamDeleteData + <$> _tdAuthPassword + .= optField "password" (maybeWithDefault Null schema) + <*> _tdVerificationCode + .= maybe_ (optField "verification_code" schema) makeLenses ''Team makeLenses ''TeamList diff --git a/libs/wire-api/src/Wire/API/Team/Conversation.hs b/libs/wire-api/src/Wire/API/Team/Conversation.hs index 3822a614923..211c2e38861 100644 --- a/libs/wire-api/src/Wire/API/Team/Conversation.hs +++ b/libs/wire-api/src/Wire/API/Team/Conversation.hs @@ -61,14 +61,15 @@ instance ToSchema TeamConversation where "TeamConversation" (description ?~ "Team conversation data") $ TeamConversation - <$> _conversationId .= field "conversation" schema + <$> _conversationId + .= field "conversation" schema <* const () - .= fieldWithDocModifier - "managed" - (description ?~ managedDesc) - (c (False :: Bool)) + .= fieldWithDocModifier + "managed" + (description ?~ managedDesc) + (c (False :: Bool)) where - c :: A.ToJSON a => a -> ValueSchema SwaggerDoc () + c :: (A.ToJSON a) => a -> ValueSchema SwaggerDoc () c val = mkSchema mempty (const (pure ())) (const (pure (A.toJSON val))) newTeamConversation :: ConvId -> TeamConversation @@ -91,7 +92,8 @@ instance ToSchema TeamConversationList where "TeamConversationList" (description ?~ "Team conversation list") $ TeamConversationList - <$> _teamConversations .= field "conversations" (array schema) + <$> _teamConversations + .= field "conversations" (array schema) newTeamConversationList :: [TeamConversation] -> TeamConversationList newTeamConversationList = TeamConversationList diff --git a/libs/wire-api/src/Wire/API/Team/Export.hs b/libs/wire-api/src/Wire/API/Team/Export.hs index 1f1d4b1462a..3760b591ded 100644 --- a/libs/wire-api/src/Wire/API/Team/Export.hs +++ b/libs/wire-api/src/Wire/API/Team/Export.hs @@ -72,13 +72,13 @@ instance ToNamedRecord TeamExportUser where ("num_devices", secureCsvFieldToByteString (tExportNumDevices row)) ] -secureCsvFieldToByteString :: forall a. ToByteString a => a -> ByteString +secureCsvFieldToByteString :: forall a. (ToByteString a) => a -> ByteString secureCsvFieldToByteString = quoted . toByteString' instance DefaultOrdered TeamExportUser where headerOrder = - const $ - fromList + const + $ fromList [ "display_name", "handle", "email", @@ -98,7 +98,7 @@ allowEmpty :: (ByteString -> Parser a) -> ByteString -> Parser (Maybe a) allowEmpty _ "" = pure Nothing allowEmpty p str = Just <$> p str -parseByteString :: forall a. FromByteString a => ByteString -> Parser a +parseByteString :: forall a. (FromByteString a) => ByteString -> Parser a parseByteString bstr = case parseOnly (parser @a) (C.fromStrict (unquoted bstr)) of Left err -> fail err @@ -117,7 +117,8 @@ instance FromNamedRecord TeamExportUser where <*> (nrec .: "managed_by" >>= parseByteString) <*> (nrec .: "saml_name_id" >>= parseByteString) <*> (nrec .: "scim_external_id" >>= parseByteString) - <*> ( nrec .: "scim_rich_info" + <*> ( nrec + .: "scim_rich_info" >>= allowEmpty ( maybe (fail "failed to decode RichInfo") pure . Aeson.decode diff --git a/libs/wire-api/src/Wire/API/Team/Feature.hs b/libs/wire-api/src/Wire/API/Team/Feature.hs index 2376634db08..96fdaa355b0 100644 --- a/libs/wire-api/src/Wire/API/Team/Feature.hs +++ b/libs/wire-api/src/Wire/API/Team/Feature.hs @@ -223,10 +223,10 @@ class FeatureTrivialConfig cfg where class HasDeprecatedFeatureName cfg where type DeprecatedFeatureName cfg :: Symbol -featureName :: forall cfg. KnownSymbol (FeatureSymbol cfg) => Text +featureName :: forall cfg. (KnownSymbol (FeatureSymbol cfg)) => Text featureName = T.pack $ symbolVal (Proxy @(FeatureSymbol cfg)) -featureNameBS :: forall cfg. KnownSymbol (FeatureSymbol cfg) => ByteString +featureNameBS :: forall cfg. (KnownSymbol (FeatureSymbol cfg)) => ByteString featureNameBS = UTF8.fromString $ symbolVal (Proxy @(FeatureSymbol cfg)) ---------------------------------------------------------------------- @@ -268,10 +268,10 @@ setLockStatus ls (WithStatusBase s _ c ttl) = WithStatusBase s (Identity ls) c t setConfig :: cfg -> WithStatus cfg -> WithStatus cfg setConfig = setConfig' -setConfig' :: forall (m :: Type -> Type) (cfg :: Type). Applicative m => cfg -> WithStatusBase m cfg -> WithStatusBase m cfg +setConfig' :: forall (m :: Type -> Type) (cfg :: Type). (Applicative m) => cfg -> WithStatusBase m cfg -> WithStatusBase m cfg setConfig' c (WithStatusBase s ls _ ttl) = WithStatusBase s ls (pure c) ttl -setTTL :: forall (m :: Type -> Type) (cfg :: Type). Applicative m => FeatureTTL -> WithStatusBase m cfg -> WithStatusBase m cfg +setTTL :: forall (m :: Type -> Type) (cfg :: Type). (Applicative m) => FeatureTTL -> WithStatusBase m cfg -> WithStatusBase m cfg setTTL ttl (WithStatusBase s ls c _) = WithStatusBase s ls c (pure ttl) setWsTTL :: FeatureTTL -> WithStatus cfg -> WithStatus cfg @@ -291,12 +291,16 @@ deriving via (Schema (WithStatus cfg)) instance (ToSchema (WithStatus cfg), Type instance (ToSchema cfg, IsFeatureConfig cfg) => ToSchema (WithStatus cfg) where schema = - object name $ - WithStatusBase - <$> (runIdentity . wsbStatus) .= (Identity <$> field "status" schema) - <*> (runIdentity . wsbLockStatus) .= (Identity <$> field "lockStatus" schema) - <*> (runIdentity . wsbConfig) .= (Identity <$> objectSchema @cfg) - <*> (runIdentity . wsbTTL) .= (Identity . fromMaybe FeatureTTLUnlimited <$> optField "ttl" schema) + object name + $ WithStatusBase + <$> (runIdentity . wsbStatus) + .= (Identity <$> field "status" schema) + <*> (runIdentity . wsbLockStatus) + .= (Identity <$> field "lockStatus" schema) + <*> (runIdentity . wsbConfig) + .= (Identity <$> objectSchema @cfg) + <*> (runIdentity . wsbTTL) + .= (Identity . fromMaybe FeatureTTLUnlimited <$> optField "ttl" schema) where inner = schema @cfg name = fromMaybe "" (getName (schemaDoc inner)) <> ".WithStatus" @@ -339,14 +343,18 @@ withStatus' = WithStatusBase -- | The ToJSON implementation of `WithStatusPatch` will encode the trivial config as `"config": {}` -- when the value is a `Just`, if it's `Nothing` it will be omitted, which is the important part. -instance ToSchema cfg => ToSchema (WithStatusPatch cfg) where +instance (ToSchema cfg) => ToSchema (WithStatusPatch cfg) where schema = - object name $ - WithStatusBase - <$> wsbStatus .= maybe_ (optField "status" schema) - <*> wsbLockStatus .= maybe_ (optField "lockStatus" schema) - <*> wsbConfig .= maybe_ (optField "config" schema) - <*> wsbTTL .= maybe_ (optField "ttl" schema) + object name + $ WithStatusBase + <$> wsbStatus + .= maybe_ (optField "status" schema) + <*> wsbLockStatus + .= maybe_ (optField "lockStatus" schema) + <*> wsbConfig + .= maybe_ (optField "config" schema) + <*> wsbTTL + .= maybe_ (optField "ttl" schema) where inner = schema @cfg name = fromMaybe "" (getName (schemaDoc inner)) <> ".WithStatusPatch" @@ -373,7 +381,7 @@ data WithStatusNoLock (cfg :: Type) = WithStatusNoLock deriving stock (Eq, Show, Generic, Typeable, Functor) deriving (ToJSON, FromJSON, S.ToSchema) via (Schema (WithStatusNoLock cfg)) -instance Arbitrary cfg => Arbitrary (WithStatusNoLock cfg) where +instance (Arbitrary cfg) => Arbitrary (WithStatusNoLock cfg) where arbitrary = WithStatusNoLock <$> arbitrary <*> arbitrary <*> arbitrary forgetLock :: WithStatus a -> WithStatusNoLock a @@ -390,11 +398,14 @@ withLocked = withLockStatus LockStatusLocked instance (ToSchema cfg, IsFeatureConfig cfg) => ToSchema (WithStatusNoLock cfg) where schema = - object name $ - WithStatusNoLock - <$> wssStatus .= field "status" schema - <*> wssConfig .= objectSchema @cfg - <*> wssTTL .= (fromMaybe FeatureTTLUnlimited <$> optField "ttl" schema) + object name + $ WithStatusNoLock + <$> wssStatus + .= field "status" schema + <*> wssConfig + .= objectSchema @cfg + <*> wssTTL + .= (fromMaybe FeatureTTLUnlimited <$> optField "ttl" schema) where inner = schema @cfg name = fromMaybe "" (getName (schemaDoc inner)) <> ".WithStatusNoLock" @@ -448,15 +459,15 @@ instance ToSchema FeatureTTL where parseUnlimited :: A.Value -> A.Parser FeatureTTL parseUnlimited = - A.withText "FeatureTTL" $ - \t -> + A.withText "FeatureTTL" + $ \t -> if t == "unlimited" || t == "0" then pure FeatureTTLUnlimited else A.parseFail "Expected ''unlimited' or '0'." parseSeconds :: A.Value -> A.Parser FeatureTTL - parseSeconds = A.withScientific "FeatureTTL" $ - \s -> case toBoundedInteger s of + parseSeconds = A.withScientific "FeatureTTL" + $ \s -> case toBoundedInteger s of Just 0 -> error "impossible (this would have parsed in `parseUnlimited` above)." Just i -> pure . FeatureTTLSeconds $ i Nothing -> A.parseFail "Expected an positive integer." @@ -516,8 +527,8 @@ instance FromHttpApiData LockStatus where instance ToSchema LockStatus where schema = - enum @Text "LockStatus" $ - mconcat + enum @Text "LockStatus" + $ mconcat [ element "locked" LockStatusLocked, element "unlocked" LockStatusUnlocked ] @@ -557,9 +568,10 @@ newtype LockStatusResponse = LockStatusResponse {_unlockStatus :: LockStatus} instance ToSchema LockStatusResponse where schema = - object "LockStatusResponse" $ - LockStatusResponse - <$> _unlockStatus .= field "lockStatus" schema + object "LockStatusResponse" + $ LockStatusResponse + <$> _unlockStatus + .= field "lockStatus" schema newtype ImplicitLockStatus (cfg :: Type) = ImplicitLockStatus {_unImplicitLockStatus :: WithStatus cfg} deriving newtype (Eq, Show, Arbitrary) @@ -810,9 +822,10 @@ deriving via (GenericUniform ClassifiedDomainsConfig) instance Arbitrary Classif instance ToSchema ClassifiedDomainsConfig where schema = - object "ClassifiedDomainsConfig" $ - ClassifiedDomainsConfig - <$> classifiedDomainsDomains .= field "domains" (array schema) + object "ClassifiedDomainsConfig" + $ ClassifiedDomainsConfig + <$> classifiedDomainsDomains + .= field "domains" (array schema) instance IsFeatureConfig ClassifiedDomainsConfig where type FeatureSymbol ClassifiedDomainsConfig = "classifiedDomains" @@ -842,10 +855,12 @@ instance RenderableSymbol AppLockConfig where instance ToSchema AppLockConfig where schema = - object "AppLockConfig" $ - AppLockConfig - <$> applockEnforceAppLock .= field "enforceAppLock" schema - <*> applockInactivityTimeoutSecs .= field "inactivityTimeoutSecs" schema + object "AppLockConfig" + $ AppLockConfig + <$> applockEnforceAppLock + .= field "enforceAppLock" schema + <*> applockInactivityTimeoutSecs + .= field "inactivityTimeoutSecs" schema instance IsFeatureConfig AppLockConfig where type FeatureSymbol AppLockConfig = "appLock" @@ -904,9 +919,10 @@ instance RenderableSymbol SelfDeletingMessagesConfig where instance ToSchema SelfDeletingMessagesConfig where schema = - object "SelfDeletingMessagesConfig" $ - SelfDeletingMessagesConfig - <$> sdmEnforcedTimeoutSeconds .= field "enforcedTimeoutSeconds" schema + object "SelfDeletingMessagesConfig" + $ SelfDeletingMessagesConfig + <$> sdmEnforcedTimeoutSeconds + .= field "enforcedTimeoutSeconds" schema instance IsFeatureConfig SelfDeletingMessagesConfig where type FeatureSymbol SelfDeletingMessagesConfig = "selfDeletingMessages" @@ -937,13 +953,18 @@ instance RenderableSymbol MLSConfig where instance ToSchema MLSConfig where schema = - object "MLSConfig" $ - MLSConfig - <$> mlsProtocolToggleUsers .= fieldWithDocModifier "protocolToggleUsers" (S.description ?~ "allowlist of users that may change protocols") (array schema) - <*> mlsDefaultProtocol .= field "defaultProtocol" schema - <*> mlsAllowedCipherSuites .= field "allowedCipherSuites" (array schema) - <*> mlsDefaultCipherSuite .= field "defaultCipherSuite" schema - <*> mlsSupportedProtocols .= field "supportedProtocols" (array schema) + object "MLSConfig" + $ MLSConfig + <$> mlsProtocolToggleUsers + .= fieldWithDocModifier "protocolToggleUsers" (S.description ?~ "allowlist of users that may change protocols") (array schema) + <*> mlsDefaultProtocol + .= field "defaultProtocol" schema + <*> mlsAllowedCipherSuites + .= field "allowedCipherSuites" (array schema) + <*> mlsDefaultCipherSuite + .= field "defaultCipherSuite" schema + <*> mlsSupportedProtocols + .= field "supportedProtocols" (array schema) instance IsFeatureConfig MLSConfig where type FeatureSymbol MLSConfig = "mls" @@ -1030,12 +1051,16 @@ instance Arbitrary MlsE2EIdConfig where instance ToSchema MlsE2EIdConfig where schema :: ValueSchema NamedSwaggerDoc MlsE2EIdConfig schema = - object "MlsE2EIdConfig" $ - MlsE2EIdConfig - <$> (toSeconds . verificationExpiration) .= fieldWithDocModifier "verificationExpiration" veDesc (fromSeconds <$> schema) - <*> acmeDiscoveryUrl .= maybe_ (optField "acmeDiscoveryUrl" schema) - <*> crlProxy .= maybe_ (optField "crlProxy" schema) - <*> useProxyOnMobile .= (fromMaybe False <$> optField "useProxyOnMobile" schema) + object "MlsE2EIdConfig" + $ MlsE2EIdConfig + <$> (toSeconds . verificationExpiration) + .= fieldWithDocModifier "verificationExpiration" veDesc (fromSeconds <$> schema) + <*> acmeDiscoveryUrl + .= maybe_ (optField "acmeDiscoveryUrl" schema) + <*> crlProxy + .= maybe_ (optField "crlProxy" schema) + <*> useProxyOnMobile + .= (fromMaybe False <$> optField "useProxyOnMobile" schema) where fromSeconds :: Int -> NominalDiffTime fromSeconds = fromIntegral @@ -1090,10 +1115,12 @@ instance Arbitrary MlsMigrationConfig where instance ToSchema MlsMigrationConfig where schema = - object "MlsMigration" $ - MlsMigrationConfig - <$> startTime .= maybe_ (optField "startTime" utcTimeSchema) - <*> finaliseRegardlessAfter .= maybe_ (optField "finaliseRegardlessAfter" utcTimeSchema) + object "MlsMigration" + $ MlsMigrationConfig + <$> startTime + .= maybe_ (optField "startTime" utcTimeSchema) + <*> finaliseRegardlessAfter + .= maybe_ (optField "finaliseRegardlessAfter" utcTimeSchema) instance IsFeatureConfig MlsMigrationConfig where type FeatureSymbol MlsMigrationConfig = "mlsMigration" @@ -1119,9 +1146,10 @@ instance Arbitrary EnforceFileDownloadLocationConfig where instance ToSchema EnforceFileDownloadLocationConfig where schema = - object "EnforceFileDownloadLocation" $ - EnforceFileDownloadLocationConfig - <$> enforcedDownloadLocation .= maybe_ (optField "enforcedDownloadLocation" schema) + object "EnforceFileDownloadLocation" + $ EnforceFileDownloadLocationConfig + <$> enforcedDownloadLocation + .= maybe_ (optField "enforcedDownloadLocation" schema) instance IsFeatureConfig EnforceFileDownloadLocationConfig where type FeatureSymbol EnforceFileDownloadLocationConfig = "enforceFileDownloadLocation" @@ -1184,8 +1212,8 @@ instance ToHttpApiData FeatureStatus where instance ToSchema FeatureStatus where schema = - enum @Text "FeatureStatus" $ - mconcat + enum @Text "FeatureStatus" + $ mconcat [ element "enabled" FeatureStatusEnabled, element "disabled" FeatureStatusDisabled ] @@ -1215,7 +1243,7 @@ instance Cass.Cql FeatureStatus where toCql FeatureStatusDisabled = Cass.CqlInt 0 toCql FeatureStatusEnabled = Cass.CqlInt 1 -defFeatureStatusNoLock :: IsFeatureConfig cfg => WithStatusNoLock cfg +defFeatureStatusNoLock :: (IsFeatureConfig cfg) => WithStatusNoLock cfg defFeatureStatusNoLock = forgetLock defFeatureStatus data AllFeatureConfigs = AllFeatureConfigs @@ -1270,28 +1298,48 @@ instance Default AllFeatureConfigs where instance ToSchema AllFeatureConfigs where schema = - object "AllFeatureConfigs" $ - AllFeatureConfigs - <$> afcLegalholdStatus .= featureField - <*> afcSSOStatus .= featureField - <*> afcTeamSearchVisibilityAvailable .= featureField - <*> afcSearchVisibilityInboundConfig .= featureField - <*> afcValidateSAMLEmails .= featureField - <*> afcDigitalSignatures .= featureField - <*> afcAppLock .= featureField - <*> afcFileSharing .= featureField - <*> afcClassifiedDomains .= featureField - <*> afcConferenceCalling .= featureField - <*> afcSelfDeletingMessages .= featureField - <*> afcGuestLink .= featureField - <*> afcSndFactorPasswordChallenge .= featureField - <*> afcMLS .= featureField - <*> afcExposeInvitationURLsToTeamAdmin .= featureField - <*> afcOutlookCalIntegration .= featureField - <*> afcMlsE2EId .= featureField - <*> afcMlsMigration .= featureField - <*> afcEnforceFileDownloadLocation .= featureField - <*> afcLimitedEventFanout .= featureField + object "AllFeatureConfigs" + $ AllFeatureConfigs + <$> afcLegalholdStatus + .= featureField + <*> afcSSOStatus + .= featureField + <*> afcTeamSearchVisibilityAvailable + .= featureField + <*> afcSearchVisibilityInboundConfig + .= featureField + <*> afcValidateSAMLEmails + .= featureField + <*> afcDigitalSignatures + .= featureField + <*> afcAppLock + .= featureField + <*> afcFileSharing + .= featureField + <*> afcClassifiedDomains + .= featureField + <*> afcConferenceCalling + .= featureField + <*> afcSelfDeletingMessages + .= featureField + <*> afcGuestLink + .= featureField + <*> afcSndFactorPasswordChallenge + .= featureField + <*> afcMLS + .= featureField + <*> afcExposeInvitationURLsToTeamAdmin + .= featureField + <*> afcOutlookCalIntegration + .= featureField + <*> afcMlsE2EId + .= featureField + <*> afcMlsMigration + .= featureField + <*> afcEnforceFileDownloadLocation + .= featureField + <*> afcLimitedEventFanout + .= featureField where featureField :: forall cfg. diff --git a/libs/wire-api/src/Wire/API/Team/HardTruncationLimit.hs b/libs/wire-api/src/Wire/API/Team/HardTruncationLimit.hs index 0ec378cc1bd..47845ffc6a7 100644 --- a/libs/wire-api/src/Wire/API/Team/HardTruncationLimit.hs +++ b/libs/wire-api/src/Wire/API/Team/HardTruncationLimit.hs @@ -6,5 +6,5 @@ import Imports type HardTruncationLimit = (2000 :: Nat) -hardTruncationLimit :: Integral a => a +hardTruncationLimit :: (Integral a) => a hardTruncationLimit = fromIntegral $ natVal (Proxy @HardTruncationLimit) diff --git a/libs/wire-api/src/Wire/API/Team/Invitation.hs b/libs/wire-api/src/Wire/API/Team/Invitation.hs index 44cc508ab69..49c08c9b05b 100644 --- a/libs/wire-api/src/Wire/API/Team/Invitation.hs +++ b/libs/wire-api/src/Wire/API/Team/Invitation.hs @@ -63,18 +63,18 @@ data InvitationRequest = InvitationRequest instance ToSchema InvitationRequest where schema = - objectWithDocModifier "InvitationRequest" (description ?~ "A request to join a team on Wire.") $ - InvitationRequest - <$> irLocale - .= optFieldWithDocModifier "locale" (description ?~ "Locale to use for the invitation.") (maybeWithDefault A.Null schema) + objectWithDocModifier "InvitationRequest" (description ?~ "A request to join a team on Wire.") + $ InvitationRequest + <$> irLocale + .= optFieldWithDocModifier "locale" (description ?~ "Locale to use for the invitation.") (maybeWithDefault A.Null schema) <*> irRole - .= optFieldWithDocModifier "role" (description ?~ "Role of the invitee (invited user).") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "role" (description ?~ "Role of the invitee (invited user).") (maybeWithDefault A.Null schema) <*> irInviteeName - .= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters).") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters).") (maybeWithDefault A.Null schema) <*> irInviteeEmail - .= fieldWithDocModifier "email" (description ?~ "Email of the invitee.") schema + .= fieldWithDocModifier "email" (description ?~ "Email of the invitee.") schema <*> irInviteePhone - .= optFieldWithDocModifier "phone" (description ?~ "Phone number of the invitee, in the E.164 format.") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "phone" (description ?~ "Phone number of the invitee, in the E.164 format.") (maybeWithDefault A.Null schema) -------------------------------------------------------------------------------- -- Invitation @@ -98,27 +98,27 @@ data Invitation = Invitation instance ToSchema Invitation where schema = - objectWithDocModifier "Invitation" (description ?~ "An invitation to join a team on Wire") $ - Invitation - <$> inTeam - .= fieldWithDocModifier "team" (description ?~ "Team ID of the inviting team") schema + objectWithDocModifier "Invitation" (description ?~ "An invitation to join a team on Wire") + $ Invitation + <$> inTeam + .= fieldWithDocModifier "team" (description ?~ "Team ID of the inviting team") schema <*> inRole - -- clients, when leaving "role" empty, can leave the default role choice to us - .= (fromMaybe defaultRole <$> optFieldWithDocModifier "role" (description ?~ "Role of the invited user") schema) + -- clients, when leaving "role" empty, can leave the default role choice to us + .= (fromMaybe defaultRole <$> optFieldWithDocModifier "role" (description ?~ "Role of the invited user") schema) <*> inInvitation - .= fieldWithDocModifier "id" (description ?~ "UUID used to refer the invitation") schema + .= fieldWithDocModifier "id" (description ?~ "UUID used to refer the invitation") schema <*> inCreatedAt - .= fieldWithDocModifier "created_at" (description ?~ "Timestamp of invitation creation") schema + .= fieldWithDocModifier "created_at" (description ?~ "Timestamp of invitation creation") schema <*> inCreatedBy - .= optFieldWithDocModifier "created_by" (description ?~ "ID of the inviting user") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "created_by" (description ?~ "ID of the inviting user") (maybeWithDefault A.Null schema) <*> inInviteeEmail - .= fieldWithDocModifier "email" (description ?~ "Email of the invitee") schema + .= fieldWithDocModifier "email" (description ?~ "Email of the invitee") schema <*> inInviteeName - .= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters)") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters)") (maybeWithDefault A.Null schema) <*> inInviteePhone - .= optFieldWithDocModifier "phone" (description ?~ "Phone number of the invitee, in the E.164 format") (maybeWithDefault A.Null schema) + .= optFieldWithDocModifier "phone" (description ?~ "Phone number of the invitee, in the E.164 format") (maybeWithDefault A.Null schema) <*> (fmap (TE.decodeUtf8 . serializeURIRef') . inInviteeUrl) - .= optFieldWithDocModifier "url" (description ?~ "URL of the invitation link to be sent to the invitee") (maybeWithDefault A.Null urlSchema) + .= optFieldWithDocModifier "url" (description ?~ "URL of the invitation link to be sent to the invitee") (maybeWithDefault A.Null urlSchema) where urlSchema = parsedText "URIRef Absolute" (runParser (uriParser strictURIParserOptions) . TE.encodeUtf8) @@ -130,8 +130,10 @@ newtype InvitationLocation = InvitationLocation instance S.ToParamSchema InvitationLocation where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.format ?~ "url" + & S.type_ + ?~ S.OpenApiString + & S.format + ?~ "url" instance FromHttpApiData InvitationLocation where parseUrlPiece = parseHeader . TE.encodeUtf8 @@ -175,9 +177,9 @@ data InvitationList = InvitationList instance ToSchema InvitationList where schema = - objectWithDocModifier "InvitationList" (description ?~ "A list of sent team invitations.") $ - InvitationList - <$> ilInvitations - .= field "invitations" (array schema) + objectWithDocModifier "InvitationList" (description ?~ "A list of sent team invitations.") + $ InvitationList + <$> ilInvitations + .= field "invitations" (array schema) <*> ilHasMore - .= fieldWithDocModifier "has_more" (description ?~ "Indicator that the server has more invitations than returned.") schema + .= fieldWithDocModifier "has_more" (description ?~ "Indicator that the server has more invitations than returned.") schema diff --git a/libs/wire-api/src/Wire/API/Team/LegalHold.hs b/libs/wire-api/src/Wire/API/Team/LegalHold.hs index e25f3ec7577..227fbe98cca 100644 --- a/libs/wire-api/src/Wire/API/Team/LegalHold.hs +++ b/libs/wire-api/src/Wire/API/Team/LegalHold.hs @@ -60,11 +60,14 @@ data NewLegalHoldService = NewLegalHoldService instance ToSchema NewLegalHoldService where schema = - object "NewLegalHoldService" $ - NewLegalHoldService - <$> newLegalHoldServiceUrl .= field "base_url" schema - <*> newLegalHoldServiceKey .= field "public_key" schema - <*> newLegalHoldServiceToken .= field "auth_token" schema + object "NewLegalHoldService" + $ NewLegalHoldService + <$> newLegalHoldServiceUrl + .= field "base_url" schema + <*> newLegalHoldServiceKey + .= field "public_key" schema + <*> newLegalHoldServiceToken + .= field "auth_token" schema -------------------------------------------------------------------------------- -- ViewLegalHoldService @@ -84,8 +87,8 @@ data LHServiceStatus = Configured | NotConfigured | Disabled instance ToSchema LHServiceStatus where schema = - enum @Text "LHServiceStatus" $ - mconcat + enum @Text "LHServiceStatus" + $ mconcat [ element "configured" Configured, element "not_configured" NotConfigured, element "disabled" Disabled @@ -93,8 +96,9 @@ instance ToSchema LHServiceStatus where instance ToSchema ViewLegalHoldService where schema = - object "ViewLegalHoldService" $ - toOutput .= recordSchema + object "ViewLegalHoldService" + $ toOutput + .= recordSchema `withParser` validateViewLegalHoldService where toOutput :: ViewLegalHoldService -> (LHServiceStatus, Maybe ViewLegalHoldServiceInfo) @@ -106,8 +110,10 @@ instance ToSchema ViewLegalHoldService where recordSchema :: ObjectSchema SwaggerDoc (LHServiceStatus, Maybe ViewLegalHoldServiceInfo) recordSchema = (,) - <$> fst .= field "status" schema - <*> snd .= maybe_ (optField "settings" schema) + <$> fst + .= field "status" schema + <*> snd + .= maybe_ (optField "settings" schema) validateViewLegalHoldService :: (LHServiceStatus, Maybe ViewLegalHoldServiceInfo) -> A.Parser ViewLegalHoldService validateViewLegalHoldService (Configured, Just info) = @@ -131,13 +137,18 @@ data ViewLegalHoldServiceInfo = ViewLegalHoldServiceInfo instance ToSchema ViewLegalHoldServiceInfo where schema = - object "ViewLegalHoldServiceInfo" $ - ViewLegalHoldServiceInfo - <$> viewLegalHoldServiceTeam .= field "team_id" schema - <*> viewLegalHoldServiceUrl .= field "base_url" schema - <*> viewLegalHoldServiceFingerprint .= field "fingerprint" schema - <*> viewLegalHoldServiceAuthToken .= field "auth_token" schema - <*> viewLegalHoldServiceKey .= field "public_key" schema + object "ViewLegalHoldServiceInfo" + $ ViewLegalHoldServiceInfo + <$> viewLegalHoldServiceTeam + .= field "team_id" schema + <*> viewLegalHoldServiceUrl + .= field "base_url" schema + <*> viewLegalHoldServiceFingerprint + .= field "fingerprint" schema + <*> viewLegalHoldServiceAuthToken + .= field "auth_token" schema + <*> viewLegalHoldServiceKey + .= field "public_key" schema -------------------------------------------------------------------------------- -- UserLegalHoldStatusResponse @@ -155,11 +166,14 @@ data UserLegalHoldStatusResponse = UserLegalHoldStatusResponse instance ToSchema UserLegalHoldStatusResponse where schema = - object "UserLegalHoldStatusResponse" $ - UserLegalHoldStatusResponse - <$> ulhsrStatus .= field "status" schema - <*> ulhsrLastPrekey .= maybe_ (optField "last_prekey" schema) - <*> (fmap IdObject . ulhsrClientId) .= maybe_ (optField "client" (fromIdObject <$> schema)) + object "UserLegalHoldStatusResponse" + $ UserLegalHoldStatusResponse + <$> ulhsrStatus + .= field "status" schema + <*> ulhsrLastPrekey + .= maybe_ (optField "last_prekey" schema) + <*> (fmap IdObject . ulhsrClientId) + .= maybe_ (optField "client" (fromIdObject <$> schema)) -------------------------------------------------------------------------------- -- RemoveLegalHoldSettingsRequest @@ -173,9 +187,10 @@ data RemoveLegalHoldSettingsRequest = RemoveLegalHoldSettingsRequest instance ToSchema RemoveLegalHoldSettingsRequest where schema = - object "RemoveLegalHoldSettingsRequest" $ - RemoveLegalHoldSettingsRequest - <$> rmlhsrPassword .= maybe_ (optField "password" schema) + object "RemoveLegalHoldSettingsRequest" + $ RemoveLegalHoldSettingsRequest + <$> rmlhsrPassword + .= maybe_ (optField "password" schema) -------------------------------------------------------------------------------- -- DisableLegalHoldForUserRequest @@ -189,9 +204,10 @@ data DisableLegalHoldForUserRequest = DisableLegalHoldForUserRequest instance ToSchema DisableLegalHoldForUserRequest where schema = - object "DisableLegalHoldForUserRequest" $ - DisableLegalHoldForUserRequest - <$> dlhfuPassword .= maybe_ (optField "password" schema) + object "DisableLegalHoldForUserRequest" + $ DisableLegalHoldForUserRequest + <$> dlhfuPassword + .= maybe_ (optField "password" schema) -------------------------------------------------------------------------------- -- ApproveLegalHoldForUserRequest @@ -205,9 +221,10 @@ data ApproveLegalHoldForUserRequest = ApproveLegalHoldForUserRequest instance ToSchema ApproveLegalHoldForUserRequest where schema = - object "ApproveLegalHoldForUserRequest" $ - ApproveLegalHoldForUserRequest - <$> alhfuPassword .= maybe_ (optField "password" schema) + object "ApproveLegalHoldForUserRequest" + $ ApproveLegalHoldForUserRequest + <$> alhfuPassword + .= maybe_ (optField "password" schema) ----------------------------------------------------------------------- @@ -237,23 +254,27 @@ instance ToSchema LegalholdProtectee where where docs :: NamedSwaggerDoc docs = - pure $ - S.NamedSchema (Just "LegalholdProtectee") $ - mempty - & S.type_ ?~ S.OpenApiObject - & S.properties . at "tag" - ?~ S.Inline - ( mempty - & S.type_ ?~ S.OpenApiString - & S.enum_ - ?~ [ A.toJSON ("ProtectedUser" :: String), - A.toJSON ("UnprotectedBot" :: String), - A.toJSON ("LegalholdPlusFederationNotImplemented" :: String) - ] - ) - & S.properties . at "contents" - ?~ S.Inline - ( S.toSchema (Proxy @UserId) - & S.description - ?~ "A UserId for ProtectedUser, otherwise empty / null." - ) + pure + $ S.NamedSchema (Just "LegalholdProtectee") + $ mempty + & S.type_ + ?~ S.OpenApiObject + & S.properties + . at "tag" + ?~ S.Inline + ( mempty + & S.type_ + ?~ S.OpenApiString + & S.enum_ + ?~ [ A.toJSON ("ProtectedUser" :: String), + A.toJSON ("UnprotectedBot" :: String), + A.toJSON ("LegalholdPlusFederationNotImplemented" :: String) + ] + ) + & S.properties + . at "contents" + ?~ S.Inline + ( S.toSchema (Proxy @UserId) + & S.description + ?~ "A UserId for ProtectedUser, otherwise empty / null." + ) diff --git a/libs/wire-api/src/Wire/API/Team/LegalHold/External.hs b/libs/wire-api/src/Wire/API/Team/LegalHold/External.hs index 8dc5fd14366..649d1f51e62 100644 --- a/libs/wire-api/src/Wire/API/Team/LegalHold/External.hs +++ b/libs/wire-api/src/Wire/API/Team/LegalHold/External.hs @@ -63,16 +63,20 @@ instance ToSchema RequestNewLegalHoldClient where instance ToJSON RequestNewLegalHoldClient where toJSON (RequestNewLegalHoldClient userId teamId) = - object $ - "user_id" .= userId - # "team_id" .= teamId + object + $ "user_id" + .= userId + # "team_id" + .= teamId # [] instance FromJSON RequestNewLegalHoldClient where parseJSON = withObject "RequestNewLegalHoldClient" $ \o -> RequestNewLegalHoldClient - <$> o .: "user_id" - <*> o .: "team_id" + <$> o + .: "user_id" + <*> o + .: "team_id" -- | Response payload that the LH service returns upon calling @/initiate@ data NewLegalHoldClient = NewLegalHoldClient @@ -95,16 +99,20 @@ instance ToSchema NewLegalHoldClient where instance ToJSON NewLegalHoldClient where toJSON c = - object $ - "prekeys" .= newLegalHoldClientPrekeys c - # "last_prekey" .= newLegalHoldClientLastKey c + object + $ "prekeys" + .= newLegalHoldClientPrekeys c + # "last_prekey" + .= newLegalHoldClientLastKey c # [] instance FromJSON NewLegalHoldClient where parseJSON = withObject "NewLegalHoldClient" $ \o -> NewLegalHoldClient - <$> o .: "prekeys" - <*> o .: "last_prekey" + <$> o + .: "prekeys" + <*> o + .: "last_prekey" -------------------------------------------------------------------------------- -- confirm @@ -122,20 +130,28 @@ data LegalHoldServiceConfirm = LegalHoldServiceConfirm instance ToJSON LegalHoldServiceConfirm where toJSON (LegalHoldServiceConfirm clientId userId teamId refreshToken) = - object $ - "client_id" .= clientId - # "user_id" .= userId - # "team_id" .= teamId - # "refresh_token" .= refreshToken + object + $ "client_id" + .= clientId + # "user_id" + .= userId + # "team_id" + .= teamId + # "refresh_token" + .= refreshToken # [] instance FromJSON LegalHoldServiceConfirm where parseJSON = withObject "LegalHoldServiceConfirm" $ \o -> LegalHoldServiceConfirm - <$> o .: "client_id" - <*> o .: "user_id" - <*> o .: "team_id" - <*> o .: "refresh_token" + <$> o + .: "client_id" + <*> o + .: "user_id" + <*> o + .: "team_id" + <*> o + .: "refresh_token" -------------------------------------------------------------------------------- -- remove @@ -150,13 +166,17 @@ data LegalHoldServiceRemove = LegalHoldServiceRemove instance ToJSON LegalHoldServiceRemove where toJSON (LegalHoldServiceRemove userId teamId) = - object $ - "user_id" .= userId - # "team_id" .= teamId + object + $ "user_id" + .= userId + # "team_id" + .= teamId # [] instance FromJSON LegalHoldServiceRemove where parseJSON = withObject "LegalHoldServiceRemove" $ \o -> LegalHoldServiceRemove - <$> o .: "user_id" - <*> o .: "team_id" + <$> o + .: "user_id" + <*> o + .: "team_id" diff --git a/libs/wire-api/src/Wire/API/Team/LegalHold/Internal.hs b/libs/wire-api/src/Wire/API/Team/LegalHold/Internal.hs index e706f472fc6..6d1276cfbcf 100644 --- a/libs/wire-api/src/Wire/API/Team/LegalHold/Internal.hs +++ b/libs/wire-api/src/Wire/API/Team/LegalHold/Internal.hs @@ -48,27 +48,32 @@ data LegalHoldService = LegalHoldService instance ToJSON LegalHoldService where toJSON s = - object $ - "team_id" .= legalHoldServiceTeam s - # "base_url" .= legalHoldServiceUrl s - # "fingerprint" .= legalHoldServiceFingerprint s - # "auth_token" .= legalHoldServiceToken s - # "public_key" .= legalHoldServiceKey s + object + $ "team_id" + .= legalHoldServiceTeam s + # "base_url" + .= legalHoldServiceUrl s + # "fingerprint" + .= legalHoldServiceFingerprint s + # "auth_token" + .= legalHoldServiceToken s + # "public_key" + .= legalHoldServiceKey s # [] instance FromJSON LegalHoldService where parseJSON = withObject "LegalHoldService" $ \o -> LegalHoldService <$> o - .: "team_id" + .: "team_id" <*> o - .: "base_url" + .: "base_url" <*> o - .: "fingerprint" + .: "fingerprint" <*> o - .: "auth_token" + .: "auth_token" <*> o - .: "public_key" + .: "public_key" legalHoldService :: TeamId -> Fingerprint Rsa -> NewLegalHoldService -> ServiceKey -> LegalHoldService legalHoldService tid fpr (NewLegalHoldService u _ t) = LegalHoldService tid u fpr t @@ -90,5 +95,7 @@ instance Schema.ToSchema LegalHoldClientRequest where Schema.object "LegalHoldClientRequest" $ LegalHoldClientRequest - <$> lhcrRequester Schema..= Schema.field "requester" Schema.schema - <*> lhcrLastPrekey Schema..= Schema.field "last_prekey" Schema.schema + <$> lhcrRequester + Schema..= Schema.field "requester" Schema.schema + <*> lhcrLastPrekey + Schema..= Schema.field "last_prekey" Schema.schema diff --git a/libs/wire-api/src/Wire/API/Team/Member.hs b/libs/wire-api/src/Wire/API/Team/Member.hs index 28c72a3808b..1297a20e77d 100644 --- a/libs/wire-api/src/Wire/API/Team/Member.hs +++ b/libs/wire-api/src/Wire/API/Team/Member.hs @@ -117,11 +117,11 @@ data TeamMember' (tag :: PermissionTag) = TeamMember ntmNewTeamMember :: NewTeamMember' tag -> TeamMember' tag ntmNewTeamMember ntm = TeamMember ntm defUserLegalHoldStatus -deriving instance Eq (PermissionType tag) => Eq (TeamMember' tag) +deriving instance (Eq (PermissionType tag)) => Eq (TeamMember' tag) -deriving instance Ord (PermissionType tag) => Ord (TeamMember' tag) +deriving instance (Ord (PermissionType tag)) => Ord (TeamMember' tag) -deriving instance Show (PermissionType tag) => Show (TeamMember' tag) +deriving instance (Show (PermissionType tag)) => Show (TeamMember' tag) deriving via (GenericUniform TeamMember) instance Arbitrary TeamMember @@ -160,25 +160,25 @@ teamMemberObjectSchema :: ObjectSchema SwaggerDoc TeamMember teamMemberObjectSchema = TeamMember <$> _newTeamMember - .= newTeamMemberSchema - <*> _legalHoldStatus - .= (fromMaybe defUserLegalHoldStatus <$> optFieldWithDocModifier "legalhold_status" (description ?~ lhDesc) schema) + .= newTeamMemberSchema + <*> _legalHoldStatus + .= (fromMaybe defUserLegalHoldStatus <$> optFieldWithDocModifier "legalhold_status" (description ?~ lhDesc) schema) instance ToSchema (TeamMember' 'Optional) where schema = - objectWithDocModifier "TeamMember" (description ?~ "team member data") $ - TeamMember - <$> _newTeamMember - .= ( NewTeamMember - <$> _nUserId - .= fieldWithDocModifier "user" (description ?~ "user ID") schema - <*> _nPermissions - .= maybe_ (optFieldWithDocModifier "permissions" (description ?~ permissionsDesc) schema) - <*> _nInvitation - .= invitedSchema' - ) + objectWithDocModifier "TeamMember" (description ?~ "team member data") + $ TeamMember + <$> _newTeamMember + .= ( NewTeamMember + <$> _nUserId + .= fieldWithDocModifier "user" (description ?~ "user ID") schema + <*> _nPermissions + .= maybe_ (optFieldWithDocModifier "permissions" (description ?~ permissionsDesc) schema) + <*> _nInvitation + .= invitedSchema' + ) <*> _legalHoldStatus - .= (fromMaybe defUserLegalHoldStatus <$> optFieldWithDocModifier "legalhold_status" (description ?~ lhDesc) schema) + .= (fromMaybe defUserLegalHoldStatus <$> optFieldWithDocModifier "legalhold_status" (description ?~ lhDesc) schema) where permissionsDesc = "The permissions this user has in the given team \ @@ -213,17 +213,17 @@ newtype TeamMembersPage = TeamMembersPage {unTeamMembersPage :: TeamMembersPage' instance ToSchema TeamMembersPage where schema = - object "TeamMembersPage" $ - TeamMembersPage - <$> unTeamMembersPage - .= ( MultiTablePage - <$> mtpResults - .= field "members" (array schema) - <*> mtpHasMore - .= field "hasMore" schema - <*> mtpPagingState - .= field "pagingState" schema - ) + object "TeamMembersPage" + $ TeamMembersPage + <$> unTeamMembersPage + .= ( MultiTablePage + <$> mtpResults + .= field "members" (array schema) + <*> mtpHasMore + .= field "hasMore" schema + <*> mtpPagingState + .= field "pagingState" schema + ) type TeamMembersPagingState = MultiTablePagingState TeamMembersPagingName TeamMembersTable @@ -243,9 +243,9 @@ data TeamMemberList' (tag :: PermissionTag) = TeamMemberList } deriving stock (Generic) -deriving instance Eq (PermissionType tag) => Eq (TeamMemberList' tag) +deriving instance (Eq (PermissionType tag)) => Eq (TeamMemberList' tag) -deriving instance Show (PermissionType tag) => Show (TeamMemberList' tag) +deriving instance (Show (PermissionType tag)) => Show (TeamMemberList' tag) deriving via (GenericUniform (TeamMemberList' 'Optional)) instance Arbitrary (TeamMemberList' 'Optional) @@ -254,13 +254,13 @@ deriving via (GenericUniform TeamMemberList) instance Arbitrary TeamMemberList deriving via (Schema (TeamMemberList' tag)) instance - ToSchema (TeamMemberList' tag) => + (ToSchema (TeamMemberList' tag)) => FromJSON (TeamMemberList' tag) deriving via (Schema (TeamMemberList' tag)) instance - ToSchema (TeamMemberList' tag) => + (ToSchema (TeamMemberList' tag)) => ToJSON (TeamMemberList' tag) deriving via @@ -272,14 +272,14 @@ deriving via newTeamMemberList :: [TeamMember] -> ListType -> TeamMemberList newTeamMemberList = TeamMemberList -instance ToSchema (TeamMember' tag) => ToSchema (TeamMemberList' tag) where +instance (ToSchema (TeamMember' tag)) => ToSchema (TeamMemberList' tag) where schema = - objectWithDocModifier "TeamMemberList" (description ?~ "list of team member") $ - TeamMemberList - <$> _teamMembers - .= fieldWithDocModifier "members" (description ?~ "the array of team members") (array schema) + objectWithDocModifier "TeamMemberList" (description ?~ "list of team member") + $ TeamMemberList + <$> _teamMembers + .= fieldWithDocModifier "members" (description ?~ "the array of team members") (array schema) <*> _teamMemberListType - .= fieldWithDocModifier "hasMore" (description ?~ "true if 'members' doesn't contain all team members") schema + .= fieldWithDocModifier "hasMore" (description ?~ "true if 'members' doesn't contain all team members") schema -- | Like 'ListType', but without backwards-compatible and boolean-blind json serialization. data NewListType @@ -291,8 +291,8 @@ data NewListType instance ToSchema NewListType where schema = - enum @Text "NewListType" $ - mconcat + enum @Text "NewListType" + $ mconcat [ element "list_complete" NewListComplete, element "list_truncated" NewListTruncated ] @@ -312,8 +312,8 @@ data ListType -- though we do want this to remain true/false instance ToSchema ListType where schema = - enum @Bool "ListType" $ - mconcat [element True ListTruncated, element False ListComplete] + enum @Bool "ListType" + $ mconcat [element True ListTruncated, element False ListComplete] -------------------------------------------------------------------------------- -- NewTeamMember @@ -364,19 +364,19 @@ newTeamMemberSchema :: ObjectSchema SwaggerDoc NewTeamMember newTeamMemberSchema = NewTeamMember <$> _nUserId - .= field "user" schema - <*> _nPermissions - .= field "permissions" schema - <*> _nInvitation - .= invitedSchema' + .= field "user" schema + <*> _nPermissions + .= field "permissions" schema + <*> _nInvitation + .= invitedSchema' invitedSchema :: ObjectSchemaP SwaggerDoc (Maybe (UserId, UTCTimeMillis)) (Maybe UserId, Maybe UTCTimeMillis) invitedSchema = (,) <$> fmap fst - .= optFieldWithDocModifier "created_by" (description ?~ "ID of the inviting user. Requires created_at.") (maybeWithDefault Null schema) - <*> fmap snd - .= optFieldWithDocModifier "created_at" (description ?~ "Timestamp of invitation creation. Requires created_by.") (maybeWithDefault Null schema) + .= optFieldWithDocModifier "created_by" (description ?~ "ID of the inviting user. Requires created_at.") (maybeWithDefault Null schema) + <*> fmap snd + .= optFieldWithDocModifier "created_at" (description ?~ "Timestamp of invitation creation. Requires created_by.") (maybeWithDefault Null schema) invitedSchema' :: ObjectSchema SwaggerDoc (Maybe (UserId, UTCTimeMillis)) invitedSchema' = withParser invitedSchema $ \(invby, invat) -> @@ -387,9 +387,9 @@ invitedSchema' = withParser invitedSchema $ \(invby, invat) -> instance ToSchema NewTeamMember where schema = - objectWithDocModifier "NewTeamMember" (description ?~ "Required data when creating new team members") $ - fieldWithDocModifier "member" (description ?~ "the team member to add (the legalhold_status field must be null or missing!)") $ - unnamed (object "Unnamed" newTeamMemberSchema) + objectWithDocModifier "NewTeamMember" (description ?~ "Required data when creating new team members") + $ fieldWithDocModifier "member" (description ?~ "the team member to add (the legalhold_status field must be null or missing!)") + $ unnamed (object "Unnamed" newTeamMemberSchema) -------------------------------------------------------------------------------- -- TeamMemberDeleteData @@ -403,8 +403,10 @@ newtype TeamMemberDeleteData = TeamMemberDeleteData instance ToSchema TeamMemberDeleteData where schema = - objectWithDocModifier "TeamMemberDeleteData" (description ?~ "Data for a team member deletion request in case of binding teams.") $ - TeamMemberDeleteData <$> _tmdAuthPassword .= optFieldWithDocModifier "password" (description ?~ "The account password to authorise the deletion.") (maybeWithDefault Null schema) + objectWithDocModifier "TeamMemberDeleteData" (description ?~ "Data for a team member deletion request in case of binding teams.") + $ TeamMemberDeleteData + <$> _tmdAuthPassword + .= optFieldWithDocModifier "password" (description ?~ "The account password to authorise the deletion.") (maybeWithDefault Null schema) newTeamMemberDeleteData :: Maybe PlainTextPassword6 -> TeamMemberDeleteData newTeamMemberDeleteData = TeamMemberDeleteData @@ -542,8 +544,8 @@ roleHiddenPermissions role = HiddenPermissions p p roleHiddenPerms :: Role -> Set HiddenPerm roleHiddenPerms RoleOwner = roleHiddenPerms RoleAdmin roleHiddenPerms RoleAdmin = - (roleHiddenPerms RoleMember <>) $ - Set.fromList + (roleHiddenPerms RoleMember <>) + $ Set.fromList [ ChangeLegalHoldTeamSettings, ChangeLegalHoldUserSettings, ChangeTeamSearchVisibility, @@ -555,8 +557,8 @@ roleHiddenPermissions role = HiddenPermissions p p DownloadTeamMembersCsv ] roleHiddenPerms RoleMember = - (roleHiddenPerms RoleExternalPartner <>) $ - Set.fromList + (roleHiddenPerms RoleExternalPartner <>) + $ Set.fromList [ ViewSameTeamEmails, SearchContacts ] diff --git a/libs/wire-api/src/Wire/API/Team/Permission.hs b/libs/wire-api/src/Wire/API/Team/Permission.hs index b4ac0d90455..9d6c6febb78 100644 --- a/libs/wire-api/src/Wire/API/Team/Permission.hs +++ b/libs/wire-api/src/Wire/API/Team/Permission.hs @@ -69,10 +69,11 @@ data Permissions = Permissions permissionsSchema :: ValueSchema NamedSwaggerDoc Permissions permissionsSchema = - objectWithDocModifier "Permissions" (description ?~ docs) $ - Permissions - <$> (permsToInt . _self) .= field "self" (intToPerms <$> schema) - <*> (permsToInt . _copy) .= field "copy" (intToPerms <$> schema) + objectWithDocModifier "Permissions" (description ?~ docs) + $ Permissions + <$> (permsToInt . _self) + .= field "self" (intToPerms <$> schema) + <*> (permsToInt . _copy) .= field "copy" (intToPerms <$> schema) where docs = "This is just a complicated way of representing a team role. self and copy \ diff --git a/libs/wire-api/src/Wire/API/Team/Role.hs b/libs/wire-api/src/Wire/API/Team/Role.hs index d4602394750..3bc6c756566 100644 --- a/libs/wire-api/src/Wire/API/Team/Role.hs +++ b/libs/wire-api/src/Wire/API/Team/Role.hs @@ -86,23 +86,27 @@ data Role = RoleOwner | RoleAdmin | RoleMember | RoleExternalPartner instance ToSchema Role where schema = - enum @Text "Role" $ - flip foldMap [minBound .. maxBound] $ \r -> + enum @Text "Role" + $ flip foldMap [minBound .. maxBound] + $ \r -> element (roleName r) r instance S.ToParamSchema Role where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.enum_ ?~ fmap roleName [minBound .. maxBound] + & S.type_ + ?~ S.OpenApiString + & S.enum_ + ?~ fmap roleName [minBound .. maxBound] instance FromHttpApiData Role where - parseQueryParam name = note ("Unknown role: " <> name) $ - getAlt $ - flip foldMap [minBound .. maxBound] $ \s -> - guard (T.pack (show s) == name) $> s + parseQueryParam name = note ("Unknown role: " <> name) + $ getAlt + $ flip foldMap [minBound .. maxBound] + $ \s -> + guard (T.pack (show s) == name) $> s -roleName :: IsString a => Role -> a +roleName :: (IsString a) => Role -> a roleName RoleOwner = "owner" roleName RoleAdmin = "admin" roleName RoleMember = "member" @@ -113,8 +117,9 @@ instance ToByteString Role where instance FromByteString Role where parser = - asum $ - [minBound .. maxBound] <&> \ctor -> + asum + $ [minBound .. maxBound] + <&> \ctor -> ctor <$ string (roleName ctor) defaultRole :: Role diff --git a/libs/wire-api/src/Wire/API/Team/SearchVisibility.hs b/libs/wire-api/src/Wire/API/Team/SearchVisibility.hs index 76d530f6f15..76e55bac554 100644 --- a/libs/wire-api/src/Wire/API/Team/SearchVisibility.hs +++ b/libs/wire-api/src/Wire/API/Team/SearchVisibility.hs @@ -80,8 +80,9 @@ newtype TeamSearchVisibilityView = TeamSearchVisibilityView TeamSearchVisibility instance ToSchema TeamSearchVisibilityView where schema = - objectWithDocModifier "TeamSearchVisibilityView" (description ?~ "Search visibility value for the team") $ - TeamSearchVisibilityView - <$> unwrap .= fieldWithDocModifier "search_visibility" (description ?~ "value of visibility") schema + objectWithDocModifier "TeamSearchVisibilityView" (description ?~ "Search visibility value for the team") + $ TeamSearchVisibilityView + <$> unwrap + .= fieldWithDocModifier "search_visibility" (description ?~ "value of visibility") schema where unwrap (TeamSearchVisibilityView v) = v diff --git a/libs/wire-api/src/Wire/API/Team/Size.hs b/libs/wire-api/src/Wire/API/Team/Size.hs index ce0d8fe6468..0c3d2777742 100644 --- a/libs/wire-api/src/Wire/API/Team/Size.hs +++ b/libs/wire-api/src/Wire/API/Team/Size.hs @@ -33,8 +33,9 @@ newtype TeamSize = TeamSize Natural instance ToSchema TeamSize where schema = - objectWithDocModifier "TeamSize" (description ?~ "A simple object with a total number of team members.") $ - TeamSize <$> (unTeamSize .= fieldWithDocModifier "teamSize" (description ?~ "Team size.") schema) + objectWithDocModifier "TeamSize" (description ?~ "A simple object with a total number of team members.") + $ TeamSize + <$> (unTeamSize .= fieldWithDocModifier "teamSize" (description ?~ "Team size.") schema) where unTeamSize :: TeamSize -> Natural unTeamSize (TeamSize n) = n diff --git a/libs/wire-api/src/Wire/API/Unreachable.hs b/libs/wire-api/src/Wire/API/Unreachable.hs index 54055ae6359..ab640fade82 100644 --- a/libs/wire-api/src/Wire/API/Unreachable.hs +++ b/libs/wire-api/src/Wire/API/Unreachable.hs @@ -42,10 +42,10 @@ instance Semigroup UnreachableUsers where instance ToSchema UnreachableUsers where schema = - named "UnreachableUsers" $ - UnreachableUsers - <$> unreachableUsers - .= nonEmptyArray schema + named "UnreachableUsers" + $ UnreachableUsers + <$> unreachableUsers + .= nonEmptyArray schema unreachableFromList :: [Qualified UserId] -> Maybe UnreachableUsers unreachableFromList = fmap (UnreachableUsers . NE.nub) . nonEmpty diff --git a/libs/wire-api/src/Wire/API/User.hs b/libs/wire-api/src/Wire/API/User.hs index 2e3e6f0a017..22ee689e469 100644 --- a/libs/wire-api/src/Wire/API/User.hs +++ b/libs/wire-api/src/Wire/API/User.hs @@ -243,10 +243,10 @@ newtype UserIdList = UserIdList {mUsers :: [UserId]} instance ToSchema UserIdList where schema = - object "UserIdList" $ - UserIdList - <$> mUsers - .= field "user_ids" (array schema) + object "UserIdList" + $ UserIdList + <$> mUsers + .= field "user_ids" (array schema) -- | Response type for endpoints returning lists of users with a specific connection state. -- E.g. 'getContactList' returns a 'UserIds' containing the list of connections in an @@ -262,10 +262,10 @@ newtype UserIds = UserIds instance ToSchema UserIds where schema = - object "UserIds" $ - UserIds - <$> cUsers - .= field "ids" (array schema) + object "UserIds" + $ UserIds + <$> cUsers + .= field "ids" (array schema) -------------------------------------------------------------------------------- -- misc internal @@ -277,10 +277,10 @@ newtype GetActivationCodeResp = GetActivationCodeResp {fromGetActivationCodeResp instance ToSchema GetActivationCodeResp where schema = - object "GetActivationCodeResp" $ - curry GetActivationCodeResp - <$> (fst . fromGetActivationCodeResp) .= field "key" schema - <*> (snd . fromGetActivationCodeResp) .= field "code" schema + object "GetActivationCodeResp" + $ curry GetActivationCodeResp + <$> (fst . fromGetActivationCodeResp) .= field "key" schema + <*> (snd . fromGetActivationCodeResp) .= field "code" schema newtype GetPasswordResetCodeResp = GetPasswordResetCodeResp {fromGetPasswordResetCodeResp :: (PasswordResetKey, PasswordResetCode)} deriving (Eq, Show, Generic) @@ -289,10 +289,10 @@ newtype GetPasswordResetCodeResp = GetPasswordResetCodeResp {fromGetPasswordRese instance ToSchema GetPasswordResetCodeResp where schema = - object "GetPasswordResetCodeResp" $ - curry GetPasswordResetCodeResp - <$> (fst . fromGetPasswordResetCodeResp) .= field "key" schema - <*> (snd . fromGetPasswordResetCodeResp) .= field "code" schema + object "GetPasswordResetCodeResp" + $ curry GetPasswordResetCodeResp + <$> (fst . fromGetPasswordResetCodeResp) .= field "key" schema + <*> (snd . fromGetPasswordResetCodeResp) .= field "code" schema data CheckBlacklistResponse = NotBlacklisted | YesBlacklisted @@ -355,10 +355,10 @@ phonePrefixParser :: Text -> Either String PhonePrefix phonePrefixParser p = maybe err pure (parsePhonePrefix p) where err = - Left $ - "Invalid phone number prefix: [" - ++ show p - ++ "]. Expected format similar to E.164 (with 1-15 digits after the +)." + Left + $ "Invalid phone number prefix: [" + ++ show p + ++ "]. Expected format similar to E.164 (with 1-15 digits after the +)." -- | Parses a phone number prefix with a mandatory leading '+'. parsePhonePrefix :: Text -> Maybe PhonePrefix @@ -393,10 +393,10 @@ data ExcludedPrefix = ExcludedPrefix instance ToSchema ExcludedPrefix where schema = - object "ExcludedPrefix" $ - ExcludedPrefix - <$> phonePrefix .= field "phone_prefix" schema - <*> comment .= field "comment" schema + object "ExcludedPrefix" + $ ExcludedPrefix + <$> phonePrefix .= field "phone_prefix" schema + <*> comment .= field "comment" schema -- | If the budget for SMS and voice calls for a phone number -- has been exhausted within a certain time frame, this timeout @@ -409,9 +409,9 @@ newtype PhoneBudgetTimeout = PhoneBudgetTimeout instance ToSchema PhoneBudgetTimeout where schema = - object "PhoneBudgetTimeout" $ - PhoneBudgetTimeout - <$> phoneBudgetTimeout .= field "expires_in" nominalDiffTimeSchema + object "PhoneBudgetTimeout" + $ PhoneBudgetTimeout + <$> phoneBudgetTimeout .= field "expires_in" nominalDiffTimeSchema -- | (32bit precision) nominalDiffTimeSchema :: ValueSchema NamedSwaggerDoc NominalDiffTime @@ -427,9 +427,9 @@ newtype ManagedByUpdate = ManagedByUpdate {mbuManagedBy :: ManagedBy} instance ToSchema ManagedByUpdate where schema = - object "ManagedByUpdate" $ - ManagedByUpdate - <$> mbuManagedBy .= field "managed_by" schema + object "ManagedByUpdate" + $ ManagedByUpdate + <$> mbuManagedBy .= field "managed_by" schema data HavePendingInvitations = WithPendingInvitations @@ -443,9 +443,9 @@ newtype RichInfoUpdate = RichInfoUpdate {riuRichInfo :: RichInfoAssocList} instance ToSchema RichInfoUpdate where schema = - object "RichInfoUpdate" $ - RichInfoUpdate - <$> riuRichInfo .= field "rich_info" schema + object "RichInfoUpdate" + $ RichInfoUpdate + <$> riuRichInfo .= field "rich_info" schema type PasswordResetPair = (PasswordResetKey, PasswordResetCode) @@ -511,19 +511,19 @@ updateConnectionsInternalTag (CreateConnectionForTest _ _) = CreateConnectionFor instance ToSchema UpdateConnectionsInternalTag where schema = - enum @Text "UpdateConnectionsInternalTag" $ - element "BlockForMissingLHConsent" BlockForMissingLHConsentTag - <> element "RemoveLHBlocksInvolving" RemoveLHBlocksInvolvingTag - <> element "CreateConnectionForTest" CreateConnectionForTestTag + enum @Text "UpdateConnectionsInternalTag" + $ element "BlockForMissingLHConsent" BlockForMissingLHConsentTag + <> element "RemoveLHBlocksInvolving" RemoveLHBlocksInvolvingTag + <> element "CreateConnectionForTest" CreateConnectionForTestTag instance ToSchema UpdateConnectionsInternal where schema = - object "UpdateConnectionsInternal" $ - snd - <$> (updateConnectionsInternalTag &&& id) - .= bind - (fst .= field "tag" tagSchema) - (snd .= dispatch untaggedSchema) + object "UpdateConnectionsInternal" + $ snd + <$> (updateConnectionsInternalTag &&& id) + .= bind + (fst .= field "tag" tagSchema) + (snd .= dispatch untaggedSchema) where tagSchema :: ValueSchema NamedSwaggerDoc UpdateConnectionsInternalTag tagSchema = schema @@ -532,18 +532,18 @@ instance ToSchema UpdateConnectionsInternal where UpdateConnectionsInternalTag -> ObjectSchema SwaggerDoc UpdateConnectionsInternal untaggedSchema BlockForMissingLHConsentTag = - tag _BlockForMissingLHConsent $ - (,) - <$> fst .= field "user" schema - <*> snd .= field "others" (array schema) + tag _BlockForMissingLHConsent + $ (,) + <$> fst .= field "user" schema + <*> snd .= field "others" (array schema) untaggedSchema RemoveLHBlocksInvolvingTag = - tag _RemoveLHBlocksInvolving $ - field "user" schema + tag _RemoveLHBlocksInvolving + $ field "user" schema untaggedSchema CreateConnectionForTestTag = - tag _CreateConnectionForTest $ - (,) - <$> fst .= field "user" schema - <*> snd .= field "other" schema + tag _CreateConnectionForTest + $ (,) + <$> fst .= field "user" schema + <*> snd .= field "other" schema deriving via Schema UpdateConnectionsInternal instance (S.ToSchema UpdateConnectionsInternal) @@ -588,7 +588,7 @@ instance (KnownNat max, 1 <= max) => FromJSON (LimitedQualifiedUserIdList max) w parseJSON = A.withObject "LimitedQualifiedUserIdList" $ \o -> LimitedQualifiedUserIdList <$> o A..: "qualified_users" -instance 1 <= max => ToJSON (LimitedQualifiedUserIdList max) where +instance (1 <= max) => ToJSON (LimitedQualifiedUserIdList max) where toJSON e = A.object ["qualified_users" A..= qualifiedUsers e] -------------------------------------------------------------------------------- @@ -621,35 +621,35 @@ data UserProfile = UserProfile instance ToSchema UserProfile where schema = - object "UserProfile" $ - UserProfile - <$> profileQualifiedId - .= field "qualified_id" schema - <* (qUnqualified . profileQualifiedId) - .= optional (field "id" (deprecatedSchema "qualified_id" schema)) - <*> profileName - .= field "name" schema - <*> profilePict - .= (field "picture" schema <|> pure noPict) - <*> profileAssets - .= (field "assets" (array schema) <|> pure []) - <*> profileAccentId - .= field "accent_id" schema - <*> ((\del -> if del then Just True else Nothing) . profileDeleted) - .= maybe_ (fromMaybe False <$> optField "deleted" schema) - <*> profileService - .= maybe_ (optField "service" schema) - <*> profileHandle - .= maybe_ (optField "handle" schema) - <*> profileExpire - .= maybe_ (optField "expires_at" schema) - <*> profileTeam - .= maybe_ (optField "team" schema) - <*> profileEmail - .= maybe_ (optField "email" schema) - <*> profileLegalholdStatus - .= field "legalhold_status" schema - <*> profileSupportedProtocols .= supportedProtocolsObjectSchema + object "UserProfile" + $ UserProfile + <$> profileQualifiedId + .= field "qualified_id" schema + <* (qUnqualified . profileQualifiedId) + .= optional (field "id" (deprecatedSchema "qualified_id" schema)) + <*> profileName + .= field "name" schema + <*> profilePict + .= (field "picture" schema <|> pure noPict) + <*> profileAssets + .= (field "assets" (array schema) <|> pure []) + <*> profileAccentId + .= field "accent_id" schema + <*> ((\del -> if del then Just True else Nothing) . profileDeleted) + .= maybe_ (fromMaybe False <$> optField "deleted" schema) + <*> profileService + .= maybe_ (optField "service" schema) + <*> profileHandle + .= maybe_ (optField "handle" schema) + <*> profileExpire + .= maybe_ (optField "expires_at" schema) + <*> profileTeam + .= maybe_ (optField "team" schema) + <*> profileEmail + .= maybe_ (optField "email" schema) + <*> profileLegalholdStatus + .= field "legalhold_status" schema + <*> profileSupportedProtocols .= supportedProtocolsObjectSchema -------------------------------------------------------------------------------- -- SelfProfile @@ -835,7 +835,8 @@ mkUserProfile emailVisibilityConfigAndViewer u legalHoldStatus = EmailVisibleIfOnTeam -> isJust (userTeam u) EmailVisibleIfOnSameTeam Nothing -> False EmailVisibleIfOnSameTeam (Just (viewerTeamId, viewerMembership)) -> - Just viewerTeamId == userTeam u + Just viewerTeamId + == userTeam u && TeamMember.hasPermission viewerMembership TeamMember.ViewSameTeamEmails in mkUserProfileWithEmail (if isEmailVisible then userEmail u else Nothing) u legalHoldStatus @@ -1040,26 +1041,26 @@ data NewUserSpar = NewUserSpar instance ToSchema NewUserSpar where schema = - object "NewUserSpar" $ - NewUserSpar - <$> newUserSparUUID - .= field "newUserSparUUID" genericToSchema - <*> newUserSparSSOId - .= field "newUserSparSSOId" genericToSchema - <*> newUserSparDisplayName - .= field "newUserSparDisplayName" schema - <*> newUserSparTeamId - .= field "newUserSparTeamId" schema - <*> newUserSparManagedBy - .= field "newUserSparManagedBy" schema - <*> newUserSparHandle - .= maybe_ (optField "newUserSparHandle" schema) - <*> newUserSparRichInfo - .= maybe_ (optField "newUserSparRichInfo" schema) - <*> newUserSparLocale - .= maybe_ (optField "newUserSparLocale" schema) - <*> newUserSparRole - .= field "newUserSparRole" schema + object "NewUserSpar" + $ NewUserSpar + <$> newUserSparUUID + .= field "newUserSparUUID" genericToSchema + <*> newUserSparSSOId + .= field "newUserSparSSOId" genericToSchema + <*> newUserSparDisplayName + .= field "newUserSparDisplayName" schema + <*> newUserSparTeamId + .= field "newUserSparTeamId" schema + <*> newUserSparManagedBy + .= field "newUserSparManagedBy" schema + <*> newUserSparHandle + .= maybe_ (optField "newUserSparHandle" schema) + <*> newUserSparRichInfo + .= maybe_ (optField "newUserSparRichInfo" schema) + <*> newUserSparLocale + .= maybe_ (optField "newUserSparLocale" schema) + <*> newUserSparRole + .= field "newUserSparRole" schema newUserFromSpar :: NewUserSpar -> NewUser newUserFromSpar new = @@ -1228,8 +1229,8 @@ newUserToRaw NewUser {..} = newUserFromRaw :: NewUserRaw -> A.Parser NewUser newUserFromRaw NewUserRaw {..} = do origin <- - either fail pure $ - maybeNewUserOriginFromComponents + either fail pure + $ maybeNewUserOriginFromComponents (isJust newUserRawPassword) (isJust newUserRawSSOId) (newUserRawInvitationCode, newUserRawTeamCode, newUserRawTeam, newUserRawTeamId) @@ -1238,8 +1239,8 @@ newUserFromRaw NewUserRaw {..} = do case (newUserRawExpiresIn, identity) of (Just _, Just _) -> fail "Only users without an identity can expire" _ -> pure newUserRawExpiresIn - pure $ - NewUser + pure + $ NewUser { newUserDisplayName = newUserRawDisplayName, newUserUUID = newUserRawUUID, newUserIdentity = identity, @@ -1425,12 +1426,12 @@ data BindingNewTeamUser = BindingNewTeamUser instance ToSchema BindingNewTeamUser where schema = - object "BindingNewTeamUser" $ - BindingNewTeamUser - <$> bnuTeam - .= bindingNewTeamObjectSchema - <*> bnuCurrency - .= maybe_ (optField "currency" genericToSchema) + object "BindingNewTeamUser" + $ BindingNewTeamUser + <$> bnuTeam + .= bindingNewTeamObjectSchema + <*> bnuCurrency + .= maybe_ (optField "currency" genericToSchema) -------------------------------------------------------------------------------- -- SCIM User Info @@ -1445,12 +1446,12 @@ data ScimUserInfo = ScimUserInfo instance ToSchema ScimUserInfo where schema = - object "ScimUserInfo" $ - ScimUserInfo - <$> suiUserId - .= field "id" schema - <*> suiCreatedOn - .= maybe_ (optField "created_on" schema) + object "ScimUserInfo" + $ ScimUserInfo + <$> suiUserId + .= field "id" schema + <*> suiCreatedOn + .= maybe_ (optField "created_on" schema) newtype ScimUserInfos = ScimUserInfos {scimUserInfos :: [ScimUserInfo]} deriving stock (Eq, Show, Generic) @@ -1459,10 +1460,10 @@ newtype ScimUserInfos = ScimUserInfos {scimUserInfos :: [ScimUserInfo]} instance ToSchema ScimUserInfos where schema = - object "ScimUserInfos" $ - ScimUserInfos - <$> scimUserInfos - .= field "scim_user_infos" (array schema) + object "ScimUserInfos" + $ ScimUserInfos + <$> scimUserInfos + .= field "scim_user_infos" (array schema) ------------------------------------------------------------------------------- -- UserSet @@ -1478,10 +1479,10 @@ newtype UserSet = UserSet instance ToSchema UserSet where schema = - object "UserSet" $ - UserSet - <$> usUsrs - .= field "users" (set schema) + object "UserSet" + $ UserSet + <$> usUsrs + .= field "users" (set schema) -------------------------------------------------------------------------------- -- Profile Updates @@ -1499,16 +1500,16 @@ data UserUpdate = UserUpdate instance ToSchema UserUpdate where schema = - object "UserUpdate" $ - UserUpdate - <$> uupName - .= maybe_ (optField "name" schema) - <*> uupPict - .= maybe_ (optField "picture" schema) - <*> uupAssets - .= maybe_ (optField "assets" (array schema)) - <*> uupAccentId - .= maybe_ (optField "accent_id" schema) + object "UserUpdate" + $ UserUpdate + <$> uupName + .= maybe_ (optField "name" schema) + <*> uupPict + .= maybe_ (optField "picture" schema) + <*> uupAssets + .= maybe_ (optField "assets" (array schema)) + <*> uupAccentId + .= maybe_ (optField "accent_id" schema) data UpdateProfileError = DisplayNameManagedByScim @@ -1545,10 +1546,10 @@ instance ToSchema PasswordChange where ) . object "PasswordChange" $ PasswordChange - <$> cpOldPassword - .= maybe_ (optField "old_password" schema) - <*> cpNewPassword - .= field "new_password" schema + <$> cpOldPassword + .= maybe_ (optField "old_password" schema) + <*> cpNewPassword + .= field "new_password" schema data ChangePasswordError = InvalidCurrentPassword @@ -1579,10 +1580,10 @@ newtype LocaleUpdate = LocaleUpdate {luLocale :: Locale} instance ToSchema LocaleUpdate where schema = - object "LocaleUpdate" $ - LocaleUpdate - <$> luLocale - .= field "locale" schema + object "LocaleUpdate" + $ LocaleUpdate + <$> luLocale + .= field "locale" schema newtype EmailUpdate = EmailUpdate {euEmail :: Email} deriving stock (Eq, Show, Generic) @@ -1591,10 +1592,10 @@ newtype EmailUpdate = EmailUpdate {euEmail :: Email} instance ToSchema EmailUpdate where schema = - object "EmailUpdate" $ - EmailUpdate - <$> euEmail - .= field "email" schema + object "EmailUpdate" + $ EmailUpdate + <$> euEmail + .= field "email" schema instance ToJSON EmailUpdate where toJSON e = A.object ["email" A..= euEmail e] @@ -1610,10 +1611,10 @@ newtype PhoneUpdate = PhoneUpdate {puPhone :: Phone} instance ToSchema PhoneUpdate where schema = - object "PhoneUpdate" $ - PhoneUpdate - <$> puPhone - .= field "phone" schema + object "PhoneUpdate" + $ PhoneUpdate + <$> puPhone + .= field "phone" schema data ChangePhoneError = PhoneExists @@ -1666,8 +1667,9 @@ newtype HandleUpdate = HandleUpdate {huHandle :: Text} instance ToSchema HandleUpdate where schema = - object "HandleUpdate" $ - HandleUpdate <$> huHandle .= field "handle" schema + object "HandleUpdate" + $ HandleUpdate + <$> huHandle .= field "handle" schema data ChangeHandleError = ChangeHandleNoIdentity @@ -1700,8 +1702,9 @@ newtype NameUpdate = NameUpdate {nuHandle :: Text} instance ToSchema NameUpdate where schema = - object "NameUpdate" $ - NameUpdate <$> nuHandle .= field "name" schema + object "NameUpdate" + $ NameUpdate + <$> nuHandle .= field "name" schema data ChangeEmailResponse = ChangeEmailResponseIdempotent @@ -1733,19 +1736,19 @@ newtype DeleteUser = DeleteUser instance ToSchema DeleteUser where schema = - object "DeleteUser" $ - DeleteUser - <$> deleteUserPassword - .= maybe_ (optField "password" schema) + object "DeleteUser" + $ DeleteUser + <$> deleteUserPassword + .= maybe_ (optField "password" schema) mkDeleteUser :: Maybe PlainTextPassword6 -> DeleteUser mkDeleteUser = DeleteUser instance ToJSON DeleteUser where toJSON d = - A.object $ - "password" - A..= deleteUserPassword d + A.object + $ "password" + A..= deleteUserPassword d # [] instance FromJSON DeleteUser where @@ -1766,12 +1769,12 @@ mkVerifyDeleteUser = VerifyDeleteUser instance ToSchema VerifyDeleteUser where schema = - objectWithDocModifier "VerifyDeleteUser" (description ?~ "Data for verifying an account deletion.") $ - VerifyDeleteUser - <$> verifyDeleteUserKey - .= fieldWithDocModifier "key" (description ?~ "The identifying key of the account (i.e. user ID).") schema - <*> verifyDeleteUserCode - .= fieldWithDocModifier "code" (description ?~ "The verification code.") schema + objectWithDocModifier "VerifyDeleteUser" (description ?~ "Data for verifying an account deletion.") + $ VerifyDeleteUser + <$> verifyDeleteUserKey + .= fieldWithDocModifier "key" (description ?~ "The identifying key of the account (i.e. user ID).") schema + <*> verifyDeleteUserCode + .= fieldWithDocModifier "code" (description ?~ "The verification code.") schema -- | A response for a pending deletion code. newtype DeletionCodeTimeout = DeletionCodeTimeout @@ -1782,10 +1785,10 @@ newtype DeletionCodeTimeout = DeletionCodeTimeout instance ToSchema DeletionCodeTimeout where schema = - object "DeletionCodeTimeout" $ - DeletionCodeTimeout - <$> fromDeletionCodeTimeout - .= field "expires_in" schema + object "DeletionCodeTimeout" + $ DeletionCodeTimeout + <$> fromDeletionCodeTimeout + .= field "expires_in" schema instance ToJSON DeletionCodeTimeout where toJSON (DeletionCodeTimeout t) = A.object ["expires_in" A..= t] @@ -1848,13 +1851,17 @@ instance S.ToSchema ListUsersQuery where declareNamedSchema _ = do uids <- S.declareSchemaRef (Proxy @[Qualified UserId]) handles <- S.declareSchemaRef (Proxy @(Range 1 4 [Qualified Handle])) - pure $ - S.NamedSchema (Just "ListUsersQuery") $ - mempty - & S.type_ ?~ S.OpenApiObject - & S.description ?~ "exactly one of qualified_ids or qualified_handles must be provided." - & S.properties .~ InsOrdHashMap.fromList [("qualified_ids", uids), ("qualified_handles", handles)] - & S.example ?~ toJSON (ListUsersByIds [Qualified (Id UUID.nil) (Domain "example.com")]) + pure + $ S.NamedSchema (Just "ListUsersQuery") + $ mempty + & S.type_ + ?~ S.OpenApiObject + & S.description + ?~ "exactly one of qualified_ids or qualified_handles must be provided." + & S.properties + .~ InsOrdHashMap.fromList [("qualified_ids", uids), ("qualified_handles", handles)] + & S.example + ?~ toJSON (ListUsersByIds [Qualified (Id UUID.nil) (Domain "example.com")]) ------------------------------------------------------------------------------- -- AccountStatus @@ -1874,8 +1881,8 @@ data AccountStatus instance Schema.ToSchema AccountStatus where schema = - Schema.enum @Text "AccountStatus" $ - mconcat + Schema.enum @Text "AccountStatus" + $ mconcat [ Schema.element "active" Active, Schema.element "suspended" Suspended, Schema.element "deleted" Deleted, @@ -1908,8 +1915,9 @@ data AccountStatusResp = AccountStatusResp {fromAccountStatusResp :: AccountStat instance Schema.ToSchema AccountStatusResp where schema = - object "AccountStatusResp" $ - AccountStatusResp <$> fromAccountStatusResp .= field "status" schema + object "AccountStatusResp" + $ AccountStatusResp + <$> fromAccountStatusResp .= field "status" schema newtype AccountStatusUpdate = AccountStatusUpdate {suStatus :: AccountStatus} deriving (Generic) @@ -1918,8 +1926,9 @@ newtype AccountStatusUpdate = AccountStatusUpdate {suStatus :: AccountStatus} instance Schema.ToSchema AccountStatusUpdate where schema = - object "AccountStatusUpdate" $ - AccountStatusUpdate <$> suStatus .= field "status" schema + object "AccountStatusUpdate" + $ AccountStatusUpdate + <$> suStatus .= field "status" schema ------------------------------------------------------------------------------- -- UserAccount @@ -1937,10 +1946,10 @@ data UserAccount = UserAccount instance Schema.ToSchema UserAccount where schema = - Schema.object "UserAccount" $ - UserAccount - <$> accountUser Schema..= userObjectSchema - <*> accountStatus Schema..= Schema.field "status" Schema.schema + Schema.object "UserAccount" + $ UserAccount + <$> accountUser Schema..= userObjectSchema + <*> accountStatus Schema..= Schema.field "status" Schema.schema ------------------------------------------------------------------------------- -- NewUserScimInvitation @@ -1960,14 +1969,14 @@ data NewUserScimInvitation = NewUserScimInvitation instance Schema.ToSchema NewUserScimInvitation where schema = - Schema.object "NewUserScimInvitation" $ - NewUserScimInvitation - <$> newUserScimInvTeamId Schema..= Schema.field "team_id" Schema.schema - <*> newUserScimInvUserId Schema..= Schema.field "user_id" Schema.schema - <*> newUserScimInvLocale Schema..= maybe_ (optField "locale" Schema.schema) - <*> newUserScimInvName Schema..= Schema.field "name" Schema.schema - <*> newUserScimInvEmail Schema..= Schema.field "email" Schema.schema - <*> newUserScimInvRole Schema..= Schema.field "role" Schema.schema + Schema.object "NewUserScimInvitation" + $ NewUserScimInvitation + <$> newUserScimInvTeamId Schema..= Schema.field "team_id" Schema.schema + <*> newUserScimInvUserId Schema..= Schema.field "user_id" Schema.schema + <*> newUserScimInvLocale Schema..= maybe_ (optField "locale" Schema.schema) + <*> newUserScimInvName Schema..= Schema.field "name" Schema.schema + <*> newUserScimInvEmail Schema..= Schema.field "email" Schema.schema + <*> newUserScimInvRole Schema..= Schema.field "role" Schema.schema ----------------------------------------------------------------------------- -- SndFactorPasswordChallenge @@ -1982,8 +1991,8 @@ data VerificationAction instance ToSchema VerificationAction where schema = - enum @Text "VerificationAction" $ - mconcat + enum @Text "VerificationAction" + $ mconcat [ element "create_scim_token" CreateScimToken, element "login" Login, element "delete_team" DeleteTeam @@ -2030,12 +2039,12 @@ data SendVerificationCode = SendVerificationCode instance ToSchema SendVerificationCode where schema = - object "SendVerificationCode" $ - SendVerificationCode - <$> svcAction - .= field "action" schema - <*> svcEmail - .= field "email" schema + object "SendVerificationCode" + $ SendVerificationCode + <$> svcAction + .= field "action" schema + <*> svcEmail + .= field "email" schema -------------------------------------------------------------------------------- -- Protocol preferences @@ -2066,8 +2075,8 @@ baseProtocolToProtocol BaseProtocolMLSTag = ProtocolMLSTag instance ToSchema BaseProtocolTag where schema = - enum @Text "BaseProtocol" $ - mconcat + enum @Text "BaseProtocol" + $ mconcat [ element "proteus" BaseProtocolProteusTag, element "mls" BaseProtocolMLSTag ] @@ -2098,10 +2107,10 @@ newtype SupportedProtocolUpdate = SupportedProtocolUpdate instance ToSchema SupportedProtocolUpdate where schema = - object "SupportedProtocolUpdate" $ - SupportedProtocolUpdate - <$> unSupportedProtocolUpdate - .= field "supported_protocols" (set schema) + object "SupportedProtocolUpdate" + $ SupportedProtocolUpdate + <$> unSupportedProtocolUpdate + .= field "supported_protocols" (set schema) ------- Partial Successes data ListUsersById = ListUsersById @@ -2113,7 +2122,7 @@ data ListUsersById = ListUsersById instance ToSchema ListUsersById where schema = - object "ListUsersById" $ - ListUsersById - <$> listUsersByIdFound .= field "found" (array schema) - <*> listUsersByIdFailed .= maybe_ (optField "failed" $ nonEmptyArray schema) + object "ListUsersById" + $ ListUsersById + <$> listUsersByIdFound .= field "found" (array schema) + <*> listUsersByIdFailed .= maybe_ (optField "failed" $ nonEmptyArray schema) diff --git a/libs/wire-api/src/Wire/API/User/Activation.hs b/libs/wire-api/src/Wire/API/User/Activation.hs index 8998854b2e2..d8d6ee968d4 100644 --- a/libs/wire-api/src/Wire/API/User/Activation.hs +++ b/libs/wire-api/src/Wire/API/User/Activation.hs @@ -120,11 +120,14 @@ data Activate = Activate instance ToSchema Activate where schema = - objectWithDocModifier "Activate" objectDocs $ - Activate - <$> (maybeActivationTargetToTuple . activateTarget) .= maybeActivationTargetObjectSchema - <*> activateCode .= fieldWithDocModifier "code" codeDocs schema - <*> activateDryrun .= fieldWithDocModifier "dryrun" dryRunDocs schema + objectWithDocModifier "Activate" objectDocs + $ Activate + <$> (maybeActivationTargetToTuple . activateTarget) + .= maybeActivationTargetObjectSchema + <*> activateCode + .= fieldWithDocModifier "code" codeDocs schema + <*> activateDryrun + .= fieldWithDocModifier "dryrun" dryRunDocs schema where objectDocs :: NamedSwaggerDoc -> NamedSwaggerDoc objectDocs = description ?~ "Data for an activation request." @@ -149,9 +152,12 @@ instance ToSchema Activate where activationTargetTupleObjectSchema :: ObjectSchema SwaggerDoc (Maybe ActivationKey, Maybe Phone, Maybe Email) activationTargetTupleObjectSchema = (,,) - <$> fst3 .= maybe_ (optFieldWithDocModifier "key" keyDocs schema) - <*> snd3 .= maybe_ (optFieldWithDocModifier "phone" phoneDocs schema) - <*> thd3 .= maybe_ (optFieldWithDocModifier "email" emailDocs schema) + <$> fst3 + .= maybe_ (optFieldWithDocModifier "key" keyDocs schema) + <*> snd3 + .= maybe_ (optFieldWithDocModifier "phone" phoneDocs schema) + <*> thd3 + .= maybe_ (optFieldWithDocModifier "email" emailDocs schema) where keyDocs = description ?~ "An opaque key to activate, as it was sent by the API." phoneDocs = description ?~ "A known phone number to activate." @@ -183,10 +189,12 @@ data ActivationResponse = ActivationResponse instance ToSchema ActivationResponse where schema = - objectWithDocModifier "ActivationResponse" (description ?~ "Response body of a successful activation request") $ - ActivationResponse - <$> activatedIdentity .= userIdentityObjectSchema - <*> activatedFirst .= (fromMaybe False <$> optFieldWithDocModifier "first" (description ?~ "Whether this is the first successful activation (i.e. account activation).") schema) + objectWithDocModifier "ActivationResponse" (description ?~ "Response body of a successful activation request") + $ ActivationResponse + <$> activatedIdentity + .= userIdentityObjectSchema + <*> activatedFirst + .= (fromMaybe False <$> optFieldWithDocModifier "first" (description ?~ "Whether this is the first successful activation (i.e. account activation).") schema) -------------------------------------------------------------------------------- -- SendActivationCode @@ -205,11 +213,14 @@ data SendActivationCode = SendActivationCode instance ToSchema SendActivationCode where schema = - objectWithDocModifier "SendActivationCode" objectDesc $ - SendActivationCode - <$> (maybeUserKeyToTuple . saUserKey) .= userKeyObjectSchema - <*> saLocale .= maybe_ (optFieldWithDocModifier "locale" (description ?~ "Locale to use for the activation code template.") schema) - <*> saCall .= (fromMaybe False <$> optFieldWithDocModifier "voice_call" (description ?~ "Request the code with a call instead (default is SMS).") schema) + objectWithDocModifier "SendActivationCode" objectDesc + $ SendActivationCode + <$> (maybeUserKeyToTuple . saUserKey) + .= userKeyObjectSchema + <*> saLocale + .= maybe_ (optFieldWithDocModifier "locale" (description ?~ "Locale to use for the activation code template.") schema) + <*> saCall + .= (fromMaybe False <$> optFieldWithDocModifier "voice_call" (description ?~ "Request the code with a call instead (default is SMS).") schema) where maybeUserKeyToTuple :: Either Email Phone -> (Maybe Email, Maybe Phone) maybeUserKeyToTuple = \case @@ -229,8 +240,10 @@ instance ToSchema SendActivationCode where userKeyTupleObjectSchema :: ObjectSchema SwaggerDoc (Maybe Email, Maybe Phone) userKeyTupleObjectSchema = (,) - <$> fst .= maybe_ (optFieldWithDocModifier "email" phoneDocs schema) - <*> snd .= maybe_ (optFieldWithDocModifier "phone" emailDocs schema) + <$> fst + .= maybe_ (optFieldWithDocModifier "email" phoneDocs schema) + <*> snd + .= maybe_ (optFieldWithDocModifier "phone" emailDocs schema) where emailDocs = description ?~ "Email address to send the code to." phoneDocs = description ?~ "E.164 phone number to send the code to." diff --git a/libs/wire-api/src/Wire/API/User/Auth/LegalHold.hs b/libs/wire-api/src/Wire/API/User/Auth/LegalHold.hs index b1f20c416a8..a1604450227 100644 --- a/libs/wire-api/src/Wire/API/User/Auth/LegalHold.hs +++ b/libs/wire-api/src/Wire/API/User/Auth/LegalHold.hs @@ -38,8 +38,11 @@ data LegalHoldLogin = LegalHoldLogin instance ToSchema LegalHoldLogin where schema = - object "LegalHoldLogin" $ - LegalHoldLogin - <$> lhlUserId .= field "user" schema - <*> lhlPassword .= optField "password" (maybeWithDefault A.Null schema) - <*> lhlLabel .= optField "label" (maybeWithDefault A.Null schema) + object "LegalHoldLogin" + $ LegalHoldLogin + <$> lhlUserId + .= field "user" schema + <*> lhlPassword + .= optField "password" (maybeWithDefault A.Null schema) + <*> lhlLabel + .= optField "label" (maybeWithDefault A.Null schema) diff --git a/libs/wire-api/src/Wire/API/User/Auth/ReAuth.hs b/libs/wire-api/src/Wire/API/User/Auth/ReAuth.hs index 0892089a90d..0e922454201 100644 --- a/libs/wire-api/src/Wire/API/User/Auth/ReAuth.hs +++ b/libs/wire-api/src/Wire/API/User/Auth/ReAuth.hs @@ -42,8 +42,11 @@ data ReAuthUser = ReAuthUser instance ToSchema ReAuthUser where schema = - object "ReAuthUser" $ - ReAuthUser - <$> reAuthPassword .= optField "password" (maybeWithDefault A.Null schema) - <*> reAuthCode .= optField "verification_code" (maybeWithDefault A.Null schema) - <*> reAuthCodeAction .= optField "action" (maybeWithDefault A.Null schema) + object "ReAuthUser" + $ ReAuthUser + <$> reAuthPassword + .= optField "password" (maybeWithDefault A.Null schema) + <*> reAuthCode + .= optField "verification_code" (maybeWithDefault A.Null schema) + <*> reAuthCodeAction + .= optField "action" (maybeWithDefault A.Null schema) diff --git a/libs/wire-api/src/Wire/API/User/Auth/Sso.hs b/libs/wire-api/src/Wire/API/User/Auth/Sso.hs index 0c9daa86859..00b26573bfa 100644 --- a/libs/wire-api/src/Wire/API/User/Auth/Sso.hs +++ b/libs/wire-api/src/Wire/API/User/Auth/Sso.hs @@ -34,7 +34,9 @@ data SsoLogin = SsoLogin instance ToSchema SsoLogin where schema = - object "SsoLogin" $ - SsoLogin - <$> ssoUserId .= field "user" schema - <*> ssoLabel .= optField "label" (maybeWithDefault A.Null schema) + object "SsoLogin" + $ SsoLogin + <$> ssoUserId + .= field "user" schema + <*> ssoLabel + .= optField "label" (maybeWithDefault A.Null schema) diff --git a/libs/wire-api/src/Wire/API/User/Client.hs b/libs/wire-api/src/Wire/API/User/Client.hs index ecdc20531bd..ffe2ab7a725 100644 --- a/libs/wire-api/src/Wire/API/User/Client.hs +++ b/libs/wire-api/src/Wire/API/User/Client.hs @@ -154,8 +154,8 @@ data ClientCapability instance ToSchema ClientCapability where schema = - enum @Text "ClientCapability" $ - element "legalhold-implicit-consent" ClientSupportsLegalholdImplicitConsent + enum @Text "ClientCapability" + $ element "legalhold-implicit-consent" ClientSupportsLegalholdImplicitConsent instance C.Cql ClientCapability where ctype = C.Tagged C.IntColumn @@ -176,11 +176,12 @@ newtype ClientCapabilityList = ClientCapabilityList {fromClientCapabilityList :: instance ToSchema ClientCapabilityList where schema = - object "ClientCapabilityList" $ - ClientCapabilityList <$> fromClientCapabilityList .= fmap runIdentity capabilitiesFieldSchema + object "ClientCapabilityList" + $ ClientCapabilityList + <$> fromClientCapabilityList .= fmap runIdentity capabilitiesFieldSchema capabilitiesFieldSchema :: - FieldFunctor SwaggerDoc f => + (FieldFunctor SwaggerDoc f) => ObjectSchemaP SwaggerDoc (Set ClientCapability) (f (Set ClientCapability)) capabilitiesFieldSchema = Set.toList @@ -201,7 +202,7 @@ newtype UserClientMap a = UserClientMap deriving newtype (Semigroup, Monoid) deriving (FromJSON, ToJSON, Swagger.ToSchema) via Schema (UserClientMap a) -instance ToSchema a => ToSchema (UserClientMap a) where +instance (ToSchema a) => ToSchema (UserClientMap a) where schema = userClientMapSchema schema class WrapName doc where @@ -218,8 +219,9 @@ userClientMapSchema :: ValueSchema doc a -> ValueSchema doc (UserClientMap a) userClientMapSchema sch = - over doc (wrapName (schemaDoc sch) ("UserClientMap" <>)) $ - UserClientMap <$> userClientMap .= map_ (map_ sch) + over doc (wrapName (schemaDoc sch) ("UserClientMap" <>)) + $ UserClientMap + <$> userClientMap .= map_ (map_ sch) newtype UserClientPrekeyMap = UserClientPrekeyMap {getUserClientPrekeyMap :: UserClientMap (Maybe Prekey)} @@ -234,8 +236,8 @@ instance ToSchema UserClientPrekeyMap where schema = UserClientPrekeyMap <$> getUserClientPrekeyMap .= addDoc sch where sch = - named "UserClientPrekeyMap" $ - userClientMapSchema (nullable (unnamed schema)) + named "UserClientPrekeyMap" + $ userClientMapSchema (nullable (unnamed schema)) addDoc = Swagger.schema . Swagger.example ?~ toJSON @@ -247,7 +249,7 @@ instance ToSchema UserClientPrekeyMap where ) ) -instance Arbitrary a => Arbitrary (UserClientMap a) where +instance (Arbitrary a) => Arbitrary (UserClientMap a) where arbitrary = UserClientMap <$> mapOf' arbitrary (mapOf' arbitrary arbitrary) newtype QualifiedUserClientMap a = QualifiedUserClientMap @@ -256,25 +258,27 @@ newtype QualifiedUserClientMap a = QualifiedUserClientMap deriving stock (Eq, Show, Functor) deriving (FromJSON, ToJSON, Swagger.ToSchema) via Schema (QualifiedUserClientMap a) -instance Semigroup a => Semigroup (QualifiedUserClientMap a) where +instance (Semigroup a) => Semigroup (QualifiedUserClientMap a) where (QualifiedUserClientMap m1) <> (QualifiedUserClientMap m2) = QualifiedUserClientMap $ Map.unionWith (Map.unionWith (Map.unionWith (<>))) m1 m2 -instance Semigroup (QualifiedUserClientMap a) => Monoid (QualifiedUserClientMap a) where +instance (Semigroup (QualifiedUserClientMap a)) => Monoid (QualifiedUserClientMap a) where mempty = QualifiedUserClientMap mempty -instance Arbitrary a => Arbitrary (QualifiedUserClientMap a) where +instance (Arbitrary a) => Arbitrary (QualifiedUserClientMap a) where arbitrary = QualifiedUserClientMap <$> mapOf' arbitrary (mapOf' arbitrary (mapOf' arbitrary arbitrary)) -instance ToSchema a => ToSchema (QualifiedUserClientMap a) where +instance (ToSchema a) => ToSchema (QualifiedUserClientMap a) where schema = qualifiedUserClientMapSchema schema qualifiedUserClientMapSchema :: ValueSchema NamedSwaggerDoc a -> ValueSchema NamedSwaggerDoc (QualifiedUserClientMap a) qualifiedUserClientMapSchema sch = - addDoc . named nm $ - QualifiedUserClientMap <$> qualifiedUserClientMap .= map_ (map_ (map_ sch)) + addDoc + . named nm + $ QualifiedUserClientMap + <$> qualifiedUserClientMap .= map_ (map_ (map_ sch)) where innerSchema = userClientMapSchema sch nm = "QualifiedUserClientMap" <> maybe "" ("_" <>) (getName (schemaDoc sch)) @@ -301,10 +305,10 @@ instance Arbitrary QualifiedUserClientPrekeyMapV4 where instance ToSchema QualifiedUserClientPrekeyMapV4 where schema = - object "QualifiedUserClientPrekeyMapV4" $ - QualifiedUserClientPrekeyMapV4 - <$> fmap to' (from' .= field "qualified_user_client_prekeys" (map_ schema)) - <*> failedToList .= maybe_ (optField "failed_to_list" (array schema)) + object "QualifiedUserClientPrekeyMapV4" + $ QualifiedUserClientPrekeyMapV4 + <$> fmap to' (from' .= field "qualified_user_client_prekeys" (map_ schema)) + <*> failedToList .= maybe_ (optField "failed_to_list" (array schema)) where from' :: QualifiedUserClientPrekeyMapV4 -> Map Domain UserClientPrekeyMap from' = coerce . qualifiedUserClientPrekeys @@ -321,8 +325,9 @@ newtype QualifiedUserClientPrekeyMap = QualifiedUserClientPrekeyMap instance ToSchema QualifiedUserClientPrekeyMap where schema = - named "QualifiedUserClientPrekeyMap" $ - mkQualifiedUserClientPrekeyMap <$> unmk .= map_ schema + named "QualifiedUserClientPrekeyMap" + $ mkQualifiedUserClientPrekeyMap + <$> unmk .= map_ schema where unmk :: QualifiedUserClientPrekeyMap -> Map Domain UserClientPrekeyMap unmk = coerce @@ -351,10 +356,10 @@ data ClientInfo = ClientInfo instance ToSchema ClientInfo where schema = - object "ClientInfo" $ - ClientInfo - <$> ciId .= field "id" schema - <*> ciMLS .= field "mls" schema + object "ClientInfo" + $ ClientInfo + <$> ciId .= field "id" schema + <*> ciMLS .= field "mls" schema -------------------------------------------------------------------------------- -- UserClients @@ -370,12 +375,12 @@ newtype UserClientsFull = UserClientsFull -- place and write something in English into the docs here. instance Swagger.ToSchema UserClientsFull where declareNamedSchema _ = do - pure $ - NamedSchema (Just "UserClientsFull") $ - mempty - & type_ ?~ OpenApiObject - & description ?~ "Dictionary object of `Client` objects indexed by `UserId`." - & example ?~ "{\"1355c55a-0ac8-11ee-97ee-db1a6351f093\": , ...}" + pure + $ NamedSchema (Just "UserClientsFull") + $ mempty + & type_ ?~ OpenApiObject + & description ?~ "Dictionary object of `Client` objects indexed by `UserId`." + & example ?~ "{\"1355c55a-0ac8-11ee-97ee-db1a6351f093\": , ...}" instance ToJSON UserClientsFull where toJSON = @@ -506,18 +511,18 @@ mlsPublicKeysSchema = clientSchema :: Maybe Version -> ValueSchema NamedSwaggerDoc Client clientSchema mv = - object ("Client" <> T.pack (foldMap show mv)) $ - Client - <$> clientId .= field "id" schema - <*> clientType .= field "type" schema - <*> clientTime .= field "time" schema - <*> clientClass .= maybe_ (optField "class" schema) - <*> clientLabel .= maybe_ (optField "label" schema) - <*> clientCookie .= maybe_ (optField "cookie" schema) - <*> clientModel .= maybe_ (optField "model" schema) - <*> clientCapabilities .= (fromMaybe mempty <$> caps) - <*> clientMLSPublicKeys .= mlsPublicKeysFieldSchema - <*> clientLastActive .= maybe_ (optField "last_active" utcTimeSchema) + object ("Client" <> T.pack (foldMap show mv)) + $ Client + <$> clientId .= field "id" schema + <*> clientType .= field "type" schema + <*> clientTime .= field "time" schema + <*> clientClass .= maybe_ (optField "class" schema) + <*> clientLabel .= maybe_ (optField "label" schema) + <*> clientCookie .= maybe_ (optField "cookie" schema) + <*> clientModel .= maybe_ (optField "model" schema) + <*> clientCapabilities .= (fromMaybe mempty <$> caps) + <*> clientMLSPublicKeys .= mlsPublicKeysFieldSchema + <*> clientLastActive .= maybe_ (optField "last_active" utcTimeSchema) where caps :: ObjectSchemaP SwaggerDoc ClientCapabilityList (Maybe ClientCapabilityList) caps = case mv of @@ -555,10 +560,10 @@ data ClientList = ClientList {clClients :: [ClientId]} instance ToSchema ClientList where schema = - object "ClientList" $ - ClientList - <$> clClients - .= field "client_ids" (array schema) + object "ClientList" + $ ClientList + <$> clClients + .= field "client_ids" (array schema) -------------------------------------------------------------------------------- -- PubClient @@ -574,10 +579,10 @@ data PubClient = PubClient instance ToSchema PubClient where schema = - object "PubClient" $ - PubClient - <$> pubClientId .= field "id" schema - <*> pubClientClass .= maybe_ (optField "class" schema) + object "PubClient" + $ PubClient + <$> pubClientId .= field "id" schema + <*> pubClientClass .= maybe_ (optField "class" schema) -------------------------------------------------------------------------------- -- Client Type/Class @@ -609,10 +614,10 @@ data ClientType instance ToSchema ClientType where schema = - enum @Text "ClientType" $ - element "temporary" TemporaryClientType - <> element "permanent" PermanentClientType - <> element "legalhold" LegalHoldClientType + enum @Text "ClientType" + $ element "temporary" TemporaryClientType + <> element "permanent" PermanentClientType + <> element "legalhold" LegalHoldClientType instance C.Cql ClientType where ctype = C.Tagged C.IntColumn @@ -636,11 +641,11 @@ data ClientClass instance ToSchema ClientClass where schema = - enum @Text "ClientClass" $ - element "phone" PhoneClient - <> element "tablet" TabletClient - <> element "desktop" DesktopClient - <> element "legalhold" LegalHoldClient + enum @Text "ClientClass" + $ element "phone" PhoneClient + <> element "tablet" TabletClient + <> element "desktop" DesktopClient + <> element "legalhold" LegalHoldClient instance C.Cql ClientClass where ctype = C.Tagged C.IntColumn @@ -677,63 +682,63 @@ data NewClient = NewClient instance ToSchema NewClient where schema = - object "NewClient" $ - NewClient - <$> newClientPrekeys - .= fieldWithDocModifier - "prekeys" - (description ?~ "Prekeys for other clients to establish OTR sessions.") - (array schema) - <*> newClientLastKey - .= fieldWithDocModifier - "lastkey" - ( description - ?~ "The last resort prekey for other clients to establish OTR sessions. \ - \This key must have the ID 0xFFFF and is never deleted." - ) - schema - <*> newClientType - .= fieldWithDocModifier - "type" - ( description - ?~ "The type of client to register. A user may have no more than \ - \7 (seven) permanent clients and 1 (one) temporary client. When the \ - \limit of permanent clients is reached, an error is returned. \ - \When a temporary client already exists, it is replaced." - ) - schema - <*> newClientLabel .= maybe_ (optField "label" schema) - <*> newClientClass - .= maybe_ - ( optFieldWithDocModifier - "class" - ( description - ?~ "The device class this client belongs to. \ - \Either 'phone', 'tablet', or 'desktop'." - ) - schema - ) - <*> newClientCookie - .= maybe_ - ( optFieldWithDocModifier - "cookie" - (description ?~ "The cookie label, i.e. the label used when logging in.") - schema - ) - <*> newClientPassword - .= maybe_ - ( optFieldWithDocModifier - "password" - ( description - ?~ "The password of the authenticated user for verification. \ - \Note: Required for registration of the 2nd, 3rd, ... client." - ) - schema - ) - <*> newClientModel .= maybe_ (optField "model" schema) - <*> newClientCapabilities .= maybe_ capabilitiesFieldSchema - <*> newClientMLSPublicKeys .= mlsPublicKeysFieldSchema - <*> newClientVerificationCode .= maybe_ (optField "verification_code" schema) + object "NewClient" + $ NewClient + <$> newClientPrekeys + .= fieldWithDocModifier + "prekeys" + (description ?~ "Prekeys for other clients to establish OTR sessions.") + (array schema) + <*> newClientLastKey + .= fieldWithDocModifier + "lastkey" + ( description + ?~ "The last resort prekey for other clients to establish OTR sessions. \ + \This key must have the ID 0xFFFF and is never deleted." + ) + schema + <*> newClientType + .= fieldWithDocModifier + "type" + ( description + ?~ "The type of client to register. A user may have no more than \ + \7 (seven) permanent clients and 1 (one) temporary client. When the \ + \limit of permanent clients is reached, an error is returned. \ + \When a temporary client already exists, it is replaced." + ) + schema + <*> newClientLabel .= maybe_ (optField "label" schema) + <*> newClientClass + .= maybe_ + ( optFieldWithDocModifier + "class" + ( description + ?~ "The device class this client belongs to. \ + \Either 'phone', 'tablet', or 'desktop'." + ) + schema + ) + <*> newClientCookie + .= maybe_ + ( optFieldWithDocModifier + "cookie" + (description ?~ "The cookie label, i.e. the label used when logging in.") + schema + ) + <*> newClientPassword + .= maybe_ + ( optFieldWithDocModifier + "password" + ( description + ?~ "The password of the authenticated user for verification. \ + \Note: Required for registration of the 2nd, 3rd, ... client." + ) + schema + ) + <*> newClientModel .= maybe_ (optField "model" schema) + <*> newClientCapabilities .= maybe_ capabilitiesFieldSchema + <*> newClientMLSPublicKeys .= mlsPublicKeysFieldSchema + <*> newClientVerificationCode .= maybe_ (optField "verification_code" schema) newClient :: ClientType -> LastPrekey -> NewClient newClient t k = @@ -778,31 +783,31 @@ defUpdateClient = instance ToSchema UpdateClient where schema = - object "UpdateClient" $ - UpdateClient - <$> updateClientPrekeys - .= ( fromMaybe [] - <$> optFieldWithDocModifier - "prekeys" - (description ?~ "New prekeys for other clients to establish OTR sessions.") - (array schema) - ) - <*> updateClientLastKey - .= maybe_ - ( optFieldWithDocModifier - "lastkey" - (description ?~ "New last-resort prekey.") - schema - ) - <*> updateClientLabel - .= maybe_ - ( optFieldWithDocModifier - "label" - (description ?~ "A new name for this client.") - schema - ) - <*> updateClientCapabilities .= maybe_ capabilitiesFieldSchema - <*> updateClientMLSPublicKeys .= mlsPublicKeysFieldSchema + object "UpdateClient" + $ UpdateClient + <$> updateClientPrekeys + .= ( fromMaybe [] + <$> optFieldWithDocModifier + "prekeys" + (description ?~ "New prekeys for other clients to establish OTR sessions.") + (array schema) + ) + <*> updateClientLastKey + .= maybe_ + ( optFieldWithDocModifier + "lastkey" + (description ?~ "New last-resort prekey.") + schema + ) + <*> updateClientLabel + .= maybe_ + ( optFieldWithDocModifier + "label" + (description ?~ "A new name for this client.") + schema + ) + <*> updateClientCapabilities .= maybe_ capabilitiesFieldSchema + <*> updateClientMLSPublicKeys .= mlsPublicKeysFieldSchema -------------------------------------------------------------------------------- -- RmClient @@ -816,13 +821,13 @@ newtype RmClient = RmClient instance ToSchema RmClient where schema = - object "DeleteClient" $ - RmClient - <$> rmPassword - .= optFieldWithDocModifier - "password" - ( description - ?~ "The password of the authenticated user for verification. \ - \The password is not required for deleting temporary clients." - ) - (maybeWithDefault A.Null schema) + object "DeleteClient" + $ RmClient + <$> rmPassword + .= optFieldWithDocModifier + "password" + ( description + ?~ "The password of the authenticated user for verification. \ + \The password is not required for deleting temporary clients." + ) + (maybeWithDefault A.Null schema) diff --git a/libs/wire-api/src/Wire/API/User/Client/DPoPAccessToken.hs b/libs/wire-api/src/Wire/API/User/Client/DPoPAccessToken.hs index 980e376e7fd..8419e42a927 100644 --- a/libs/wire-api/src/Wire/API/User/Client/DPoPAccessToken.hs +++ b/libs/wire-api/src/Wire/API/User/Client/DPoPAccessToken.hs @@ -77,8 +77,8 @@ data AccessTokenType = DPoP instance ToSchema AccessTokenType where schema = - enum @Text "AccessTokenType" $ - mconcat + enum @Text "AccessTokenType" + $ mconcat [ element "DPoP" DPoP ] @@ -92,8 +92,11 @@ data DPoPAccessTokenResponse = DPoPAccessTokenResponse instance ToSchema DPoPAccessTokenResponse where schema = - object "DPoPAccessTokenResponse" $ - DPoPAccessTokenResponse - <$> datrToken .= field "token" schema - <*> datrType .= field "type" schema - <*> datrExpiresIn .= field "expires_in" schema + object "DPoPAccessTokenResponse" + $ DPoPAccessTokenResponse + <$> datrToken + .= field "token" schema + <*> datrType + .= field "type" schema + <*> datrExpiresIn + .= field "expires_in" schema diff --git a/libs/wire-api/src/Wire/API/User/Client/Prekey.hs b/libs/wire-api/src/Wire/API/User/Client/Prekey.hs index 9447da1b530..64dc0d54f12 100644 --- a/libs/wire-api/src/Wire/API/User/Client/Prekey.hs +++ b/libs/wire-api/src/Wire/API/User/Client/Prekey.hs @@ -61,10 +61,12 @@ data Prekey = Prekey instance ToSchema Prekey where schema = - object "Prekey" $ - Prekey - <$> prekeyId .= field "id" schema - <*> prekeyKey .= field "key" schema + object "Prekey" + $ Prekey + <$> prekeyId + .= field "id" schema + <*> prekeyKey + .= field "key" schema -- | Construct a new client ID from a prekey. -- @@ -94,7 +96,8 @@ instance ToSchema LastPrekey where schema = LastPrekey <$> unpackLastPrekey .= schema `withParser` check where check x = - x <$ guard (prekeyId x == lastPrekeyId) + x + <$ guard (prekeyId x == lastPrekeyId) <|> fail "Invalid last prekey ID" instance Arbitrary LastPrekey where @@ -124,10 +127,12 @@ data PrekeyBundle = PrekeyBundle instance ToSchema PrekeyBundle where schema = - object "PrekeyBundle" $ - PrekeyBundle - <$> prekeyUser .= field "user" schema - <*> prekeyClients .= field "clients" (array schema) + object "PrekeyBundle" + $ PrekeyBundle + <$> prekeyUser + .= field "user" schema + <*> prekeyClients + .= field "clients" (array schema) -------------------------------------------------------------------------------- -- ClientPrekey @@ -142,7 +147,9 @@ data ClientPrekey = ClientPrekey instance ToSchema ClientPrekey where schema = - object "ClientPrekey" $ - ClientPrekey - <$> prekeyClient .= field "client" schema - <*> prekeyData .= field "prekey" schema + object "ClientPrekey" + $ ClientPrekey + <$> prekeyClient + .= field "client" schema + <*> prekeyData + .= field "prekey" schema diff --git a/libs/wire-api/src/Wire/API/User/Handle.hs b/libs/wire-api/src/Wire/API/User/Handle.hs index 3db27ef8c12..75aeee1b188 100644 --- a/libs/wire-api/src/Wire/API/User/Handle.hs +++ b/libs/wire-api/src/Wire/API/User/Handle.hs @@ -45,11 +45,11 @@ newtype UserHandleInfo = UserHandleInfo {userHandleId :: Qualified UserId} instance ToSchema UserHandleInfo where schema = - object "UserHandleInfo" $ - UserHandleInfo - <$> userHandleId .= field "qualified_user" schema - <* (qUnqualified . userHandleId) - .= optional (field "user" (deprecatedSchema "qualified_user" schema)) + object "UserHandleInfo" + $ UserHandleInfo + <$> userHandleId .= field "qualified_user" schema + <* (qUnqualified . userHandleId) + .= optional (field "user" (deprecatedSchema "qualified_user" schema)) -------------------------------------------------------------------------------- -- CheckHandles @@ -80,7 +80,7 @@ instance FromJSON CheckHandles where instance ToSchema CheckHandles where schema = - object "CheckHandles" $ - CheckHandles - <$> checkHandlesList .= field "handles" (fromRange .= rangedSchema (array schema)) - <*> checkHandlesNum .= field "return" schema + object "CheckHandles" + $ CheckHandles + <$> checkHandlesList .= field "handles" (fromRange .= rangedSchema (array schema)) + <*> checkHandlesNum .= field "return" schema diff --git a/libs/wire-api/src/Wire/API/User/Orphans.hs b/libs/wire-api/src/Wire/API/User/Orphans.hs index 5cb2e0225db..9f6f3ea2145 100644 --- a/libs/wire-api/src/Wire/API/User/Orphans.hs +++ b/libs/wire-api/src/Wire/API/User/Orphans.hs @@ -59,8 +59,8 @@ instance ToSchema CountryCode -- Preserve the old prefix semantics for types that are coming from outside of this repo. samlSchemaOptions :: SchemaOptions samlSchemaOptions = - fromAesonOptions $ - deriveJSONOptions + fromAesonOptions + $ deriveJSONOptions { A.fieldLabelModifier = fieldMod . dropPrefix } where @@ -95,12 +95,12 @@ instance ToSchema SAML.NameIDFormat where instance ToSchema (SAML.FormRedirect SAML.AuthnRequest) where declareNamedSchema _ = do authnReqSchema <- declareSchemaRef (Proxy @SAML.AuthnRequest) - pure $ - NamedSchema (Just "FormRedirect") $ - mempty - & type_ ?~ OpenApiObject - & properties . at "uri" ?~ Inline (toSchema (Proxy @Text)) - & properties . at "xml" ?~ authnReqSchema + pure + $ NamedSchema (Just "FormRedirect") + $ mempty + & type_ ?~ OpenApiObject + & properties . at "uri" ?~ Inline (toSchema (Proxy @Text)) + & properties . at "xml" ?~ authnReqSchema instance ToSchema (SAML.ID SAML.AuthnRequest) where declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions @@ -114,13 +114,13 @@ instance ToSchema SAML.SPMetadata where instance ToSchema Void where declareNamedSchema _ = declareNamedSchema (Proxy @String) -instance HasOpenApi route => HasOpenApi (SM.MultipartForm SM.Mem resp :> route) where +instance (HasOpenApi route) => HasOpenApi (SM.MultipartForm SM.Mem resp :> route) where toOpenApi _proxy = toOpenApi (Proxy @route) instance ToSchema SAML.IdPId where declareNamedSchema _ = declareNamedSchema (Proxy @UUID) -instance ToSchema a => ToSchema (SAML.IdPConfig a) where +instance (ToSchema a) => ToSchema (SAML.IdPConfig a) where declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions instance ToSchema SAML.Issuer where diff --git a/libs/wire-api/src/Wire/API/User/Password.hs b/libs/wire-api/src/Wire/API/User/Password.hs index a4c3f92c2ae..bb7849351ab 100644 --- a/libs/wire-api/src/Wire/API/User/Password.hs +++ b/libs/wire-api/src/Wire/API/User/Password.hs @@ -60,9 +60,10 @@ newtype NewPasswordReset = NewPasswordReset (Either Email Phone) instance ToSchema NewPasswordReset where schema = - objectWithDocModifier "NewPasswordReset" objectDesc $ - NewPasswordReset - <$> (toTuple . unNewPasswordReset) Schema..= newPasswordResetObjectSchema + objectWithDocModifier "NewPasswordReset" objectDesc + $ NewPasswordReset + <$> (toTuple . unNewPasswordReset) + Schema..= newPasswordResetObjectSchema where unNewPasswordReset :: NewPasswordReset -> Either Email Phone unNewPasswordReset (NewPasswordReset v) = v @@ -76,8 +77,10 @@ instance ToSchema NewPasswordReset where newPasswordResetTupleObjectSchema :: ObjectSchema SwaggerDoc (Maybe Email, Maybe Phone) newPasswordResetTupleObjectSchema = (,) - <$> fst .= maybe_ (optFieldWithDocModifier "email" phoneDocs schema) - <*> snd .= maybe_ (optFieldWithDocModifier "phone" emailDocs schema) + <$> fst + .= maybe_ (optFieldWithDocModifier "email" phoneDocs schema) + <*> snd + .= maybe_ (optFieldWithDocModifier "phone" emailDocs schema) where emailDocs :: NamedSwaggerDoc -> NamedSwaggerDoc emailDocs = description ?~ "Email" @@ -112,11 +115,14 @@ data CompletePasswordReset = CompletePasswordReset instance ToSchema CompletePasswordReset where schema = - objectWithDocModifier "CompletePasswordReset" objectDocs $ - CompletePasswordReset - <$> (maybePasswordResetIdentityToTuple . cpwrIdent) .= maybePasswordResetIdentityObjectSchema - <*> cpwrCode .= fieldWithDocModifier "code" codeDocs schema - <*> cpwrPassword .= fieldWithDocModifier "password" pwDocs schema + objectWithDocModifier "CompletePasswordReset" objectDocs + $ CompletePasswordReset + <$> (maybePasswordResetIdentityToTuple . cpwrIdent) + .= maybePasswordResetIdentityObjectSchema + <*> cpwrCode + .= fieldWithDocModifier "code" codeDocs schema + <*> cpwrPassword + .= fieldWithDocModifier "password" pwDocs schema where objectDocs :: NamedSwaggerDoc -> NamedSwaggerDoc objectDocs = description ?~ "Data to complete a password reset" @@ -134,9 +140,12 @@ instance ToSchema CompletePasswordReset where passwordResetIdentityTupleObjectSchema :: ObjectSchema SwaggerDoc (Maybe PasswordResetKey, Maybe Email, Maybe Phone) passwordResetIdentityTupleObjectSchema = (,,) - <$> fst3 .= maybe_ (optFieldWithDocModifier "key" keyDocs schema) - <*> snd3 .= maybe_ (optFieldWithDocModifier "email" emailDocs schema) - <*> thd3 .= maybe_ (optFieldWithDocModifier "phone" phoneDocs schema) + <$> fst3 + .= maybe_ (optFieldWithDocModifier "key" keyDocs schema) + <*> snd3 + .= maybe_ (optFieldWithDocModifier "email" emailDocs schema) + <*> thd3 + .= maybe_ (optFieldWithDocModifier "phone" phoneDocs schema) where keyDocs = description ?~ "An opaque key for a pending password reset." emailDocs = description ?~ "A known email with a pending password reset." @@ -208,10 +217,12 @@ data PasswordReset = PasswordReset instance ToSchema PasswordReset where schema = - objectWithDocModifier "PasswordReset" objectDocs $ - PasswordReset - <$> pwrCode .= fieldWithDocModifier "code" codeDocs schema - <*> pwrPassword .= fieldWithDocModifier "password" pwDocs schema + objectWithDocModifier "PasswordReset" objectDocs + $ PasswordReset + <$> pwrCode + .= fieldWithDocModifier "code" codeDocs schema + <*> pwrPassword + .= fieldWithDocModifier "password" pwDocs schema where objectDocs :: NamedSwaggerDoc -> NamedSwaggerDoc objectDocs = description ?~ "Data to complete a password reset" diff --git a/libs/wire-api/src/Wire/API/User/Profile.hs b/libs/wire-api/src/Wire/API/User/Profile.hs index 9a5e06883d2..734ea4d81ab 100644 --- a/libs/wire-api/src/Wire/API/User/Profile.hs +++ b/libs/wire-api/src/Wire/API/User/Profile.hs @@ -115,16 +115,19 @@ data Asset = ImageAsset instance ToSchema Asset where schema = - object "UserAsset" $ - ImageAsset - <$> assetKey .= field "key" schema - <*> assetSize .= maybe_ (optField "size" schema) - <* const () .= field "type" typeSchema + object "UserAsset" + $ ImageAsset + <$> assetKey + .= field "key" schema + <*> assetSize + .= maybe_ (optField "size" schema) + <* const () + .= field "type" typeSchema where typeSchema :: ValueSchema NamedSwaggerDoc () typeSchema = - enum @Text @NamedSwaggerDoc "AssetType" $ - element "image" () + enum @Text @NamedSwaggerDoc "AssetType" + $ element "image" () instance C.Cql Asset where -- Note: Type name and column names and types must match up with the @@ -148,7 +151,7 @@ instance C.Cql Asset where 0 -> pure $! ImageAsset k s _ -> Left $ "unexpected user asset type: " ++ show t where - required :: C.Cql r => Text -> Either String r + required :: (C.Cql r) => Text -> Either String r required f = maybe (Left ("Asset: Missing required field '" ++ show f ++ "'")) @@ -172,8 +175,8 @@ data AssetSize = AssetComplete | AssetPreview instance ToSchema AssetSize where schema = - enum @Text "AssetSize" $ - mconcat + enum @Text "AssetSize" + $ mconcat [ element "preview" AssetPreview, element "complete" AssetComplete ] @@ -298,8 +301,8 @@ data ManagedBy instance ToSchema ManagedBy where schema = - enum @Text "ManagedBy" $ - mconcat + enum @Text "ManagedBy" + $ mconcat [ element "wire" ManagedByWire, element "scim" ManagedByScim ] @@ -338,8 +341,10 @@ newtype Pict = Pict {fromPict :: [A.Object]} instance ToSchema Pict where schema = - named "Pict" $ - Pict <$> fromPict .= untypedRangedSchema 0 10 (array jsonObject) + named "Pict" + $ Pict + <$> fromPict + .= untypedRangedSchema 0 10 (array jsonObject) instance Arbitrary Pict where arbitrary = pure $ Pict [] diff --git a/libs/wire-api/src/Wire/API/User/RichInfo.hs b/libs/wire-api/src/Wire/API/User/RichInfo.hs index d84ba4f3c2f..e8cd27d6051 100644 --- a/libs/wire-api/src/Wire/API/User/RichInfo.hs +++ b/libs/wire-api/src/Wire/API/User/RichInfo.hs @@ -71,8 +71,11 @@ newtype RichInfo = RichInfo {unRichInfo :: RichInfoAssocList} instance ToSchema RichInfo where schema = - ciObject "RichInfo" $ - RichInfo . toRichInfoAssocList <$> (fromRichInfoAssocList . unRichInfo) .= richInfoMapAndListSchema + ciObject "RichInfo" + $ RichInfo + . toRichInfoAssocList + <$> (fromRichInfoAssocList . unRichInfo) + .= richInfoMapAndListSchema instance Monoid RichInfo where mempty = RichInfo mempty @@ -194,23 +197,23 @@ richInfoMapAndListSchema = withParser ( RichInfoMapAndList <$> richInfoMap - .= ( fromMaybe mempty - <$> ciOptField richInfoMapURN (mapWithKeys CI.original CI.mk schema) - ) - <*> richInfoAssocList - .= ( fromMaybe mempty - <$> ciOptField - richInfoAssocListURN - ( unRichInfoAssocList - <$> ciObject - "RichInfoAssocList" - ( RichInfoAssocList - .= ciField - "richInfo" - (unnamed schema <> richInfoAssocListSchemaLegacy) - ) - ) - ) + .= ( fromMaybe mempty + <$> ciOptField richInfoMapURN (mapWithKeys CI.original CI.mk schema) + ) + <*> richInfoAssocList + .= ( fromMaybe mempty + <$> ciOptField + richInfoAssocListURN + ( unRichInfoAssocList + <$> ciObject + "RichInfoAssocList" + ( RichInfoAssocList + .= ciField + "richInfo" + (unnamed schema <> richInfoAssocListSchemaLegacy) + ) + ) + ) ) (pure . normalizeRichInfoMapAndList) where @@ -261,7 +264,7 @@ instance Arbitrary RichInfoMapAndList where arbitrary = mkRichInfoMapAndList <$> arbitrary -- | Uniform Resource Names used for serialization of 'RichInfo'. -richInfoMapURN, richInfoAssocListURN :: IsString s => s +richInfoMapURN, richInfoAssocListURN :: (IsString s) => s richInfoMapURN = "urn:ietf:params:scim:schemas:extension:wire:1.0:User" richInfoAssocListURN = "urn:wire:scim:schemas:profile:1.0" @@ -298,8 +301,10 @@ instance ToSchema RichInfoAssocList where richInfoAssocListSchema = withParser ( (,) - <$> const (0 :: Int) .= ciField "version" schema - <*> unRichInfoAssocList .= ciField "fields" (array schema) + <$> const (0 :: Int) + .= ciField "version" schema + <*> unRichInfoAssocList + .= ciField "fields" (array schema) ) $ \(version, fields) -> mkRichInfoAssocList <$> validateRichInfoAssocList version fields @@ -342,10 +347,12 @@ instance ToSchema RichField where -- "value": ...}@ is how all other SCIM payloads are formatted, so it's quite possible -- that some provisioning agent would support "type" but not "name". schema = - object "RichField" $ - RichField - <$> richFieldType .= field "type" (CI.original .= (CI.mk <$> schema)) - <*> richFieldValue .= field "value" schema + object "RichField" + $ RichField + <$> richFieldType + .= field "type" (CI.original .= (CI.mk <$> schema)) + <*> richFieldValue + .= field "value" schema instance Arbitrary RichField where arbitrary = diff --git a/libs/wire-api/src/Wire/API/User/Saml.hs b/libs/wire-api/src/Wire/API/User/Saml.hs index f165a17f76c..fa97f24fb07 100644 --- a/libs/wire-api/src/Wire/API/User/Saml.hs +++ b/libs/wire-api/src/Wire/API/User/Saml.hs @@ -66,7 +66,7 @@ makeLenses ''VerdictFormat deriveJSON deriveJSONOptions ''VerdictFormat -mkVerdictGrantedFormatMobile :: MonadError String m => URI -> SetCookie -> UserId -> m URI +mkVerdictGrantedFormatMobile :: (MonadError String m) => URI -> SetCookie -> UserId -> m URI mkVerdictGrantedFormatMobile before cky uid = parseURI' . substituteVar @@ -80,7 +80,7 @@ mkVerdictGrantedFormatMobile before cky uid = . substituteVar "userid" (T.pack . show $ uid) $ renderURI before -mkVerdictDeniedFormatMobile :: MonadError String m => URI -> Text -> m URI +mkVerdictDeniedFormatMobile :: (MonadError String m) => URI -> Text -> m URI mkVerdictDeniedFormatMobile before lbl = parseURI' . substituteVar "label" lbl @@ -96,7 +96,7 @@ substituteVar' var val = T.intercalate val . T.splitOn var newtype TTL (tablename :: Symbol) = TTL {fromTTL :: Int32} deriving (Eq, Ord, Show, Num) -showTTL :: KnownSymbol a => TTL a -> String +showTTL :: (KnownSymbol a) => TTL a -> String showTTL (TTL i :: TTL a) = "TTL:" <> symbolVal (Proxy @a) <> ":" <> show i instance FromJSON (TTL a) where diff --git a/libs/wire-api/src/Wire/API/User/Scim.hs b/libs/wire-api/src/Wire/API/User/Scim.hs index d8482447523..fd46b7ea310 100644 --- a/libs/wire-api/src/Wire/API/User/Scim.hs +++ b/libs/wire-api/src/Wire/API/User/Scim.hs @@ -167,12 +167,17 @@ instance FromJSON ScimTokenInfo where instance ToJSON ScimTokenInfo where toJSON s = - A.object $ - "team" A..= stiTeam s - # "id" A..= stiId s - # "created_at" A..= stiCreatedAt s - # "idp" A..= stiIdP s - # "description" A..= stiDescr s + A.object + $ "team" + A..= stiTeam s + # "id" + A..= stiId s + # "created_at" + A..= stiCreatedAt s + # "idp" + A..= stiIdP s + # "description" + A..= stiDescr s # [] ---------------------------------------------------------------------------- @@ -370,15 +375,15 @@ runValidExternalIdUnsafe :: ValidExternalId -> Text runValidExternalIdUnsafe = runValidExternalIdEither urefToExternalIdUnsafe fromEmail veidUref :: Prism' ValidExternalId SAML.UserRef -veidUref = prism' UrefOnly $ - \case +veidUref = prism' UrefOnly + $ \case EmailAndUref _ uref -> Just uref UrefOnly uref -> Just uref EmailOnly _ -> Nothing veidEmail :: Prism' ValidExternalId Email -veidEmail = prism' EmailOnly $ - \case +veidEmail = prism' EmailOnly + $ \case EmailAndUref em _ -> Just em UrefOnly _ -> Nothing EmailOnly em -> Just em @@ -466,7 +471,10 @@ instance ToParamSchema ScimToken where instance ToSchema ScimToken where declareNamedSchema _ = declareNamedSchema (Proxy @Text) - & mapped . schema . description ?~ "Authentication token" + & mapped + . schema + . description + ?~ "Authentication token" instance ToSchema ScimTokenInfo where declareNamedSchema _ = do @@ -475,55 +483,63 @@ instance ToSchema ScimTokenInfo where createdAtSchema <- declareSchemaRef (Proxy @UTCTime) idpSchema <- declareSchemaRef (Proxy @SAML.IdPId) descrSchema <- declareSchemaRef (Proxy @Text) - pure $ - NamedSchema (Just "ScimTokenInfo") $ - mempty - & type_ ?~ OpenApiObject - & properties - .~ [ ("team", teamSchema), - ("id", idSchema), - ("created_at", createdAtSchema), - ("idp", idpSchema), - ("description", descrSchema) - ] - & required .~ ["team", "id", "created_at", "description"] + pure + $ NamedSchema (Just "ScimTokenInfo") + $ mempty + & type_ + ?~ OpenApiObject + & properties + .~ [ ("team", teamSchema), + ("id", idSchema), + ("created_at", createdAtSchema), + ("idp", idpSchema), + ("description", descrSchema) + ] + & required + .~ ["team", "id", "created_at", "description"] instance ToSchema CreateScimToken where declareNamedSchema _ = do textSchema <- declareSchemaRef (Proxy @Text) - pure $ - NamedSchema (Just "CreateScimToken") $ - mempty - & type_ ?~ OpenApiObject - & properties - .~ [ ("description", textSchema), - ("password", textSchema), - ("verification_code", textSchema) - ] - & required .~ ["description"] + pure + $ NamedSchema (Just "CreateScimToken") + $ mempty + & type_ + ?~ OpenApiObject + & properties + .~ [ ("description", textSchema), + ("password", textSchema), + ("verification_code", textSchema) + ] + & required + .~ ["description"] instance ToSchema CreateScimTokenResponse where declareNamedSchema _ = do tokenSchema <- declareSchemaRef (Proxy @ScimToken) infoSchema <- declareSchemaRef (Proxy @ScimTokenInfo) - pure $ - NamedSchema (Just "CreateScimTokenResponse") $ - mempty - & type_ ?~ OpenApiObject - & properties - .~ [ ("token", tokenSchema), - ("info", infoSchema) - ] - & required .~ ["token", "info"] + pure + $ NamedSchema (Just "CreateScimTokenResponse") + $ mempty + & type_ + ?~ OpenApiObject + & properties + .~ [ ("token", tokenSchema), + ("info", infoSchema) + ] + & required + .~ ["token", "info"] instance ToSchema ScimTokenList where declareNamedSchema _ = do infoListSchema <- declareSchemaRef (Proxy @[ScimTokenInfo]) - pure $ - NamedSchema (Just "ScimTokenList") $ - mempty - & type_ ?~ OpenApiObject - & properties - .~ [ ("tokens", infoListSchema) - ] - & required .~ ["tokens"] + pure + $ NamedSchema (Just "ScimTokenList") + $ mempty + & type_ + ?~ OpenApiObject + & properties + .~ [ ("tokens", infoListSchema) + ] + & required + .~ ["tokens"] diff --git a/libs/wire-api/src/Wire/API/User/Search.hs b/libs/wire-api/src/Wire/API/User/Search.hs index 435c7cf3998..c8fb33cc3a6 100644 --- a/libs/wire-api/src/Wire/API/User/Search.hs +++ b/libs/wire-api/src/Wire/API/User/Search.hs @@ -107,17 +107,24 @@ instance Traversable SearchResult where newResults <- traverse f (searchResults r) pure $ r {searchResults = newResults} -instance ToSchema a => ToSchema (SearchResult a) where +instance (ToSchema a) => ToSchema (SearchResult a) where schema = - object "SearchResult" $ - SearchResult - <$> searchFound .= fieldWithDocModifier "found" (S.description ?~ "Total number of hits") schema - <*> searchReturned .= fieldWithDocModifier "returned" (S.description ?~ "Total number of hits returned") schema - <*> searchTook .= fieldWithDocModifier "took" (S.description ?~ "Search time in ms") schema - <*> searchResults .= fieldWithDocModifier "documents" (S.description ?~ "List of contacts found") (array schema) - <*> searchPolicy .= fieldWithDocModifier "search_policy" (S.description ?~ "Search policy that was applied when searching for users") schema - <*> searchPagingState .= maybe_ (optFieldWithDocModifier "paging_state" (S.description ?~ "Paging state that should be supplied to retrieve the next page of results") schema) - <*> searchHasMore .= maybe_ (optFieldWithDocModifier "has_more" (S.description ?~ "Indicates whether there are more results to be fetched") schema) + object "SearchResult" + $ SearchResult + <$> searchFound + .= fieldWithDocModifier "found" (S.description ?~ "Total number of hits") schema + <*> searchReturned + .= fieldWithDocModifier "returned" (S.description ?~ "Total number of hits returned") schema + <*> searchTook + .= fieldWithDocModifier "took" (S.description ?~ "Search time in ms") schema + <*> searchResults + .= fieldWithDocModifier "documents" (S.description ?~ "List of contacts found") (array schema) + <*> searchPolicy + .= fieldWithDocModifier "search_policy" (S.description ?~ "Search policy that was applied when searching for users") schema + <*> searchPagingState + .= maybe_ (optFieldWithDocModifier "paging_state" (S.description ?~ "Paging state that should be supplied to retrieve the next page of results") schema) + <*> searchHasMore + .= maybe_ (optFieldWithDocModifier "has_more" (S.description ?~ "Indicates whether there are more results to be fetched") schema) deriving via (Schema (SearchResult Contact)) instance ToJSON (SearchResult Contact) @@ -149,14 +156,20 @@ data Contact = Contact instance ToSchema Contact where schema = - objectWithDocModifier "Contact" (description ?~ "Contact discovered through search") $ - Contact - <$> contactQualifiedId .= field "qualified_id" schema - <* (qUnqualified . contactQualifiedId) .= optField "id" schema - <*> contactName .= field "name" schema - <*> contactColorId .= optField "accent_id" (maybeWithDefault Aeson.Null schema) - <*> contactHandle .= optField "handle" (maybeWithDefault Aeson.Null schema) - <*> contactTeam .= optField "team" (maybeWithDefault Aeson.Null schema) + objectWithDocModifier "Contact" (description ?~ "Contact discovered through search") + $ Contact + <$> contactQualifiedId + .= field "qualified_id" schema + <* (qUnqualified . contactQualifiedId) + .= optField "id" schema + <*> contactName + .= field "name" schema + <*> contactColorId + .= optField "accent_id" (maybeWithDefault Aeson.Null schema) + <*> contactHandle + .= optField "handle" (maybeWithDefault Aeson.Null schema) + <*> contactTeam + .= optField "team" (maybeWithDefault Aeson.Null schema) -------------------------------------------------------------------------------- -- TeamContact @@ -172,10 +185,12 @@ data Sso = Sso instance ToSchema Sso where schema = - object "Sso" $ - Sso - <$> ssoIssuer .= field "issuer" schema - <*> ssoNameId .= field "nameid" schema + object "Sso" + $ Sso + <$> ssoIssuer + .= field "issuer" schema + <*> ssoNameId + .= field "nameid" schema -- | Returned by 'browseTeam' under @/teams/:tid/search@. data TeamContact = TeamContact @@ -199,21 +214,34 @@ data TeamContact = TeamContact instance ToSchema TeamContact where schema = - object "TeamContact" $ - TeamContact - <$> teamContactUserId .= field "id" schema - <*> teamContactName .= field "name" schema - <*> teamContactColorId .= optField "accent_id" (maybeWithDefault Aeson.Null schema) - <*> teamContactHandle .= optField "handle" (maybeWithDefault Aeson.Null schema) - <*> teamContactTeam .= optField "team" (maybeWithDefault Aeson.Null schema) - <*> teamContactEmail .= optField "email" (maybeWithDefault Aeson.Null schema) - <*> teamContactCreatedAt .= optField "created_at" (maybeWithDefault Aeson.Null schema) - <*> teamContactManagedBy .= optField "managed_by" (maybeWithDefault Aeson.Null schema) - <*> teamContactSAMLIdp .= optField "saml_idp" (maybeWithDefault Aeson.Null schema) - <*> teamContactRole .= optField "role" (maybeWithDefault Aeson.Null schema) - <*> teamContactScimExternalId .= optField "scim_external_id" (maybeWithDefault Aeson.Null schema) - <*> teamContactSso .= optField "sso" (maybeWithDefault Aeson.Null schema) - <*> teamContactEmailUnvalidated .= optField "email_unvalidated" (maybeWithDefault Aeson.Null schema) + object "TeamContact" + $ TeamContact + <$> teamContactUserId + .= field "id" schema + <*> teamContactName + .= field "name" schema + <*> teamContactColorId + .= optField "accent_id" (maybeWithDefault Aeson.Null schema) + <*> teamContactHandle + .= optField "handle" (maybeWithDefault Aeson.Null schema) + <*> teamContactTeam + .= optField "team" (maybeWithDefault Aeson.Null schema) + <*> teamContactEmail + .= optField "email" (maybeWithDefault Aeson.Null schema) + <*> teamContactCreatedAt + .= optField "created_at" (maybeWithDefault Aeson.Null schema) + <*> teamContactManagedBy + .= optField "managed_by" (maybeWithDefault Aeson.Null schema) + <*> teamContactSAMLIdp + .= optField "saml_idp" (maybeWithDefault Aeson.Null schema) + <*> teamContactRole + .= optField "role" (maybeWithDefault Aeson.Null schema) + <*> teamContactScimExternalId + .= optField "scim_external_id" (maybeWithDefault Aeson.Null schema) + <*> teamContactSso + .= optField "sso" (maybeWithDefault Aeson.Null schema) + <*> teamContactEmailUnvalidated + .= optField "email_unvalidated" (maybeWithDefault Aeson.Null schema) data TeamUserSearchSortBy = SortByName @@ -229,25 +257,29 @@ data TeamUserSearchSortBy instance S.ToParamSchema TeamUserSearchSortBy where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.enum_ ?~ fmap teamUserSearchSortByName [minBound .. maxBound] + & S.type_ + ?~ S.OpenApiString + & S.enum_ + ?~ fmap teamUserSearchSortByName [minBound .. maxBound] instance ToByteString TeamUserSearchSortBy where builder = teamUserSearchSortByName instance FromByteString TeamUserSearchSortBy where parser = - asum $ - [minBound .. maxBound] <&> \ctor -> + asum + $ [minBound .. maxBound] + <&> \ctor -> ctor <$ string (teamUserSearchSortByName ctor) instance FromHttpApiData TeamUserSearchSortBy where - parseQueryParam name = note ("Unknown search sort: " <> name) $ - getAlt $ - flip foldMap [minBound .. maxBound] $ \s -> - guard (teamUserSearchSortByName s == name) $> s + parseQueryParam name = note ("Unknown search sort: " <> name) + $ getAlt + $ flip foldMap [minBound .. maxBound] + $ \s -> + guard (teamUserSearchSortByName s == name) $> s -teamUserSearchSortByName :: IsString a => TeamUserSearchSortBy -> a +teamUserSearchSortByName :: (IsString a) => TeamUserSearchSortBy -> a teamUserSearchSortByName SortByName = "name" teamUserSearchSortByName SortByHandle = "handle" teamUserSearchSortByName SortByEmail = "email" @@ -265,25 +297,29 @@ data TeamUserSearchSortOrder instance S.ToParamSchema TeamUserSearchSortOrder where toParamSchema _ = mempty - & S.type_ ?~ S.OpenApiString - & S.enum_ ?~ fmap teamUserSearchSortOrderName [minBound .. maxBound] + & S.type_ + ?~ S.OpenApiString + & S.enum_ + ?~ fmap teamUserSearchSortOrderName [minBound .. maxBound] instance ToByteString TeamUserSearchSortOrder where builder = teamUserSearchSortOrderName instance FromByteString TeamUserSearchSortOrder where parser = - asum $ - [minBound .. maxBound] <&> \ctor -> + asum + $ [minBound .. maxBound] + <&> \ctor -> ctor <$ string (teamUserSearchSortOrderName ctor) instance FromHttpApiData TeamUserSearchSortOrder where - parseQueryParam name = note ("Unknown search order: " <> name) $ - getAlt $ - flip foldMap [minBound .. maxBound] $ \s -> - guard (teamUserSearchSortOrderName s == name) $> s + parseQueryParam name = note ("Unknown search order: " <> name) + $ getAlt + $ flip foldMap [minBound .. maxBound] + $ \s -> + guard (teamUserSearchSortOrderName s == name) $> s -teamUserSearchSortOrderName :: IsString a => TeamUserSearchSortOrder -> a +teamUserSearchSortOrderName :: (IsString a) => TeamUserSearchSortOrder -> a teamUserSearchSortOrderName SortOrderAsc = "asc" teamUserSearchSortOrderName SortOrderDesc = "desc" @@ -313,10 +349,10 @@ data FederatedUserSearchPolicy instance ToSchema FederatedUserSearchPolicy where schema = - enum @Text "FederatedUserSearchPolicy" $ - element "no_search" NoSearch - <> element "exact_handle_search" ExactHandleSearch - <> element "full_search" FullSearch + enum @Text "FederatedUserSearchPolicy" + $ element "no_search" NoSearch + <> element "exact_handle_search" ExactHandleSearch + <> element "full_search" FullSearch instance C.Cql FederatedUserSearchPolicy where ctype = C.Tagged C.IntColumn diff --git a/libs/wire-api/src/Wire/API/UserEvent.hs b/libs/wire-api/src/Wire/API/UserEvent.hs index 59e5ff91502..1329f2ea646 100644 --- a/libs/wire-api/src/Wire/API/UserEvent.hs +++ b/libs/wire-api/src/Wire/API/UserEvent.hs @@ -85,8 +85,8 @@ data EventType instance ToSchema EventType where schema = - enum @Text "EventType" $ - mconcat + enum @Text "EventType" + $ mconcat [ element "user.new" EventTypeUserCreated, element "user.activate" EventTypeUserActivated, element "user.update" EventTypeUserUpdated, @@ -216,8 +216,8 @@ supportedProtocolUpdate u prots = profileUpdated :: UserId -> UserUpdate -> UserEvent profileUpdated u UserUpdate {..} = - UserUpdated $ - (emptyUserUpdatedData u) + UserUpdated + $ (emptyUserUpdatedData u) { eupName = uupName, eupPict = uupPict, eupAccentId = uupAccentId, @@ -270,22 +270,32 @@ eventObjectSchema = ( object "UserUpdatedData" ( UserUpdatedData - <$> eupId .= field "id" schema - <*> eupName .= maybe_ (optField "name" schema) - <*> eupPict .= maybe_ (optField "picture" schema) -- DEPRECATED - <*> eupAccentId .= maybe_ (optField "accent_id" schema) - <*> eupAssets .= maybe_ (optField "assets" (array schema)) - <*> eupHandle .= maybe_ (optField "handle" schema) - <*> eupLocale .= maybe_ (optField "locale" schema) - <*> eupManagedBy .= maybe_ (optField "managed_by" schema) - <*> eupSSOId .= maybe_ (optField "sso_id" genericToSchema) - <*> eupSSOIdRemoved .= field "sso_id_deleted" schema - <*> eupSupportedProtocols - .= maybe_ - ( optField - "supported_protocols" - (set schema) - ) + <$> eupId + .= field "id" schema + <*> eupName + .= maybe_ (optField "name" schema) + <*> eupPict + .= maybe_ (optField "picture" schema) -- DEPRECATED + <*> eupAccentId + .= maybe_ (optField "accent_id" schema) + <*> eupAssets + .= maybe_ (optField "assets" (array schema)) + <*> eupHandle + .= maybe_ (optField "handle" schema) + <*> eupLocale + .= maybe_ (optField "locale" schema) + <*> eupManagedBy + .= maybe_ (optField "managed_by" schema) + <*> eupSSOId + .= maybe_ (optField "sso_id" genericToSchema) + <*> eupSSOIdRemoved + .= field "sso_id_deleted" schema + <*> eupSupportedProtocols + .= maybe_ + ( optField + "supported_protocols" + (set schema) + ) ) ) ) @@ -296,9 +306,12 @@ eventObjectSchema = ( object "UserIdentityUpdatedData" ( UserIdentityUpdatedData - <$> eiuId .= field "id" schema - <*> eiuEmail .= maybe_ (optField "email" schema) - <*> eiuPhone .= maybe_ (optField "phone" schema) + <$> eiuId + .= field "id" schema + <*> eiuEmail + .= maybe_ (optField "email" schema) + <*> eiuPhone + .= maybe_ (optField "phone" schema) ) ) ) @@ -313,9 +326,12 @@ eventObjectSchema = ( object "UserIdentityRemovedData" ( UserIdentityRemovedData - <$> eirId .= field "id" schema - <*> eirEmail .= maybe_ (optField "email" schema) - <*> eirPhone .= maybe_ (optField "phone" schema) + <$> eirId + .= field "id" schema + <*> eirEmail + .= maybe_ (optField "email" schema) + <*> eirPhone + .= maybe_ (optField "phone" schema) ) ) ) @@ -328,7 +344,8 @@ eventObjectSchema = ( tag _UserDeleted ( field "qualified_id" schema - <* qUnqualified .= field "id" schema + <* qUnqualified + .= field "id" schema ) ) EventTypeUserLegalholdEnabled -> @@ -347,9 +364,12 @@ eventObjectSchema = ( tag _LegalHoldClientRequested ( LegalHoldClientRequestedData - <$> lhcTargetUser .= field "id" schema - <*> lhcLastPrekey .= field "last_prekey" schema - <*> lhcClientId .= field "client" (idObjectSchema schema) + <$> lhcTargetUser + .= field "id" schema + <*> lhcLastPrekey + .= field "last_prekey" schema + <*> lhcClientId + .= field "client" (idObjectSchema schema) ) ) EventTypePropertiesSet -> @@ -358,8 +378,10 @@ eventObjectSchema = ( tag _PropertySet ( (,) - <$> fst .= field "key" genericToSchema - <*> snd .= field "value" jsonValue + <$> fst + .= field "key" genericToSchema + <*> snd + .= field "value" jsonValue ) ) EventTypePropertiesDeleted -> @@ -394,8 +416,10 @@ eventObjectSchema = tag _ConnectionEvent ( ConnectionUpdated - <$> ucConn .= field "connection" schema - <*> ucName .= maybe_ (optField "user" (object "UserName" (field "name" schema))) + <$> ucConn + .= field "connection" schema + <*> ucName + .= maybe_ (optField "user" (object "UserName" (field "name" schema))) ) ) where diff --git a/libs/wire-api/src/Wire/API/UserMap.hs b/libs/wire-api/src/Wire/API/UserMap.hs index 31f81392195..923552b8127 100644 --- a/libs/wire-api/src/Wire/API/UserMap.hs +++ b/libs/wire-api/src/Wire/API/UserMap.hs @@ -38,7 +38,7 @@ newtype UserMap a = UserMap {userMap :: Map UserId a} deriving stock (Eq, Show) deriving newtype (Semigroup, Monoid, ToJSON, FromJSON, Functor) -instance Arbitrary a => Arbitrary (UserMap a) where +instance (Arbitrary a) => Arbitrary (UserMap a) where arbitrary = UserMap <$> mapOf' arbitrary arbitrary type WrappedQualifiedUserMap a = Wrapped "qualified_user_map" (QualifiedUserMap a) @@ -53,28 +53,35 @@ instance Functor QualifiedUserMap where fmap f (QualifiedUserMap qMap) = QualifiedUserMap $ f <$$> qMap -instance Arbitrary a => Arbitrary (QualifiedUserMap a) where +instance (Arbitrary a) => Arbitrary (QualifiedUserMap a) where arbitrary = QualifiedUserMap <$> mapOf' arbitrary arbitrary instance (ToSchema a, ToJSON a, Arbitrary a) => ToSchema (UserMap (Set a)) where declareNamedSchema _ = do mapSch <- declareSchema (Proxy @(Map UserId (Set a))) let valueTypeName = Text.pack $ show $ typeRep $ Proxy @a - pure $ - NamedSchema (Just $ "UserMap_Set_" <> valueTypeName) $ - mapSch - & description ?~ "Map of UserId to (Set " <> valueTypeName <> ")" - & example ?~ toJSON (Map.singleton (generateExample @UserId) (Set.singleton (generateExample @a))) + pure + $ NamedSchema (Just $ "UserMap_Set_" <> valueTypeName) + $ mapSch + & description + ?~ "Map of UserId to (Set " + <> valueTypeName + <> ")" + & example + ?~ toJSON (Map.singleton (generateExample @UserId) (Set.singleton (generateExample @a))) instance (Typeable a, ToSchema (UserMap a)) => ToSchema (QualifiedUserMap a) where declareNamedSchema _ = do mapSch <- declareSchema (Proxy @(Map Domain (UserMap a))) let userMapSchema = toSchema (Proxy @(UserMap a)) let valueTypeName = Text.replace " " "_" . Text.pack $ show $ typeRep $ Proxy @a - pure $ - NamedSchema (Just $ "QualifiedUserMap_" <> valueTypeName) $ - mapSch - & description ?~ "Map of Domain to (UserMap (" <> valueTypeName <> "))." - & example - ?~ toJSON - (Map.singleton ("domain1.example.com" :: Text) (userMapSchema ^. example)) + pure + $ NamedSchema (Just $ "QualifiedUserMap_" <> valueTypeName) + $ mapSch + & description + ?~ "Map of Domain to (UserMap (" + <> valueTypeName + <> "))." + & example + ?~ toJSON + (Map.singleton ("domain1.example.com" :: Text) (userMapSchema ^. example)) diff --git a/libs/wire-api/src/Wire/API/VersionInfo.hs b/libs/wire-api/src/Wire/API/VersionInfo.hs index 1d05a55e027..eb92c4b0717 100644 --- a/libs/wire-api/src/Wire/API/VersionInfo.hs +++ b/libs/wire-api/src/Wire/API/VersionInfo.hs @@ -71,19 +71,20 @@ instance type ServerT (Until n :> api) m = ServerT api m route _ ctx action = - route (Proxy @api) ctx $ - fmap const action `addHeaderCheck` withRequest headerCheck + route (Proxy @api) ctx + $ fmap const action + `addHeaderCheck` withRequest headerCheck where headerCheck :: Wai.Request -> DelayedIO () headerCheck req = do let v = - toEnum $ - maybe + toEnum + $ maybe 0 (fromRight 0 . parseHeader) (lookup versionHeader (Wai.requestHeaders req)) - when (v >= demote @n) $ - delayedFail err404 + when (v >= demote @n) + $ delayedFail err404 hoistServerWithContext _ ctx f = hoistServerWithContext (Proxy @api) ctx f @@ -107,7 +108,7 @@ instance clientWithRoute pm (Proxy @api) req hoistClientMonad pm _ f = hoistClientMonad pm (Proxy @api) f -instance RoutesToPaths api => RoutesToPaths (Until v :> api) where +instance (RoutesToPaths api) => RoutesToPaths (Until v :> api) where getRoutes = getRoutes @api instance @@ -122,19 +123,20 @@ instance type ServerT (From n :> api) m = ServerT api m route _ ctx action = - route (Proxy @api) ctx $ - fmap const action `addHeaderCheck` withRequest headerCheck + route (Proxy @api) ctx + $ fmap const action + `addHeaderCheck` withRequest headerCheck where headerCheck :: Wai.Request -> DelayedIO () headerCheck req = do let v = - toEnum $ - maybe + toEnum + $ maybe 0 (fromRight 0 . parseHeader) (lookup versionHeader (Wai.requestHeaders req)) - when (v < demote @n) $ - delayedFail err404 + when (v < demote @n) + $ delayedFail err404 hoistServerWithContext _ ctx f = hoistServerWithContext (Proxy @api) ctx f @@ -155,5 +157,5 @@ instance clientWithRoute pm (Proxy @api) req hoistClientMonad pm _ f = hoistClientMonad pm (Proxy @api) f -instance RoutesToPaths api => RoutesToPaths (From v :> api) where +instance (RoutesToPaths api) => RoutesToPaths (From v :> api) where getRoutes = getRoutes @api diff --git a/libs/wire-api/src/Wire/API/Wrapped.hs b/libs/wire-api/src/Wire/API/Wrapped.hs index 44c41bbddc2..dfc5d115de4 100644 --- a/libs/wire-api/src/Wire/API/Wrapped.hs +++ b/libs/wire-api/src/Wire/API/Wrapped.hs @@ -45,11 +45,13 @@ instance (FromJSON a, KnownSymbol name) => FromJSON (Wrapped name a) where instance (ToSchema a, KnownSymbol name) => ToSchema (Wrapped name a) where declareNamedSchema _ = do wrappedSchema <- declareSchemaRef (Proxy @a) - pure $ - NamedSchema Nothing $ - mempty - & type_ ?~ OpenApiObject - & properties .~ InsOrdHashMap.singleton (Text.pack (symbolVal (Proxy @name))) wrappedSchema + pure + $ NamedSchema Nothing + $ mempty + & type_ + ?~ OpenApiObject + & properties + .~ InsOrdHashMap.singleton (Text.pack (symbolVal (Proxy @name))) wrappedSchema instance (Arbitrary a, KnownSymbol name) => Arbitrary (Wrapped name a) where arbitrary = Wrapped <$> arbitrary diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/FromJSON.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/FromJSON.hs index 1294ca9bd06..ed20b8ed93f 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/FromJSON.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/FromJSON.hs @@ -34,11 +34,11 @@ tests :: TestTree tests = testGroup "FromJSON golden tests" - [ testCase "NewOtrMessage" $ - testFromJSONObjects + [ testCase "NewOtrMessage" + $ testFromJSONObjects [(testObject_NewOtrMessage_user_1, "testObject_NewOtrMessage_user_1.json")], - testCase "SimpleMember" $ - testFromJSONObjects + testCase "SimpleMember" + $ testFromJSONObjects [ (testObject_SimpleMember_user_2, "testObject_SimpleMember_user_2.json"), (testObject_SimpleMember_user_2, "testObject_SimpleMember_user_2-2.json") ], @@ -46,47 +46,47 @@ tests = "RmClient" $ testFromJSONObjects [(testObject_RmClient_user_4, "testObject_RmClient_user_4.json")], - testCase "RmClient failure" $ - testFromJSONFailure @RmClient "testObject_RmClient_failure.json", - testCase "QualifiedConversationId" $ - testFromJSONFailure @Conversation "testObject_Conversation_qualifiedId.json", - testCase "Invite" $ - testFromJSONObject testObject_Invite_user_2 "testObject_Invite_user_2.json", - testCase "MemberUpdate" $ - testFromJSONFailureWithMsg @MemberUpdate - ( Just $ - "One of { 'otr_muted_ref', 'otr_archived', 'otr_archived_ref', \ - \'hidden', 'hidden_ref', 'conversation_role'} required." + testCase "RmClient failure" + $ testFromJSONFailure @RmClient "testObject_RmClient_failure.json", + testCase "QualifiedConversationId" + $ testFromJSONFailure @Conversation "testObject_Conversation_qualifiedId.json", + testCase "Invite" + $ testFromJSONObject testObject_Invite_user_2 "testObject_Invite_user_2.json", + testCase "MemberUpdate" + $ testFromJSONFailureWithMsg @MemberUpdate + ( Just + $ "One of { 'otr_muted_ref', 'otr_archived', 'otr_archived_ref', \ + \'hidden', 'hidden_ref', 'conversation_role'} required." ) "testObject_MemberUpdate_user_3.json", - testCase "MemberUpdateData" $ - testFromJSONObject + testCase "MemberUpdateData" + $ testFromJSONObject testObject_MemberUpdateData_user_1 "testObject_MemberUpdateData_user_1.json", - testCase "OtherMemberUpdate" $ - testFromJSONFailure @OtherMemberUpdate "testObject_OtherMemberUpdate_user_2.json", - testGroup "NewUser: failure" $ - [ testCase "testObject_NewUser_user_3-2.json" $ - testFromJSONFailureWithMsg @NewUser - (Just "Only users without an identity can expire") - "testObject_NewUser_user_3-2.json", - testCase "testObject_NewUser_user_5-2.json" $ - testFromJSONFailureWithMsg @NewUser - (Just "all team users must set a password on creation") - "testObject_NewUser_user_5-2.json", - testCase "testObject_NewUser_user_6-3.json" $ - testFromJSONFailureWithMsg @NewUser - (Just "sso_id, team_id must be either both present or both absent.") - "testObject_NewUser_user_6-3.json" - ], - testGroup "NewUserPublic: failure" $ - [ testCase "testObject_NewUserPublic_user_1-2.json" $ - testFromJSONFailureWithMsg @NewUserPublic - (Just "it is not allowed to provide a UUID for the users here.") - "testObject_NewUserPublic_user_1-2.json", - testCase "testObject_NewUserPublic_user_1-3.json" $ - testFromJSONFailureWithMsg @NewUserPublic - (Just "only managed-by-Wire users can be created here.") - "testObject_NewUserPublic_user_1-3.json" - ] + testCase "OtherMemberUpdate" + $ testFromJSONFailure @OtherMemberUpdate "testObject_OtherMemberUpdate_user_2.json", + testGroup "NewUser: failure" + $ [ testCase "testObject_NewUser_user_3-2.json" + $ testFromJSONFailureWithMsg @NewUser + (Just "Only users without an identity can expire") + "testObject_NewUser_user_3-2.json", + testCase "testObject_NewUser_user_5-2.json" + $ testFromJSONFailureWithMsg @NewUser + (Just "all team users must set a password on creation") + "testObject_NewUser_user_5-2.json", + testCase "testObject_NewUser_user_6-3.json" + $ testFromJSONFailureWithMsg @NewUser + (Just "sso_id, team_id must be either both present or both absent.") + "testObject_NewUser_user_6-3.json" + ], + testGroup "NewUserPublic: failure" + $ [ testCase "testObject_NewUserPublic_user_1-2.json" + $ testFromJSONFailureWithMsg @NewUserPublic + (Just "it is not allowed to provide a UUID for the users here.") + "testObject_NewUserPublic_user_1-2.json", + testCase "testObject_NewUserPublic_user_1-3.json" + $ testFromJSONFailureWithMsg @NewUserPublic + (Just "only managed-by-Wire users can be created here.") + "testObject_NewUserPublic_user_1-3.json" + ] ] diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs index db14e78b856..c6a6bbd2332 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs @@ -243,8 +243,8 @@ tests :: TestTree tests = testGroup "Golden tests" - [ testGroup "Golden: AssetToken_user" $ - testObjects + [ testGroup "Golden: AssetToken_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AssetToken_user.testObject_AssetToken_user_1, "testObject_AssetToken_user_1.json"), (Test.Wire.API.Golden.Generated.AssetToken_user.testObject_AssetToken_user_4, "testObject_AssetToken_user_4.json"), (Test.Wire.API.Golden.Generated.AssetToken_user.testObject_AssetToken_user_5, "testObject_AssetToken_user_5.json"), @@ -253,22 +253,22 @@ tests = (Test.Wire.API.Golden.Generated.AssetToken_user.testObject_AssetToken_user_15, "testObject_AssetToken_user_15.json"), (Test.Wire.API.Golden.Generated.AssetToken_user.testObject_AssetToken_user_20, "testObject_AssetToken_user_20.json") ], - testGroup "Golden: NewAssetToken_user" $ - testObjects + testGroup "Golden: NewAssetToken_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.NewAssetToken_user.testObject_NewAssetToken_user_3, "testObject_NewAssetToken_user_3.json"), (Test.Wire.API.Golden.Generated.NewAssetToken_user.testObject_NewAssetToken_user_6, "testObject_NewAssetToken_user_6.json"), (Test.Wire.API.Golden.Generated.NewAssetToken_user.testObject_NewAssetToken_user_9, "testObject_NewAssetToken_user_9.json") ], - testGroup "Golden: AssetRetention_user" $ - testObjects + testGroup "Golden: AssetRetention_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AssetRetention_user.testObject_AssetRetention_user_1, "testObject_AssetRetention_user_1.json"), (Test.Wire.API.Golden.Generated.AssetRetention_user.testObject_AssetRetention_user_2, "testObject_AssetRetention_user_2.json"), (Test.Wire.API.Golden.Generated.AssetRetention_user.testObject_AssetRetention_user_3, "testObject_AssetRetention_user_3.json"), (Test.Wire.API.Golden.Generated.AssetRetention_user.testObject_AssetRetention_user_8, "testObject_AssetRetention_user_8.json"), (Test.Wire.API.Golden.Generated.AssetRetention_user.testObject_AssetRetention_user_13, "testObject_AssetRetention_user_13.json") ], - testGroup "Golden: AssetSettings_user" $ - testObjects + testGroup "Golden: AssetSettings_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AssetSettings_user.testObject_AssetSettings_user_1, "testObject_AssetSettings_user_1.json"), (Test.Wire.API.Golden.Generated.AssetSettings_user.testObject_AssetSettings_user_2, "testObject_AssetSettings_user_2.json"), (Test.Wire.API.Golden.Generated.AssetSettings_user.testObject_AssetSettings_user_3, "testObject_AssetSettings_user_3.json"), @@ -281,16 +281,16 @@ tests = (Test.Wire.API.Golden.Generated.AssetSettings_user.testObject_AssetSettings_user_19, "testObject_AssetSettings_user_19.json"), (Test.Wire.API.Golden.Generated.AssetSettings_user.testObject_AssetSettings_user_20, "testObject_AssetSettings_user_20.json") ], - testGroup "Golden: AssetKey_user" $ - testObjects + testGroup "Golden: AssetKey_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AssetKey_user.testObject_AssetKey_user_1, "testObject_AssetKey_user_1.json"), (Test.Wire.API.Golden.Generated.AssetKey_user.testObject_AssetKey_user_2, "testObject_AssetKey_user_2.json"), (Test.Wire.API.Golden.Generated.AssetKey_user.testObject_AssetKey_user_3, "testObject_AssetKey_user_3.json"), (Test.Wire.API.Golden.Generated.AssetKey_user.testObject_AssetKey_user_4, "testObject_AssetKey_user_4.json"), (Test.Wire.API.Golden.Generated.AssetKey_user.testObject_AssetKey_user_5, "testObject_AssetKey_user_5.json") ], - testGroup "Golden: TurnHost_user" $ - testObjects + testGroup "Golden: TurnHost_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.TurnHost_user.testObject_TurnHost_user_1, "testObject_TurnHost_user_1.json"), (Test.Wire.API.Golden.Generated.TurnHost_user.testObject_TurnHost_user_2, "testObject_TurnHost_user_2.json"), (Test.Wire.API.Golden.Generated.TurnHost_user.testObject_TurnHost_user_8, "testObject_TurnHost_user_8.json"), @@ -299,23 +299,23 @@ tests = (Test.Wire.API.Golden.Generated.TurnHost_user.testObject_TurnHost_user_14, "testObject_TurnHost_user_14.json"), (Test.Wire.API.Golden.Generated.TurnHost_user.testObject_TurnHost_user_20, "testObject_TurnHost_user_20.json") ], - testGroup "Golden: Scheme_user" $ - testObjects + testGroup "Golden: Scheme_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Scheme_user.testObject_Scheme_user_1, "testObject_Scheme_user_1.json"), (Test.Wire.API.Golden.Generated.Scheme_user.testObject_Scheme_user_2, "testObject_Scheme_user_2.json") ], - testGroup "Golden: Transport_user" $ - testObjects + testGroup "Golden: Transport_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Transport_user.testObject_Transport_user_1, "testObject_Transport_user_1.json"), (Test.Wire.API.Golden.Generated.Transport_user.testObject_Transport_user_2, "testObject_Transport_user_2.json") ], - testGroup "Golden: TurnURI_user" $ - testObjects + testGroup "Golden: TurnURI_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.TurnURI_user.testObject_TurnURI_user_1, "testObject_TurnURI_user_1.json"), (Test.Wire.API.Golden.Generated.TurnURI_user.testObject_TurnURI_user_9, "testObject_TurnURI_user_9.json") ], - testGroup "Golden: TurnUsername_user" $ - testObjects + testGroup "Golden: TurnUsername_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.TurnUsername_user.testObject_TurnUsername_user_1, "testObject_TurnUsername_user_1.json"), (Test.Wire.API.Golden.Generated.TurnUsername_user.testObject_TurnUsername_user_2, "testObject_TurnUsername_user_2.json"), (Test.Wire.API.Golden.Generated.TurnUsername_user.testObject_TurnUsername_user_3, "testObject_TurnUsername_user_3.json"), @@ -337,13 +337,13 @@ tests = (Test.Wire.API.Golden.Generated.TurnUsername_user.testObject_TurnUsername_user_19, "testObject_TurnUsername_user_19.json"), (Test.Wire.API.Golden.Generated.TurnUsername_user.testObject_TurnUsername_user_20, "testObject_TurnUsername_user_20.json") ], - testGroup "Golden: RTCIceServer_user" $ - testObjects + testGroup "Golden: RTCIceServer_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.RTCIceServer_user.testObject_RTCIceServer_user_1, "testObject_RTCIceServer_user_1.json"), (Test.Wire.API.Golden.Generated.RTCIceServer_user.testObject_RTCIceServer_user_2, "testObject_RTCIceServer_user_2.json") ], - testGroup "Golden: RTCConfiguration_user" $ - testObjects + testGroup "Golden: RTCConfiguration_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.RTCConfiguration_user.testObject_RTCConfiguration_user_1, "testObject_RTCConfiguration_user_1.json"), (Test.Wire.API.Golden.Generated.RTCConfiguration_user.testObject_RTCConfiguration_user_2, "testObject_RTCConfiguration_user_2.json"), (Test.Wire.API.Golden.Generated.RTCConfiguration_user.testObject_RTCConfiguration_user_3, "testObject_RTCConfiguration_user_3.json"), @@ -353,17 +353,17 @@ tests = (Test.Wire.API.Golden.Generated.RTCConfiguration_user.testObject_RTCConfiguration_user_7, "testObject_RTCConfiguration_user_7.json"), (Test.Wire.API.Golden.Generated.RTCConfiguration_user.testObject_RTCConfiguration_user_8, "testObject_RTCConfiguration_user_8.json") ], - testGroup "Golden: SFTServer_user" $ - testObjects + testGroup "Golden: SFTServer_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.SFTServer_user.testObject_SFTServer_user_1, "testObject_SFTServer_user_1.json") ], - testGroup "Golden: ConnectionRequest_user" $ - testObjects + testGroup "Golden: ConnectionRequest_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.ConnectionRequest_user.testObject_ConnectionRequest_user_1, "testObject_ConnectionRequest_user_1.json"), (Test.Wire.API.Golden.Generated.ConnectionRequest_user.testObject_ConnectionRequest_user_2, "testObject_ConnectionRequest_user_2.json") ], - testGroup "Golden: Relation_user" $ - testObjects + testGroup "Golden: Relation_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Relation_user.testObject_Relation_user_1, "testObject_Relation_user_1.json"), (Test.Wire.API.Golden.Generated.Relation_user.testObject_Relation_user_2, "testObject_Relation_user_2.json"), (Test.Wire.API.Golden.Generated.Relation_user.testObject_Relation_user_3, "testObject_Relation_user_3.json"), @@ -372,56 +372,56 @@ tests = (Test.Wire.API.Golden.Generated.Relation_user.testObject_Relation_user_6, "testObject_Relation_user_6.json"), (Test.Wire.API.Golden.Generated.Relation_user.testObject_Relation_user_7, "testObject_Relation_user_7.json") ], - testGroup "Golden: UserConnection_user" $ - testObjects + testGroup "Golden: UserConnection_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.UserConnection_user.testObject_UserConnection_user_1, "testObject_UserConnection_user_1.json"), (Test.Wire.API.Golden.Generated.UserConnection_user.testObject_UserConnection_user_2, "testObject_UserConnection_user_2.json") ], - testGroup "Golden: UserConnectionList_user" $ - testObjects + testGroup "Golden: UserConnectionList_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.UserConnectionList_user.testObject_UserConnectionList_user_1, "testObject_UserConnectionList_user_1.json"), (Test.Wire.API.Golden.Generated.UserConnectionList_user.testObject_UserConnectionList_user_2, "testObject_UserConnectionList_user_2.json") ], - testGroup "Golden: ConnectionUpdate_user" $ - testObjects + testGroup "Golden: ConnectionUpdate_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.ConnectionUpdate_user.testObject_ConnectionUpdate_user_1, "testObject_ConnectionUpdate_user_1.json") ], - testGroup "Golden: Conversation_user V2" $ - testObjects + testGroup "Golden: Conversation_user V2" + $ testObjects [ (Versioned @'V2 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_1, "testObject_Conversation_v2_user_1.json"), (Versioned @'V2 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_2, "testObject_Conversation_v2_user_2.json"), (Versioned @'V2 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_3, "testObject_Conversation_v2_user_3.json"), (Versioned @'V2 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_4, "testObject_Conversation_v2_user_4.json"), (Versioned @'V2 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_5, "testObject_Conversation_v2_user_5.json") ], - testGroup "Golden: Conversation_user V5" $ - testObjects + testGroup "Golden: Conversation_user V5" + $ testObjects [ (Versioned @'V5 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_1, "testObject_Conversation_v5_user_1.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_2, "testObject_Conversation_v5_user_2.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_3, "testObject_Conversation_v5_user_3.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_4, "testObject_Conversation_v5_user_4.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_5, "testObject_Conversation_v5_user_5.json") ], - testGroup "Golden: Conversation_user" $ - testObjects + testGroup "Golden: Conversation_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_1, "testObject_Conversation_user_1.json"), (Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_2, "testObject_Conversation_user_2.json"), (Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_3, "testObject_Conversation_user_3.json"), (Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_4, "testObject_Conversation_user_4.json"), (Test.Wire.API.Golden.Generated.Conversation_user.testObject_Conversation_user_5, "testObject_Conversation_user_5.json") ], - testGroup "Golden: NewConv_user V2" $ - testObjects + testGroup "Golden: NewConv_user V2" + $ testObjects [ (Versioned @'V2 Test.Wire.API.Golden.Generated.NewConv_user.testObject_NewConv_user_1, "testObject_NewConv_v2_user_1.json"), (Versioned @'V2 Test.Wire.API.Golden.Generated.NewConv_user.testObject_NewConv_user_3, "testObject_NewConv_v2_user_3.json") ], - testGroup "Golden: NewConv_user" $ - testObjects + testGroup "Golden: NewConv_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.NewConv_user.testObject_NewConv_user_1, "testObject_NewConv_user_1.json"), (Test.Wire.API.Golden.Generated.NewConv_user.testObject_NewConv_user_3, "testObject_NewConv_user_3.json") ], - testGroup "Golden: ConversationList_20_28Id_20_2a_20C_29_user" $ - testObjects + testGroup "Golden: ConversationList_20_28Id_20_2a_20C_29_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationList_20_28Id_20_2a_20C_29_user.testObject_ConversationList_20_28Id_20_2a_20C_29_user_1, "testObject_ConversationList_20_28Id_20_2a_20C_29_user_1.json" ), @@ -429,8 +429,8 @@ tests = "testObject_ConversationList_20_28Id_20_2a_20C_29_user_2.json" ) ], - testGroup "Golden: ConversationList_20Conversation_user V2" $ - testObjects + testGroup "Golden: ConversationList_20Conversation_user V2" + $ testObjects [ ( Versioned @'V2 Test.Wire.API.Golden.Generated.ConversationList_20Conversation_user.testObject_ConversationList_20Conversation_user_1, "testObject_ConversationList_20Conversation_v2_user_1.json" ), @@ -438,48 +438,48 @@ tests = "testObject_ConversationList_20Conversation_v2_user_2.json" ) ], - testGroup "Golden: Access_user" $ - testObjects + testGroup "Golden: Access_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Access_user.testObject_Access_user_1, "testObject_Access_user_1.json"), (Test.Wire.API.Golden.Generated.Access_user.testObject_Access_user_2, "testObject_Access_user_2.json"), (Test.Wire.API.Golden.Generated.Access_user.testObject_Access_user_3, "testObject_Access_user_3.json"), (Test.Wire.API.Golden.Generated.Access_user.testObject_Access_user_4, "testObject_Access_user_4.json") ], - testGroup "Golden: AccessRoleLegacy_user" $ - testObjects + testGroup "Golden: AccessRoleLegacy_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AccessRoleLegacy_user.testObject_AccessRoleLegacy_user_1, "testObject_AccessRoleLegacy_user_1.json"), (Test.Wire.API.Golden.Generated.AccessRoleLegacy_user.testObject_AccessRoleLegacy_user_2, "testObject_AccessRoleLegacy_user_2.json"), (Test.Wire.API.Golden.Generated.AccessRoleLegacy_user.testObject_AccessRoleLegacy_user_3, "testObject_AccessRoleLegacy_user_3.json"), (Test.Wire.API.Golden.Generated.AccessRoleLegacy_user.testObject_AccessRoleLegacy_user_4, "testObject_AccessRoleLegacy_user_4.json") ], - testGroup "Golden: ConvType_user" $ - testObjects + testGroup "Golden: ConvType_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.ConvType_user.testObject_ConvType_user_1, "testObject_ConvType_user_1.json"), (Test.Wire.API.Golden.Generated.ConvType_user.testObject_ConvType_user_2, "testObject_ConvType_user_2.json"), (Test.Wire.API.Golden.Generated.ConvType_user.testObject_ConvType_user_3, "testObject_ConvType_user_3.json"), (Test.Wire.API.Golden.Generated.ConvType_user.testObject_ConvType_user_4, "testObject_ConvType_user_4.json") ], - testGroup "Golden: ReceiptMode_user" $ - testObjects + testGroup "Golden: ReceiptMode_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.ReceiptMode_user.testObject_ReceiptMode_user_1, "testObject_ReceiptMode_user_1.json"), (Test.Wire.API.Golden.Generated.ReceiptMode_user.testObject_ReceiptMode_user_2, "testObject_ReceiptMode_user_2.json") ], - testGroup "Golden: ConvTeamInfo_user" $ - testObjects + testGroup "Golden: ConvTeamInfo_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.ConvTeamInfo_user.testObject_ConvTeamInfo_user_1, "testObject_ConvTeamInfo_user_1.json") ], - testGroup "Golden: Invite_user" $ - testObjects + testGroup "Golden: Invite_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Invite_user.testObject_Invite_user_1, "testObject_Invite_user_1.json") ], - testGroup "Golden: ConversationRename_user" $ - testObjects + testGroup "Golden: ConversationRename_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationRename_user.testObject_ConversationRename_user_1, "testObject_ConversationRename_user_1.json" ) ], - testGroup "Golden: ConversationAccessData_user V2" $ - testObjects + testGroup "Golden: ConversationAccessData_user V2" + $ testObjects [ ( Versioned @'V2 Test.Wire.API.Golden.Generated.ConversationAccessData_user.testObject_ConversationAccessData_user_1, "testObject_ConversationAccessData_v2_user_1.json" ), @@ -487,8 +487,8 @@ tests = "testObject_ConversationAccessData_v2_user_2.json" ) ], - testGroup "Golden: ConversationAccessData_user" $ - testObjects + testGroup "Golden: ConversationAccessData_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationAccessData_user.testObject_ConversationAccessData_user_1, "testObject_ConversationAccessData_user_1.json" ), @@ -496,14 +496,14 @@ tests = "testObject_ConversationAccessData_user_2.json" ) ], - testGroup "Golden: ConversationReceiptModeUpdate_user" $ - testObjects + testGroup "Golden: ConversationReceiptModeUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationReceiptModeUpdate_user.testObject_ConversationReceiptModeUpdate_user_1, "testObject_ConversationReceiptModeUpdate_user_1.json" ) ], - testGroup "Golden: ConversationMessageTimerUpdate_user" $ - testObjects + testGroup "Golden: ConversationMessageTimerUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationMessageTimerUpdate_user.testObject_ConversationMessageTimerUpdate_user_1, "testObject_ConversationMessageTimerUpdate_user_1.json" ), @@ -511,24 +511,24 @@ tests = "testObject_ConversationMessageTimerUpdate_user_2.json" ) ], - testGroup "Golden: AddBot_user" $ - testObjects + testGroup "Golden: AddBot_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AddBot_user.testObject_AddBot_user_1, "testObject_AddBot_user_1.json"), (Test.Wire.API.Golden.Generated.AddBot_user.testObject_AddBot_user_2, "testObject_AddBot_user_2.json") ], - testGroup "Golden: AddBotResponse_user" $ - testObjects + testGroup "Golden: AddBotResponse_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AddBotResponse_user.testObject_AddBotResponse_user_1, "testObject_AddBotResponse_user_1.json"), (Test.Wire.API.Golden.Generated.AddBotResponse_user.testObject_AddBotResponse_user_2, "testObject_AddBotResponse_user_2.json") ], - testGroup "Golden: RemoveBotResponse_user" $ - testObjects + testGroup "Golden: RemoveBotResponse_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.RemoveBotResponse_user.testObject_RemoveBotResponse_user_1, "testObject_RemoveBotResponse_user_1.json" ) ], - testGroup "Golden: UpdateBotPrekeys_user" $ - testObjects + testGroup "Golden: UpdateBotPrekeys_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.UpdateBotPrekeys_user.testObject_UpdateBotPrekeys_user_1, "testObject_UpdateBotPrekeys_user_1.json" ), @@ -536,8 +536,8 @@ tests = "testObject_UpdateBotPrekeys_user_2.json" ) ], - testGroup "Golden: ConversationCode_user" $ - testObjects + testGroup "Golden: ConversationCode_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationCode_user.testObject_ConversationCode_user_1, "testObject_ConversationCode_user_1.json" ), @@ -545,8 +545,8 @@ tests = "testObject_ConversationCode_user_2.json" ) ], - testGroup "Golden: MemberUpdate_user" $ - testObjects + testGroup "Golden: MemberUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.MemberUpdate_user.testObject_MemberUpdate_user_1, "testObject_MemberUpdate_user_1.json" ), @@ -554,19 +554,19 @@ tests = "testObject_MemberUpdate_user_2.json" ) ], - testGroup "Golden: MutedStatus_user" $ - testObjects + testGroup "Golden: MutedStatus_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.MutedStatus_user.testObject_MutedStatus_user_1, "testObject_MutedStatus_user_1.json" ) ], - testGroup "Golden: Member_user" $ - testObjects + testGroup "Golden: Member_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Member_user.testObject_Member_user_1, "testObject_Member_user_1.json"), (Test.Wire.API.Golden.Generated.Member_user.testObject_Member_user_2, "testObject_Member_user_2.json") ], - testGroup "Golden: OtherMember_user" $ - testObjects + testGroup "Golden: OtherMember_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.OtherMember_user.testObject_OtherMember_user_1, "testObject_OtherMember_user_1.json" ), @@ -574,8 +574,8 @@ tests = "testObject_OtherMember_user_2.json" ) ], - testGroup "Golden: ConvMembers_user" $ - testObjects + testGroup "Golden: ConvMembers_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConvMembers_user.testObject_ConvMembers_user_1, "testObject_ConvMembers_user_1.json" ), @@ -583,20 +583,20 @@ tests = "testObject_ConvMembers_user_2.json" ) ], - testGroup "Golden: OtherMemberUpdate_user" $ - testObjects + testGroup "Golden: OtherMemberUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.OtherMemberUpdate_user.testObject_OtherMemberUpdate_user_1, "testObject_OtherMemberUpdate_user_1.json" ) ], - testGroup "Golden: RoleName_user" $ - testObjects + testGroup "Golden: RoleName_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.RoleName_user.testObject_RoleName_user_1, "testObject_RoleName_user_1.json" ) ], - testGroup "Golden: Action_user" $ - testObjects + testGroup "Golden: Action_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Action_user.testObject_Action_user_1, "testObject_Action_user_1.json"), (Test.Wire.API.Golden.Generated.Action_user.testObject_Action_user_2, "testObject_Action_user_2.json"), (Test.Wire.API.Golden.Generated.Action_user.testObject_Action_user_3, "testObject_Action_user_3.json"), @@ -607,8 +607,8 @@ tests = (Test.Wire.API.Golden.Generated.Action_user.testObject_Action_user_8, "testObject_Action_user_8.json"), (Test.Wire.API.Golden.Generated.Action_user.testObject_Action_user_9, "testObject_Action_user_9.json") ], - testGroup "Golden: ConversationRole_user" $ - testObjects + testGroup "Golden: ConversationRole_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationRole_user.testObject_ConversationRole_user_1, "testObject_ConversationRole_user_1.json" ), @@ -619,8 +619,8 @@ tests = "testObject_ConversationRole_user_3.json" ) ], - testGroup "Golden: ConversationRolesList_user" $ - testObjects + testGroup "Golden: ConversationRolesList_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ConversationRolesList_user.testObject_ConversationRolesList_user_1, "testObject_ConversationRolesList_user_1.json" ), @@ -628,8 +628,8 @@ tests = "testObject_ConversationRolesList_user_2.json" ) ], - testGroup "Golden: TypingStatus_user" $ - testObjects + testGroup "Golden: TypingStatus_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.TypingStatus_user.testObject_TypingStatus_user_1, "testObject_TypingStatus_user_1.json" ), @@ -637,8 +637,8 @@ tests = "testObject_TypingStatus_user_2.json" ) ], - testGroup "Golden: CustomBackend_user" $ - testObjects + testGroup "Golden: CustomBackend_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.CustomBackend_user.testObject_CustomBackend_user_1, "testObject_CustomBackend_user_1.json"), (Test.Wire.API.Golden.Generated.CustomBackend_user.testObject_CustomBackend_user_2, "testObject_CustomBackend_user_2.json"), (Test.Wire.API.Golden.Generated.CustomBackend_user.testObject_CustomBackend_user_3, "testObject_CustomBackend_user_3.json"), @@ -660,8 +660,8 @@ tests = (Test.Wire.API.Golden.Generated.CustomBackend_user.testObject_CustomBackend_user_19, "testObject_CustomBackend_user_19.json"), (Test.Wire.API.Golden.Generated.CustomBackend_user.testObject_CustomBackend_user_20, "testObject_CustomBackend_user_20.json") ], - testGroup "Golden: Event_user" $ - testObjects + testGroup "Golden: Event_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Event_user.testObject_Event_user_1, "testObject_Event_user_1.json"), (Test.Wire.API.Golden.Generated.Event_user.testObject_Event_user_2, "testObject_Event_user_2.json"), (Test.Wire.API.Golden.Generated.Event_user.testObject_Event_user_3, "testObject_Event_user_3.json"), @@ -679,8 +679,8 @@ tests = (Test.Wire.API.Golden.Generated.Event_user.testObject_Event_user_15, "testObject_Event_user_15.json"), (Test.Wire.API.Golden.Generated.Event_user.testObject_Event_user_16, "testObject_Event_user_16.json") ], - testGroup "Golden: EventType_user" $ - testObjects + testGroup "Golden: EventType_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.EventType_user.testObject_EventType_user_1, "testObject_EventType_user_1.json"), (Test.Wire.API.Golden.Generated.EventType_user.testObject_EventType_user_2, "testObject_EventType_user_2.json"), (Test.Wire.API.Golden.Generated.EventType_user.testObject_EventType_user_3, "testObject_EventType_user_3.json"), @@ -696,14 +696,14 @@ tests = (Test.Wire.API.Golden.Generated.EventType_user.testObject_EventType_user_13, "testObject_EventType_user_13.json"), (Test.Wire.API.Golden.Generated.EventType_user.testObject_EventType_user_14, "testObject_EventType_user_14.json") ], - testGroup "Golden: SimpleMember_user" $ - testObjects + testGroup "Golden: SimpleMember_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.SimpleMember_user.testObject_SimpleMember_user_1, "testObject_SimpleMember_user_1.json" ) ], - testGroup "Golden: SimpleMembers_user" $ - testObjects + testGroup "Golden: SimpleMembers_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.SimpleMembers_user.testObject_SimpleMembers_user_1, "testObject_SimpleMembers_user_1.json" ), @@ -711,13 +711,13 @@ tests = "testObject_SimpleMembers_user_2.json" ) ], - testGroup "Golden: Connect_user" $ - testObjects + testGroup "Golden: Connect_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Connect_user.testObject_Connect_user_1, "testObject_Connect_user_1.json"), (Test.Wire.API.Golden.Generated.Connect_user.testObject_Connect_user_2, "testObject_Connect_user_2.json") ], - testGroup "Golden: MemberUpdateData_user" $ - testObjects + testGroup "Golden: MemberUpdateData_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.MemberUpdateData_user.testObject_MemberUpdateData_user_1, "testObject_MemberUpdateData_user_1.json" ), @@ -725,8 +725,8 @@ tests = "testObject_MemberUpdateData_user_2.json" ) ], - testGroup "Golden: OtrMessage_user" $ - testObjects + testGroup "Golden: OtrMessage_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.OtrMessage_user.testObject_OtrMessage_user_1, "testObject_OtrMessage_user_1.json" ), @@ -734,17 +734,17 @@ tests = "testObject_OtrMessage_user_2.json" ) ], - testGroup "Golden: Priority_user" $ - testObjects + testGroup "Golden: Priority_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Priority_user.testObject_Priority_user_1, "testObject_Priority_user_1.json"), (Test.Wire.API.Golden.Generated.Priority_user.testObject_Priority_user_2, "testObject_Priority_user_2.json") ], - testGroup "Golden: OtrRecipients_user" $ - testObjects + testGroup "Golden: OtrRecipients_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.OtrRecipients_user.testObject_OtrRecipients_user_1, "testObject_OtrRecipients_user_1.json") ], - testGroup "Golden: NewOtrMessage_user" $ - testObjects + testGroup "Golden: NewOtrMessage_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.NewOtrMessage_user.testObject_NewOtrMessage_user_1, "testObject_NewOtrMessage_user_1.json" ), @@ -752,20 +752,20 @@ tests = "testObject_NewOtrMessage_user_2.json" ) ], - testGroup "Golden: ClientMismatch_user" $ - testObjects + testGroup "Golden: ClientMismatch_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.ClientMismatch_user.testObject_ClientMismatch_user_1, "testObject_ClientMismatch_user_1.json" ) ], - testGroup "Golden: QueuedNotification_user" $ - testObjects + testGroup "Golden: QueuedNotification_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.QueuedNotification_user.testObject_QueuedNotification_user_1, "testObject_QueuedNotification_user_1.json" ) ], - testGroup "Golden: QueuedNotificationList_user" $ - testObjects + testGroup "Golden: QueuedNotificationList_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.QueuedNotificationList_user.testObject_QueuedNotificationList_user_1, "testObject_QueuedNotificationList_user_1.json" ), @@ -773,8 +773,8 @@ tests = "testObject_QueuedNotificationList_user_2.json" ) ], - testGroup "Golden: PropertyKey_user" $ - testObjects + testGroup "Golden: PropertyKey_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.PropertyKey_user.testObject_PropertyKey_user_1, "testObject_PropertyKey_user_1.json"), (Test.Wire.API.Golden.Generated.PropertyKey_user.testObject_PropertyKey_user_2, "testObject_PropertyKey_user_2.json"), (Test.Wire.API.Golden.Generated.PropertyKey_user.testObject_PropertyKey_user_3, "testObject_PropertyKey_user_3.json"), @@ -796,8 +796,8 @@ tests = (Test.Wire.API.Golden.Generated.PropertyKey_user.testObject_PropertyKey_user_19, "testObject_PropertyKey_user_19.json"), (Test.Wire.API.Golden.Generated.PropertyKey_user.testObject_PropertyKey_user_20, "testObject_PropertyKey_user_20.json") ], - testGroup "Golden: Push_2eToken_2eTransport_user" $ - testObjects + testGroup "Golden: Push_2eToken_2eTransport_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.Push_2eToken_2eTransport_user.testObject_Push_2eToken_2eTransport_user_1, "testObject_Push_2eToken_2eTransport_user_1.json" ), @@ -814,20 +814,20 @@ tests = "testObject_Push_2eToken_2eTransport_user_5.json" ) ], - testGroup "Golden: Token_user" $ - testObjects + testGroup "Golden: Token_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.Token_user.testObject_Token_user_1, "testObject_Token_user_1.json") ], - testGroup "Golden: AppName_user" $ - testObjects + testGroup "Golden: AppName_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.AppName_user.testObject_AppName_user_1, "testObject_AppName_user_1.json") ], - testGroup "Golden: PushToken_user" $ - testObjects + testGroup "Golden: PushToken_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.PushToken_user.testObject_PushToken_user_1, "testObject_PushToken_user_1.json") ], - testGroup "Golden: PushTokenList_user" $ - testObjects + testGroup "Golden: PushTokenList_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.PushTokenList_user.testObject_PushTokenList_user_1, "testObject_PushTokenList_user_1.json" ), @@ -835,14 +835,14 @@ tests = "testObject_PushTokenList_user_2.json" ) ], - testGroup "Golden: NameUpdate_user" $ - testObjects + testGroup "Golden: NameUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.NameUpdate_user.testObject_NameUpdate_user_1, "testObject_NameUpdate_user_1.json" ) ], - testGroup "Golden: NewUser_user" $ - testObjects + testGroup "Golden: NewUser_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.NewUser_user.testObject_NewUser_user_1, "testObject_NewUser_user_1.json" ), @@ -868,32 +868,32 @@ tests = "testObject_NewUser_user_8.json" ) ], - testGroup "Golden: NewUserPublic_user" $ - testObjects + testGroup "Golden: NewUserPublic_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.NewUserPublic_user.testObject_NewUserPublic_user_1, "testObject_NewUserPublic_user_1.json" ) ], - testGroup "Golden: LimitedQualifiedUserIdList_user_1" $ - testObjects + testGroup "Golden: LimitedQualifiedUserIdList_user_1" + $ testObjects [ ( Test.Wire.API.Golden.Generated.LimitedQualifiedUserIdList_user.testObject_LimitedQualifiedUserIdList_user_1, "testObject_LimitedQualifiedUserIdList_user_1.json" ) ], - testGroup "Golden: LimitedQualifiedUserIdList_user_2" $ - testObjects + testGroup "Golden: LimitedQualifiedUserIdList_user_2" + $ testObjects [ ( Test.Wire.API.Golden.Generated.LimitedQualifiedUserIdList_user.testObject_LimitedQualifiedUserIdList_user_2, "testObject_LimitedQualifiedUserIdList_user_2.json" ) ], - testGroup "Golden: LimitedQualifiedUserIdList_user_3" $ - testObjects + testGroup "Golden: LimitedQualifiedUserIdList_user_3" + $ testObjects [ ( Test.Wire.API.Golden.Generated.LimitedQualifiedUserIdList_user.testObject_LimitedQualifiedUserIdList_user_3, "testObject_LimitedQualifiedUserIdList_user_3.json" ) ], - testGroup "Golden: UserProfile_user" $ - testObjects + testGroup "Golden: UserProfile_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.UserProfile_user.testObject_UserProfile_user_1, "testObject_UserProfile_user_1.json" ), @@ -901,8 +901,8 @@ tests = "testObject_UserProfile_user_2.json" ) ], - testGroup "Golden: User_user" $ - testObjects + testGroup "Golden: User_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.User_user.testObject_User_user_1, "testObject_User_user_1.json" ), @@ -919,14 +919,14 @@ tests = "testObject_User_user_5.json" ) ], - testGroup "Golden: SelfProfile_user" $ - testObjects + testGroup "Golden: SelfProfile_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.SelfProfile_user.testObject_SelfProfile_user_1, "testObject_SelfProfile_user_1.json" ) ], - testGroup "Golden: InvitationCode_user" $ - testObjects + testGroup "Golden: InvitationCode_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.InvitationCode_user.testObject_InvitationCode_user_1, "testObject_InvitationCode_user_1.json" ), @@ -943,8 +943,8 @@ tests = "testObject_InvitationCode_user_5.json" ) ], - testGroup "Golden: BindingNewTeamUser_user" $ - testObjects + testGroup "Golden: BindingNewTeamUser_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.BindingNewTeamUser_user.testObject_BindingNewTeamUser_user_1, "testObject_BindingNewTeamUser_user_1.json" ), @@ -952,8 +952,8 @@ tests = "testObject_BindingNewTeamUser_user_2.json" ) ], - testGroup "Golden: UserUpdate_user" $ - testObjects + testGroup "Golden: UserUpdate_user" + $ testObjects [ ( Test.Wire.API.Golden.Generated.UserUpdate_user.testObject_UserUpdate_user_1, "testObject_UserUpdate_user_1.json" ), @@ -961,222 +961,222 @@ tests = "testObject_UserUpdate_user_2.json" ) ], - testGroup "Golden: PasswordChange_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_1, "testObject_PasswordChange_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_2, "testObject_PasswordChange_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_3, "testObject_PasswordChange_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_4, "testObject_PasswordChange_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_5, "testObject_PasswordChange_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_6, "testObject_PasswordChange_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_7, "testObject_PasswordChange_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_8, "testObject_PasswordChange_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_9, "testObject_PasswordChange_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_10, "testObject_PasswordChange_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_11, "testObject_PasswordChange_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_12, "testObject_PasswordChange_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_13, "testObject_PasswordChange_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_14, "testObject_PasswordChange_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_15, "testObject_PasswordChange_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_16, "testObject_PasswordChange_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_17, "testObject_PasswordChange_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_18, "testObject_PasswordChange_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_19, "testObject_PasswordChange_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_20, "testObject_PasswordChange_user_20.json")], - testGroup "Golden: LocaleUpdate_user" $ - testObjects [(Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_1, "testObject_LocaleUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_2, "testObject_LocaleUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_3, "testObject_LocaleUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_4, "testObject_LocaleUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_5, "testObject_LocaleUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_6, "testObject_LocaleUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_7, "testObject_LocaleUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_8, "testObject_LocaleUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_9, "testObject_LocaleUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_10, "testObject_LocaleUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_11, "testObject_LocaleUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_12, "testObject_LocaleUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_13, "testObject_LocaleUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_14, "testObject_LocaleUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_15, "testObject_LocaleUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_16, "testObject_LocaleUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_17, "testObject_LocaleUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_18, "testObject_LocaleUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_19, "testObject_LocaleUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_20, "testObject_LocaleUpdate_user_20.json")], - testGroup "Golden: EmailUpdate_user" $ - testObjects [(Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_1, "testObject_EmailUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_2, "testObject_EmailUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_3, "testObject_EmailUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_4, "testObject_EmailUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_5, "testObject_EmailUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_6, "testObject_EmailUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_7, "testObject_EmailUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_8, "testObject_EmailUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_9, "testObject_EmailUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_10, "testObject_EmailUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_11, "testObject_EmailUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_12, "testObject_EmailUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_13, "testObject_EmailUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_14, "testObject_EmailUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_15, "testObject_EmailUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_16, "testObject_EmailUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_17, "testObject_EmailUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_18, "testObject_EmailUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_19, "testObject_EmailUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_20, "testObject_EmailUpdate_user_20.json")], - testGroup "Golden: PhoneUpdate_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_1, "testObject_PhoneUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_2, "testObject_PhoneUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_3, "testObject_PhoneUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_4, "testObject_PhoneUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_5, "testObject_PhoneUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_6, "testObject_PhoneUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_7, "testObject_PhoneUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_8, "testObject_PhoneUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_9, "testObject_PhoneUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_10, "testObject_PhoneUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_11, "testObject_PhoneUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_12, "testObject_PhoneUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_13, "testObject_PhoneUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_14, "testObject_PhoneUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_15, "testObject_PhoneUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_16, "testObject_PhoneUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_17, "testObject_PhoneUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_18, "testObject_PhoneUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_19, "testObject_PhoneUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_20, "testObject_PhoneUpdate_user_20.json")], - testGroup "Golden: HandleUpdate_user" $ - testObjects [(Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_1, "testObject_HandleUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_2, "testObject_HandleUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_3, "testObject_HandleUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_4, "testObject_HandleUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_5, "testObject_HandleUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_6, "testObject_HandleUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_7, "testObject_HandleUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_8, "testObject_HandleUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_9, "testObject_HandleUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_10, "testObject_HandleUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_11, "testObject_HandleUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_12, "testObject_HandleUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_13, "testObject_HandleUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_14, "testObject_HandleUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_15, "testObject_HandleUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_16, "testObject_HandleUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_17, "testObject_HandleUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_18, "testObject_HandleUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_19, "testObject_HandleUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_20, "testObject_HandleUpdate_user_20.json")], - testGroup "Golden: DeleteUser_user" $ - testObjects [(Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_1, "testObject_DeleteUser_user_1.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_2, "testObject_DeleteUser_user_2.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_3, "testObject_DeleteUser_user_3.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_4, "testObject_DeleteUser_user_4.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_5, "testObject_DeleteUser_user_5.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_6, "testObject_DeleteUser_user_6.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_7, "testObject_DeleteUser_user_7.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_8, "testObject_DeleteUser_user_8.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_9, "testObject_DeleteUser_user_9.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_10, "testObject_DeleteUser_user_10.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_11, "testObject_DeleteUser_user_11.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_12, "testObject_DeleteUser_user_12.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_13, "testObject_DeleteUser_user_13.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_14, "testObject_DeleteUser_user_14.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_15, "testObject_DeleteUser_user_15.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_16, "testObject_DeleteUser_user_16.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_17, "testObject_DeleteUser_user_17.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_18, "testObject_DeleteUser_user_18.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_19, "testObject_DeleteUser_user_19.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_20, "testObject_DeleteUser_user_20.json")], - testGroup "Golden: VerifyDeleteUser_user" $ - testObjects [(Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_1, "testObject_VerifyDeleteUser_user_1.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_2, "testObject_VerifyDeleteUser_user_2.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_3, "testObject_VerifyDeleteUser_user_3.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_4, "testObject_VerifyDeleteUser_user_4.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_5, "testObject_VerifyDeleteUser_user_5.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_6, "testObject_VerifyDeleteUser_user_6.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_7, "testObject_VerifyDeleteUser_user_7.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_8, "testObject_VerifyDeleteUser_user_8.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_9, "testObject_VerifyDeleteUser_user_9.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_10, "testObject_VerifyDeleteUser_user_10.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_11, "testObject_VerifyDeleteUser_user_11.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_12, "testObject_VerifyDeleteUser_user_12.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_13, "testObject_VerifyDeleteUser_user_13.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_14, "testObject_VerifyDeleteUser_user_14.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_15, "testObject_VerifyDeleteUser_user_15.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_16, "testObject_VerifyDeleteUser_user_16.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_17, "testObject_VerifyDeleteUser_user_17.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_18, "testObject_VerifyDeleteUser_user_18.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_19, "testObject_VerifyDeleteUser_user_19.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_20, "testObject_VerifyDeleteUser_user_20.json")], - testGroup "Golden: DeletionCodeTimeout_user" $ - testObjects [(Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_1, "testObject_DeletionCodeTimeout_user_1.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_2, "testObject_DeletionCodeTimeout_user_2.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_3, "testObject_DeletionCodeTimeout_user_3.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_4, "testObject_DeletionCodeTimeout_user_4.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_5, "testObject_DeletionCodeTimeout_user_5.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_6, "testObject_DeletionCodeTimeout_user_6.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_7, "testObject_DeletionCodeTimeout_user_7.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_8, "testObject_DeletionCodeTimeout_user_8.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_9, "testObject_DeletionCodeTimeout_user_9.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_10, "testObject_DeletionCodeTimeout_user_10.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_11, "testObject_DeletionCodeTimeout_user_11.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_12, "testObject_DeletionCodeTimeout_user_12.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_13, "testObject_DeletionCodeTimeout_user_13.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_14, "testObject_DeletionCodeTimeout_user_14.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_15, "testObject_DeletionCodeTimeout_user_15.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_16, "testObject_DeletionCodeTimeout_user_16.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_17, "testObject_DeletionCodeTimeout_user_17.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_18, "testObject_DeletionCodeTimeout_user_18.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_19, "testObject_DeletionCodeTimeout_user_19.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_20, "testObject_DeletionCodeTimeout_user_20.json")], - testGroup "Golden: ActivationKey_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_1, "testObject_ActivationKey_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_2, "testObject_ActivationKey_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_3, "testObject_ActivationKey_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_4, "testObject_ActivationKey_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_5, "testObject_ActivationKey_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_6, "testObject_ActivationKey_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_7, "testObject_ActivationKey_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_8, "testObject_ActivationKey_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_9, "testObject_ActivationKey_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_10, "testObject_ActivationKey_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_11, "testObject_ActivationKey_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_12, "testObject_ActivationKey_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_13, "testObject_ActivationKey_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_14, "testObject_ActivationKey_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_15, "testObject_ActivationKey_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_16, "testObject_ActivationKey_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_17, "testObject_ActivationKey_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_18, "testObject_ActivationKey_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_19, "testObject_ActivationKey_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_20, "testObject_ActivationKey_user_20.json")], - testGroup "Golden: ActivationCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_1, "testObject_ActivationCode_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_2, "testObject_ActivationCode_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_3, "testObject_ActivationCode_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_4, "testObject_ActivationCode_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_5, "testObject_ActivationCode_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_6, "testObject_ActivationCode_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_7, "testObject_ActivationCode_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_8, "testObject_ActivationCode_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_9, "testObject_ActivationCode_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_10, "testObject_ActivationCode_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_11, "testObject_ActivationCode_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_12, "testObject_ActivationCode_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_13, "testObject_ActivationCode_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_14, "testObject_ActivationCode_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_15, "testObject_ActivationCode_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_16, "testObject_ActivationCode_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_17, "testObject_ActivationCode_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_18, "testObject_ActivationCode_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_19, "testObject_ActivationCode_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_20, "testObject_ActivationCode_user_20.json")], - testGroup "Golden: Activate_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_1, "testObject_Activate_user_1.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_2, "testObject_Activate_user_2.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_3, "testObject_Activate_user_3.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_4, "testObject_Activate_user_4.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_5, "testObject_Activate_user_5.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_6, "testObject_Activate_user_6.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_7, "testObject_Activate_user_7.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_8, "testObject_Activate_user_8.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_9, "testObject_Activate_user_9.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_10, "testObject_Activate_user_10.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_11, "testObject_Activate_user_11.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_12, "testObject_Activate_user_12.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_13, "testObject_Activate_user_13.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_14, "testObject_Activate_user_14.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_15, "testObject_Activate_user_15.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_16, "testObject_Activate_user_16.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_17, "testObject_Activate_user_17.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_18, "testObject_Activate_user_18.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_19, "testObject_Activate_user_19.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_20, "testObject_Activate_user_20.json")], - testGroup "Golden: ActivationResponse_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_1, "testObject_ActivationResponse_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_2, "testObject_ActivationResponse_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_3, "testObject_ActivationResponse_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_4, "testObject_ActivationResponse_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_5, "testObject_ActivationResponse_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_6, "testObject_ActivationResponse_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_7, "testObject_ActivationResponse_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_8, "testObject_ActivationResponse_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_9, "testObject_ActivationResponse_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_10, "testObject_ActivationResponse_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_11, "testObject_ActivationResponse_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_12, "testObject_ActivationResponse_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_13, "testObject_ActivationResponse_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_14, "testObject_ActivationResponse_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_15, "testObject_ActivationResponse_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_16, "testObject_ActivationResponse_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_17, "testObject_ActivationResponse_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_18, "testObject_ActivationResponse_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_19, "testObject_ActivationResponse_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_20, "testObject_ActivationResponse_user_20.json")], - testGroup "Golden: SendActivationCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_1, "testObject_SendActivationCode_user_1.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_2, "testObject_SendActivationCode_user_2.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_3, "testObject_SendActivationCode_user_3.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_4, "testObject_SendActivationCode_user_4.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_5, "testObject_SendActivationCode_user_5.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_6, "testObject_SendActivationCode_user_6.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_7, "testObject_SendActivationCode_user_7.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_8, "testObject_SendActivationCode_user_8.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_9, "testObject_SendActivationCode_user_9.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_10, "testObject_SendActivationCode_user_10.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_11, "testObject_SendActivationCode_user_11.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_12, "testObject_SendActivationCode_user_12.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_13, "testObject_SendActivationCode_user_13.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_14, "testObject_SendActivationCode_user_14.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_15, "testObject_SendActivationCode_user_15.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_16, "testObject_SendActivationCode_user_16.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_17, "testObject_SendActivationCode_user_17.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_18, "testObject_SendActivationCode_user_18.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_19, "testObject_SendActivationCode_user_19.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_20, "testObject_SendActivationCode_user_20.json")], - testGroup "Golden: LoginId_user" $ - testObjects [(Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_1, "testObject_LoginId_user_1.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_2, "testObject_LoginId_user_2.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_3, "testObject_LoginId_user_3.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_4, "testObject_LoginId_user_4.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_5, "testObject_LoginId_user_5.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_6, "testObject_LoginId_user_6.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_7, "testObject_LoginId_user_7.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_8, "testObject_LoginId_user_8.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_9, "testObject_LoginId_user_9.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_10, "testObject_LoginId_user_10.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_11, "testObject_LoginId_user_11.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_12, "testObject_LoginId_user_12.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_13, "testObject_LoginId_user_13.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_14, "testObject_LoginId_user_14.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_15, "testObject_LoginId_user_15.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_16, "testObject_LoginId_user_16.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_17, "testObject_LoginId_user_17.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_18, "testObject_LoginId_user_18.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_19, "testObject_LoginId_user_19.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_20, "testObject_LoginId_user_20.json")], - testGroup "Golden: LoginCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_1, "testObject_LoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_2, "testObject_LoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_3, "testObject_LoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_4, "testObject_LoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_5, "testObject_LoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_6, "testObject_LoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_7, "testObject_LoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_8, "testObject_LoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_9, "testObject_LoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_10, "testObject_LoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_11, "testObject_LoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_12, "testObject_LoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_13, "testObject_LoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_14, "testObject_LoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_15, "testObject_LoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_16, "testObject_LoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_17, "testObject_LoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_18, "testObject_LoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_19, "testObject_LoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_20, "testObject_LoginCode_user_20.json")], - testGroup "Golden: PendingLoginCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_1, "testObject_PendingLoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_2, "testObject_PendingLoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_3, "testObject_PendingLoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_4, "testObject_PendingLoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_5, "testObject_PendingLoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_6, "testObject_PendingLoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_7, "testObject_PendingLoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_8, "testObject_PendingLoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_9, "testObject_PendingLoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_10, "testObject_PendingLoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_11, "testObject_PendingLoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_12, "testObject_PendingLoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_13, "testObject_PendingLoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_14, "testObject_PendingLoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_15, "testObject_PendingLoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_16, "testObject_PendingLoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_17, "testObject_PendingLoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_18, "testObject_PendingLoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_19, "testObject_PendingLoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_20, "testObject_PendingLoginCode_user_20.json")], - testGroup "Golden: SendLoginCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_1, "testObject_SendLoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_2, "testObject_SendLoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_3, "testObject_SendLoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_4, "testObject_SendLoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_5, "testObject_SendLoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_6, "testObject_SendLoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_7, "testObject_SendLoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_8, "testObject_SendLoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_9, "testObject_SendLoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_10, "testObject_SendLoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_11, "testObject_SendLoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_12, "testObject_SendLoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_13, "testObject_SendLoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_14, "testObject_SendLoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_15, "testObject_SendLoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_16, "testObject_SendLoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_17, "testObject_SendLoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_18, "testObject_SendLoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_19, "testObject_SendLoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_20, "testObject_SendLoginCode_user_20.json")], - testGroup "Golden: LoginCodeTimeout_user" $ - testObjects [(Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_1, "testObject_LoginCodeTimeout_user_1.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_2, "testObject_LoginCodeTimeout_user_2.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_3, "testObject_LoginCodeTimeout_user_3.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_4, "testObject_LoginCodeTimeout_user_4.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_5, "testObject_LoginCodeTimeout_user_5.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_6, "testObject_LoginCodeTimeout_user_6.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_7, "testObject_LoginCodeTimeout_user_7.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_8, "testObject_LoginCodeTimeout_user_8.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_9, "testObject_LoginCodeTimeout_user_9.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_10, "testObject_LoginCodeTimeout_user_10.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_11, "testObject_LoginCodeTimeout_user_11.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_12, "testObject_LoginCodeTimeout_user_12.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_13, "testObject_LoginCodeTimeout_user_13.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_14, "testObject_LoginCodeTimeout_user_14.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_15, "testObject_LoginCodeTimeout_user_15.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_16, "testObject_LoginCodeTimeout_user_16.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_17, "testObject_LoginCodeTimeout_user_17.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_18, "testObject_LoginCodeTimeout_user_18.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_19, "testObject_LoginCodeTimeout_user_19.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_20, "testObject_LoginCodeTimeout_user_20.json")], - testGroup "Golden: CookieLabel_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_1, "testObject_CookieLabel_user_1.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_2, "testObject_CookieLabel_user_2.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_3, "testObject_CookieLabel_user_3.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_4, "testObject_CookieLabel_user_4.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_5, "testObject_CookieLabel_user_5.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_6, "testObject_CookieLabel_user_6.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_7, "testObject_CookieLabel_user_7.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_8, "testObject_CookieLabel_user_8.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_9, "testObject_CookieLabel_user_9.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_10, "testObject_CookieLabel_user_10.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_11, "testObject_CookieLabel_user_11.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_12, "testObject_CookieLabel_user_12.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_13, "testObject_CookieLabel_user_13.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_14, "testObject_CookieLabel_user_14.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_15, "testObject_CookieLabel_user_15.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_16, "testObject_CookieLabel_user_16.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_17, "testObject_CookieLabel_user_17.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_18, "testObject_CookieLabel_user_18.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_19, "testObject_CookieLabel_user_19.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_20, "testObject_CookieLabel_user_20.json")], - testGroup "Golden: Login_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_1, "testObject_Login_user_1.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_2, "testObject_Login_user_2.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_3, "testObject_Login_user_3.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_4, "testObject_Login_user_4.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_5, "testObject_Login_user_5.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_6, "testObject_Login_user_6.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_7, "testObject_Login_user_7.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_8, "testObject_Login_user_8.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_9, "testObject_Login_user_9.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_10, "testObject_Login_user_10.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_11, "testObject_Login_user_11.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_12, "testObject_Login_user_12.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_13, "testObject_Login_user_13.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_14, "testObject_Login_user_14.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_15, "testObject_Login_user_15.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_16, "testObject_Login_user_16.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_17, "testObject_Login_user_17.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_18, "testObject_Login_user_18.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_19, "testObject_Login_user_19.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_20, "testObject_Login_user_20.json")], - testGroup "Golden: CookieId_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_1, "testObject_CookieId_user_1.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_2, "testObject_CookieId_user_2.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_3, "testObject_CookieId_user_3.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_4, "testObject_CookieId_user_4.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_5, "testObject_CookieId_user_5.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_6, "testObject_CookieId_user_6.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_7, "testObject_CookieId_user_7.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_8, "testObject_CookieId_user_8.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_9, "testObject_CookieId_user_9.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_10, "testObject_CookieId_user_10.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_11, "testObject_CookieId_user_11.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_12, "testObject_CookieId_user_12.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_13, "testObject_CookieId_user_13.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_14, "testObject_CookieId_user_14.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_15, "testObject_CookieId_user_15.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_16, "testObject_CookieId_user_16.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_17, "testObject_CookieId_user_17.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_18, "testObject_CookieId_user_18.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_19, "testObject_CookieId_user_19.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_20, "testObject_CookieId_user_20.json")], - testGroup "Golden: CookieType_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_1, "testObject_CookieType_user_1.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_2, "testObject_CookieType_user_2.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_3, "testObject_CookieType_user_3.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_4, "testObject_CookieType_user_4.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_5, "testObject_CookieType_user_5.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_6, "testObject_CookieType_user_6.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_7, "testObject_CookieType_user_7.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_8, "testObject_CookieType_user_8.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_9, "testObject_CookieType_user_9.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_10, "testObject_CookieType_user_10.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_11, "testObject_CookieType_user_11.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_12, "testObject_CookieType_user_12.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_13, "testObject_CookieType_user_13.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_14, "testObject_CookieType_user_14.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_15, "testObject_CookieType_user_15.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_16, "testObject_CookieType_user_16.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_17, "testObject_CookieType_user_17.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_18, "testObject_CookieType_user_18.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_19, "testObject_CookieType_user_19.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_20, "testObject_CookieType_user_20.json")], - testGroup "Golden: Cookie_20_28_29_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_1, "testObject_Cookie_20_28_29_user_1.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_2, "testObject_Cookie_20_28_29_user_2.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_3, "testObject_Cookie_20_28_29_user_3.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_4, "testObject_Cookie_20_28_29_user_4.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_5, "testObject_Cookie_20_28_29_user_5.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_6, "testObject_Cookie_20_28_29_user_6.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_7, "testObject_Cookie_20_28_29_user_7.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_8, "testObject_Cookie_20_28_29_user_8.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_9, "testObject_Cookie_20_28_29_user_9.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_10, "testObject_Cookie_20_28_29_user_10.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_11, "testObject_Cookie_20_28_29_user_11.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_12, "testObject_Cookie_20_28_29_user_12.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_13, "testObject_Cookie_20_28_29_user_13.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_14, "testObject_Cookie_20_28_29_user_14.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_15, "testObject_Cookie_20_28_29_user_15.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_16, "testObject_Cookie_20_28_29_user_16.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_17, "testObject_Cookie_20_28_29_user_17.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_18, "testObject_Cookie_20_28_29_user_18.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_19, "testObject_Cookie_20_28_29_user_19.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_20, "testObject_Cookie_20_28_29_user_20.json")], - testGroup "Golden: CookieList_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_1, "testObject_CookieList_user_1.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_2, "testObject_CookieList_user_2.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_3, "testObject_CookieList_user_3.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_4, "testObject_CookieList_user_4.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_5, "testObject_CookieList_user_5.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_6, "testObject_CookieList_user_6.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_7, "testObject_CookieList_user_7.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_8, "testObject_CookieList_user_8.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_9, "testObject_CookieList_user_9.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_10, "testObject_CookieList_user_10.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_11, "testObject_CookieList_user_11.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_12, "testObject_CookieList_user_12.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_13, "testObject_CookieList_user_13.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_14, "testObject_CookieList_user_14.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_15, "testObject_CookieList_user_15.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_16, "testObject_CookieList_user_16.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_17, "testObject_CookieList_user_17.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_18, "testObject_CookieList_user_18.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_19, "testObject_CookieList_user_19.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_20, "testObject_CookieList_user_20.json")], - testGroup "Golden: RemoveCookies_user" $ - testObjects [(Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_1, "testObject_RemoveCookies_user_1.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_2, "testObject_RemoveCookies_user_2.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_3, "testObject_RemoveCookies_user_3.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_4, "testObject_RemoveCookies_user_4.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_5, "testObject_RemoveCookies_user_5.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_6, "testObject_RemoveCookies_user_6.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_7, "testObject_RemoveCookies_user_7.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_8, "testObject_RemoveCookies_user_8.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_9, "testObject_RemoveCookies_user_9.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_10, "testObject_RemoveCookies_user_10.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_11, "testObject_RemoveCookies_user_11.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_12, "testObject_RemoveCookies_user_12.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_13, "testObject_RemoveCookies_user_13.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_14, "testObject_RemoveCookies_user_14.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_15, "testObject_RemoveCookies_user_15.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_16, "testObject_RemoveCookies_user_16.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_17, "testObject_RemoveCookies_user_17.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_18, "testObject_RemoveCookies_user_18.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_19, "testObject_RemoveCookies_user_19.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_20, "testObject_RemoveCookies_user_20.json")], - testGroup "Golden: TokenType_user" $ - testObjects [(Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_1, "testObject_TokenType_user_1.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_2, "testObject_TokenType_user_2.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_3, "testObject_TokenType_user_3.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_4, "testObject_TokenType_user_4.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_5, "testObject_TokenType_user_5.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_6, "testObject_TokenType_user_6.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_7, "testObject_TokenType_user_7.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_8, "testObject_TokenType_user_8.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_9, "testObject_TokenType_user_9.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_10, "testObject_TokenType_user_10.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_11, "testObject_TokenType_user_11.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_12, "testObject_TokenType_user_12.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_13, "testObject_TokenType_user_13.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_14, "testObject_TokenType_user_14.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_15, "testObject_TokenType_user_15.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_16, "testObject_TokenType_user_16.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_17, "testObject_TokenType_user_17.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_18, "testObject_TokenType_user_18.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_19, "testObject_TokenType_user_19.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_20, "testObject_TokenType_user_20.json")], - testGroup "Golden: AccessToken_user" $ - testObjects [(Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_1, "testObject_AccessToken_user_1.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_2, "testObject_AccessToken_user_2.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_3, "testObject_AccessToken_user_3.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_4, "testObject_AccessToken_user_4.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_5, "testObject_AccessToken_user_5.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_6, "testObject_AccessToken_user_6.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_7, "testObject_AccessToken_user_7.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_8, "testObject_AccessToken_user_8.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_9, "testObject_AccessToken_user_9.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_10, "testObject_AccessToken_user_10.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_11, "testObject_AccessToken_user_11.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_12, "testObject_AccessToken_user_12.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_13, "testObject_AccessToken_user_13.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_14, "testObject_AccessToken_user_14.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_15, "testObject_AccessToken_user_15.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_16, "testObject_AccessToken_user_16.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_17, "testObject_AccessToken_user_17.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_18, "testObject_AccessToken_user_18.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_19, "testObject_AccessToken_user_19.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_20, "testObject_AccessToken_user_20.json")], - testGroup "Golden: UserClientMap_20Int_user" $ - testObjects [(Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_1, "testObject_UserClientMap_20Int_user_1.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_2, "testObject_UserClientMap_20Int_user_2.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_3, "testObject_UserClientMap_20Int_user_3.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_4, "testObject_UserClientMap_20Int_user_4.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_5, "testObject_UserClientMap_20Int_user_5.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_6, "testObject_UserClientMap_20Int_user_6.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_7, "testObject_UserClientMap_20Int_user_7.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_8, "testObject_UserClientMap_20Int_user_8.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_9, "testObject_UserClientMap_20Int_user_9.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_10, "testObject_UserClientMap_20Int_user_10.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_11, "testObject_UserClientMap_20Int_user_11.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_12, "testObject_UserClientMap_20Int_user_12.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_13, "testObject_UserClientMap_20Int_user_13.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_14, "testObject_UserClientMap_20Int_user_14.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_15, "testObject_UserClientMap_20Int_user_15.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_16, "testObject_UserClientMap_20Int_user_16.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_17, "testObject_UserClientMap_20Int_user_17.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_18, "testObject_UserClientMap_20Int_user_18.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_19, "testObject_UserClientMap_20Int_user_19.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_20, "testObject_UserClientMap_20Int_user_20.json")], - testGroup "Golden: UserClients_user" $ - testObjects [(Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_1, "testObject_UserClients_user_1.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_2, "testObject_UserClients_user_2.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_3, "testObject_UserClients_user_3.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_4, "testObject_UserClients_user_4.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_5, "testObject_UserClients_user_5.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_6, "testObject_UserClients_user_6.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_7, "testObject_UserClients_user_7.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_8, "testObject_UserClients_user_8.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_9, "testObject_UserClients_user_9.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_10, "testObject_UserClients_user_10.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_11, "testObject_UserClients_user_11.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_12, "testObject_UserClients_user_12.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_13, "testObject_UserClients_user_13.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_14, "testObject_UserClients_user_14.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_15, "testObject_UserClients_user_15.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_16, "testObject_UserClients_user_16.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_17, "testObject_UserClients_user_17.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_18, "testObject_UserClients_user_18.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_19, "testObject_UserClients_user_19.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_20, "testObject_UserClients_user_20.json")], - testGroup "Golden: ClientType_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_1, "testObject_ClientType_user_1.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_2, "testObject_ClientType_user_2.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_3, "testObject_ClientType_user_3.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_4, "testObject_ClientType_user_4.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_5, "testObject_ClientType_user_5.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_6, "testObject_ClientType_user_6.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_7, "testObject_ClientType_user_7.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_8, "testObject_ClientType_user_8.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_9, "testObject_ClientType_user_9.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_10, "testObject_ClientType_user_10.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_11, "testObject_ClientType_user_11.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_12, "testObject_ClientType_user_12.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_13, "testObject_ClientType_user_13.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_14, "testObject_ClientType_user_14.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_15, "testObject_ClientType_user_15.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_16, "testObject_ClientType_user_16.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_17, "testObject_ClientType_user_17.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_18, "testObject_ClientType_user_18.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_19, "testObject_ClientType_user_19.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_20, "testObject_ClientType_user_20.json")], - testGroup "Golden: ClientClass_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_1, "testObject_ClientClass_user_1.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_2, "testObject_ClientClass_user_2.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_3, "testObject_ClientClass_user_3.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_4, "testObject_ClientClass_user_4.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_5, "testObject_ClientClass_user_5.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_6, "testObject_ClientClass_user_6.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_7, "testObject_ClientClass_user_7.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_8, "testObject_ClientClass_user_8.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_9, "testObject_ClientClass_user_9.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_10, "testObject_ClientClass_user_10.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_11, "testObject_ClientClass_user_11.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_12, "testObject_ClientClass_user_12.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_13, "testObject_ClientClass_user_13.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_14, "testObject_ClientClass_user_14.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_15, "testObject_ClientClass_user_15.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_16, "testObject_ClientClass_user_16.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_17, "testObject_ClientClass_user_17.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_18, "testObject_ClientClass_user_18.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_19, "testObject_ClientClass_user_19.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_20, "testObject_ClientClass_user_20.json")], - testGroup "Golden: PubClient_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_1, "testObject_PubClient_user_1.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_2, "testObject_PubClient_user_2.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_3, "testObject_PubClient_user_3.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_4, "testObject_PubClient_user_4.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_5, "testObject_PubClient_user_5.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_6, "testObject_PubClient_user_6.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_7, "testObject_PubClient_user_7.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_8, "testObject_PubClient_user_8.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_9, "testObject_PubClient_user_9.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_10, "testObject_PubClient_user_10.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_11, "testObject_PubClient_user_11.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_12, "testObject_PubClient_user_12.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_13, "testObject_PubClient_user_13.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_14, "testObject_PubClient_user_14.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_15, "testObject_PubClient_user_15.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_16, "testObject_PubClient_user_16.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_17, "testObject_PubClient_user_17.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_18, "testObject_PubClient_user_18.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_19, "testObject_PubClient_user_19.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_20, "testObject_PubClient_user_20.json")], - testGroup "Golden: ClientV5_user" $ - testObjects [(Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_1, "testObject_ClientV5_user_1.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_2, "testObject_ClientV5_user_2.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_3, "testObject_ClientV5_user_3.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_4, "testObject_ClientV5_user_4.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_5, "testObject_ClientV5_user_5.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_6, "testObject_ClientV5_user_6.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_7, "testObject_ClientV5_user_7.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_8, "testObject_ClientV5_user_8.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_9, "testObject_ClientV5_user_9.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_10, "testObject_ClientV5_user_10.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_11, "testObject_ClientV5_user_11.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_12, "testObject_ClientV5_user_12.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_13, "testObject_ClientV5_user_13.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_14, "testObject_ClientV5_user_14.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_15, "testObject_ClientV5_user_15.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_16, "testObject_ClientV5_user_16.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_17, "testObject_ClientV5_user_17.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_18, "testObject_ClientV5_user_18.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_19, "testObject_ClientV5_user_19.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_20, "testObject_ClientV5_user_20.json")], - testGroup "Golden: Client_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_1, "testObject_Client_user_1.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_2, "testObject_Client_user_2.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_3, "testObject_Client_user_3.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_4, "testObject_Client_user_4.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_5, "testObject_Client_user_5.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_6, "testObject_Client_user_6.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_7, "testObject_Client_user_7.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_8, "testObject_Client_user_8.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_9, "testObject_Client_user_9.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_10, "testObject_Client_user_10.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_11, "testObject_Client_user_11.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_12, "testObject_Client_user_12.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_13, "testObject_Client_user_13.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_14, "testObject_Client_user_14.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_15, "testObject_Client_user_15.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_16, "testObject_Client_user_16.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_17, "testObject_Client_user_17.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_18, "testObject_Client_user_18.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_19, "testObject_Client_user_19.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_20, "testObject_Client_user_20.json")], - testGroup "Golden: NewClient_user" $ - testObjects [(Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_1, "testObject_NewClient_user_1.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_2, "testObject_NewClient_user_2.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_3, "testObject_NewClient_user_3.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_4, "testObject_NewClient_user_4.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_5, "testObject_NewClient_user_5.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_6, "testObject_NewClient_user_6.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_7, "testObject_NewClient_user_7.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_8, "testObject_NewClient_user_8.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_9, "testObject_NewClient_user_9.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_10, "testObject_NewClient_user_10.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_11, "testObject_NewClient_user_11.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_12, "testObject_NewClient_user_12.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_13, "testObject_NewClient_user_13.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_14, "testObject_NewClient_user_14.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_15, "testObject_NewClient_user_15.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_16, "testObject_NewClient_user_16.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_17, "testObject_NewClient_user_17.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_18, "testObject_NewClient_user_18.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_19, "testObject_NewClient_user_19.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_20, "testObject_NewClient_user_20.json")], - testGroup "Golden: UpdateClient_user" $ - testObjects [(Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_1, "testObject_UpdateClient_user_1.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_2, "testObject_UpdateClient_user_2.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_3, "testObject_UpdateClient_user_3.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_4, "testObject_UpdateClient_user_4.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_5, "testObject_UpdateClient_user_5.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_6, "testObject_UpdateClient_user_6.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_7, "testObject_UpdateClient_user_7.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_8, "testObject_UpdateClient_user_8.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_9, "testObject_UpdateClient_user_9.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_10, "testObject_UpdateClient_user_10.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_11, "testObject_UpdateClient_user_11.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_12, "testObject_UpdateClient_user_12.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_13, "testObject_UpdateClient_user_13.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_14, "testObject_UpdateClient_user_14.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_15, "testObject_UpdateClient_user_15.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_16, "testObject_UpdateClient_user_16.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_17, "testObject_UpdateClient_user_17.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_18, "testObject_UpdateClient_user_18.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_19, "testObject_UpdateClient_user_19.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_20, "testObject_UpdateClient_user_20.json")], - testGroup "Golden: RmClient_user" $ - testObjects [(Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_1, "testObject_RmClient_user_1.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_2, "testObject_RmClient_user_2.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_3, "testObject_RmClient_user_3.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_4, "testObject_RmClient_user_4.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_5, "testObject_RmClient_user_5.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_6, "testObject_RmClient_user_6.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_7, "testObject_RmClient_user_7.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_8, "testObject_RmClient_user_8.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_9, "testObject_RmClient_user_9.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_10, "testObject_RmClient_user_10.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_11, "testObject_RmClient_user_11.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_12, "testObject_RmClient_user_12.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_13, "testObject_RmClient_user_13.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_14, "testObject_RmClient_user_14.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_15, "testObject_RmClient_user_15.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_16, "testObject_RmClient_user_16.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_17, "testObject_RmClient_user_17.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_18, "testObject_RmClient_user_18.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_19, "testObject_RmClient_user_19.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_20, "testObject_RmClient_user_20.json")], - testGroup "Golden: LastPrekey_user" $ - testObjects [(Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_1, "testObject_LastPrekey_user_1.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_2, "testObject_LastPrekey_user_2.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_3, "testObject_LastPrekey_user_3.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_4, "testObject_LastPrekey_user_4.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_5, "testObject_LastPrekey_user_5.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_6, "testObject_LastPrekey_user_6.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_7, "testObject_LastPrekey_user_7.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_8, "testObject_LastPrekey_user_8.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_9, "testObject_LastPrekey_user_9.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_10, "testObject_LastPrekey_user_10.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_11, "testObject_LastPrekey_user_11.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_12, "testObject_LastPrekey_user_12.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_13, "testObject_LastPrekey_user_13.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_14, "testObject_LastPrekey_user_14.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_15, "testObject_LastPrekey_user_15.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_16, "testObject_LastPrekey_user_16.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_17, "testObject_LastPrekey_user_17.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_18, "testObject_LastPrekey_user_18.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_19, "testObject_LastPrekey_user_19.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_20, "testObject_LastPrekey_user_20.json")], - testGroup "Golden: PrekeyId_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_1, "testObject_PrekeyId_user_1.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_2, "testObject_PrekeyId_user_2.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_3, "testObject_PrekeyId_user_3.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_4, "testObject_PrekeyId_user_4.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_5, "testObject_PrekeyId_user_5.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_6, "testObject_PrekeyId_user_6.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_7, "testObject_PrekeyId_user_7.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_8, "testObject_PrekeyId_user_8.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_9, "testObject_PrekeyId_user_9.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_10, "testObject_PrekeyId_user_10.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_11, "testObject_PrekeyId_user_11.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_12, "testObject_PrekeyId_user_12.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_13, "testObject_PrekeyId_user_13.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_14, "testObject_PrekeyId_user_14.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_15, "testObject_PrekeyId_user_15.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_16, "testObject_PrekeyId_user_16.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_17, "testObject_PrekeyId_user_17.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_18, "testObject_PrekeyId_user_18.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_19, "testObject_PrekeyId_user_19.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_20, "testObject_PrekeyId_user_20.json")], - testGroup "Golden: Prekey_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_1, "testObject_Prekey_user_1.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_2, "testObject_Prekey_user_2.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_3, "testObject_Prekey_user_3.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_4, "testObject_Prekey_user_4.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_5, "testObject_Prekey_user_5.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_6, "testObject_Prekey_user_6.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_7, "testObject_Prekey_user_7.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_8, "testObject_Prekey_user_8.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_9, "testObject_Prekey_user_9.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_10, "testObject_Prekey_user_10.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_11, "testObject_Prekey_user_11.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_12, "testObject_Prekey_user_12.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_13, "testObject_Prekey_user_13.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_14, "testObject_Prekey_user_14.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_15, "testObject_Prekey_user_15.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_16, "testObject_Prekey_user_16.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_17, "testObject_Prekey_user_17.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_18, "testObject_Prekey_user_18.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_19, "testObject_Prekey_user_19.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_20, "testObject_Prekey_user_20.json")], - testGroup "Golden: ClientPrekey_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_1, "testObject_ClientPrekey_user_1.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_2, "testObject_ClientPrekey_user_2.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_3, "testObject_ClientPrekey_user_3.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_4, "testObject_ClientPrekey_user_4.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_5, "testObject_ClientPrekey_user_5.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_6, "testObject_ClientPrekey_user_6.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_7, "testObject_ClientPrekey_user_7.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_8, "testObject_ClientPrekey_user_8.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_9, "testObject_ClientPrekey_user_9.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_10, "testObject_ClientPrekey_user_10.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_11, "testObject_ClientPrekey_user_11.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_12, "testObject_ClientPrekey_user_12.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_13, "testObject_ClientPrekey_user_13.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_14, "testObject_ClientPrekey_user_14.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_15, "testObject_ClientPrekey_user_15.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_16, "testObject_ClientPrekey_user_16.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_17, "testObject_ClientPrekey_user_17.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_18, "testObject_ClientPrekey_user_18.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_19, "testObject_ClientPrekey_user_19.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_20, "testObject_ClientPrekey_user_20.json")], - testGroup "Golden: PrekeyBundle_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_1, "testObject_PrekeyBundle_user_1.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_2, "testObject_PrekeyBundle_user_2.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_3, "testObject_PrekeyBundle_user_3.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_4, "testObject_PrekeyBundle_user_4.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_5, "testObject_PrekeyBundle_user_5.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_6, "testObject_PrekeyBundle_user_6.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_7, "testObject_PrekeyBundle_user_7.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_8, "testObject_PrekeyBundle_user_8.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_9, "testObject_PrekeyBundle_user_9.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_10, "testObject_PrekeyBundle_user_10.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_11, "testObject_PrekeyBundle_user_11.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_12, "testObject_PrekeyBundle_user_12.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_13, "testObject_PrekeyBundle_user_13.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_14, "testObject_PrekeyBundle_user_14.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_15, "testObject_PrekeyBundle_user_15.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_16, "testObject_PrekeyBundle_user_16.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_17, "testObject_PrekeyBundle_user_17.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_18, "testObject_PrekeyBundle_user_18.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_19, "testObject_PrekeyBundle_user_19.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_20, "testObject_PrekeyBundle_user_20.json")], - testGroup "Golden: UserHandleInfo_user" $ - testObjects [(Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_1, "testObject_UserHandleInfo_user_1.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_2, "testObject_UserHandleInfo_user_2.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_3, "testObject_UserHandleInfo_user_3.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_4, "testObject_UserHandleInfo_user_4.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_5, "testObject_UserHandleInfo_user_5.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_6, "testObject_UserHandleInfo_user_6.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_7, "testObject_UserHandleInfo_user_7.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_8, "testObject_UserHandleInfo_user_8.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_9, "testObject_UserHandleInfo_user_9.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_10, "testObject_UserHandleInfo_user_10.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_11, "testObject_UserHandleInfo_user_11.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_12, "testObject_UserHandleInfo_user_12.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_13, "testObject_UserHandleInfo_user_13.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_14, "testObject_UserHandleInfo_user_14.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_15, "testObject_UserHandleInfo_user_15.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_16, "testObject_UserHandleInfo_user_16.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_17, "testObject_UserHandleInfo_user_17.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_18, "testObject_UserHandleInfo_user_18.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_19, "testObject_UserHandleInfo_user_19.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_20, "testObject_UserHandleInfo_user_20.json")], - testGroup "Golden: CheckHandles_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_1, "testObject_CheckHandles_user_1.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_2, "testObject_CheckHandles_user_2.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_3, "testObject_CheckHandles_user_3.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_4, "testObject_CheckHandles_user_4.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_5, "testObject_CheckHandles_user_5.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_6, "testObject_CheckHandles_user_6.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_7, "testObject_CheckHandles_user_7.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_8, "testObject_CheckHandles_user_8.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_9, "testObject_CheckHandles_user_9.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_10, "testObject_CheckHandles_user_10.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_11, "testObject_CheckHandles_user_11.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_12, "testObject_CheckHandles_user_12.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_13, "testObject_CheckHandles_user_13.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_14, "testObject_CheckHandles_user_14.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_15, "testObject_CheckHandles_user_15.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_16, "testObject_CheckHandles_user_16.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_17, "testObject_CheckHandles_user_17.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_18, "testObject_CheckHandles_user_18.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_19, "testObject_CheckHandles_user_19.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_20, "testObject_CheckHandles_user_20.json")], - testGroup "Golden: Email_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_1, "testObject_Email_user_1.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_2, "testObject_Email_user_2.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_3, "testObject_Email_user_3.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_4, "testObject_Email_user_4.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_5, "testObject_Email_user_5.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_6, "testObject_Email_user_6.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_7, "testObject_Email_user_7.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_8, "testObject_Email_user_8.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_9, "testObject_Email_user_9.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_10, "testObject_Email_user_10.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_11, "testObject_Email_user_11.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_12, "testObject_Email_user_12.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_13, "testObject_Email_user_13.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_14, "testObject_Email_user_14.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_15, "testObject_Email_user_15.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_16, "testObject_Email_user_16.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_17, "testObject_Email_user_17.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_18, "testObject_Email_user_18.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_19, "testObject_Email_user_19.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_20, "testObject_Email_user_20.json")], - testGroup "Golden: Phone_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_1, "testObject_Phone_user_1.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_2, "testObject_Phone_user_2.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_3, "testObject_Phone_user_3.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_4, "testObject_Phone_user_4.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_5, "testObject_Phone_user_5.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_6, "testObject_Phone_user_6.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_7, "testObject_Phone_user_7.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_8, "testObject_Phone_user_8.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_9, "testObject_Phone_user_9.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_10, "testObject_Phone_user_10.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_11, "testObject_Phone_user_11.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_12, "testObject_Phone_user_12.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_13, "testObject_Phone_user_13.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_14, "testObject_Phone_user_14.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_15, "testObject_Phone_user_15.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_16, "testObject_Phone_user_16.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_17, "testObject_Phone_user_17.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_18, "testObject_Phone_user_18.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_19, "testObject_Phone_user_19.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_20, "testObject_Phone_user_20.json")], - testGroup "Golden: UserSSOId_user" $ - testObjects [(Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_2, "testObject_UserSSOId_user_2.json"), (Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_9, "testObject_UserSSOId_user_9.json"), (Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_13, "testObject_UserSSOId_user_13.json")], - testGroup "Golden: NewPasswordReset_user" $ - testObjects [(Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_1, "testObject_NewPasswordReset_user_1.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_2, "testObject_NewPasswordReset_user_2.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_3, "testObject_NewPasswordReset_user_3.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_4, "testObject_NewPasswordReset_user_4.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_5, "testObject_NewPasswordReset_user_5.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_6, "testObject_NewPasswordReset_user_6.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_7, "testObject_NewPasswordReset_user_7.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_8, "testObject_NewPasswordReset_user_8.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_9, "testObject_NewPasswordReset_user_9.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_10, "testObject_NewPasswordReset_user_10.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_11, "testObject_NewPasswordReset_user_11.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_12, "testObject_NewPasswordReset_user_12.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_13, "testObject_NewPasswordReset_user_13.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_14, "testObject_NewPasswordReset_user_14.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_15, "testObject_NewPasswordReset_user_15.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_16, "testObject_NewPasswordReset_user_16.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_17, "testObject_NewPasswordReset_user_17.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_18, "testObject_NewPasswordReset_user_18.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_19, "testObject_NewPasswordReset_user_19.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_20, "testObject_NewPasswordReset_user_20.json")], - testGroup "Golden: PasswordResetKey_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_1, "testObject_PasswordResetKey_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_2, "testObject_PasswordResetKey_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_3, "testObject_PasswordResetKey_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_4, "testObject_PasswordResetKey_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_5, "testObject_PasswordResetKey_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_6, "testObject_PasswordResetKey_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_7, "testObject_PasswordResetKey_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_8, "testObject_PasswordResetKey_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_9, "testObject_PasswordResetKey_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_10, "testObject_PasswordResetKey_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_11, "testObject_PasswordResetKey_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_12, "testObject_PasswordResetKey_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_13, "testObject_PasswordResetKey_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_14, "testObject_PasswordResetKey_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_15, "testObject_PasswordResetKey_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_16, "testObject_PasswordResetKey_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_17, "testObject_PasswordResetKey_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_18, "testObject_PasswordResetKey_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_19, "testObject_PasswordResetKey_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_20, "testObject_PasswordResetKey_user_20.json")], - testGroup "Golden: PasswordResetCode_user" $ - testObjects [(Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_1, "testObject_PasswordResetCode_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_2, "testObject_PasswordResetCode_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_3, "testObject_PasswordResetCode_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_4, "testObject_PasswordResetCode_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_5, "testObject_PasswordResetCode_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_6, "testObject_PasswordResetCode_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_7, "testObject_PasswordResetCode_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_8, "testObject_PasswordResetCode_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_9, "testObject_PasswordResetCode_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_10, "testObject_PasswordResetCode_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_11, "testObject_PasswordResetCode_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_12, "testObject_PasswordResetCode_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_13, "testObject_PasswordResetCode_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_14, "testObject_PasswordResetCode_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_15, "testObject_PasswordResetCode_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_16, "testObject_PasswordResetCode_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_17, "testObject_PasswordResetCode_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_18, "testObject_PasswordResetCode_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_19, "testObject_PasswordResetCode_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_20, "testObject_PasswordResetCode_user_20.json")], - testGroup "Golden: CompletePasswordReset_user" $ - testObjects [(Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_1, "testObject_CompletePasswordReset_user_1.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_2, "testObject_CompletePasswordReset_user_2.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_3, "testObject_CompletePasswordReset_user_3.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_4, "testObject_CompletePasswordReset_user_4.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_5, "testObject_CompletePasswordReset_user_5.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_6, "testObject_CompletePasswordReset_user_6.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_7, "testObject_CompletePasswordReset_user_7.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_8, "testObject_CompletePasswordReset_user_8.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_9, "testObject_CompletePasswordReset_user_9.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_10, "testObject_CompletePasswordReset_user_10.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_11, "testObject_CompletePasswordReset_user_11.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_12, "testObject_CompletePasswordReset_user_12.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_13, "testObject_CompletePasswordReset_user_13.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_14, "testObject_CompletePasswordReset_user_14.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_15, "testObject_CompletePasswordReset_user_15.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_16, "testObject_CompletePasswordReset_user_16.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_17, "testObject_CompletePasswordReset_user_17.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_18, "testObject_CompletePasswordReset_user_18.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_19, "testObject_CompletePasswordReset_user_19.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_20, "testObject_CompletePasswordReset_user_20.json")], - testGroup "Golden: Pict_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_1, "testObject_Pict_user_1.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_2, "testObject_Pict_user_2.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_3, "testObject_Pict_user_3.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_4, "testObject_Pict_user_4.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_5, "testObject_Pict_user_5.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_6, "testObject_Pict_user_6.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_7, "testObject_Pict_user_7.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_8, "testObject_Pict_user_8.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_9, "testObject_Pict_user_9.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_10, "testObject_Pict_user_10.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_11, "testObject_Pict_user_11.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_12, "testObject_Pict_user_12.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_13, "testObject_Pict_user_13.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_14, "testObject_Pict_user_14.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_15, "testObject_Pict_user_15.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_16, "testObject_Pict_user_16.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_17, "testObject_Pict_user_17.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_18, "testObject_Pict_user_18.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_19, "testObject_Pict_user_19.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_20, "testObject_Pict_user_20.json")], - testGroup "Golden: Name_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_1, "testObject_Name_user_1.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_2, "testObject_Name_user_2.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_3, "testObject_Name_user_3.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_4, "testObject_Name_user_4.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_5, "testObject_Name_user_5.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_6, "testObject_Name_user_6.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_7, "testObject_Name_user_7.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_8, "testObject_Name_user_8.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_9, "testObject_Name_user_9.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_10, "testObject_Name_user_10.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_11, "testObject_Name_user_11.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_12, "testObject_Name_user_12.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_13, "testObject_Name_user_13.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_14, "testObject_Name_user_14.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_15, "testObject_Name_user_15.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_16, "testObject_Name_user_16.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_17, "testObject_Name_user_17.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_18, "testObject_Name_user_18.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_19, "testObject_Name_user_19.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_20, "testObject_Name_user_20.json")], - testGroup "Golden: ColourId_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_1, "testObject_ColourId_user_1.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_2, "testObject_ColourId_user_2.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_3, "testObject_ColourId_user_3.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_4, "testObject_ColourId_user_4.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_5, "testObject_ColourId_user_5.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_6, "testObject_ColourId_user_6.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_7, "testObject_ColourId_user_7.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_8, "testObject_ColourId_user_8.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_9, "testObject_ColourId_user_9.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_10, "testObject_ColourId_user_10.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_11, "testObject_ColourId_user_11.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_12, "testObject_ColourId_user_12.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_13, "testObject_ColourId_user_13.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_14, "testObject_ColourId_user_14.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_15, "testObject_ColourId_user_15.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_16, "testObject_ColourId_user_16.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_17, "testObject_ColourId_user_17.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_18, "testObject_ColourId_user_18.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_19, "testObject_ColourId_user_19.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_20, "testObject_ColourId_user_20.json")], - testGroup "Golden: AssetSize_user" $ - testObjects [(Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_1, "testObject_AssetSize_user_1.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_2, "testObject_AssetSize_user_2.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_3, "testObject_AssetSize_user_3.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_4, "testObject_AssetSize_user_4.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_5, "testObject_AssetSize_user_5.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_6, "testObject_AssetSize_user_6.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_7, "testObject_AssetSize_user_7.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_8, "testObject_AssetSize_user_8.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_9, "testObject_AssetSize_user_9.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_10, "testObject_AssetSize_user_10.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_11, "testObject_AssetSize_user_11.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_12, "testObject_AssetSize_user_12.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_13, "testObject_AssetSize_user_13.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_14, "testObject_AssetSize_user_14.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_15, "testObject_AssetSize_user_15.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_16, "testObject_AssetSize_user_16.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_17, "testObject_AssetSize_user_17.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_18, "testObject_AssetSize_user_18.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_19, "testObject_AssetSize_user_19.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_20, "testObject_AssetSize_user_20.json")], - testGroup "Golden: User_2eProfile_2eAsset_user" $ - testObjects [(Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_1, "testObject_User_2eProfile_2eAsset_user_1.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_2, "testObject_User_2eProfile_2eAsset_user_2.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_3, "testObject_User_2eProfile_2eAsset_user_3.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_4, "testObject_User_2eProfile_2eAsset_user_4.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_5, "testObject_User_2eProfile_2eAsset_user_5.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_6, "testObject_User_2eProfile_2eAsset_user_6.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_7, "testObject_User_2eProfile_2eAsset_user_7.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_8, "testObject_User_2eProfile_2eAsset_user_8.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_9, "testObject_User_2eProfile_2eAsset_user_9.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_10, "testObject_User_2eProfile_2eAsset_user_10.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_11, "testObject_User_2eProfile_2eAsset_user_11.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_12, "testObject_User_2eProfile_2eAsset_user_12.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_13, "testObject_User_2eProfile_2eAsset_user_13.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_14, "testObject_User_2eProfile_2eAsset_user_14.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_15, "testObject_User_2eProfile_2eAsset_user_15.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_16, "testObject_User_2eProfile_2eAsset_user_16.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_17, "testObject_User_2eProfile_2eAsset_user_17.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_18, "testObject_User_2eProfile_2eAsset_user_18.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_19, "testObject_User_2eProfile_2eAsset_user_19.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_20, "testObject_User_2eProfile_2eAsset_user_20.json")], - testGroup "Golden: Locale_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_1, "testObject_Locale_user_1.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_2, "testObject_Locale_user_2.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_3, "testObject_Locale_user_3.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_4, "testObject_Locale_user_4.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_5, "testObject_Locale_user_5.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_6, "testObject_Locale_user_6.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_7, "testObject_Locale_user_7.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_8, "testObject_Locale_user_8.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_9, "testObject_Locale_user_9.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_10, "testObject_Locale_user_10.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_11, "testObject_Locale_user_11.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_12, "testObject_Locale_user_12.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_13, "testObject_Locale_user_13.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_14, "testObject_Locale_user_14.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_15, "testObject_Locale_user_15.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_16, "testObject_Locale_user_16.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_17, "testObject_Locale_user_17.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_18, "testObject_Locale_user_18.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_19, "testObject_Locale_user_19.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_20, "testObject_Locale_user_20.json")], - testGroup "Golden: ManagedBy_user" $ - testObjects [(Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_1, "testObject_ManagedBy_user_1.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_2, "testObject_ManagedBy_user_2.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_3, "testObject_ManagedBy_user_3.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_4, "testObject_ManagedBy_user_4.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_5, "testObject_ManagedBy_user_5.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_6, "testObject_ManagedBy_user_6.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_7, "testObject_ManagedBy_user_7.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_8, "testObject_ManagedBy_user_8.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_9, "testObject_ManagedBy_user_9.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_10, "testObject_ManagedBy_user_10.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_11, "testObject_ManagedBy_user_11.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_12, "testObject_ManagedBy_user_12.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_13, "testObject_ManagedBy_user_13.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_14, "testObject_ManagedBy_user_14.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_15, "testObject_ManagedBy_user_15.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_16, "testObject_ManagedBy_user_16.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_17, "testObject_ManagedBy_user_17.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_18, "testObject_ManagedBy_user_18.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_19, "testObject_ManagedBy_user_19.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_20, "testObject_ManagedBy_user_20.json")], - testGroup "Golden: RichField_user" $ - testObjects [(Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_1, "testObject_RichField_user_1.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_2, "testObject_RichField_user_2.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_3, "testObject_RichField_user_3.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_4, "testObject_RichField_user_4.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_5, "testObject_RichField_user_5.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_6, "testObject_RichField_user_6.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_7, "testObject_RichField_user_7.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_8, "testObject_RichField_user_8.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_9, "testObject_RichField_user_9.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_10, "testObject_RichField_user_10.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_11, "testObject_RichField_user_11.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_12, "testObject_RichField_user_12.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_13, "testObject_RichField_user_13.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_14, "testObject_RichField_user_14.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_15, "testObject_RichField_user_15.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_16, "testObject_RichField_user_16.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_17, "testObject_RichField_user_17.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_18, "testObject_RichField_user_18.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_19, "testObject_RichField_user_19.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_20, "testObject_RichField_user_20.json")], - testGroup "Golden: RichInfoAssocList_user" $ - testObjects [(Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_1, "testObject_RichInfoAssocList_user_1.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_2, "testObject_RichInfoAssocList_user_2.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_3, "testObject_RichInfoAssocList_user_3.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_4, "testObject_RichInfoAssocList_user_4.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_5, "testObject_RichInfoAssocList_user_5.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_6, "testObject_RichInfoAssocList_user_6.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_7, "testObject_RichInfoAssocList_user_7.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_8, "testObject_RichInfoAssocList_user_8.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_9, "testObject_RichInfoAssocList_user_9.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_10, "testObject_RichInfoAssocList_user_10.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_11, "testObject_RichInfoAssocList_user_11.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_12, "testObject_RichInfoAssocList_user_12.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_13, "testObject_RichInfoAssocList_user_13.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_14, "testObject_RichInfoAssocList_user_14.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_15, "testObject_RichInfoAssocList_user_15.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_16, "testObject_RichInfoAssocList_user_16.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_17, "testObject_RichInfoAssocList_user_17.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_18, "testObject_RichInfoAssocList_user_18.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_19, "testObject_RichInfoAssocList_user_19.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_20, "testObject_RichInfoAssocList_user_20.json")], - testGroup "Golden: RichInfo_user" $ - testObjects [(Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_1, "testObject_RichInfo_user_1.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_2, "testObject_RichInfo_user_2.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_3, "testObject_RichInfo_user_3.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_4, "testObject_RichInfo_user_4.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_5, "testObject_RichInfo_user_5.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_6, "testObject_RichInfo_user_6.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_7, "testObject_RichInfo_user_7.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_8, "testObject_RichInfo_user_8.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_9, "testObject_RichInfo_user_9.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_10, "testObject_RichInfo_user_10.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_11, "testObject_RichInfo_user_11.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_12, "testObject_RichInfo_user_12.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_13, "testObject_RichInfo_user_13.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_14, "testObject_RichInfo_user_14.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_15, "testObject_RichInfo_user_15.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_16, "testObject_RichInfo_user_16.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_17, "testObject_RichInfo_user_17.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_18, "testObject_RichInfo_user_18.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_19, "testObject_RichInfo_user_19.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_20, "testObject_RichInfo_user_20.json")], - testGroup "Golden: SearchResult_20Contact_user" $ - testObjects [(Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_1, "testObject_SearchResult_20Contact_user_1.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_2, "testObject_SearchResult_20Contact_user_2.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_3, "testObject_SearchResult_20Contact_user_3.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_4, "testObject_SearchResult_20Contact_user_4.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_5, "testObject_SearchResult_20Contact_user_5.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_6, "testObject_SearchResult_20Contact_user_6.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_7, "testObject_SearchResult_20Contact_user_7.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_8, "testObject_SearchResult_20Contact_user_8.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_9, "testObject_SearchResult_20Contact_user_9.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_10, "testObject_SearchResult_20Contact_user_10.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_11, "testObject_SearchResult_20Contact_user_11.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_12, "testObject_SearchResult_20Contact_user_12.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_13, "testObject_SearchResult_20Contact_user_13.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_14, "testObject_SearchResult_20Contact_user_14.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_15, "testObject_SearchResult_20Contact_user_15.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_16, "testObject_SearchResult_20Contact_user_16.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_17, "testObject_SearchResult_20Contact_user_17.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_18, "testObject_SearchResult_20Contact_user_18.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_19, "testObject_SearchResult_20Contact_user_19.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_20, "testObject_SearchResult_20Contact_user_20.json")], - testGroup "Golden: Contact_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_1, "testObject_Contact_user_1.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_2, "testObject_Contact_user_2.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_3, "testObject_Contact_user_3.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_4, "testObject_Contact_user_4.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_5, "testObject_Contact_user_5.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_6, "testObject_Contact_user_6.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_7, "testObject_Contact_user_7.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_8, "testObject_Contact_user_8.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_9, "testObject_Contact_user_9.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_10, "testObject_Contact_user_10.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_11, "testObject_Contact_user_11.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_12, "testObject_Contact_user_12.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_13, "testObject_Contact_user_13.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_14, "testObject_Contact_user_14.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_15, "testObject_Contact_user_15.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_16, "testObject_Contact_user_16.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_17, "testObject_Contact_user_17.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_18, "testObject_Contact_user_18.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_19, "testObject_Contact_user_19.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_20, "testObject_Contact_user_20.json")], - testGroup "Golden: SearchResult_20TeamContact_user" $ - testObjects [(Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_1, "testObject_SearchResult_20TeamContact_user_1.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_2, "testObject_SearchResult_20TeamContact_user_2.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_3, "testObject_SearchResult_20TeamContact_user_3.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_4, "testObject_SearchResult_20TeamContact_user_4.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_5, "testObject_SearchResult_20TeamContact_user_5.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_6, "testObject_SearchResult_20TeamContact_user_6.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_7, "testObject_SearchResult_20TeamContact_user_7.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_8, "testObject_SearchResult_20TeamContact_user_8.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_9, "testObject_SearchResult_20TeamContact_user_9.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_10, "testObject_SearchResult_20TeamContact_user_10.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_11, "testObject_SearchResult_20TeamContact_user_11.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_12, "testObject_SearchResult_20TeamContact_user_12.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_13, "testObject_SearchResult_20TeamContact_user_13.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_14, "testObject_SearchResult_20TeamContact_user_14.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_15, "testObject_SearchResult_20TeamContact_user_15.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_16, "testObject_SearchResult_20TeamContact_user_16.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_17, "testObject_SearchResult_20TeamContact_user_17.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_18, "testObject_SearchResult_20TeamContact_user_18.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_19, "testObject_SearchResult_20TeamContact_user_19.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_20, "testObject_SearchResult_20TeamContact_user_20.json")], - testGroup "Golden: TeamContact_user" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_1, "testObject_TeamContact_user_1.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_2, "testObject_TeamContact_user_2.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_3, "testObject_TeamContact_user_3.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_4, "testObject_TeamContact_user_4.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_5, "testObject_TeamContact_user_5.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_6, "testObject_TeamContact_user_6.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_7, "testObject_TeamContact_user_7.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_8, "testObject_TeamContact_user_8.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_9, "testObject_TeamContact_user_9.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_10, "testObject_TeamContact_user_10.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_11, "testObject_TeamContact_user_11.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_12, "testObject_TeamContact_user_12.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_13, "testObject_TeamContact_user_13.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_14, "testObject_TeamContact_user_14.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_15, "testObject_TeamContact_user_15.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_16, "testObject_TeamContact_user_16.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_17, "testObject_TeamContact_user_17.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_18, "testObject_TeamContact_user_18.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_19, "testObject_TeamContact_user_19.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_20, "testObject_TeamContact_user_20.json")], - testGroup "Golden: Wrapped_20_22some_5fint_22_20Int_user" $ - testObjects [(Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_1, "testObject_Wrapped_20_22some_5fint_22_20Int_user_1.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_2, "testObject_Wrapped_20_22some_5fint_22_20Int_user_2.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_3, "testObject_Wrapped_20_22some_5fint_22_20Int_user_3.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_4, "testObject_Wrapped_20_22some_5fint_22_20Int_user_4.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_5, "testObject_Wrapped_20_22some_5fint_22_20Int_user_5.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_6, "testObject_Wrapped_20_22some_5fint_22_20Int_user_6.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_7, "testObject_Wrapped_20_22some_5fint_22_20Int_user_7.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_8, "testObject_Wrapped_20_22some_5fint_22_20Int_user_8.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_9, "testObject_Wrapped_20_22some_5fint_22_20Int_user_9.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_10, "testObject_Wrapped_20_22some_5fint_22_20Int_user_10.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_11, "testObject_Wrapped_20_22some_5fint_22_20Int_user_11.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_12, "testObject_Wrapped_20_22some_5fint_22_20Int_user_12.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_13, "testObject_Wrapped_20_22some_5fint_22_20Int_user_13.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_14, "testObject_Wrapped_20_22some_5fint_22_20Int_user_14.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_15, "testObject_Wrapped_20_22some_5fint_22_20Int_user_15.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_16, "testObject_Wrapped_20_22some_5fint_22_20Int_user_16.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_17, "testObject_Wrapped_20_22some_5fint_22_20Int_user_17.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_18, "testObject_Wrapped_20_22some_5fint_22_20Int_user_18.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_19, "testObject_Wrapped_20_22some_5fint_22_20Int_user_19.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_20, "testObject_Wrapped_20_22some_5fint_22_20Int_user_20.json")], - testGroup "Golden: Asset_asset" $ - testObjects [(Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_1, "testObject_Asset_asset_1.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_2, "testObject_Asset_asset_2.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_3, "testObject_Asset_asset_3.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_4, "testObject_Asset_asset_4.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_5, "testObject_Asset_asset_5.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_6, "testObject_Asset_asset_6.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_7, "testObject_Asset_asset_7.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_8, "testObject_Asset_asset_8.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_9, "testObject_Asset_asset_9.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_10, "testObject_Asset_asset_10.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_11, "testObject_Asset_asset_11.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_12, "testObject_Asset_asset_12.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_13, "testObject_Asset_asset_13.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_14, "testObject_Asset_asset_14.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_15, "testObject_Asset_asset_15.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_16, "testObject_Asset_asset_16.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_17, "testObject_Asset_asset_17.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_18, "testObject_Asset_asset_18.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_19, "testObject_Asset_asset_19.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_20, "testObject_Asset_asset_20.json")], - testGroup "Golden: Event_team" $ - testObjects [(Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_1, "testObject_Event_team_1.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_2, "testObject_Event_team_2.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_3, "testObject_Event_team_3.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_4, "testObject_Event_team_4.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_5, "testObject_Event_team_5.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_6, "testObject_Event_team_6.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_7, "testObject_Event_team_7.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_8, "testObject_Event_team_8.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_9, "testObject_Event_team_9.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_10, "testObject_Event_team_10.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_11, "testObject_Event_team_11.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_12, "testObject_Event_team_12.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_13, "testObject_Event_team_13.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_14, "testObject_Event_team_14.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_15, "testObject_Event_team_15.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_16, "testObject_Event_team_16.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_17, "testObject_Event_team_17.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_18, "testObject_Event_team_18.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_19, "testObject_Event_team_19.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_20, "testObject_Event_team_20.json")], - testGroup "Golden: EventType_team" $ - testObjects [(Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_1, "testObject_EventType_team_1.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_2, "testObject_EventType_team_2.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_3, "testObject_EventType_team_3.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_4, "testObject_EventType_team_4.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_5, "testObject_EventType_team_5.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_6, "testObject_EventType_team_6.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_7, "testObject_EventType_team_7.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_8, "testObject_EventType_team_8.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_9, "testObject_EventType_team_9.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_10, "testObject_EventType_team_10.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_11, "testObject_EventType_team_11.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_12, "testObject_EventType_team_12.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_13, "testObject_EventType_team_13.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_14, "testObject_EventType_team_14.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_15, "testObject_EventType_team_15.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_16, "testObject_EventType_team_16.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_17, "testObject_EventType_team_17.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_18, "testObject_EventType_team_18.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_19, "testObject_EventType_team_19.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_20, "testObject_EventType_team_20.json")], - testGroup "Golden: Provider_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_1, "testObject_Provider_provider_1.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_2, "testObject_Provider_provider_2.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_3, "testObject_Provider_provider_3.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_4, "testObject_Provider_provider_4.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_5, "testObject_Provider_provider_5.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_6, "testObject_Provider_provider_6.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_7, "testObject_Provider_provider_7.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_8, "testObject_Provider_provider_8.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_9, "testObject_Provider_provider_9.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_10, "testObject_Provider_provider_10.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_11, "testObject_Provider_provider_11.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_12, "testObject_Provider_provider_12.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_13, "testObject_Provider_provider_13.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_14, "testObject_Provider_provider_14.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_15, "testObject_Provider_provider_15.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_16, "testObject_Provider_provider_16.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_17, "testObject_Provider_provider_17.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_18, "testObject_Provider_provider_18.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_19, "testObject_Provider_provider_19.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_20, "testObject_Provider_provider_20.json")], - testGroup "Golden: ProviderProfile_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_1, "testObject_ProviderProfile_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_2, "testObject_ProviderProfile_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_3, "testObject_ProviderProfile_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_4, "testObject_ProviderProfile_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_5, "testObject_ProviderProfile_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_6, "testObject_ProviderProfile_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_7, "testObject_ProviderProfile_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_8, "testObject_ProviderProfile_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_9, "testObject_ProviderProfile_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_10, "testObject_ProviderProfile_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_11, "testObject_ProviderProfile_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_12, "testObject_ProviderProfile_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_13, "testObject_ProviderProfile_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_14, "testObject_ProviderProfile_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_15, "testObject_ProviderProfile_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_16, "testObject_ProviderProfile_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_17, "testObject_ProviderProfile_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_18, "testObject_ProviderProfile_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_19, "testObject_ProviderProfile_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_20, "testObject_ProviderProfile_provider_20.json")], - testGroup "Golden: NewProvider_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_1, "testObject_NewProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_2, "testObject_NewProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_3, "testObject_NewProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_4, "testObject_NewProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_5, "testObject_NewProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_6, "testObject_NewProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_7, "testObject_NewProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_8, "testObject_NewProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_9, "testObject_NewProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_10, "testObject_NewProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_11, "testObject_NewProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_12, "testObject_NewProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_13, "testObject_NewProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_14, "testObject_NewProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_15, "testObject_NewProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_16, "testObject_NewProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_17, "testObject_NewProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_18, "testObject_NewProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_19, "testObject_NewProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_20, "testObject_NewProvider_provider_20.json")], - testGroup "Golden: NewProviderResponse_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_1, "testObject_NewProviderResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_2, "testObject_NewProviderResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_3, "testObject_NewProviderResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_4, "testObject_NewProviderResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_5, "testObject_NewProviderResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_6, "testObject_NewProviderResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_7, "testObject_NewProviderResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_8, "testObject_NewProviderResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_9, "testObject_NewProviderResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_10, "testObject_NewProviderResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_11, "testObject_NewProviderResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_12, "testObject_NewProviderResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_13, "testObject_NewProviderResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_14, "testObject_NewProviderResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_15, "testObject_NewProviderResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_16, "testObject_NewProviderResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_17, "testObject_NewProviderResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_18, "testObject_NewProviderResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_19, "testObject_NewProviderResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_20, "testObject_NewProviderResponse_provider_20.json")], - testGroup "Golden: UpdateProvider_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_1, "testObject_UpdateProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_2, "testObject_UpdateProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_3, "testObject_UpdateProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_4, "testObject_UpdateProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_5, "testObject_UpdateProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_6, "testObject_UpdateProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_7, "testObject_UpdateProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_8, "testObject_UpdateProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_9, "testObject_UpdateProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_10, "testObject_UpdateProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_11, "testObject_UpdateProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_12, "testObject_UpdateProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_13, "testObject_UpdateProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_14, "testObject_UpdateProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_15, "testObject_UpdateProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_16, "testObject_UpdateProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_17, "testObject_UpdateProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_18, "testObject_UpdateProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_19, "testObject_UpdateProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_20, "testObject_UpdateProvider_provider_20.json")], - testGroup "Golden: ProviderActivationResponse_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_1, "testObject_ProviderActivationResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_2, "testObject_ProviderActivationResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_3, "testObject_ProviderActivationResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_4, "testObject_ProviderActivationResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_5, "testObject_ProviderActivationResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_6, "testObject_ProviderActivationResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_7, "testObject_ProviderActivationResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_8, "testObject_ProviderActivationResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_9, "testObject_ProviderActivationResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_10, "testObject_ProviderActivationResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_11, "testObject_ProviderActivationResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_12, "testObject_ProviderActivationResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_13, "testObject_ProviderActivationResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_14, "testObject_ProviderActivationResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_15, "testObject_ProviderActivationResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_16, "testObject_ProviderActivationResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_17, "testObject_ProviderActivationResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_18, "testObject_ProviderActivationResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_19, "testObject_ProviderActivationResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_20, "testObject_ProviderActivationResponse_provider_20.json")], - testGroup "Golden: ProviderLogin_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_1, "testObject_ProviderLogin_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_2, "testObject_ProviderLogin_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_3, "testObject_ProviderLogin_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_4, "testObject_ProviderLogin_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_5, "testObject_ProviderLogin_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_6, "testObject_ProviderLogin_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_7, "testObject_ProviderLogin_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_8, "testObject_ProviderLogin_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_9, "testObject_ProviderLogin_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_10, "testObject_ProviderLogin_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_11, "testObject_ProviderLogin_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_12, "testObject_ProviderLogin_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_13, "testObject_ProviderLogin_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_14, "testObject_ProviderLogin_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_15, "testObject_ProviderLogin_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_16, "testObject_ProviderLogin_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_17, "testObject_ProviderLogin_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_18, "testObject_ProviderLogin_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_19, "testObject_ProviderLogin_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_20, "testObject_ProviderLogin_provider_20.json")], - testGroup "Golden: DeleteProvider_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_1, "testObject_DeleteProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_2, "testObject_DeleteProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_3, "testObject_DeleteProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_4, "testObject_DeleteProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_5, "testObject_DeleteProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_6, "testObject_DeleteProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_7, "testObject_DeleteProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_8, "testObject_DeleteProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_9, "testObject_DeleteProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_10, "testObject_DeleteProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_11, "testObject_DeleteProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_12, "testObject_DeleteProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_13, "testObject_DeleteProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_14, "testObject_DeleteProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_15, "testObject_DeleteProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_16, "testObject_DeleteProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_17, "testObject_DeleteProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_18, "testObject_DeleteProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_19, "testObject_DeleteProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_20, "testObject_DeleteProvider_provider_20.json")], - testGroup "Golden: PasswordReset_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_1, "testObject_PasswordReset_provider_1.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_2, "testObject_PasswordReset_provider_2.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_3, "testObject_PasswordReset_provider_3.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_4, "testObject_PasswordReset_provider_4.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_5, "testObject_PasswordReset_provider_5.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_6, "testObject_PasswordReset_provider_6.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_7, "testObject_PasswordReset_provider_7.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_8, "testObject_PasswordReset_provider_8.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_9, "testObject_PasswordReset_provider_9.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_10, "testObject_PasswordReset_provider_10.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_11, "testObject_PasswordReset_provider_11.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_12, "testObject_PasswordReset_provider_12.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_13, "testObject_PasswordReset_provider_13.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_14, "testObject_PasswordReset_provider_14.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_15, "testObject_PasswordReset_provider_15.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_16, "testObject_PasswordReset_provider_16.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_17, "testObject_PasswordReset_provider_17.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_18, "testObject_PasswordReset_provider_18.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_19, "testObject_PasswordReset_provider_19.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_20, "testObject_PasswordReset_provider_20.json")], - testGroup "Golden: CompletePasswordReset_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_1, "testObject_CompletePasswordReset_provider_1.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_2, "testObject_CompletePasswordReset_provider_2.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_3, "testObject_CompletePasswordReset_provider_3.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_4, "testObject_CompletePasswordReset_provider_4.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_5, "testObject_CompletePasswordReset_provider_5.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_6, "testObject_CompletePasswordReset_provider_6.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_7, "testObject_CompletePasswordReset_provider_7.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_8, "testObject_CompletePasswordReset_provider_8.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_9, "testObject_CompletePasswordReset_provider_9.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_10, "testObject_CompletePasswordReset_provider_10.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_11, "testObject_CompletePasswordReset_provider_11.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_12, "testObject_CompletePasswordReset_provider_12.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_13, "testObject_CompletePasswordReset_provider_13.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_14, "testObject_CompletePasswordReset_provider_14.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_15, "testObject_CompletePasswordReset_provider_15.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_16, "testObject_CompletePasswordReset_provider_16.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_17, "testObject_CompletePasswordReset_provider_17.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_18, "testObject_CompletePasswordReset_provider_18.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_19, "testObject_CompletePasswordReset_provider_19.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_20, "testObject_CompletePasswordReset_provider_20.json")], - testGroup "Golden: PasswordChange_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_1, "testObject_PasswordChange_provider_1.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_2, "testObject_PasswordChange_provider_2.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_3, "testObject_PasswordChange_provider_3.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_4, "testObject_PasswordChange_provider_4.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_5, "testObject_PasswordChange_provider_5.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_6, "testObject_PasswordChange_provider_6.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_7, "testObject_PasswordChange_provider_7.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_8, "testObject_PasswordChange_provider_8.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_9, "testObject_PasswordChange_provider_9.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_10, "testObject_PasswordChange_provider_10.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_11, "testObject_PasswordChange_provider_11.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_12, "testObject_PasswordChange_provider_12.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_13, "testObject_PasswordChange_provider_13.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_14, "testObject_PasswordChange_provider_14.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_15, "testObject_PasswordChange_provider_15.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_16, "testObject_PasswordChange_provider_16.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_17, "testObject_PasswordChange_provider_17.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_18, "testObject_PasswordChange_provider_18.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_19, "testObject_PasswordChange_provider_19.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_20, "testObject_PasswordChange_provider_20.json")], - testGroup "Golden: EmailUpdate_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_1, "testObject_EmailUpdate_provider_1.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_2, "testObject_EmailUpdate_provider_2.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_3, "testObject_EmailUpdate_provider_3.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_4, "testObject_EmailUpdate_provider_4.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_5, "testObject_EmailUpdate_provider_5.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_6, "testObject_EmailUpdate_provider_6.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_7, "testObject_EmailUpdate_provider_7.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_8, "testObject_EmailUpdate_provider_8.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_9, "testObject_EmailUpdate_provider_9.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_10, "testObject_EmailUpdate_provider_10.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_11, "testObject_EmailUpdate_provider_11.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_12, "testObject_EmailUpdate_provider_12.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_13, "testObject_EmailUpdate_provider_13.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_14, "testObject_EmailUpdate_provider_14.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_15, "testObject_EmailUpdate_provider_15.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_16, "testObject_EmailUpdate_provider_16.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_17, "testObject_EmailUpdate_provider_17.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_18, "testObject_EmailUpdate_provider_18.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_19, "testObject_EmailUpdate_provider_19.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_20, "testObject_EmailUpdate_provider_20.json")], - testGroup "Golden: BotConvView_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_1, "testObject_BotConvView_provider_1.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_2, "testObject_BotConvView_provider_2.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_3, "testObject_BotConvView_provider_3.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_4, "testObject_BotConvView_provider_4.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_5, "testObject_BotConvView_provider_5.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_6, "testObject_BotConvView_provider_6.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_7, "testObject_BotConvView_provider_7.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_8, "testObject_BotConvView_provider_8.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_9, "testObject_BotConvView_provider_9.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_10, "testObject_BotConvView_provider_10.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_11, "testObject_BotConvView_provider_11.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_12, "testObject_BotConvView_provider_12.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_13, "testObject_BotConvView_provider_13.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_14, "testObject_BotConvView_provider_14.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_15, "testObject_BotConvView_provider_15.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_16, "testObject_BotConvView_provider_16.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_17, "testObject_BotConvView_provider_17.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_18, "testObject_BotConvView_provider_18.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_19, "testObject_BotConvView_provider_19.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_20, "testObject_BotConvView_provider_20.json")], - testGroup "Golden: BotUserView_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_1, "testObject_BotUserView_provider_1.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_2, "testObject_BotUserView_provider_2.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_3, "testObject_BotUserView_provider_3.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_4, "testObject_BotUserView_provider_4.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_5, "testObject_BotUserView_provider_5.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_6, "testObject_BotUserView_provider_6.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_7, "testObject_BotUserView_provider_7.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_8, "testObject_BotUserView_provider_8.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_9, "testObject_BotUserView_provider_9.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_10, "testObject_BotUserView_provider_10.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_11, "testObject_BotUserView_provider_11.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_12, "testObject_BotUserView_provider_12.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_13, "testObject_BotUserView_provider_13.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_14, "testObject_BotUserView_provider_14.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_15, "testObject_BotUserView_provider_15.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_16, "testObject_BotUserView_provider_16.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_17, "testObject_BotUserView_provider_17.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_18, "testObject_BotUserView_provider_18.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_19, "testObject_BotUserView_provider_19.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_20, "testObject_BotUserView_provider_20.json")], - testGroup "Golden: NewBotRequest_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_1, "testObject_NewBotRequest_provider_1.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_2, "testObject_NewBotRequest_provider_2.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_3, "testObject_NewBotRequest_provider_3.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_4, "testObject_NewBotRequest_provider_4.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_5, "testObject_NewBotRequest_provider_5.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_6, "testObject_NewBotRequest_provider_6.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_7, "testObject_NewBotRequest_provider_7.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_8, "testObject_NewBotRequest_provider_8.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_9, "testObject_NewBotRequest_provider_9.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_10, "testObject_NewBotRequest_provider_10.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_11, "testObject_NewBotRequest_provider_11.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_12, "testObject_NewBotRequest_provider_12.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_13, "testObject_NewBotRequest_provider_13.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_14, "testObject_NewBotRequest_provider_14.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_15, "testObject_NewBotRequest_provider_15.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_16, "testObject_NewBotRequest_provider_16.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_17, "testObject_NewBotRequest_provider_17.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_18, "testObject_NewBotRequest_provider_18.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_19, "testObject_NewBotRequest_provider_19.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_20, "testObject_NewBotRequest_provider_20.json")], - testGroup "Golden: NewBotResponse_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_1, "testObject_NewBotResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_2, "testObject_NewBotResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_3, "testObject_NewBotResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_4, "testObject_NewBotResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_5, "testObject_NewBotResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_6, "testObject_NewBotResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_7, "testObject_NewBotResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_8, "testObject_NewBotResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_9, "testObject_NewBotResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_10, "testObject_NewBotResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_11, "testObject_NewBotResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_12, "testObject_NewBotResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_13, "testObject_NewBotResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_14, "testObject_NewBotResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_15, "testObject_NewBotResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_16, "testObject_NewBotResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_17, "testObject_NewBotResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_18, "testObject_NewBotResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_19, "testObject_NewBotResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_20, "testObject_NewBotResponse_provider_20.json")], - testGroup "Golden: ServiceRef_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_1, "testObject_ServiceRef_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_2, "testObject_ServiceRef_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_3, "testObject_ServiceRef_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_4, "testObject_ServiceRef_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_5, "testObject_ServiceRef_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_6, "testObject_ServiceRef_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_7, "testObject_ServiceRef_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_8, "testObject_ServiceRef_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_9, "testObject_ServiceRef_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_10, "testObject_ServiceRef_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_11, "testObject_ServiceRef_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_12, "testObject_ServiceRef_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_13, "testObject_ServiceRef_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_14, "testObject_ServiceRef_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_15, "testObject_ServiceRef_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_16, "testObject_ServiceRef_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_17, "testObject_ServiceRef_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_18, "testObject_ServiceRef_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_19, "testObject_ServiceRef_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_20, "testObject_ServiceRef_provider_20.json")], - testGroup "Golden: ServiceKeyPEM_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_1, "testObject_ServiceKeyPEM_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_2, "testObject_ServiceKeyPEM_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_3, "testObject_ServiceKeyPEM_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_4, "testObject_ServiceKeyPEM_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_5, "testObject_ServiceKeyPEM_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_6, "testObject_ServiceKeyPEM_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_7, "testObject_ServiceKeyPEM_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_8, "testObject_ServiceKeyPEM_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_9, "testObject_ServiceKeyPEM_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_10, "testObject_ServiceKeyPEM_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_11, "testObject_ServiceKeyPEM_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_12, "testObject_ServiceKeyPEM_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_13, "testObject_ServiceKeyPEM_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_14, "testObject_ServiceKeyPEM_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_15, "testObject_ServiceKeyPEM_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_16, "testObject_ServiceKeyPEM_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_17, "testObject_ServiceKeyPEM_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_18, "testObject_ServiceKeyPEM_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_19, "testObject_ServiceKeyPEM_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_20, "testObject_ServiceKeyPEM_provider_20.json")], - testGroup "Golden: ServiceKeyType_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_1, "testObject_ServiceKeyType_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_2, "testObject_ServiceKeyType_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_3, "testObject_ServiceKeyType_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_4, "testObject_ServiceKeyType_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_5, "testObject_ServiceKeyType_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_6, "testObject_ServiceKeyType_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_7, "testObject_ServiceKeyType_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_8, "testObject_ServiceKeyType_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_9, "testObject_ServiceKeyType_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_10, "testObject_ServiceKeyType_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_11, "testObject_ServiceKeyType_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_12, "testObject_ServiceKeyType_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_13, "testObject_ServiceKeyType_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_14, "testObject_ServiceKeyType_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_15, "testObject_ServiceKeyType_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_16, "testObject_ServiceKeyType_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_17, "testObject_ServiceKeyType_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_18, "testObject_ServiceKeyType_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_19, "testObject_ServiceKeyType_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_20, "testObject_ServiceKeyType_provider_20.json")], - testGroup "Golden: ServiceKey_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_1, "testObject_ServiceKey_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_2, "testObject_ServiceKey_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_3, "testObject_ServiceKey_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_4, "testObject_ServiceKey_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_5, "testObject_ServiceKey_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_6, "testObject_ServiceKey_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_7, "testObject_ServiceKey_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_8, "testObject_ServiceKey_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_9, "testObject_ServiceKey_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_10, "testObject_ServiceKey_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_11, "testObject_ServiceKey_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_12, "testObject_ServiceKey_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_13, "testObject_ServiceKey_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_14, "testObject_ServiceKey_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_15, "testObject_ServiceKey_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_16, "testObject_ServiceKey_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_17, "testObject_ServiceKey_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_18, "testObject_ServiceKey_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_19, "testObject_ServiceKey_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_20, "testObject_ServiceKey_provider_20.json")], - testGroup "Golden: ServiceToken_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_1, "testObject_ServiceToken_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_2, "testObject_ServiceToken_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_3, "testObject_ServiceToken_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_4, "testObject_ServiceToken_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_5, "testObject_ServiceToken_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_6, "testObject_ServiceToken_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_7, "testObject_ServiceToken_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_8, "testObject_ServiceToken_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_9, "testObject_ServiceToken_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_10, "testObject_ServiceToken_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_11, "testObject_ServiceToken_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_12, "testObject_ServiceToken_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_13, "testObject_ServiceToken_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_14, "testObject_ServiceToken_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_15, "testObject_ServiceToken_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_16, "testObject_ServiceToken_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_17, "testObject_ServiceToken_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_18, "testObject_ServiceToken_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_19, "testObject_ServiceToken_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_20, "testObject_ServiceToken_provider_20.json")], - testGroup "Golden: Service_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_1, "testObject_Service_provider_1.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_2, "testObject_Service_provider_2.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_3, "testObject_Service_provider_3.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_4, "testObject_Service_provider_4.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_5, "testObject_Service_provider_5.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_6, "testObject_Service_provider_6.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_7, "testObject_Service_provider_7.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_8, "testObject_Service_provider_8.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_9, "testObject_Service_provider_9.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_10, "testObject_Service_provider_10.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_11, "testObject_Service_provider_11.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_12, "testObject_Service_provider_12.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_13, "testObject_Service_provider_13.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_14, "testObject_Service_provider_14.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_15, "testObject_Service_provider_15.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_16, "testObject_Service_provider_16.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_17, "testObject_Service_provider_17.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_18, "testObject_Service_provider_18.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_19, "testObject_Service_provider_19.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_20, "testObject_Service_provider_20.json")], - testGroup "Golden: ServiceProfile_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_1, "testObject_ServiceProfile_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_2, "testObject_ServiceProfile_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_3, "testObject_ServiceProfile_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_4, "testObject_ServiceProfile_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_5, "testObject_ServiceProfile_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_6, "testObject_ServiceProfile_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_7, "testObject_ServiceProfile_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_8, "testObject_ServiceProfile_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_9, "testObject_ServiceProfile_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_10, "testObject_ServiceProfile_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_11, "testObject_ServiceProfile_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_12, "testObject_ServiceProfile_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_13, "testObject_ServiceProfile_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_14, "testObject_ServiceProfile_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_15, "testObject_ServiceProfile_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_16, "testObject_ServiceProfile_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_17, "testObject_ServiceProfile_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_18, "testObject_ServiceProfile_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_19, "testObject_ServiceProfile_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_20, "testObject_ServiceProfile_provider_20.json")], - testGroup "Golden: ServiceProfilePage_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_1, "testObject_ServiceProfilePage_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_2, "testObject_ServiceProfilePage_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_3, "testObject_ServiceProfilePage_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_4, "testObject_ServiceProfilePage_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_5, "testObject_ServiceProfilePage_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_6, "testObject_ServiceProfilePage_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_7, "testObject_ServiceProfilePage_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_8, "testObject_ServiceProfilePage_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_9, "testObject_ServiceProfilePage_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_10, "testObject_ServiceProfilePage_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_11, "testObject_ServiceProfilePage_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_12, "testObject_ServiceProfilePage_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_13, "testObject_ServiceProfilePage_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_14, "testObject_ServiceProfilePage_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_15, "testObject_ServiceProfilePage_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_16, "testObject_ServiceProfilePage_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_17, "testObject_ServiceProfilePage_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_18, "testObject_ServiceProfilePage_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_19, "testObject_ServiceProfilePage_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_20, "testObject_ServiceProfilePage_provider_20.json")], - testGroup "Golden: NewService_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_1, "testObject_NewService_provider_1.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_2, "testObject_NewService_provider_2.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_3, "testObject_NewService_provider_3.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_4, "testObject_NewService_provider_4.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_5, "testObject_NewService_provider_5.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_6, "testObject_NewService_provider_6.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_7, "testObject_NewService_provider_7.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_8, "testObject_NewService_provider_8.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_9, "testObject_NewService_provider_9.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_10, "testObject_NewService_provider_10.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_11, "testObject_NewService_provider_11.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_12, "testObject_NewService_provider_12.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_13, "testObject_NewService_provider_13.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_14, "testObject_NewService_provider_14.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_15, "testObject_NewService_provider_15.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_16, "testObject_NewService_provider_16.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_17, "testObject_NewService_provider_17.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_18, "testObject_NewService_provider_18.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_19, "testObject_NewService_provider_19.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_20, "testObject_NewService_provider_20.json")], - testGroup "Golden: NewServiceResponse_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_1, "testObject_NewServiceResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_2, "testObject_NewServiceResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_3, "testObject_NewServiceResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_4, "testObject_NewServiceResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_5, "testObject_NewServiceResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_6, "testObject_NewServiceResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_7, "testObject_NewServiceResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_8, "testObject_NewServiceResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_9, "testObject_NewServiceResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_10, "testObject_NewServiceResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_11, "testObject_NewServiceResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_12, "testObject_NewServiceResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_13, "testObject_NewServiceResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_14, "testObject_NewServiceResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_15, "testObject_NewServiceResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_16, "testObject_NewServiceResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_17, "testObject_NewServiceResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_18, "testObject_NewServiceResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_19, "testObject_NewServiceResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_20, "testObject_NewServiceResponse_provider_20.json")], - testGroup "Golden: UpdateService_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_1, "testObject_UpdateService_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_2, "testObject_UpdateService_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_3, "testObject_UpdateService_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_4, "testObject_UpdateService_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_5, "testObject_UpdateService_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_6, "testObject_UpdateService_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_7, "testObject_UpdateService_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_8, "testObject_UpdateService_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_9, "testObject_UpdateService_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_10, "testObject_UpdateService_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_11, "testObject_UpdateService_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_12, "testObject_UpdateService_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_13, "testObject_UpdateService_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_14, "testObject_UpdateService_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_15, "testObject_UpdateService_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_16, "testObject_UpdateService_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_17, "testObject_UpdateService_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_18, "testObject_UpdateService_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_19, "testObject_UpdateService_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_20, "testObject_UpdateService_provider_20.json")], - testGroup "Golden: UpdateServiceConn_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_1, "testObject_UpdateServiceConn_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_2, "testObject_UpdateServiceConn_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_3, "testObject_UpdateServiceConn_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_4, "testObject_UpdateServiceConn_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_5, "testObject_UpdateServiceConn_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_6, "testObject_UpdateServiceConn_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_7, "testObject_UpdateServiceConn_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_8, "testObject_UpdateServiceConn_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_9, "testObject_UpdateServiceConn_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_10, "testObject_UpdateServiceConn_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_11, "testObject_UpdateServiceConn_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_12, "testObject_UpdateServiceConn_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_13, "testObject_UpdateServiceConn_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_14, "testObject_UpdateServiceConn_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_15, "testObject_UpdateServiceConn_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_16, "testObject_UpdateServiceConn_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_17, "testObject_UpdateServiceConn_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_18, "testObject_UpdateServiceConn_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_19, "testObject_UpdateServiceConn_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_20, "testObject_UpdateServiceConn_provider_20.json")], - testGroup "Golden: DeleteService_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_1, "testObject_DeleteService_provider_1.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_2, "testObject_DeleteService_provider_2.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_3, "testObject_DeleteService_provider_3.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_4, "testObject_DeleteService_provider_4.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_5, "testObject_DeleteService_provider_5.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_6, "testObject_DeleteService_provider_6.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_7, "testObject_DeleteService_provider_7.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_8, "testObject_DeleteService_provider_8.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_9, "testObject_DeleteService_provider_9.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_10, "testObject_DeleteService_provider_10.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_11, "testObject_DeleteService_provider_11.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_12, "testObject_DeleteService_provider_12.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_13, "testObject_DeleteService_provider_13.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_14, "testObject_DeleteService_provider_14.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_15, "testObject_DeleteService_provider_15.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_16, "testObject_DeleteService_provider_16.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_17, "testObject_DeleteService_provider_17.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_18, "testObject_DeleteService_provider_18.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_19, "testObject_DeleteService_provider_19.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_20, "testObject_DeleteService_provider_20.json")], - testGroup "Golden: UpdateServiceWhitelist_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_1, "testObject_UpdateServiceWhitelist_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_2, "testObject_UpdateServiceWhitelist_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_3, "testObject_UpdateServiceWhitelist_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_4, "testObject_UpdateServiceWhitelist_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_5, "testObject_UpdateServiceWhitelist_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_6, "testObject_UpdateServiceWhitelist_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_7, "testObject_UpdateServiceWhitelist_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_8, "testObject_UpdateServiceWhitelist_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_9, "testObject_UpdateServiceWhitelist_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_10, "testObject_UpdateServiceWhitelist_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_11, "testObject_UpdateServiceWhitelist_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_12, "testObject_UpdateServiceWhitelist_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_13, "testObject_UpdateServiceWhitelist_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_14, "testObject_UpdateServiceWhitelist_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_15, "testObject_UpdateServiceWhitelist_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_16, "testObject_UpdateServiceWhitelist_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_17, "testObject_UpdateServiceWhitelist_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_18, "testObject_UpdateServiceWhitelist_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_19, "testObject_UpdateServiceWhitelist_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_20, "testObject_UpdateServiceWhitelist_provider_20.json")], - testGroup "Golden: ServiceTag_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_1, "testObject_ServiceTag_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_2, "testObject_ServiceTag_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_3, "testObject_ServiceTag_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_4, "testObject_ServiceTag_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_5, "testObject_ServiceTag_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_6, "testObject_ServiceTag_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_7, "testObject_ServiceTag_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_8, "testObject_ServiceTag_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_9, "testObject_ServiceTag_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_10, "testObject_ServiceTag_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_11, "testObject_ServiceTag_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_12, "testObject_ServiceTag_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_13, "testObject_ServiceTag_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_14, "testObject_ServiceTag_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_15, "testObject_ServiceTag_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_16, "testObject_ServiceTag_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_17, "testObject_ServiceTag_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_18, "testObject_ServiceTag_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_19, "testObject_ServiceTag_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_20, "testObject_ServiceTag_provider_20.json")], - testGroup "Golden: ServiceTagList_provider" $ - testObjects [(Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_1, "testObject_ServiceTagList_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_2, "testObject_ServiceTagList_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_3, "testObject_ServiceTagList_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_4, "testObject_ServiceTagList_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_5, "testObject_ServiceTagList_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_6, "testObject_ServiceTagList_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_7, "testObject_ServiceTagList_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_8, "testObject_ServiceTagList_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_9, "testObject_ServiceTagList_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_10, "testObject_ServiceTagList_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_11, "testObject_ServiceTagList_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_12, "testObject_ServiceTagList_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_13, "testObject_ServiceTagList_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_14, "testObject_ServiceTagList_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_15, "testObject_ServiceTagList_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_16, "testObject_ServiceTagList_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_17, "testObject_ServiceTagList_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_18, "testObject_ServiceTagList_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_19, "testObject_ServiceTagList_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_20, "testObject_ServiceTagList_provider_20.json")], - testGroup "Golden: BindingNewTeam_team" $ - testObjects [(Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_1, "testObject_BindingNewTeam_team_1.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_2, "testObject_BindingNewTeam_team_2.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_3, "testObject_BindingNewTeam_team_3.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_4, "testObject_BindingNewTeam_team_4.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_5, "testObject_BindingNewTeam_team_5.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_6, "testObject_BindingNewTeam_team_6.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_7, "testObject_BindingNewTeam_team_7.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_8, "testObject_BindingNewTeam_team_8.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_9, "testObject_BindingNewTeam_team_9.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_10, "testObject_BindingNewTeam_team_10.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_11, "testObject_BindingNewTeam_team_11.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_12, "testObject_BindingNewTeam_team_12.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_13, "testObject_BindingNewTeam_team_13.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_14, "testObject_BindingNewTeam_team_14.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_15, "testObject_BindingNewTeam_team_15.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_16, "testObject_BindingNewTeam_team_16.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_17, "testObject_BindingNewTeam_team_17.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_18, "testObject_BindingNewTeam_team_18.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_19, "testObject_BindingNewTeam_team_19.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_20, "testObject_BindingNewTeam_team_20.json")], - testGroup "Golden: TeamBinding_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_1, "testObject_TeamBinding_team_1.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_2, "testObject_TeamBinding_team_2.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_3, "testObject_TeamBinding_team_3.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_4, "testObject_TeamBinding_team_4.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_5, "testObject_TeamBinding_team_5.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_6, "testObject_TeamBinding_team_6.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_7, "testObject_TeamBinding_team_7.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_8, "testObject_TeamBinding_team_8.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_9, "testObject_TeamBinding_team_9.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_10, "testObject_TeamBinding_team_10.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_11, "testObject_TeamBinding_team_11.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_12, "testObject_TeamBinding_team_12.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_13, "testObject_TeamBinding_team_13.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_14, "testObject_TeamBinding_team_14.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_15, "testObject_TeamBinding_team_15.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_16, "testObject_TeamBinding_team_16.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_17, "testObject_TeamBinding_team_17.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_18, "testObject_TeamBinding_team_18.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_19, "testObject_TeamBinding_team_19.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_20, "testObject_TeamBinding_team_20.json")], - testGroup "Golden: Team_team" $ - testObjects [(Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_1, "testObject_Team_team_1.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_2, "testObject_Team_team_2.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_3, "testObject_Team_team_3.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_4, "testObject_Team_team_4.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_5, "testObject_Team_team_5.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_6, "testObject_Team_team_6.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_7, "testObject_Team_team_7.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_8, "testObject_Team_team_8.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_9, "testObject_Team_team_9.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_10, "testObject_Team_team_10.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_11, "testObject_Team_team_11.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_12, "testObject_Team_team_12.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_13, "testObject_Team_team_13.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_14, "testObject_Team_team_14.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_15, "testObject_Team_team_15.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_16, "testObject_Team_team_16.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_17, "testObject_Team_team_17.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_18, "testObject_Team_team_18.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_19, "testObject_Team_team_19.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_20, "testObject_Team_team_20.json")], - testGroup "Golden: TeamList_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_1, "testObject_TeamList_team_1.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_2, "testObject_TeamList_team_2.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_3, "testObject_TeamList_team_3.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_4, "testObject_TeamList_team_4.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_5, "testObject_TeamList_team_5.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_6, "testObject_TeamList_team_6.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_7, "testObject_TeamList_team_7.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_8, "testObject_TeamList_team_8.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_9, "testObject_TeamList_team_9.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_10, "testObject_TeamList_team_10.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_11, "testObject_TeamList_team_11.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_12, "testObject_TeamList_team_12.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_13, "testObject_TeamList_team_13.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_14, "testObject_TeamList_team_14.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_15, "testObject_TeamList_team_15.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_16, "testObject_TeamList_team_16.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_17, "testObject_TeamList_team_17.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_18, "testObject_TeamList_team_18.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_19, "testObject_TeamList_team_19.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_20, "testObject_TeamList_team_20.json")], - testGroup "Golden: TeamUpdateData_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_1, "testObject_TeamUpdateData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_2, "testObject_TeamUpdateData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_3, "testObject_TeamUpdateData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_4, "testObject_TeamUpdateData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_5, "testObject_TeamUpdateData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_6, "testObject_TeamUpdateData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_7, "testObject_TeamUpdateData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_8, "testObject_TeamUpdateData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_9, "testObject_TeamUpdateData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_10, "testObject_TeamUpdateData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_11, "testObject_TeamUpdateData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_12, "testObject_TeamUpdateData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_13, "testObject_TeamUpdateData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_14, "testObject_TeamUpdateData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_15, "testObject_TeamUpdateData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_16, "testObject_TeamUpdateData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_17, "testObject_TeamUpdateData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_18, "testObject_TeamUpdateData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_19, "testObject_TeamUpdateData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_20, "testObject_TeamUpdateData_team_20.json")], - testGroup "Golden: TeamDeleteData_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_1, "testObject_TeamDeleteData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_2, "testObject_TeamDeleteData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_3, "testObject_TeamDeleteData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_4, "testObject_TeamDeleteData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_5, "testObject_TeamDeleteData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_6, "testObject_TeamDeleteData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_7, "testObject_TeamDeleteData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_8, "testObject_TeamDeleteData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_9, "testObject_TeamDeleteData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_10, "testObject_TeamDeleteData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_11, "testObject_TeamDeleteData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_12, "testObject_TeamDeleteData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_13, "testObject_TeamDeleteData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_14, "testObject_TeamDeleteData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_15, "testObject_TeamDeleteData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_16, "testObject_TeamDeleteData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_17, "testObject_TeamDeleteData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_18, "testObject_TeamDeleteData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_19, "testObject_TeamDeleteData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_20, "testObject_TeamDeleteData_team_20.json")], - testGroup "Golden: TeamConversation_team" $ - testObjects + testGroup "Golden: PasswordChange_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_1, "testObject_PasswordChange_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_2, "testObject_PasswordChange_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_3, "testObject_PasswordChange_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_4, "testObject_PasswordChange_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_5, "testObject_PasswordChange_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_6, "testObject_PasswordChange_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_7, "testObject_PasswordChange_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_8, "testObject_PasswordChange_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_9, "testObject_PasswordChange_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_10, "testObject_PasswordChange_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_11, "testObject_PasswordChange_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_12, "testObject_PasswordChange_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_13, "testObject_PasswordChange_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_14, "testObject_PasswordChange_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_15, "testObject_PasswordChange_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_16, "testObject_PasswordChange_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_17, "testObject_PasswordChange_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_18, "testObject_PasswordChange_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_19, "testObject_PasswordChange_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordChange_user.testObject_PasswordChange_user_20, "testObject_PasswordChange_user_20.json")], + testGroup "Golden: LocaleUpdate_user" + $ testObjects [(Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_1, "testObject_LocaleUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_2, "testObject_LocaleUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_3, "testObject_LocaleUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_4, "testObject_LocaleUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_5, "testObject_LocaleUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_6, "testObject_LocaleUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_7, "testObject_LocaleUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_8, "testObject_LocaleUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_9, "testObject_LocaleUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_10, "testObject_LocaleUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_11, "testObject_LocaleUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_12, "testObject_LocaleUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_13, "testObject_LocaleUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_14, "testObject_LocaleUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_15, "testObject_LocaleUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_16, "testObject_LocaleUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_17, "testObject_LocaleUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_18, "testObject_LocaleUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_19, "testObject_LocaleUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.LocaleUpdate_user.testObject_LocaleUpdate_user_20, "testObject_LocaleUpdate_user_20.json")], + testGroup "Golden: EmailUpdate_user" + $ testObjects [(Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_1, "testObject_EmailUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_2, "testObject_EmailUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_3, "testObject_EmailUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_4, "testObject_EmailUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_5, "testObject_EmailUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_6, "testObject_EmailUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_7, "testObject_EmailUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_8, "testObject_EmailUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_9, "testObject_EmailUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_10, "testObject_EmailUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_11, "testObject_EmailUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_12, "testObject_EmailUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_13, "testObject_EmailUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_14, "testObject_EmailUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_15, "testObject_EmailUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_16, "testObject_EmailUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_17, "testObject_EmailUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_18, "testObject_EmailUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_19, "testObject_EmailUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_user.testObject_EmailUpdate_user_20, "testObject_EmailUpdate_user_20.json")], + testGroup "Golden: PhoneUpdate_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_1, "testObject_PhoneUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_2, "testObject_PhoneUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_3, "testObject_PhoneUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_4, "testObject_PhoneUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_5, "testObject_PhoneUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_6, "testObject_PhoneUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_7, "testObject_PhoneUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_8, "testObject_PhoneUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_9, "testObject_PhoneUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_10, "testObject_PhoneUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_11, "testObject_PhoneUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_12, "testObject_PhoneUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_13, "testObject_PhoneUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_14, "testObject_PhoneUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_15, "testObject_PhoneUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_16, "testObject_PhoneUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_17, "testObject_PhoneUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_18, "testObject_PhoneUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_19, "testObject_PhoneUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.PhoneUpdate_user.testObject_PhoneUpdate_user_20, "testObject_PhoneUpdate_user_20.json")], + testGroup "Golden: HandleUpdate_user" + $ testObjects [(Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_1, "testObject_HandleUpdate_user_1.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_2, "testObject_HandleUpdate_user_2.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_3, "testObject_HandleUpdate_user_3.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_4, "testObject_HandleUpdate_user_4.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_5, "testObject_HandleUpdate_user_5.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_6, "testObject_HandleUpdate_user_6.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_7, "testObject_HandleUpdate_user_7.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_8, "testObject_HandleUpdate_user_8.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_9, "testObject_HandleUpdate_user_9.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_10, "testObject_HandleUpdate_user_10.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_11, "testObject_HandleUpdate_user_11.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_12, "testObject_HandleUpdate_user_12.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_13, "testObject_HandleUpdate_user_13.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_14, "testObject_HandleUpdate_user_14.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_15, "testObject_HandleUpdate_user_15.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_16, "testObject_HandleUpdate_user_16.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_17, "testObject_HandleUpdate_user_17.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_18, "testObject_HandleUpdate_user_18.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_19, "testObject_HandleUpdate_user_19.json"), (Test.Wire.API.Golden.Generated.HandleUpdate_user.testObject_HandleUpdate_user_20, "testObject_HandleUpdate_user_20.json")], + testGroup "Golden: DeleteUser_user" + $ testObjects [(Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_1, "testObject_DeleteUser_user_1.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_2, "testObject_DeleteUser_user_2.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_3, "testObject_DeleteUser_user_3.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_4, "testObject_DeleteUser_user_4.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_5, "testObject_DeleteUser_user_5.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_6, "testObject_DeleteUser_user_6.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_7, "testObject_DeleteUser_user_7.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_8, "testObject_DeleteUser_user_8.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_9, "testObject_DeleteUser_user_9.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_10, "testObject_DeleteUser_user_10.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_11, "testObject_DeleteUser_user_11.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_12, "testObject_DeleteUser_user_12.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_13, "testObject_DeleteUser_user_13.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_14, "testObject_DeleteUser_user_14.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_15, "testObject_DeleteUser_user_15.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_16, "testObject_DeleteUser_user_16.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_17, "testObject_DeleteUser_user_17.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_18, "testObject_DeleteUser_user_18.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_19, "testObject_DeleteUser_user_19.json"), (Test.Wire.API.Golden.Generated.DeleteUser_user.testObject_DeleteUser_user_20, "testObject_DeleteUser_user_20.json")], + testGroup "Golden: VerifyDeleteUser_user" + $ testObjects [(Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_1, "testObject_VerifyDeleteUser_user_1.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_2, "testObject_VerifyDeleteUser_user_2.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_3, "testObject_VerifyDeleteUser_user_3.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_4, "testObject_VerifyDeleteUser_user_4.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_5, "testObject_VerifyDeleteUser_user_5.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_6, "testObject_VerifyDeleteUser_user_6.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_7, "testObject_VerifyDeleteUser_user_7.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_8, "testObject_VerifyDeleteUser_user_8.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_9, "testObject_VerifyDeleteUser_user_9.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_10, "testObject_VerifyDeleteUser_user_10.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_11, "testObject_VerifyDeleteUser_user_11.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_12, "testObject_VerifyDeleteUser_user_12.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_13, "testObject_VerifyDeleteUser_user_13.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_14, "testObject_VerifyDeleteUser_user_14.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_15, "testObject_VerifyDeleteUser_user_15.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_16, "testObject_VerifyDeleteUser_user_16.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_17, "testObject_VerifyDeleteUser_user_17.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_18, "testObject_VerifyDeleteUser_user_18.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_19, "testObject_VerifyDeleteUser_user_19.json"), (Test.Wire.API.Golden.Generated.VerifyDeleteUser_user.testObject_VerifyDeleteUser_user_20, "testObject_VerifyDeleteUser_user_20.json")], + testGroup "Golden: DeletionCodeTimeout_user" + $ testObjects [(Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_1, "testObject_DeletionCodeTimeout_user_1.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_2, "testObject_DeletionCodeTimeout_user_2.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_3, "testObject_DeletionCodeTimeout_user_3.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_4, "testObject_DeletionCodeTimeout_user_4.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_5, "testObject_DeletionCodeTimeout_user_5.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_6, "testObject_DeletionCodeTimeout_user_6.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_7, "testObject_DeletionCodeTimeout_user_7.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_8, "testObject_DeletionCodeTimeout_user_8.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_9, "testObject_DeletionCodeTimeout_user_9.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_10, "testObject_DeletionCodeTimeout_user_10.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_11, "testObject_DeletionCodeTimeout_user_11.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_12, "testObject_DeletionCodeTimeout_user_12.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_13, "testObject_DeletionCodeTimeout_user_13.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_14, "testObject_DeletionCodeTimeout_user_14.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_15, "testObject_DeletionCodeTimeout_user_15.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_16, "testObject_DeletionCodeTimeout_user_16.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_17, "testObject_DeletionCodeTimeout_user_17.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_18, "testObject_DeletionCodeTimeout_user_18.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_19, "testObject_DeletionCodeTimeout_user_19.json"), (Test.Wire.API.Golden.Generated.DeletionCodeTimeout_user.testObject_DeletionCodeTimeout_user_20, "testObject_DeletionCodeTimeout_user_20.json")], + testGroup "Golden: ActivationKey_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_1, "testObject_ActivationKey_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_2, "testObject_ActivationKey_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_3, "testObject_ActivationKey_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_4, "testObject_ActivationKey_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_5, "testObject_ActivationKey_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_6, "testObject_ActivationKey_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_7, "testObject_ActivationKey_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_8, "testObject_ActivationKey_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_9, "testObject_ActivationKey_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_10, "testObject_ActivationKey_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_11, "testObject_ActivationKey_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_12, "testObject_ActivationKey_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_13, "testObject_ActivationKey_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_14, "testObject_ActivationKey_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_15, "testObject_ActivationKey_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_16, "testObject_ActivationKey_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_17, "testObject_ActivationKey_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_18, "testObject_ActivationKey_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_19, "testObject_ActivationKey_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationKey_user.testObject_ActivationKey_user_20, "testObject_ActivationKey_user_20.json")], + testGroup "Golden: ActivationCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_1, "testObject_ActivationCode_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_2, "testObject_ActivationCode_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_3, "testObject_ActivationCode_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_4, "testObject_ActivationCode_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_5, "testObject_ActivationCode_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_6, "testObject_ActivationCode_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_7, "testObject_ActivationCode_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_8, "testObject_ActivationCode_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_9, "testObject_ActivationCode_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_10, "testObject_ActivationCode_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_11, "testObject_ActivationCode_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_12, "testObject_ActivationCode_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_13, "testObject_ActivationCode_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_14, "testObject_ActivationCode_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_15, "testObject_ActivationCode_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_16, "testObject_ActivationCode_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_17, "testObject_ActivationCode_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_18, "testObject_ActivationCode_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_19, "testObject_ActivationCode_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationCode_user.testObject_ActivationCode_user_20, "testObject_ActivationCode_user_20.json")], + testGroup "Golden: Activate_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_1, "testObject_Activate_user_1.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_2, "testObject_Activate_user_2.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_3, "testObject_Activate_user_3.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_4, "testObject_Activate_user_4.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_5, "testObject_Activate_user_5.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_6, "testObject_Activate_user_6.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_7, "testObject_Activate_user_7.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_8, "testObject_Activate_user_8.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_9, "testObject_Activate_user_9.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_10, "testObject_Activate_user_10.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_11, "testObject_Activate_user_11.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_12, "testObject_Activate_user_12.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_13, "testObject_Activate_user_13.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_14, "testObject_Activate_user_14.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_15, "testObject_Activate_user_15.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_16, "testObject_Activate_user_16.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_17, "testObject_Activate_user_17.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_18, "testObject_Activate_user_18.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_19, "testObject_Activate_user_19.json"), (Test.Wire.API.Golden.Generated.Activate_user.testObject_Activate_user_20, "testObject_Activate_user_20.json")], + testGroup "Golden: ActivationResponse_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_1, "testObject_ActivationResponse_user_1.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_2, "testObject_ActivationResponse_user_2.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_3, "testObject_ActivationResponse_user_3.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_4, "testObject_ActivationResponse_user_4.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_5, "testObject_ActivationResponse_user_5.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_6, "testObject_ActivationResponse_user_6.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_7, "testObject_ActivationResponse_user_7.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_8, "testObject_ActivationResponse_user_8.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_9, "testObject_ActivationResponse_user_9.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_10, "testObject_ActivationResponse_user_10.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_11, "testObject_ActivationResponse_user_11.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_12, "testObject_ActivationResponse_user_12.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_13, "testObject_ActivationResponse_user_13.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_14, "testObject_ActivationResponse_user_14.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_15, "testObject_ActivationResponse_user_15.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_16, "testObject_ActivationResponse_user_16.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_17, "testObject_ActivationResponse_user_17.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_18, "testObject_ActivationResponse_user_18.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_19, "testObject_ActivationResponse_user_19.json"), (Test.Wire.API.Golden.Generated.ActivationResponse_user.testObject_ActivationResponse_user_20, "testObject_ActivationResponse_user_20.json")], + testGroup "Golden: SendActivationCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_1, "testObject_SendActivationCode_user_1.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_2, "testObject_SendActivationCode_user_2.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_3, "testObject_SendActivationCode_user_3.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_4, "testObject_SendActivationCode_user_4.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_5, "testObject_SendActivationCode_user_5.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_6, "testObject_SendActivationCode_user_6.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_7, "testObject_SendActivationCode_user_7.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_8, "testObject_SendActivationCode_user_8.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_9, "testObject_SendActivationCode_user_9.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_10, "testObject_SendActivationCode_user_10.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_11, "testObject_SendActivationCode_user_11.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_12, "testObject_SendActivationCode_user_12.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_13, "testObject_SendActivationCode_user_13.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_14, "testObject_SendActivationCode_user_14.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_15, "testObject_SendActivationCode_user_15.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_16, "testObject_SendActivationCode_user_16.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_17, "testObject_SendActivationCode_user_17.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_18, "testObject_SendActivationCode_user_18.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_19, "testObject_SendActivationCode_user_19.json"), (Test.Wire.API.Golden.Generated.SendActivationCode_user.testObject_SendActivationCode_user_20, "testObject_SendActivationCode_user_20.json")], + testGroup "Golden: LoginId_user" + $ testObjects [(Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_1, "testObject_LoginId_user_1.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_2, "testObject_LoginId_user_2.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_3, "testObject_LoginId_user_3.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_4, "testObject_LoginId_user_4.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_5, "testObject_LoginId_user_5.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_6, "testObject_LoginId_user_6.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_7, "testObject_LoginId_user_7.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_8, "testObject_LoginId_user_8.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_9, "testObject_LoginId_user_9.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_10, "testObject_LoginId_user_10.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_11, "testObject_LoginId_user_11.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_12, "testObject_LoginId_user_12.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_13, "testObject_LoginId_user_13.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_14, "testObject_LoginId_user_14.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_15, "testObject_LoginId_user_15.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_16, "testObject_LoginId_user_16.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_17, "testObject_LoginId_user_17.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_18, "testObject_LoginId_user_18.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_19, "testObject_LoginId_user_19.json"), (Test.Wire.API.Golden.Generated.LoginId_user.testObject_LoginId_user_20, "testObject_LoginId_user_20.json")], + testGroup "Golden: LoginCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_1, "testObject_LoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_2, "testObject_LoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_3, "testObject_LoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_4, "testObject_LoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_5, "testObject_LoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_6, "testObject_LoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_7, "testObject_LoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_8, "testObject_LoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_9, "testObject_LoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_10, "testObject_LoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_11, "testObject_LoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_12, "testObject_LoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_13, "testObject_LoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_14, "testObject_LoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_15, "testObject_LoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_16, "testObject_LoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_17, "testObject_LoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_18, "testObject_LoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_19, "testObject_LoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.LoginCode_user.testObject_LoginCode_user_20, "testObject_LoginCode_user_20.json")], + testGroup "Golden: PendingLoginCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_1, "testObject_PendingLoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_2, "testObject_PendingLoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_3, "testObject_PendingLoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_4, "testObject_PendingLoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_5, "testObject_PendingLoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_6, "testObject_PendingLoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_7, "testObject_PendingLoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_8, "testObject_PendingLoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_9, "testObject_PendingLoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_10, "testObject_PendingLoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_11, "testObject_PendingLoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_12, "testObject_PendingLoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_13, "testObject_PendingLoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_14, "testObject_PendingLoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_15, "testObject_PendingLoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_16, "testObject_PendingLoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_17, "testObject_PendingLoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_18, "testObject_PendingLoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_19, "testObject_PendingLoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.PendingLoginCode_user.testObject_PendingLoginCode_user_20, "testObject_PendingLoginCode_user_20.json")], + testGroup "Golden: SendLoginCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_1, "testObject_SendLoginCode_user_1.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_2, "testObject_SendLoginCode_user_2.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_3, "testObject_SendLoginCode_user_3.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_4, "testObject_SendLoginCode_user_4.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_5, "testObject_SendLoginCode_user_5.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_6, "testObject_SendLoginCode_user_6.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_7, "testObject_SendLoginCode_user_7.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_8, "testObject_SendLoginCode_user_8.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_9, "testObject_SendLoginCode_user_9.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_10, "testObject_SendLoginCode_user_10.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_11, "testObject_SendLoginCode_user_11.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_12, "testObject_SendLoginCode_user_12.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_13, "testObject_SendLoginCode_user_13.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_14, "testObject_SendLoginCode_user_14.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_15, "testObject_SendLoginCode_user_15.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_16, "testObject_SendLoginCode_user_16.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_17, "testObject_SendLoginCode_user_17.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_18, "testObject_SendLoginCode_user_18.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_19, "testObject_SendLoginCode_user_19.json"), (Test.Wire.API.Golden.Generated.SendLoginCode_user.testObject_SendLoginCode_user_20, "testObject_SendLoginCode_user_20.json")], + testGroup "Golden: LoginCodeTimeout_user" + $ testObjects [(Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_1, "testObject_LoginCodeTimeout_user_1.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_2, "testObject_LoginCodeTimeout_user_2.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_3, "testObject_LoginCodeTimeout_user_3.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_4, "testObject_LoginCodeTimeout_user_4.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_5, "testObject_LoginCodeTimeout_user_5.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_6, "testObject_LoginCodeTimeout_user_6.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_7, "testObject_LoginCodeTimeout_user_7.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_8, "testObject_LoginCodeTimeout_user_8.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_9, "testObject_LoginCodeTimeout_user_9.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_10, "testObject_LoginCodeTimeout_user_10.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_11, "testObject_LoginCodeTimeout_user_11.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_12, "testObject_LoginCodeTimeout_user_12.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_13, "testObject_LoginCodeTimeout_user_13.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_14, "testObject_LoginCodeTimeout_user_14.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_15, "testObject_LoginCodeTimeout_user_15.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_16, "testObject_LoginCodeTimeout_user_16.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_17, "testObject_LoginCodeTimeout_user_17.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_18, "testObject_LoginCodeTimeout_user_18.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_19, "testObject_LoginCodeTimeout_user_19.json"), (Test.Wire.API.Golden.Generated.LoginCodeTimeout_user.testObject_LoginCodeTimeout_user_20, "testObject_LoginCodeTimeout_user_20.json")], + testGroup "Golden: CookieLabel_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_1, "testObject_CookieLabel_user_1.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_2, "testObject_CookieLabel_user_2.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_3, "testObject_CookieLabel_user_3.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_4, "testObject_CookieLabel_user_4.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_5, "testObject_CookieLabel_user_5.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_6, "testObject_CookieLabel_user_6.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_7, "testObject_CookieLabel_user_7.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_8, "testObject_CookieLabel_user_8.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_9, "testObject_CookieLabel_user_9.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_10, "testObject_CookieLabel_user_10.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_11, "testObject_CookieLabel_user_11.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_12, "testObject_CookieLabel_user_12.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_13, "testObject_CookieLabel_user_13.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_14, "testObject_CookieLabel_user_14.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_15, "testObject_CookieLabel_user_15.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_16, "testObject_CookieLabel_user_16.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_17, "testObject_CookieLabel_user_17.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_18, "testObject_CookieLabel_user_18.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_19, "testObject_CookieLabel_user_19.json"), (Test.Wire.API.Golden.Generated.CookieLabel_user.testObject_CookieLabel_user_20, "testObject_CookieLabel_user_20.json")], + testGroup "Golden: Login_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_1, "testObject_Login_user_1.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_2, "testObject_Login_user_2.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_3, "testObject_Login_user_3.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_4, "testObject_Login_user_4.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_5, "testObject_Login_user_5.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_6, "testObject_Login_user_6.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_7, "testObject_Login_user_7.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_8, "testObject_Login_user_8.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_9, "testObject_Login_user_9.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_10, "testObject_Login_user_10.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_11, "testObject_Login_user_11.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_12, "testObject_Login_user_12.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_13, "testObject_Login_user_13.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_14, "testObject_Login_user_14.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_15, "testObject_Login_user_15.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_16, "testObject_Login_user_16.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_17, "testObject_Login_user_17.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_18, "testObject_Login_user_18.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_19, "testObject_Login_user_19.json"), (Test.Wire.API.Golden.Generated.Login_user.testObject_Login_user_20, "testObject_Login_user_20.json")], + testGroup "Golden: CookieId_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_1, "testObject_CookieId_user_1.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_2, "testObject_CookieId_user_2.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_3, "testObject_CookieId_user_3.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_4, "testObject_CookieId_user_4.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_5, "testObject_CookieId_user_5.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_6, "testObject_CookieId_user_6.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_7, "testObject_CookieId_user_7.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_8, "testObject_CookieId_user_8.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_9, "testObject_CookieId_user_9.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_10, "testObject_CookieId_user_10.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_11, "testObject_CookieId_user_11.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_12, "testObject_CookieId_user_12.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_13, "testObject_CookieId_user_13.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_14, "testObject_CookieId_user_14.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_15, "testObject_CookieId_user_15.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_16, "testObject_CookieId_user_16.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_17, "testObject_CookieId_user_17.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_18, "testObject_CookieId_user_18.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_19, "testObject_CookieId_user_19.json"), (Test.Wire.API.Golden.Generated.CookieId_user.testObject_CookieId_user_20, "testObject_CookieId_user_20.json")], + testGroup "Golden: CookieType_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_1, "testObject_CookieType_user_1.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_2, "testObject_CookieType_user_2.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_3, "testObject_CookieType_user_3.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_4, "testObject_CookieType_user_4.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_5, "testObject_CookieType_user_5.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_6, "testObject_CookieType_user_6.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_7, "testObject_CookieType_user_7.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_8, "testObject_CookieType_user_8.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_9, "testObject_CookieType_user_9.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_10, "testObject_CookieType_user_10.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_11, "testObject_CookieType_user_11.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_12, "testObject_CookieType_user_12.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_13, "testObject_CookieType_user_13.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_14, "testObject_CookieType_user_14.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_15, "testObject_CookieType_user_15.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_16, "testObject_CookieType_user_16.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_17, "testObject_CookieType_user_17.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_18, "testObject_CookieType_user_18.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_19, "testObject_CookieType_user_19.json"), (Test.Wire.API.Golden.Generated.CookieType_user.testObject_CookieType_user_20, "testObject_CookieType_user_20.json")], + testGroup "Golden: Cookie_20_28_29_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_1, "testObject_Cookie_20_28_29_user_1.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_2, "testObject_Cookie_20_28_29_user_2.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_3, "testObject_Cookie_20_28_29_user_3.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_4, "testObject_Cookie_20_28_29_user_4.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_5, "testObject_Cookie_20_28_29_user_5.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_6, "testObject_Cookie_20_28_29_user_6.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_7, "testObject_Cookie_20_28_29_user_7.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_8, "testObject_Cookie_20_28_29_user_8.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_9, "testObject_Cookie_20_28_29_user_9.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_10, "testObject_Cookie_20_28_29_user_10.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_11, "testObject_Cookie_20_28_29_user_11.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_12, "testObject_Cookie_20_28_29_user_12.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_13, "testObject_Cookie_20_28_29_user_13.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_14, "testObject_Cookie_20_28_29_user_14.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_15, "testObject_Cookie_20_28_29_user_15.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_16, "testObject_Cookie_20_28_29_user_16.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_17, "testObject_Cookie_20_28_29_user_17.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_18, "testObject_Cookie_20_28_29_user_18.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_19, "testObject_Cookie_20_28_29_user_19.json"), (Test.Wire.API.Golden.Generated.Cookie_20_28_29_user.testObject_Cookie_20_28_29_user_20, "testObject_Cookie_20_28_29_user_20.json")], + testGroup "Golden: CookieList_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_1, "testObject_CookieList_user_1.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_2, "testObject_CookieList_user_2.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_3, "testObject_CookieList_user_3.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_4, "testObject_CookieList_user_4.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_5, "testObject_CookieList_user_5.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_6, "testObject_CookieList_user_6.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_7, "testObject_CookieList_user_7.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_8, "testObject_CookieList_user_8.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_9, "testObject_CookieList_user_9.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_10, "testObject_CookieList_user_10.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_11, "testObject_CookieList_user_11.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_12, "testObject_CookieList_user_12.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_13, "testObject_CookieList_user_13.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_14, "testObject_CookieList_user_14.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_15, "testObject_CookieList_user_15.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_16, "testObject_CookieList_user_16.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_17, "testObject_CookieList_user_17.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_18, "testObject_CookieList_user_18.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_19, "testObject_CookieList_user_19.json"), (Test.Wire.API.Golden.Generated.CookieList_user.testObject_CookieList_user_20, "testObject_CookieList_user_20.json")], + testGroup "Golden: RemoveCookies_user" + $ testObjects [(Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_1, "testObject_RemoveCookies_user_1.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_2, "testObject_RemoveCookies_user_2.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_3, "testObject_RemoveCookies_user_3.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_4, "testObject_RemoveCookies_user_4.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_5, "testObject_RemoveCookies_user_5.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_6, "testObject_RemoveCookies_user_6.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_7, "testObject_RemoveCookies_user_7.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_8, "testObject_RemoveCookies_user_8.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_9, "testObject_RemoveCookies_user_9.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_10, "testObject_RemoveCookies_user_10.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_11, "testObject_RemoveCookies_user_11.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_12, "testObject_RemoveCookies_user_12.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_13, "testObject_RemoveCookies_user_13.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_14, "testObject_RemoveCookies_user_14.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_15, "testObject_RemoveCookies_user_15.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_16, "testObject_RemoveCookies_user_16.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_17, "testObject_RemoveCookies_user_17.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_18, "testObject_RemoveCookies_user_18.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_19, "testObject_RemoveCookies_user_19.json"), (Test.Wire.API.Golden.Generated.RemoveCookies_user.testObject_RemoveCookies_user_20, "testObject_RemoveCookies_user_20.json")], + testGroup "Golden: TokenType_user" + $ testObjects [(Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_1, "testObject_TokenType_user_1.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_2, "testObject_TokenType_user_2.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_3, "testObject_TokenType_user_3.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_4, "testObject_TokenType_user_4.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_5, "testObject_TokenType_user_5.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_6, "testObject_TokenType_user_6.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_7, "testObject_TokenType_user_7.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_8, "testObject_TokenType_user_8.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_9, "testObject_TokenType_user_9.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_10, "testObject_TokenType_user_10.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_11, "testObject_TokenType_user_11.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_12, "testObject_TokenType_user_12.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_13, "testObject_TokenType_user_13.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_14, "testObject_TokenType_user_14.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_15, "testObject_TokenType_user_15.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_16, "testObject_TokenType_user_16.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_17, "testObject_TokenType_user_17.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_18, "testObject_TokenType_user_18.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_19, "testObject_TokenType_user_19.json"), (Test.Wire.API.Golden.Generated.TokenType_user.testObject_TokenType_user_20, "testObject_TokenType_user_20.json")], + testGroup "Golden: AccessToken_user" + $ testObjects [(Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_1, "testObject_AccessToken_user_1.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_2, "testObject_AccessToken_user_2.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_3, "testObject_AccessToken_user_3.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_4, "testObject_AccessToken_user_4.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_5, "testObject_AccessToken_user_5.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_6, "testObject_AccessToken_user_6.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_7, "testObject_AccessToken_user_7.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_8, "testObject_AccessToken_user_8.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_9, "testObject_AccessToken_user_9.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_10, "testObject_AccessToken_user_10.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_11, "testObject_AccessToken_user_11.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_12, "testObject_AccessToken_user_12.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_13, "testObject_AccessToken_user_13.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_14, "testObject_AccessToken_user_14.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_15, "testObject_AccessToken_user_15.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_16, "testObject_AccessToken_user_16.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_17, "testObject_AccessToken_user_17.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_18, "testObject_AccessToken_user_18.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_19, "testObject_AccessToken_user_19.json"), (Test.Wire.API.Golden.Generated.AccessToken_user.testObject_AccessToken_user_20, "testObject_AccessToken_user_20.json")], + testGroup "Golden: UserClientMap_20Int_user" + $ testObjects [(Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_1, "testObject_UserClientMap_20Int_user_1.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_2, "testObject_UserClientMap_20Int_user_2.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_3, "testObject_UserClientMap_20Int_user_3.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_4, "testObject_UserClientMap_20Int_user_4.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_5, "testObject_UserClientMap_20Int_user_5.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_6, "testObject_UserClientMap_20Int_user_6.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_7, "testObject_UserClientMap_20Int_user_7.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_8, "testObject_UserClientMap_20Int_user_8.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_9, "testObject_UserClientMap_20Int_user_9.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_10, "testObject_UserClientMap_20Int_user_10.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_11, "testObject_UserClientMap_20Int_user_11.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_12, "testObject_UserClientMap_20Int_user_12.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_13, "testObject_UserClientMap_20Int_user_13.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_14, "testObject_UserClientMap_20Int_user_14.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_15, "testObject_UserClientMap_20Int_user_15.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_16, "testObject_UserClientMap_20Int_user_16.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_17, "testObject_UserClientMap_20Int_user_17.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_18, "testObject_UserClientMap_20Int_user_18.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_19, "testObject_UserClientMap_20Int_user_19.json"), (Test.Wire.API.Golden.Generated.UserClientMap_20Int_user.testObject_UserClientMap_20Int_user_20, "testObject_UserClientMap_20Int_user_20.json")], + testGroup "Golden: UserClients_user" + $ testObjects [(Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_1, "testObject_UserClients_user_1.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_2, "testObject_UserClients_user_2.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_3, "testObject_UserClients_user_3.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_4, "testObject_UserClients_user_4.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_5, "testObject_UserClients_user_5.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_6, "testObject_UserClients_user_6.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_7, "testObject_UserClients_user_7.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_8, "testObject_UserClients_user_8.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_9, "testObject_UserClients_user_9.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_10, "testObject_UserClients_user_10.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_11, "testObject_UserClients_user_11.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_12, "testObject_UserClients_user_12.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_13, "testObject_UserClients_user_13.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_14, "testObject_UserClients_user_14.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_15, "testObject_UserClients_user_15.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_16, "testObject_UserClients_user_16.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_17, "testObject_UserClients_user_17.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_18, "testObject_UserClients_user_18.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_19, "testObject_UserClients_user_19.json"), (Test.Wire.API.Golden.Generated.UserClients_user.testObject_UserClients_user_20, "testObject_UserClients_user_20.json")], + testGroup "Golden: ClientType_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_1, "testObject_ClientType_user_1.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_2, "testObject_ClientType_user_2.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_3, "testObject_ClientType_user_3.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_4, "testObject_ClientType_user_4.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_5, "testObject_ClientType_user_5.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_6, "testObject_ClientType_user_6.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_7, "testObject_ClientType_user_7.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_8, "testObject_ClientType_user_8.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_9, "testObject_ClientType_user_9.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_10, "testObject_ClientType_user_10.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_11, "testObject_ClientType_user_11.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_12, "testObject_ClientType_user_12.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_13, "testObject_ClientType_user_13.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_14, "testObject_ClientType_user_14.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_15, "testObject_ClientType_user_15.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_16, "testObject_ClientType_user_16.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_17, "testObject_ClientType_user_17.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_18, "testObject_ClientType_user_18.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_19, "testObject_ClientType_user_19.json"), (Test.Wire.API.Golden.Generated.ClientType_user.testObject_ClientType_user_20, "testObject_ClientType_user_20.json")], + testGroup "Golden: ClientClass_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_1, "testObject_ClientClass_user_1.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_2, "testObject_ClientClass_user_2.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_3, "testObject_ClientClass_user_3.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_4, "testObject_ClientClass_user_4.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_5, "testObject_ClientClass_user_5.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_6, "testObject_ClientClass_user_6.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_7, "testObject_ClientClass_user_7.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_8, "testObject_ClientClass_user_8.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_9, "testObject_ClientClass_user_9.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_10, "testObject_ClientClass_user_10.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_11, "testObject_ClientClass_user_11.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_12, "testObject_ClientClass_user_12.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_13, "testObject_ClientClass_user_13.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_14, "testObject_ClientClass_user_14.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_15, "testObject_ClientClass_user_15.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_16, "testObject_ClientClass_user_16.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_17, "testObject_ClientClass_user_17.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_18, "testObject_ClientClass_user_18.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_19, "testObject_ClientClass_user_19.json"), (Test.Wire.API.Golden.Generated.ClientClass_user.testObject_ClientClass_user_20, "testObject_ClientClass_user_20.json")], + testGroup "Golden: PubClient_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_1, "testObject_PubClient_user_1.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_2, "testObject_PubClient_user_2.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_3, "testObject_PubClient_user_3.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_4, "testObject_PubClient_user_4.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_5, "testObject_PubClient_user_5.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_6, "testObject_PubClient_user_6.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_7, "testObject_PubClient_user_7.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_8, "testObject_PubClient_user_8.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_9, "testObject_PubClient_user_9.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_10, "testObject_PubClient_user_10.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_11, "testObject_PubClient_user_11.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_12, "testObject_PubClient_user_12.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_13, "testObject_PubClient_user_13.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_14, "testObject_PubClient_user_14.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_15, "testObject_PubClient_user_15.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_16, "testObject_PubClient_user_16.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_17, "testObject_PubClient_user_17.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_18, "testObject_PubClient_user_18.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_19, "testObject_PubClient_user_19.json"), (Test.Wire.API.Golden.Generated.PubClient_user.testObject_PubClient_user_20, "testObject_PubClient_user_20.json")], + testGroup "Golden: ClientV5_user" + $ testObjects [(Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_1, "testObject_ClientV5_user_1.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_2, "testObject_ClientV5_user_2.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_3, "testObject_ClientV5_user_3.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_4, "testObject_ClientV5_user_4.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_5, "testObject_ClientV5_user_5.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_6, "testObject_ClientV5_user_6.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_7, "testObject_ClientV5_user_7.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_8, "testObject_ClientV5_user_8.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_9, "testObject_ClientV5_user_9.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_10, "testObject_ClientV5_user_10.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_11, "testObject_ClientV5_user_11.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_12, "testObject_ClientV5_user_12.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_13, "testObject_ClientV5_user_13.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_14, "testObject_ClientV5_user_14.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_15, "testObject_ClientV5_user_15.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_16, "testObject_ClientV5_user_16.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_17, "testObject_ClientV5_user_17.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_18, "testObject_ClientV5_user_18.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_19, "testObject_ClientV5_user_19.json"), (Versioned @'V5 Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_20, "testObject_ClientV5_user_20.json")], + testGroup "Golden: Client_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_1, "testObject_Client_user_1.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_2, "testObject_Client_user_2.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_3, "testObject_Client_user_3.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_4, "testObject_Client_user_4.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_5, "testObject_Client_user_5.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_6, "testObject_Client_user_6.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_7, "testObject_Client_user_7.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_8, "testObject_Client_user_8.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_9, "testObject_Client_user_9.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_10, "testObject_Client_user_10.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_11, "testObject_Client_user_11.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_12, "testObject_Client_user_12.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_13, "testObject_Client_user_13.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_14, "testObject_Client_user_14.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_15, "testObject_Client_user_15.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_16, "testObject_Client_user_16.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_17, "testObject_Client_user_17.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_18, "testObject_Client_user_18.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_19, "testObject_Client_user_19.json"), (Test.Wire.API.Golden.Generated.Client_user.testObject_Client_user_20, "testObject_Client_user_20.json")], + testGroup "Golden: NewClient_user" + $ testObjects [(Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_1, "testObject_NewClient_user_1.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_2, "testObject_NewClient_user_2.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_3, "testObject_NewClient_user_3.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_4, "testObject_NewClient_user_4.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_5, "testObject_NewClient_user_5.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_6, "testObject_NewClient_user_6.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_7, "testObject_NewClient_user_7.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_8, "testObject_NewClient_user_8.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_9, "testObject_NewClient_user_9.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_10, "testObject_NewClient_user_10.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_11, "testObject_NewClient_user_11.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_12, "testObject_NewClient_user_12.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_13, "testObject_NewClient_user_13.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_14, "testObject_NewClient_user_14.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_15, "testObject_NewClient_user_15.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_16, "testObject_NewClient_user_16.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_17, "testObject_NewClient_user_17.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_18, "testObject_NewClient_user_18.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_19, "testObject_NewClient_user_19.json"), (Test.Wire.API.Golden.Generated.NewClient_user.testObject_NewClient_user_20, "testObject_NewClient_user_20.json")], + testGroup "Golden: UpdateClient_user" + $ testObjects [(Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_1, "testObject_UpdateClient_user_1.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_2, "testObject_UpdateClient_user_2.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_3, "testObject_UpdateClient_user_3.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_4, "testObject_UpdateClient_user_4.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_5, "testObject_UpdateClient_user_5.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_6, "testObject_UpdateClient_user_6.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_7, "testObject_UpdateClient_user_7.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_8, "testObject_UpdateClient_user_8.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_9, "testObject_UpdateClient_user_9.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_10, "testObject_UpdateClient_user_10.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_11, "testObject_UpdateClient_user_11.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_12, "testObject_UpdateClient_user_12.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_13, "testObject_UpdateClient_user_13.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_14, "testObject_UpdateClient_user_14.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_15, "testObject_UpdateClient_user_15.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_16, "testObject_UpdateClient_user_16.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_17, "testObject_UpdateClient_user_17.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_18, "testObject_UpdateClient_user_18.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_19, "testObject_UpdateClient_user_19.json"), (Test.Wire.API.Golden.Generated.UpdateClient_user.testObject_UpdateClient_user_20, "testObject_UpdateClient_user_20.json")], + testGroup "Golden: RmClient_user" + $ testObjects [(Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_1, "testObject_RmClient_user_1.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_2, "testObject_RmClient_user_2.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_3, "testObject_RmClient_user_3.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_4, "testObject_RmClient_user_4.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_5, "testObject_RmClient_user_5.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_6, "testObject_RmClient_user_6.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_7, "testObject_RmClient_user_7.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_8, "testObject_RmClient_user_8.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_9, "testObject_RmClient_user_9.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_10, "testObject_RmClient_user_10.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_11, "testObject_RmClient_user_11.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_12, "testObject_RmClient_user_12.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_13, "testObject_RmClient_user_13.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_14, "testObject_RmClient_user_14.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_15, "testObject_RmClient_user_15.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_16, "testObject_RmClient_user_16.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_17, "testObject_RmClient_user_17.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_18, "testObject_RmClient_user_18.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_19, "testObject_RmClient_user_19.json"), (Test.Wire.API.Golden.Generated.RmClient_user.testObject_RmClient_user_20, "testObject_RmClient_user_20.json")], + testGroup "Golden: LastPrekey_user" + $ testObjects [(Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_1, "testObject_LastPrekey_user_1.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_2, "testObject_LastPrekey_user_2.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_3, "testObject_LastPrekey_user_3.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_4, "testObject_LastPrekey_user_4.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_5, "testObject_LastPrekey_user_5.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_6, "testObject_LastPrekey_user_6.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_7, "testObject_LastPrekey_user_7.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_8, "testObject_LastPrekey_user_8.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_9, "testObject_LastPrekey_user_9.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_10, "testObject_LastPrekey_user_10.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_11, "testObject_LastPrekey_user_11.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_12, "testObject_LastPrekey_user_12.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_13, "testObject_LastPrekey_user_13.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_14, "testObject_LastPrekey_user_14.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_15, "testObject_LastPrekey_user_15.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_16, "testObject_LastPrekey_user_16.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_17, "testObject_LastPrekey_user_17.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_18, "testObject_LastPrekey_user_18.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_19, "testObject_LastPrekey_user_19.json"), (Test.Wire.API.Golden.Generated.LastPrekey_user.testObject_LastPrekey_user_20, "testObject_LastPrekey_user_20.json")], + testGroup "Golden: PrekeyId_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_1, "testObject_PrekeyId_user_1.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_2, "testObject_PrekeyId_user_2.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_3, "testObject_PrekeyId_user_3.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_4, "testObject_PrekeyId_user_4.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_5, "testObject_PrekeyId_user_5.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_6, "testObject_PrekeyId_user_6.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_7, "testObject_PrekeyId_user_7.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_8, "testObject_PrekeyId_user_8.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_9, "testObject_PrekeyId_user_9.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_10, "testObject_PrekeyId_user_10.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_11, "testObject_PrekeyId_user_11.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_12, "testObject_PrekeyId_user_12.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_13, "testObject_PrekeyId_user_13.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_14, "testObject_PrekeyId_user_14.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_15, "testObject_PrekeyId_user_15.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_16, "testObject_PrekeyId_user_16.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_17, "testObject_PrekeyId_user_17.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_18, "testObject_PrekeyId_user_18.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_19, "testObject_PrekeyId_user_19.json"), (Test.Wire.API.Golden.Generated.PrekeyId_user.testObject_PrekeyId_user_20, "testObject_PrekeyId_user_20.json")], + testGroup "Golden: Prekey_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_1, "testObject_Prekey_user_1.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_2, "testObject_Prekey_user_2.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_3, "testObject_Prekey_user_3.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_4, "testObject_Prekey_user_4.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_5, "testObject_Prekey_user_5.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_6, "testObject_Prekey_user_6.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_7, "testObject_Prekey_user_7.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_8, "testObject_Prekey_user_8.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_9, "testObject_Prekey_user_9.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_10, "testObject_Prekey_user_10.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_11, "testObject_Prekey_user_11.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_12, "testObject_Prekey_user_12.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_13, "testObject_Prekey_user_13.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_14, "testObject_Prekey_user_14.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_15, "testObject_Prekey_user_15.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_16, "testObject_Prekey_user_16.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_17, "testObject_Prekey_user_17.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_18, "testObject_Prekey_user_18.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_19, "testObject_Prekey_user_19.json"), (Test.Wire.API.Golden.Generated.Prekey_user.testObject_Prekey_user_20, "testObject_Prekey_user_20.json")], + testGroup "Golden: ClientPrekey_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_1, "testObject_ClientPrekey_user_1.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_2, "testObject_ClientPrekey_user_2.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_3, "testObject_ClientPrekey_user_3.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_4, "testObject_ClientPrekey_user_4.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_5, "testObject_ClientPrekey_user_5.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_6, "testObject_ClientPrekey_user_6.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_7, "testObject_ClientPrekey_user_7.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_8, "testObject_ClientPrekey_user_8.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_9, "testObject_ClientPrekey_user_9.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_10, "testObject_ClientPrekey_user_10.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_11, "testObject_ClientPrekey_user_11.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_12, "testObject_ClientPrekey_user_12.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_13, "testObject_ClientPrekey_user_13.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_14, "testObject_ClientPrekey_user_14.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_15, "testObject_ClientPrekey_user_15.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_16, "testObject_ClientPrekey_user_16.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_17, "testObject_ClientPrekey_user_17.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_18, "testObject_ClientPrekey_user_18.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_19, "testObject_ClientPrekey_user_19.json"), (Test.Wire.API.Golden.Generated.ClientPrekey_user.testObject_ClientPrekey_user_20, "testObject_ClientPrekey_user_20.json")], + testGroup "Golden: PrekeyBundle_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_1, "testObject_PrekeyBundle_user_1.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_2, "testObject_PrekeyBundle_user_2.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_3, "testObject_PrekeyBundle_user_3.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_4, "testObject_PrekeyBundle_user_4.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_5, "testObject_PrekeyBundle_user_5.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_6, "testObject_PrekeyBundle_user_6.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_7, "testObject_PrekeyBundle_user_7.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_8, "testObject_PrekeyBundle_user_8.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_9, "testObject_PrekeyBundle_user_9.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_10, "testObject_PrekeyBundle_user_10.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_11, "testObject_PrekeyBundle_user_11.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_12, "testObject_PrekeyBundle_user_12.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_13, "testObject_PrekeyBundle_user_13.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_14, "testObject_PrekeyBundle_user_14.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_15, "testObject_PrekeyBundle_user_15.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_16, "testObject_PrekeyBundle_user_16.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_17, "testObject_PrekeyBundle_user_17.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_18, "testObject_PrekeyBundle_user_18.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_19, "testObject_PrekeyBundle_user_19.json"), (Test.Wire.API.Golden.Generated.PrekeyBundle_user.testObject_PrekeyBundle_user_20, "testObject_PrekeyBundle_user_20.json")], + testGroup "Golden: UserHandleInfo_user" + $ testObjects [(Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_1, "testObject_UserHandleInfo_user_1.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_2, "testObject_UserHandleInfo_user_2.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_3, "testObject_UserHandleInfo_user_3.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_4, "testObject_UserHandleInfo_user_4.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_5, "testObject_UserHandleInfo_user_5.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_6, "testObject_UserHandleInfo_user_6.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_7, "testObject_UserHandleInfo_user_7.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_8, "testObject_UserHandleInfo_user_8.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_9, "testObject_UserHandleInfo_user_9.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_10, "testObject_UserHandleInfo_user_10.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_11, "testObject_UserHandleInfo_user_11.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_12, "testObject_UserHandleInfo_user_12.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_13, "testObject_UserHandleInfo_user_13.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_14, "testObject_UserHandleInfo_user_14.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_15, "testObject_UserHandleInfo_user_15.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_16, "testObject_UserHandleInfo_user_16.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_17, "testObject_UserHandleInfo_user_17.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_18, "testObject_UserHandleInfo_user_18.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_19, "testObject_UserHandleInfo_user_19.json"), (Test.Wire.API.Golden.Generated.UserHandleInfo_user.testObject_UserHandleInfo_user_20, "testObject_UserHandleInfo_user_20.json")], + testGroup "Golden: CheckHandles_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_1, "testObject_CheckHandles_user_1.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_2, "testObject_CheckHandles_user_2.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_3, "testObject_CheckHandles_user_3.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_4, "testObject_CheckHandles_user_4.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_5, "testObject_CheckHandles_user_5.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_6, "testObject_CheckHandles_user_6.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_7, "testObject_CheckHandles_user_7.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_8, "testObject_CheckHandles_user_8.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_9, "testObject_CheckHandles_user_9.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_10, "testObject_CheckHandles_user_10.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_11, "testObject_CheckHandles_user_11.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_12, "testObject_CheckHandles_user_12.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_13, "testObject_CheckHandles_user_13.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_14, "testObject_CheckHandles_user_14.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_15, "testObject_CheckHandles_user_15.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_16, "testObject_CheckHandles_user_16.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_17, "testObject_CheckHandles_user_17.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_18, "testObject_CheckHandles_user_18.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_19, "testObject_CheckHandles_user_19.json"), (Test.Wire.API.Golden.Generated.CheckHandles_user.testObject_CheckHandles_user_20, "testObject_CheckHandles_user_20.json")], + testGroup "Golden: Email_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_1, "testObject_Email_user_1.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_2, "testObject_Email_user_2.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_3, "testObject_Email_user_3.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_4, "testObject_Email_user_4.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_5, "testObject_Email_user_5.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_6, "testObject_Email_user_6.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_7, "testObject_Email_user_7.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_8, "testObject_Email_user_8.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_9, "testObject_Email_user_9.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_10, "testObject_Email_user_10.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_11, "testObject_Email_user_11.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_12, "testObject_Email_user_12.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_13, "testObject_Email_user_13.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_14, "testObject_Email_user_14.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_15, "testObject_Email_user_15.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_16, "testObject_Email_user_16.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_17, "testObject_Email_user_17.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_18, "testObject_Email_user_18.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_19, "testObject_Email_user_19.json"), (Test.Wire.API.Golden.Generated.Email_user.testObject_Email_user_20, "testObject_Email_user_20.json")], + testGroup "Golden: Phone_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_1, "testObject_Phone_user_1.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_2, "testObject_Phone_user_2.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_3, "testObject_Phone_user_3.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_4, "testObject_Phone_user_4.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_5, "testObject_Phone_user_5.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_6, "testObject_Phone_user_6.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_7, "testObject_Phone_user_7.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_8, "testObject_Phone_user_8.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_9, "testObject_Phone_user_9.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_10, "testObject_Phone_user_10.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_11, "testObject_Phone_user_11.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_12, "testObject_Phone_user_12.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_13, "testObject_Phone_user_13.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_14, "testObject_Phone_user_14.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_15, "testObject_Phone_user_15.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_16, "testObject_Phone_user_16.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_17, "testObject_Phone_user_17.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_18, "testObject_Phone_user_18.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_19, "testObject_Phone_user_19.json"), (Test.Wire.API.Golden.Generated.Phone_user.testObject_Phone_user_20, "testObject_Phone_user_20.json")], + testGroup "Golden: UserSSOId_user" + $ testObjects [(Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_2, "testObject_UserSSOId_user_2.json"), (Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_9, "testObject_UserSSOId_user_9.json"), (Test.Wire.API.Golden.Generated.UserSSOId_user.testObject_UserSSOId_user_13, "testObject_UserSSOId_user_13.json")], + testGroup "Golden: NewPasswordReset_user" + $ testObjects [(Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_1, "testObject_NewPasswordReset_user_1.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_2, "testObject_NewPasswordReset_user_2.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_3, "testObject_NewPasswordReset_user_3.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_4, "testObject_NewPasswordReset_user_4.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_5, "testObject_NewPasswordReset_user_5.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_6, "testObject_NewPasswordReset_user_6.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_7, "testObject_NewPasswordReset_user_7.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_8, "testObject_NewPasswordReset_user_8.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_9, "testObject_NewPasswordReset_user_9.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_10, "testObject_NewPasswordReset_user_10.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_11, "testObject_NewPasswordReset_user_11.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_12, "testObject_NewPasswordReset_user_12.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_13, "testObject_NewPasswordReset_user_13.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_14, "testObject_NewPasswordReset_user_14.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_15, "testObject_NewPasswordReset_user_15.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_16, "testObject_NewPasswordReset_user_16.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_17, "testObject_NewPasswordReset_user_17.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_18, "testObject_NewPasswordReset_user_18.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_19, "testObject_NewPasswordReset_user_19.json"), (Test.Wire.API.Golden.Generated.NewPasswordReset_user.testObject_NewPasswordReset_user_20, "testObject_NewPasswordReset_user_20.json")], + testGroup "Golden: PasswordResetKey_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_1, "testObject_PasswordResetKey_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_2, "testObject_PasswordResetKey_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_3, "testObject_PasswordResetKey_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_4, "testObject_PasswordResetKey_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_5, "testObject_PasswordResetKey_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_6, "testObject_PasswordResetKey_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_7, "testObject_PasswordResetKey_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_8, "testObject_PasswordResetKey_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_9, "testObject_PasswordResetKey_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_10, "testObject_PasswordResetKey_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_11, "testObject_PasswordResetKey_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_12, "testObject_PasswordResetKey_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_13, "testObject_PasswordResetKey_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_14, "testObject_PasswordResetKey_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_15, "testObject_PasswordResetKey_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_16, "testObject_PasswordResetKey_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_17, "testObject_PasswordResetKey_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_18, "testObject_PasswordResetKey_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_19, "testObject_PasswordResetKey_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordResetKey_user.testObject_PasswordResetKey_user_20, "testObject_PasswordResetKey_user_20.json")], + testGroup "Golden: PasswordResetCode_user" + $ testObjects [(Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_1, "testObject_PasswordResetCode_user_1.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_2, "testObject_PasswordResetCode_user_2.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_3, "testObject_PasswordResetCode_user_3.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_4, "testObject_PasswordResetCode_user_4.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_5, "testObject_PasswordResetCode_user_5.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_6, "testObject_PasswordResetCode_user_6.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_7, "testObject_PasswordResetCode_user_7.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_8, "testObject_PasswordResetCode_user_8.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_9, "testObject_PasswordResetCode_user_9.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_10, "testObject_PasswordResetCode_user_10.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_11, "testObject_PasswordResetCode_user_11.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_12, "testObject_PasswordResetCode_user_12.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_13, "testObject_PasswordResetCode_user_13.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_14, "testObject_PasswordResetCode_user_14.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_15, "testObject_PasswordResetCode_user_15.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_16, "testObject_PasswordResetCode_user_16.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_17, "testObject_PasswordResetCode_user_17.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_18, "testObject_PasswordResetCode_user_18.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_19, "testObject_PasswordResetCode_user_19.json"), (Test.Wire.API.Golden.Generated.PasswordResetCode_user.testObject_PasswordResetCode_user_20, "testObject_PasswordResetCode_user_20.json")], + testGroup "Golden: CompletePasswordReset_user" + $ testObjects [(Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_1, "testObject_CompletePasswordReset_user_1.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_2, "testObject_CompletePasswordReset_user_2.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_3, "testObject_CompletePasswordReset_user_3.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_4, "testObject_CompletePasswordReset_user_4.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_5, "testObject_CompletePasswordReset_user_5.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_6, "testObject_CompletePasswordReset_user_6.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_7, "testObject_CompletePasswordReset_user_7.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_8, "testObject_CompletePasswordReset_user_8.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_9, "testObject_CompletePasswordReset_user_9.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_10, "testObject_CompletePasswordReset_user_10.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_11, "testObject_CompletePasswordReset_user_11.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_12, "testObject_CompletePasswordReset_user_12.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_13, "testObject_CompletePasswordReset_user_13.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_14, "testObject_CompletePasswordReset_user_14.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_15, "testObject_CompletePasswordReset_user_15.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_16, "testObject_CompletePasswordReset_user_16.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_17, "testObject_CompletePasswordReset_user_17.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_18, "testObject_CompletePasswordReset_user_18.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_19, "testObject_CompletePasswordReset_user_19.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_user.testObject_CompletePasswordReset_user_20, "testObject_CompletePasswordReset_user_20.json")], + testGroup "Golden: Pict_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_1, "testObject_Pict_user_1.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_2, "testObject_Pict_user_2.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_3, "testObject_Pict_user_3.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_4, "testObject_Pict_user_4.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_5, "testObject_Pict_user_5.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_6, "testObject_Pict_user_6.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_7, "testObject_Pict_user_7.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_8, "testObject_Pict_user_8.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_9, "testObject_Pict_user_9.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_10, "testObject_Pict_user_10.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_11, "testObject_Pict_user_11.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_12, "testObject_Pict_user_12.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_13, "testObject_Pict_user_13.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_14, "testObject_Pict_user_14.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_15, "testObject_Pict_user_15.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_16, "testObject_Pict_user_16.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_17, "testObject_Pict_user_17.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_18, "testObject_Pict_user_18.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_19, "testObject_Pict_user_19.json"), (Test.Wire.API.Golden.Generated.Pict_user.testObject_Pict_user_20, "testObject_Pict_user_20.json")], + testGroup "Golden: Name_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_1, "testObject_Name_user_1.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_2, "testObject_Name_user_2.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_3, "testObject_Name_user_3.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_4, "testObject_Name_user_4.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_5, "testObject_Name_user_5.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_6, "testObject_Name_user_6.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_7, "testObject_Name_user_7.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_8, "testObject_Name_user_8.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_9, "testObject_Name_user_9.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_10, "testObject_Name_user_10.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_11, "testObject_Name_user_11.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_12, "testObject_Name_user_12.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_13, "testObject_Name_user_13.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_14, "testObject_Name_user_14.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_15, "testObject_Name_user_15.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_16, "testObject_Name_user_16.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_17, "testObject_Name_user_17.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_18, "testObject_Name_user_18.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_19, "testObject_Name_user_19.json"), (Test.Wire.API.Golden.Generated.Name_user.testObject_Name_user_20, "testObject_Name_user_20.json")], + testGroup "Golden: ColourId_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_1, "testObject_ColourId_user_1.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_2, "testObject_ColourId_user_2.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_3, "testObject_ColourId_user_3.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_4, "testObject_ColourId_user_4.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_5, "testObject_ColourId_user_5.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_6, "testObject_ColourId_user_6.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_7, "testObject_ColourId_user_7.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_8, "testObject_ColourId_user_8.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_9, "testObject_ColourId_user_9.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_10, "testObject_ColourId_user_10.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_11, "testObject_ColourId_user_11.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_12, "testObject_ColourId_user_12.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_13, "testObject_ColourId_user_13.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_14, "testObject_ColourId_user_14.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_15, "testObject_ColourId_user_15.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_16, "testObject_ColourId_user_16.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_17, "testObject_ColourId_user_17.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_18, "testObject_ColourId_user_18.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_19, "testObject_ColourId_user_19.json"), (Test.Wire.API.Golden.Generated.ColourId_user.testObject_ColourId_user_20, "testObject_ColourId_user_20.json")], + testGroup "Golden: AssetSize_user" + $ testObjects [(Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_1, "testObject_AssetSize_user_1.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_2, "testObject_AssetSize_user_2.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_3, "testObject_AssetSize_user_3.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_4, "testObject_AssetSize_user_4.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_5, "testObject_AssetSize_user_5.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_6, "testObject_AssetSize_user_6.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_7, "testObject_AssetSize_user_7.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_8, "testObject_AssetSize_user_8.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_9, "testObject_AssetSize_user_9.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_10, "testObject_AssetSize_user_10.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_11, "testObject_AssetSize_user_11.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_12, "testObject_AssetSize_user_12.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_13, "testObject_AssetSize_user_13.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_14, "testObject_AssetSize_user_14.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_15, "testObject_AssetSize_user_15.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_16, "testObject_AssetSize_user_16.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_17, "testObject_AssetSize_user_17.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_18, "testObject_AssetSize_user_18.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_19, "testObject_AssetSize_user_19.json"), (Test.Wire.API.Golden.Generated.AssetSize_user.testObject_AssetSize_user_20, "testObject_AssetSize_user_20.json")], + testGroup "Golden: User_2eProfile_2eAsset_user" + $ testObjects [(Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_1, "testObject_User_2eProfile_2eAsset_user_1.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_2, "testObject_User_2eProfile_2eAsset_user_2.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_3, "testObject_User_2eProfile_2eAsset_user_3.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_4, "testObject_User_2eProfile_2eAsset_user_4.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_5, "testObject_User_2eProfile_2eAsset_user_5.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_6, "testObject_User_2eProfile_2eAsset_user_6.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_7, "testObject_User_2eProfile_2eAsset_user_7.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_8, "testObject_User_2eProfile_2eAsset_user_8.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_9, "testObject_User_2eProfile_2eAsset_user_9.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_10, "testObject_User_2eProfile_2eAsset_user_10.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_11, "testObject_User_2eProfile_2eAsset_user_11.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_12, "testObject_User_2eProfile_2eAsset_user_12.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_13, "testObject_User_2eProfile_2eAsset_user_13.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_14, "testObject_User_2eProfile_2eAsset_user_14.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_15, "testObject_User_2eProfile_2eAsset_user_15.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_16, "testObject_User_2eProfile_2eAsset_user_16.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_17, "testObject_User_2eProfile_2eAsset_user_17.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_18, "testObject_User_2eProfile_2eAsset_user_18.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_19, "testObject_User_2eProfile_2eAsset_user_19.json"), (Test.Wire.API.Golden.Generated.User_2eProfile_2eAsset_user.testObject_User_2eProfile_2eAsset_user_20, "testObject_User_2eProfile_2eAsset_user_20.json")], + testGroup "Golden: Locale_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_1, "testObject_Locale_user_1.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_2, "testObject_Locale_user_2.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_3, "testObject_Locale_user_3.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_4, "testObject_Locale_user_4.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_5, "testObject_Locale_user_5.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_6, "testObject_Locale_user_6.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_7, "testObject_Locale_user_7.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_8, "testObject_Locale_user_8.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_9, "testObject_Locale_user_9.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_10, "testObject_Locale_user_10.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_11, "testObject_Locale_user_11.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_12, "testObject_Locale_user_12.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_13, "testObject_Locale_user_13.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_14, "testObject_Locale_user_14.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_15, "testObject_Locale_user_15.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_16, "testObject_Locale_user_16.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_17, "testObject_Locale_user_17.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_18, "testObject_Locale_user_18.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_19, "testObject_Locale_user_19.json"), (Test.Wire.API.Golden.Generated.Locale_user.testObject_Locale_user_20, "testObject_Locale_user_20.json")], + testGroup "Golden: ManagedBy_user" + $ testObjects [(Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_1, "testObject_ManagedBy_user_1.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_2, "testObject_ManagedBy_user_2.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_3, "testObject_ManagedBy_user_3.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_4, "testObject_ManagedBy_user_4.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_5, "testObject_ManagedBy_user_5.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_6, "testObject_ManagedBy_user_6.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_7, "testObject_ManagedBy_user_7.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_8, "testObject_ManagedBy_user_8.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_9, "testObject_ManagedBy_user_9.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_10, "testObject_ManagedBy_user_10.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_11, "testObject_ManagedBy_user_11.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_12, "testObject_ManagedBy_user_12.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_13, "testObject_ManagedBy_user_13.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_14, "testObject_ManagedBy_user_14.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_15, "testObject_ManagedBy_user_15.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_16, "testObject_ManagedBy_user_16.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_17, "testObject_ManagedBy_user_17.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_18, "testObject_ManagedBy_user_18.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_19, "testObject_ManagedBy_user_19.json"), (Test.Wire.API.Golden.Generated.ManagedBy_user.testObject_ManagedBy_user_20, "testObject_ManagedBy_user_20.json")], + testGroup "Golden: RichField_user" + $ testObjects [(Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_1, "testObject_RichField_user_1.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_2, "testObject_RichField_user_2.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_3, "testObject_RichField_user_3.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_4, "testObject_RichField_user_4.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_5, "testObject_RichField_user_5.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_6, "testObject_RichField_user_6.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_7, "testObject_RichField_user_7.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_8, "testObject_RichField_user_8.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_9, "testObject_RichField_user_9.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_10, "testObject_RichField_user_10.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_11, "testObject_RichField_user_11.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_12, "testObject_RichField_user_12.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_13, "testObject_RichField_user_13.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_14, "testObject_RichField_user_14.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_15, "testObject_RichField_user_15.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_16, "testObject_RichField_user_16.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_17, "testObject_RichField_user_17.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_18, "testObject_RichField_user_18.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_19, "testObject_RichField_user_19.json"), (Test.Wire.API.Golden.Generated.RichField_user.testObject_RichField_user_20, "testObject_RichField_user_20.json")], + testGroup "Golden: RichInfoAssocList_user" + $ testObjects [(Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_1, "testObject_RichInfoAssocList_user_1.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_2, "testObject_RichInfoAssocList_user_2.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_3, "testObject_RichInfoAssocList_user_3.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_4, "testObject_RichInfoAssocList_user_4.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_5, "testObject_RichInfoAssocList_user_5.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_6, "testObject_RichInfoAssocList_user_6.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_7, "testObject_RichInfoAssocList_user_7.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_8, "testObject_RichInfoAssocList_user_8.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_9, "testObject_RichInfoAssocList_user_9.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_10, "testObject_RichInfoAssocList_user_10.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_11, "testObject_RichInfoAssocList_user_11.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_12, "testObject_RichInfoAssocList_user_12.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_13, "testObject_RichInfoAssocList_user_13.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_14, "testObject_RichInfoAssocList_user_14.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_15, "testObject_RichInfoAssocList_user_15.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_16, "testObject_RichInfoAssocList_user_16.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_17, "testObject_RichInfoAssocList_user_17.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_18, "testObject_RichInfoAssocList_user_18.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_19, "testObject_RichInfoAssocList_user_19.json"), (Test.Wire.API.Golden.Generated.RichInfoAssocList_user.testObject_RichInfoAssocList_user_20, "testObject_RichInfoAssocList_user_20.json")], + testGroup "Golden: RichInfo_user" + $ testObjects [(Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_1, "testObject_RichInfo_user_1.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_2, "testObject_RichInfo_user_2.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_3, "testObject_RichInfo_user_3.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_4, "testObject_RichInfo_user_4.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_5, "testObject_RichInfo_user_5.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_6, "testObject_RichInfo_user_6.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_7, "testObject_RichInfo_user_7.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_8, "testObject_RichInfo_user_8.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_9, "testObject_RichInfo_user_9.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_10, "testObject_RichInfo_user_10.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_11, "testObject_RichInfo_user_11.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_12, "testObject_RichInfo_user_12.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_13, "testObject_RichInfo_user_13.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_14, "testObject_RichInfo_user_14.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_15, "testObject_RichInfo_user_15.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_16, "testObject_RichInfo_user_16.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_17, "testObject_RichInfo_user_17.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_18, "testObject_RichInfo_user_18.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_19, "testObject_RichInfo_user_19.json"), (Test.Wire.API.Golden.Generated.RichInfo_user.testObject_RichInfo_user_20, "testObject_RichInfo_user_20.json")], + testGroup "Golden: SearchResult_20Contact_user" + $ testObjects [(Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_1, "testObject_SearchResult_20Contact_user_1.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_2, "testObject_SearchResult_20Contact_user_2.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_3, "testObject_SearchResult_20Contact_user_3.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_4, "testObject_SearchResult_20Contact_user_4.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_5, "testObject_SearchResult_20Contact_user_5.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_6, "testObject_SearchResult_20Contact_user_6.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_7, "testObject_SearchResult_20Contact_user_7.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_8, "testObject_SearchResult_20Contact_user_8.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_9, "testObject_SearchResult_20Contact_user_9.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_10, "testObject_SearchResult_20Contact_user_10.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_11, "testObject_SearchResult_20Contact_user_11.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_12, "testObject_SearchResult_20Contact_user_12.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_13, "testObject_SearchResult_20Contact_user_13.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_14, "testObject_SearchResult_20Contact_user_14.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_15, "testObject_SearchResult_20Contact_user_15.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_16, "testObject_SearchResult_20Contact_user_16.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_17, "testObject_SearchResult_20Contact_user_17.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_18, "testObject_SearchResult_20Contact_user_18.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_19, "testObject_SearchResult_20Contact_user_19.json"), (Test.Wire.API.Golden.Generated.SearchResult_20Contact_user.testObject_SearchResult_20Contact_user_20, "testObject_SearchResult_20Contact_user_20.json")], + testGroup "Golden: Contact_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_1, "testObject_Contact_user_1.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_2, "testObject_Contact_user_2.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_3, "testObject_Contact_user_3.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_4, "testObject_Contact_user_4.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_5, "testObject_Contact_user_5.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_6, "testObject_Contact_user_6.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_7, "testObject_Contact_user_7.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_8, "testObject_Contact_user_8.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_9, "testObject_Contact_user_9.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_10, "testObject_Contact_user_10.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_11, "testObject_Contact_user_11.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_12, "testObject_Contact_user_12.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_13, "testObject_Contact_user_13.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_14, "testObject_Contact_user_14.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_15, "testObject_Contact_user_15.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_16, "testObject_Contact_user_16.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_17, "testObject_Contact_user_17.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_18, "testObject_Contact_user_18.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_19, "testObject_Contact_user_19.json"), (Test.Wire.API.Golden.Generated.Contact_user.testObject_Contact_user_20, "testObject_Contact_user_20.json")], + testGroup "Golden: SearchResult_20TeamContact_user" + $ testObjects [(Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_1, "testObject_SearchResult_20TeamContact_user_1.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_2, "testObject_SearchResult_20TeamContact_user_2.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_3, "testObject_SearchResult_20TeamContact_user_3.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_4, "testObject_SearchResult_20TeamContact_user_4.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_5, "testObject_SearchResult_20TeamContact_user_5.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_6, "testObject_SearchResult_20TeamContact_user_6.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_7, "testObject_SearchResult_20TeamContact_user_7.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_8, "testObject_SearchResult_20TeamContact_user_8.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_9, "testObject_SearchResult_20TeamContact_user_9.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_10, "testObject_SearchResult_20TeamContact_user_10.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_11, "testObject_SearchResult_20TeamContact_user_11.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_12, "testObject_SearchResult_20TeamContact_user_12.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_13, "testObject_SearchResult_20TeamContact_user_13.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_14, "testObject_SearchResult_20TeamContact_user_14.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_15, "testObject_SearchResult_20TeamContact_user_15.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_16, "testObject_SearchResult_20TeamContact_user_16.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_17, "testObject_SearchResult_20TeamContact_user_17.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_18, "testObject_SearchResult_20TeamContact_user_18.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_19, "testObject_SearchResult_20TeamContact_user_19.json"), (Test.Wire.API.Golden.Generated.SearchResult_20TeamContact_user.testObject_SearchResult_20TeamContact_user_20, "testObject_SearchResult_20TeamContact_user_20.json")], + testGroup "Golden: TeamContact_user" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_1, "testObject_TeamContact_user_1.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_2, "testObject_TeamContact_user_2.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_3, "testObject_TeamContact_user_3.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_4, "testObject_TeamContact_user_4.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_5, "testObject_TeamContact_user_5.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_6, "testObject_TeamContact_user_6.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_7, "testObject_TeamContact_user_7.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_8, "testObject_TeamContact_user_8.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_9, "testObject_TeamContact_user_9.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_10, "testObject_TeamContact_user_10.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_11, "testObject_TeamContact_user_11.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_12, "testObject_TeamContact_user_12.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_13, "testObject_TeamContact_user_13.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_14, "testObject_TeamContact_user_14.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_15, "testObject_TeamContact_user_15.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_16, "testObject_TeamContact_user_16.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_17, "testObject_TeamContact_user_17.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_18, "testObject_TeamContact_user_18.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_19, "testObject_TeamContact_user_19.json"), (Test.Wire.API.Golden.Generated.TeamContact_user.testObject_TeamContact_user_20, "testObject_TeamContact_user_20.json")], + testGroup "Golden: Wrapped_20_22some_5fint_22_20Int_user" + $ testObjects [(Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_1, "testObject_Wrapped_20_22some_5fint_22_20Int_user_1.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_2, "testObject_Wrapped_20_22some_5fint_22_20Int_user_2.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_3, "testObject_Wrapped_20_22some_5fint_22_20Int_user_3.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_4, "testObject_Wrapped_20_22some_5fint_22_20Int_user_4.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_5, "testObject_Wrapped_20_22some_5fint_22_20Int_user_5.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_6, "testObject_Wrapped_20_22some_5fint_22_20Int_user_6.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_7, "testObject_Wrapped_20_22some_5fint_22_20Int_user_7.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_8, "testObject_Wrapped_20_22some_5fint_22_20Int_user_8.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_9, "testObject_Wrapped_20_22some_5fint_22_20Int_user_9.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_10, "testObject_Wrapped_20_22some_5fint_22_20Int_user_10.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_11, "testObject_Wrapped_20_22some_5fint_22_20Int_user_11.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_12, "testObject_Wrapped_20_22some_5fint_22_20Int_user_12.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_13, "testObject_Wrapped_20_22some_5fint_22_20Int_user_13.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_14, "testObject_Wrapped_20_22some_5fint_22_20Int_user_14.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_15, "testObject_Wrapped_20_22some_5fint_22_20Int_user_15.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_16, "testObject_Wrapped_20_22some_5fint_22_20Int_user_16.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_17, "testObject_Wrapped_20_22some_5fint_22_20Int_user_17.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_18, "testObject_Wrapped_20_22some_5fint_22_20Int_user_18.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_19, "testObject_Wrapped_20_22some_5fint_22_20Int_user_19.json"), (Test.Wire.API.Golden.Generated.Wrapped_20_22some_5fint_22_20Int_user.testObject_Wrapped_20_22some_5fint_22_20Int_user_20, "testObject_Wrapped_20_22some_5fint_22_20Int_user_20.json")], + testGroup "Golden: Asset_asset" + $ testObjects [(Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_1, "testObject_Asset_asset_1.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_2, "testObject_Asset_asset_2.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_3, "testObject_Asset_asset_3.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_4, "testObject_Asset_asset_4.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_5, "testObject_Asset_asset_5.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_6, "testObject_Asset_asset_6.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_7, "testObject_Asset_asset_7.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_8, "testObject_Asset_asset_8.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_9, "testObject_Asset_asset_9.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_10, "testObject_Asset_asset_10.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_11, "testObject_Asset_asset_11.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_12, "testObject_Asset_asset_12.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_13, "testObject_Asset_asset_13.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_14, "testObject_Asset_asset_14.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_15, "testObject_Asset_asset_15.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_16, "testObject_Asset_asset_16.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_17, "testObject_Asset_asset_17.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_18, "testObject_Asset_asset_18.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_19, "testObject_Asset_asset_19.json"), (Test.Wire.API.Golden.Generated.Asset_asset.testObject_Asset_asset_20, "testObject_Asset_asset_20.json")], + testGroup "Golden: Event_team" + $ testObjects [(Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_1, "testObject_Event_team_1.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_2, "testObject_Event_team_2.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_3, "testObject_Event_team_3.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_4, "testObject_Event_team_4.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_5, "testObject_Event_team_5.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_6, "testObject_Event_team_6.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_7, "testObject_Event_team_7.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_8, "testObject_Event_team_8.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_9, "testObject_Event_team_9.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_10, "testObject_Event_team_10.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_11, "testObject_Event_team_11.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_12, "testObject_Event_team_12.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_13, "testObject_Event_team_13.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_14, "testObject_Event_team_14.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_15, "testObject_Event_team_15.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_16, "testObject_Event_team_16.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_17, "testObject_Event_team_17.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_18, "testObject_Event_team_18.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_19, "testObject_Event_team_19.json"), (Test.Wire.API.Golden.Generated.Event_team.testObject_Event_team_20, "testObject_Event_team_20.json")], + testGroup "Golden: EventType_team" + $ testObjects [(Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_1, "testObject_EventType_team_1.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_2, "testObject_EventType_team_2.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_3, "testObject_EventType_team_3.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_4, "testObject_EventType_team_4.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_5, "testObject_EventType_team_5.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_6, "testObject_EventType_team_6.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_7, "testObject_EventType_team_7.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_8, "testObject_EventType_team_8.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_9, "testObject_EventType_team_9.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_10, "testObject_EventType_team_10.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_11, "testObject_EventType_team_11.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_12, "testObject_EventType_team_12.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_13, "testObject_EventType_team_13.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_14, "testObject_EventType_team_14.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_15, "testObject_EventType_team_15.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_16, "testObject_EventType_team_16.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_17, "testObject_EventType_team_17.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_18, "testObject_EventType_team_18.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_19, "testObject_EventType_team_19.json"), (Test.Wire.API.Golden.Generated.EventType_team.testObject_EventType_team_20, "testObject_EventType_team_20.json")], + testGroup "Golden: Provider_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_1, "testObject_Provider_provider_1.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_2, "testObject_Provider_provider_2.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_3, "testObject_Provider_provider_3.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_4, "testObject_Provider_provider_4.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_5, "testObject_Provider_provider_5.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_6, "testObject_Provider_provider_6.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_7, "testObject_Provider_provider_7.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_8, "testObject_Provider_provider_8.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_9, "testObject_Provider_provider_9.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_10, "testObject_Provider_provider_10.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_11, "testObject_Provider_provider_11.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_12, "testObject_Provider_provider_12.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_13, "testObject_Provider_provider_13.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_14, "testObject_Provider_provider_14.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_15, "testObject_Provider_provider_15.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_16, "testObject_Provider_provider_16.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_17, "testObject_Provider_provider_17.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_18, "testObject_Provider_provider_18.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_19, "testObject_Provider_provider_19.json"), (Test.Wire.API.Golden.Generated.Provider_provider.testObject_Provider_provider_20, "testObject_Provider_provider_20.json")], + testGroup "Golden: ProviderProfile_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_1, "testObject_ProviderProfile_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_2, "testObject_ProviderProfile_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_3, "testObject_ProviderProfile_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_4, "testObject_ProviderProfile_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_5, "testObject_ProviderProfile_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_6, "testObject_ProviderProfile_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_7, "testObject_ProviderProfile_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_8, "testObject_ProviderProfile_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_9, "testObject_ProviderProfile_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_10, "testObject_ProviderProfile_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_11, "testObject_ProviderProfile_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_12, "testObject_ProviderProfile_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_13, "testObject_ProviderProfile_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_14, "testObject_ProviderProfile_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_15, "testObject_ProviderProfile_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_16, "testObject_ProviderProfile_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_17, "testObject_ProviderProfile_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_18, "testObject_ProviderProfile_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_19, "testObject_ProviderProfile_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderProfile_provider.testObject_ProviderProfile_provider_20, "testObject_ProviderProfile_provider_20.json")], + testGroup "Golden: NewProvider_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_1, "testObject_NewProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_2, "testObject_NewProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_3, "testObject_NewProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_4, "testObject_NewProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_5, "testObject_NewProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_6, "testObject_NewProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_7, "testObject_NewProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_8, "testObject_NewProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_9, "testObject_NewProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_10, "testObject_NewProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_11, "testObject_NewProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_12, "testObject_NewProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_13, "testObject_NewProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_14, "testObject_NewProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_15, "testObject_NewProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_16, "testObject_NewProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_17, "testObject_NewProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_18, "testObject_NewProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_19, "testObject_NewProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.NewProvider_provider.testObject_NewProvider_provider_20, "testObject_NewProvider_provider_20.json")], + testGroup "Golden: NewProviderResponse_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_1, "testObject_NewProviderResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_2, "testObject_NewProviderResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_3, "testObject_NewProviderResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_4, "testObject_NewProviderResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_5, "testObject_NewProviderResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_6, "testObject_NewProviderResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_7, "testObject_NewProviderResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_8, "testObject_NewProviderResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_9, "testObject_NewProviderResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_10, "testObject_NewProviderResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_11, "testObject_NewProviderResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_12, "testObject_NewProviderResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_13, "testObject_NewProviderResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_14, "testObject_NewProviderResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_15, "testObject_NewProviderResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_16, "testObject_NewProviderResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_17, "testObject_NewProviderResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_18, "testObject_NewProviderResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_19, "testObject_NewProviderResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewProviderResponse_provider.testObject_NewProviderResponse_provider_20, "testObject_NewProviderResponse_provider_20.json")], + testGroup "Golden: UpdateProvider_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_1, "testObject_UpdateProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_2, "testObject_UpdateProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_3, "testObject_UpdateProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_4, "testObject_UpdateProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_5, "testObject_UpdateProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_6, "testObject_UpdateProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_7, "testObject_UpdateProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_8, "testObject_UpdateProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_9, "testObject_UpdateProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_10, "testObject_UpdateProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_11, "testObject_UpdateProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_12, "testObject_UpdateProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_13, "testObject_UpdateProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_14, "testObject_UpdateProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_15, "testObject_UpdateProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_16, "testObject_UpdateProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_17, "testObject_UpdateProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_18, "testObject_UpdateProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_19, "testObject_UpdateProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateProvider_provider.testObject_UpdateProvider_provider_20, "testObject_UpdateProvider_provider_20.json")], + testGroup "Golden: ProviderActivationResponse_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_1, "testObject_ProviderActivationResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_2, "testObject_ProviderActivationResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_3, "testObject_ProviderActivationResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_4, "testObject_ProviderActivationResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_5, "testObject_ProviderActivationResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_6, "testObject_ProviderActivationResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_7, "testObject_ProviderActivationResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_8, "testObject_ProviderActivationResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_9, "testObject_ProviderActivationResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_10, "testObject_ProviderActivationResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_11, "testObject_ProviderActivationResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_12, "testObject_ProviderActivationResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_13, "testObject_ProviderActivationResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_14, "testObject_ProviderActivationResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_15, "testObject_ProviderActivationResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_16, "testObject_ProviderActivationResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_17, "testObject_ProviderActivationResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_18, "testObject_ProviderActivationResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_19, "testObject_ProviderActivationResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderActivationResponse_provider.testObject_ProviderActivationResponse_provider_20, "testObject_ProviderActivationResponse_provider_20.json")], + testGroup "Golden: ProviderLogin_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_1, "testObject_ProviderLogin_provider_1.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_2, "testObject_ProviderLogin_provider_2.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_3, "testObject_ProviderLogin_provider_3.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_4, "testObject_ProviderLogin_provider_4.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_5, "testObject_ProviderLogin_provider_5.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_6, "testObject_ProviderLogin_provider_6.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_7, "testObject_ProviderLogin_provider_7.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_8, "testObject_ProviderLogin_provider_8.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_9, "testObject_ProviderLogin_provider_9.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_10, "testObject_ProviderLogin_provider_10.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_11, "testObject_ProviderLogin_provider_11.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_12, "testObject_ProviderLogin_provider_12.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_13, "testObject_ProviderLogin_provider_13.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_14, "testObject_ProviderLogin_provider_14.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_15, "testObject_ProviderLogin_provider_15.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_16, "testObject_ProviderLogin_provider_16.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_17, "testObject_ProviderLogin_provider_17.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_18, "testObject_ProviderLogin_provider_18.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_19, "testObject_ProviderLogin_provider_19.json"), (Test.Wire.API.Golden.Generated.ProviderLogin_provider.testObject_ProviderLogin_provider_20, "testObject_ProviderLogin_provider_20.json")], + testGroup "Golden: DeleteProvider_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_1, "testObject_DeleteProvider_provider_1.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_2, "testObject_DeleteProvider_provider_2.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_3, "testObject_DeleteProvider_provider_3.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_4, "testObject_DeleteProvider_provider_4.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_5, "testObject_DeleteProvider_provider_5.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_6, "testObject_DeleteProvider_provider_6.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_7, "testObject_DeleteProvider_provider_7.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_8, "testObject_DeleteProvider_provider_8.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_9, "testObject_DeleteProvider_provider_9.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_10, "testObject_DeleteProvider_provider_10.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_11, "testObject_DeleteProvider_provider_11.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_12, "testObject_DeleteProvider_provider_12.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_13, "testObject_DeleteProvider_provider_13.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_14, "testObject_DeleteProvider_provider_14.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_15, "testObject_DeleteProvider_provider_15.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_16, "testObject_DeleteProvider_provider_16.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_17, "testObject_DeleteProvider_provider_17.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_18, "testObject_DeleteProvider_provider_18.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_19, "testObject_DeleteProvider_provider_19.json"), (Test.Wire.API.Golden.Generated.DeleteProvider_provider.testObject_DeleteProvider_provider_20, "testObject_DeleteProvider_provider_20.json")], + testGroup "Golden: PasswordReset_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_1, "testObject_PasswordReset_provider_1.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_2, "testObject_PasswordReset_provider_2.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_3, "testObject_PasswordReset_provider_3.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_4, "testObject_PasswordReset_provider_4.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_5, "testObject_PasswordReset_provider_5.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_6, "testObject_PasswordReset_provider_6.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_7, "testObject_PasswordReset_provider_7.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_8, "testObject_PasswordReset_provider_8.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_9, "testObject_PasswordReset_provider_9.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_10, "testObject_PasswordReset_provider_10.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_11, "testObject_PasswordReset_provider_11.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_12, "testObject_PasswordReset_provider_12.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_13, "testObject_PasswordReset_provider_13.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_14, "testObject_PasswordReset_provider_14.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_15, "testObject_PasswordReset_provider_15.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_16, "testObject_PasswordReset_provider_16.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_17, "testObject_PasswordReset_provider_17.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_18, "testObject_PasswordReset_provider_18.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_19, "testObject_PasswordReset_provider_19.json"), (Test.Wire.API.Golden.Generated.PasswordReset_provider.testObject_PasswordReset_provider_20, "testObject_PasswordReset_provider_20.json")], + testGroup "Golden: CompletePasswordReset_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_1, "testObject_CompletePasswordReset_provider_1.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_2, "testObject_CompletePasswordReset_provider_2.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_3, "testObject_CompletePasswordReset_provider_3.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_4, "testObject_CompletePasswordReset_provider_4.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_5, "testObject_CompletePasswordReset_provider_5.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_6, "testObject_CompletePasswordReset_provider_6.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_7, "testObject_CompletePasswordReset_provider_7.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_8, "testObject_CompletePasswordReset_provider_8.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_9, "testObject_CompletePasswordReset_provider_9.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_10, "testObject_CompletePasswordReset_provider_10.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_11, "testObject_CompletePasswordReset_provider_11.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_12, "testObject_CompletePasswordReset_provider_12.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_13, "testObject_CompletePasswordReset_provider_13.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_14, "testObject_CompletePasswordReset_provider_14.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_15, "testObject_CompletePasswordReset_provider_15.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_16, "testObject_CompletePasswordReset_provider_16.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_17, "testObject_CompletePasswordReset_provider_17.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_18, "testObject_CompletePasswordReset_provider_18.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_19, "testObject_CompletePasswordReset_provider_19.json"), (Test.Wire.API.Golden.Generated.CompletePasswordReset_provider.testObject_CompletePasswordReset_provider_20, "testObject_CompletePasswordReset_provider_20.json")], + testGroup "Golden: PasswordChange_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_1, "testObject_PasswordChange_provider_1.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_2, "testObject_PasswordChange_provider_2.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_3, "testObject_PasswordChange_provider_3.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_4, "testObject_PasswordChange_provider_4.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_5, "testObject_PasswordChange_provider_5.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_6, "testObject_PasswordChange_provider_6.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_7, "testObject_PasswordChange_provider_7.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_8, "testObject_PasswordChange_provider_8.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_9, "testObject_PasswordChange_provider_9.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_10, "testObject_PasswordChange_provider_10.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_11, "testObject_PasswordChange_provider_11.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_12, "testObject_PasswordChange_provider_12.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_13, "testObject_PasswordChange_provider_13.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_14, "testObject_PasswordChange_provider_14.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_15, "testObject_PasswordChange_provider_15.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_16, "testObject_PasswordChange_provider_16.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_17, "testObject_PasswordChange_provider_17.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_18, "testObject_PasswordChange_provider_18.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_19, "testObject_PasswordChange_provider_19.json"), (Test.Wire.API.Golden.Generated.PasswordChange_provider.testObject_PasswordChange_provider_20, "testObject_PasswordChange_provider_20.json")], + testGroup "Golden: EmailUpdate_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_1, "testObject_EmailUpdate_provider_1.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_2, "testObject_EmailUpdate_provider_2.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_3, "testObject_EmailUpdate_provider_3.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_4, "testObject_EmailUpdate_provider_4.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_5, "testObject_EmailUpdate_provider_5.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_6, "testObject_EmailUpdate_provider_6.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_7, "testObject_EmailUpdate_provider_7.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_8, "testObject_EmailUpdate_provider_8.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_9, "testObject_EmailUpdate_provider_9.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_10, "testObject_EmailUpdate_provider_10.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_11, "testObject_EmailUpdate_provider_11.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_12, "testObject_EmailUpdate_provider_12.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_13, "testObject_EmailUpdate_provider_13.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_14, "testObject_EmailUpdate_provider_14.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_15, "testObject_EmailUpdate_provider_15.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_16, "testObject_EmailUpdate_provider_16.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_17, "testObject_EmailUpdate_provider_17.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_18, "testObject_EmailUpdate_provider_18.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_19, "testObject_EmailUpdate_provider_19.json"), (Test.Wire.API.Golden.Generated.EmailUpdate_provider.testObject_EmailUpdate_provider_20, "testObject_EmailUpdate_provider_20.json")], + testGroup "Golden: BotConvView_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_1, "testObject_BotConvView_provider_1.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_2, "testObject_BotConvView_provider_2.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_3, "testObject_BotConvView_provider_3.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_4, "testObject_BotConvView_provider_4.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_5, "testObject_BotConvView_provider_5.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_6, "testObject_BotConvView_provider_6.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_7, "testObject_BotConvView_provider_7.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_8, "testObject_BotConvView_provider_8.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_9, "testObject_BotConvView_provider_9.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_10, "testObject_BotConvView_provider_10.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_11, "testObject_BotConvView_provider_11.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_12, "testObject_BotConvView_provider_12.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_13, "testObject_BotConvView_provider_13.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_14, "testObject_BotConvView_provider_14.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_15, "testObject_BotConvView_provider_15.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_16, "testObject_BotConvView_provider_16.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_17, "testObject_BotConvView_provider_17.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_18, "testObject_BotConvView_provider_18.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_19, "testObject_BotConvView_provider_19.json"), (Test.Wire.API.Golden.Generated.BotConvView_provider.testObject_BotConvView_provider_20, "testObject_BotConvView_provider_20.json")], + testGroup "Golden: BotUserView_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_1, "testObject_BotUserView_provider_1.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_2, "testObject_BotUserView_provider_2.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_3, "testObject_BotUserView_provider_3.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_4, "testObject_BotUserView_provider_4.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_5, "testObject_BotUserView_provider_5.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_6, "testObject_BotUserView_provider_6.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_7, "testObject_BotUserView_provider_7.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_8, "testObject_BotUserView_provider_8.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_9, "testObject_BotUserView_provider_9.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_10, "testObject_BotUserView_provider_10.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_11, "testObject_BotUserView_provider_11.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_12, "testObject_BotUserView_provider_12.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_13, "testObject_BotUserView_provider_13.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_14, "testObject_BotUserView_provider_14.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_15, "testObject_BotUserView_provider_15.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_16, "testObject_BotUserView_provider_16.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_17, "testObject_BotUserView_provider_17.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_18, "testObject_BotUserView_provider_18.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_19, "testObject_BotUserView_provider_19.json"), (Test.Wire.API.Golden.Generated.BotUserView_provider.testObject_BotUserView_provider_20, "testObject_BotUserView_provider_20.json")], + testGroup "Golden: NewBotRequest_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_1, "testObject_NewBotRequest_provider_1.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_2, "testObject_NewBotRequest_provider_2.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_3, "testObject_NewBotRequest_provider_3.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_4, "testObject_NewBotRequest_provider_4.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_5, "testObject_NewBotRequest_provider_5.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_6, "testObject_NewBotRequest_provider_6.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_7, "testObject_NewBotRequest_provider_7.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_8, "testObject_NewBotRequest_provider_8.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_9, "testObject_NewBotRequest_provider_9.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_10, "testObject_NewBotRequest_provider_10.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_11, "testObject_NewBotRequest_provider_11.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_12, "testObject_NewBotRequest_provider_12.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_13, "testObject_NewBotRequest_provider_13.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_14, "testObject_NewBotRequest_provider_14.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_15, "testObject_NewBotRequest_provider_15.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_16, "testObject_NewBotRequest_provider_16.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_17, "testObject_NewBotRequest_provider_17.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_18, "testObject_NewBotRequest_provider_18.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_19, "testObject_NewBotRequest_provider_19.json"), (Test.Wire.API.Golden.Generated.NewBotRequest_provider.testObject_NewBotRequest_provider_20, "testObject_NewBotRequest_provider_20.json")], + testGroup "Golden: NewBotResponse_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_1, "testObject_NewBotResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_2, "testObject_NewBotResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_3, "testObject_NewBotResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_4, "testObject_NewBotResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_5, "testObject_NewBotResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_6, "testObject_NewBotResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_7, "testObject_NewBotResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_8, "testObject_NewBotResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_9, "testObject_NewBotResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_10, "testObject_NewBotResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_11, "testObject_NewBotResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_12, "testObject_NewBotResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_13, "testObject_NewBotResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_14, "testObject_NewBotResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_15, "testObject_NewBotResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_16, "testObject_NewBotResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_17, "testObject_NewBotResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_18, "testObject_NewBotResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_19, "testObject_NewBotResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewBotResponse_provider.testObject_NewBotResponse_provider_20, "testObject_NewBotResponse_provider_20.json")], + testGroup "Golden: ServiceRef_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_1, "testObject_ServiceRef_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_2, "testObject_ServiceRef_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_3, "testObject_ServiceRef_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_4, "testObject_ServiceRef_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_5, "testObject_ServiceRef_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_6, "testObject_ServiceRef_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_7, "testObject_ServiceRef_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_8, "testObject_ServiceRef_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_9, "testObject_ServiceRef_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_10, "testObject_ServiceRef_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_11, "testObject_ServiceRef_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_12, "testObject_ServiceRef_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_13, "testObject_ServiceRef_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_14, "testObject_ServiceRef_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_15, "testObject_ServiceRef_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_16, "testObject_ServiceRef_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_17, "testObject_ServiceRef_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_18, "testObject_ServiceRef_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_19, "testObject_ServiceRef_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceRef_provider.testObject_ServiceRef_provider_20, "testObject_ServiceRef_provider_20.json")], + testGroup "Golden: ServiceKeyPEM_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_1, "testObject_ServiceKeyPEM_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_2, "testObject_ServiceKeyPEM_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_3, "testObject_ServiceKeyPEM_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_4, "testObject_ServiceKeyPEM_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_5, "testObject_ServiceKeyPEM_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_6, "testObject_ServiceKeyPEM_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_7, "testObject_ServiceKeyPEM_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_8, "testObject_ServiceKeyPEM_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_9, "testObject_ServiceKeyPEM_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_10, "testObject_ServiceKeyPEM_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_11, "testObject_ServiceKeyPEM_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_12, "testObject_ServiceKeyPEM_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_13, "testObject_ServiceKeyPEM_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_14, "testObject_ServiceKeyPEM_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_15, "testObject_ServiceKeyPEM_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_16, "testObject_ServiceKeyPEM_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_17, "testObject_ServiceKeyPEM_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_18, "testObject_ServiceKeyPEM_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_19, "testObject_ServiceKeyPEM_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKeyPEM_provider.testObject_ServiceKeyPEM_provider_20, "testObject_ServiceKeyPEM_provider_20.json")], + testGroup "Golden: ServiceKeyType_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_1, "testObject_ServiceKeyType_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_2, "testObject_ServiceKeyType_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_3, "testObject_ServiceKeyType_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_4, "testObject_ServiceKeyType_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_5, "testObject_ServiceKeyType_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_6, "testObject_ServiceKeyType_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_7, "testObject_ServiceKeyType_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_8, "testObject_ServiceKeyType_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_9, "testObject_ServiceKeyType_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_10, "testObject_ServiceKeyType_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_11, "testObject_ServiceKeyType_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_12, "testObject_ServiceKeyType_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_13, "testObject_ServiceKeyType_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_14, "testObject_ServiceKeyType_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_15, "testObject_ServiceKeyType_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_16, "testObject_ServiceKeyType_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_17, "testObject_ServiceKeyType_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_18, "testObject_ServiceKeyType_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_19, "testObject_ServiceKeyType_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKeyType_provider.testObject_ServiceKeyType_provider_20, "testObject_ServiceKeyType_provider_20.json")], + testGroup "Golden: ServiceKey_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_1, "testObject_ServiceKey_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_2, "testObject_ServiceKey_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_3, "testObject_ServiceKey_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_4, "testObject_ServiceKey_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_5, "testObject_ServiceKey_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_6, "testObject_ServiceKey_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_7, "testObject_ServiceKey_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_8, "testObject_ServiceKey_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_9, "testObject_ServiceKey_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_10, "testObject_ServiceKey_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_11, "testObject_ServiceKey_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_12, "testObject_ServiceKey_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_13, "testObject_ServiceKey_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_14, "testObject_ServiceKey_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_15, "testObject_ServiceKey_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_16, "testObject_ServiceKey_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_17, "testObject_ServiceKey_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_18, "testObject_ServiceKey_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_19, "testObject_ServiceKey_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceKey_provider.testObject_ServiceKey_provider_20, "testObject_ServiceKey_provider_20.json")], + testGroup "Golden: ServiceToken_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_1, "testObject_ServiceToken_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_2, "testObject_ServiceToken_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_3, "testObject_ServiceToken_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_4, "testObject_ServiceToken_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_5, "testObject_ServiceToken_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_6, "testObject_ServiceToken_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_7, "testObject_ServiceToken_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_8, "testObject_ServiceToken_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_9, "testObject_ServiceToken_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_10, "testObject_ServiceToken_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_11, "testObject_ServiceToken_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_12, "testObject_ServiceToken_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_13, "testObject_ServiceToken_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_14, "testObject_ServiceToken_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_15, "testObject_ServiceToken_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_16, "testObject_ServiceToken_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_17, "testObject_ServiceToken_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_18, "testObject_ServiceToken_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_19, "testObject_ServiceToken_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceToken_provider.testObject_ServiceToken_provider_20, "testObject_ServiceToken_provider_20.json")], + testGroup "Golden: Service_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_1, "testObject_Service_provider_1.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_2, "testObject_Service_provider_2.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_3, "testObject_Service_provider_3.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_4, "testObject_Service_provider_4.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_5, "testObject_Service_provider_5.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_6, "testObject_Service_provider_6.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_7, "testObject_Service_provider_7.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_8, "testObject_Service_provider_8.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_9, "testObject_Service_provider_9.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_10, "testObject_Service_provider_10.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_11, "testObject_Service_provider_11.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_12, "testObject_Service_provider_12.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_13, "testObject_Service_provider_13.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_14, "testObject_Service_provider_14.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_15, "testObject_Service_provider_15.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_16, "testObject_Service_provider_16.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_17, "testObject_Service_provider_17.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_18, "testObject_Service_provider_18.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_19, "testObject_Service_provider_19.json"), (Test.Wire.API.Golden.Generated.Service_provider.testObject_Service_provider_20, "testObject_Service_provider_20.json")], + testGroup "Golden: ServiceProfile_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_1, "testObject_ServiceProfile_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_2, "testObject_ServiceProfile_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_3, "testObject_ServiceProfile_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_4, "testObject_ServiceProfile_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_5, "testObject_ServiceProfile_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_6, "testObject_ServiceProfile_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_7, "testObject_ServiceProfile_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_8, "testObject_ServiceProfile_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_9, "testObject_ServiceProfile_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_10, "testObject_ServiceProfile_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_11, "testObject_ServiceProfile_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_12, "testObject_ServiceProfile_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_13, "testObject_ServiceProfile_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_14, "testObject_ServiceProfile_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_15, "testObject_ServiceProfile_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_16, "testObject_ServiceProfile_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_17, "testObject_ServiceProfile_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_18, "testObject_ServiceProfile_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_19, "testObject_ServiceProfile_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceProfile_provider.testObject_ServiceProfile_provider_20, "testObject_ServiceProfile_provider_20.json")], + testGroup "Golden: ServiceProfilePage_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_1, "testObject_ServiceProfilePage_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_2, "testObject_ServiceProfilePage_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_3, "testObject_ServiceProfilePage_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_4, "testObject_ServiceProfilePage_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_5, "testObject_ServiceProfilePage_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_6, "testObject_ServiceProfilePage_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_7, "testObject_ServiceProfilePage_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_8, "testObject_ServiceProfilePage_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_9, "testObject_ServiceProfilePage_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_10, "testObject_ServiceProfilePage_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_11, "testObject_ServiceProfilePage_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_12, "testObject_ServiceProfilePage_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_13, "testObject_ServiceProfilePage_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_14, "testObject_ServiceProfilePage_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_15, "testObject_ServiceProfilePage_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_16, "testObject_ServiceProfilePage_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_17, "testObject_ServiceProfilePage_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_18, "testObject_ServiceProfilePage_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_19, "testObject_ServiceProfilePage_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceProfilePage_provider.testObject_ServiceProfilePage_provider_20, "testObject_ServiceProfilePage_provider_20.json")], + testGroup "Golden: NewService_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_1, "testObject_NewService_provider_1.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_2, "testObject_NewService_provider_2.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_3, "testObject_NewService_provider_3.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_4, "testObject_NewService_provider_4.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_5, "testObject_NewService_provider_5.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_6, "testObject_NewService_provider_6.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_7, "testObject_NewService_provider_7.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_8, "testObject_NewService_provider_8.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_9, "testObject_NewService_provider_9.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_10, "testObject_NewService_provider_10.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_11, "testObject_NewService_provider_11.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_12, "testObject_NewService_provider_12.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_13, "testObject_NewService_provider_13.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_14, "testObject_NewService_provider_14.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_15, "testObject_NewService_provider_15.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_16, "testObject_NewService_provider_16.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_17, "testObject_NewService_provider_17.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_18, "testObject_NewService_provider_18.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_19, "testObject_NewService_provider_19.json"), (Test.Wire.API.Golden.Generated.NewService_provider.testObject_NewService_provider_20, "testObject_NewService_provider_20.json")], + testGroup "Golden: NewServiceResponse_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_1, "testObject_NewServiceResponse_provider_1.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_2, "testObject_NewServiceResponse_provider_2.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_3, "testObject_NewServiceResponse_provider_3.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_4, "testObject_NewServiceResponse_provider_4.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_5, "testObject_NewServiceResponse_provider_5.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_6, "testObject_NewServiceResponse_provider_6.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_7, "testObject_NewServiceResponse_provider_7.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_8, "testObject_NewServiceResponse_provider_8.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_9, "testObject_NewServiceResponse_provider_9.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_10, "testObject_NewServiceResponse_provider_10.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_11, "testObject_NewServiceResponse_provider_11.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_12, "testObject_NewServiceResponse_provider_12.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_13, "testObject_NewServiceResponse_provider_13.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_14, "testObject_NewServiceResponse_provider_14.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_15, "testObject_NewServiceResponse_provider_15.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_16, "testObject_NewServiceResponse_provider_16.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_17, "testObject_NewServiceResponse_provider_17.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_18, "testObject_NewServiceResponse_provider_18.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_19, "testObject_NewServiceResponse_provider_19.json"), (Test.Wire.API.Golden.Generated.NewServiceResponse_provider.testObject_NewServiceResponse_provider_20, "testObject_NewServiceResponse_provider_20.json")], + testGroup "Golden: UpdateService_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_1, "testObject_UpdateService_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_2, "testObject_UpdateService_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_3, "testObject_UpdateService_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_4, "testObject_UpdateService_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_5, "testObject_UpdateService_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_6, "testObject_UpdateService_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_7, "testObject_UpdateService_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_8, "testObject_UpdateService_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_9, "testObject_UpdateService_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_10, "testObject_UpdateService_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_11, "testObject_UpdateService_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_12, "testObject_UpdateService_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_13, "testObject_UpdateService_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_14, "testObject_UpdateService_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_15, "testObject_UpdateService_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_16, "testObject_UpdateService_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_17, "testObject_UpdateService_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_18, "testObject_UpdateService_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_19, "testObject_UpdateService_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateService_provider.testObject_UpdateService_provider_20, "testObject_UpdateService_provider_20.json")], + testGroup "Golden: UpdateServiceConn_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_1, "testObject_UpdateServiceConn_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_2, "testObject_UpdateServiceConn_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_3, "testObject_UpdateServiceConn_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_4, "testObject_UpdateServiceConn_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_5, "testObject_UpdateServiceConn_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_6, "testObject_UpdateServiceConn_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_7, "testObject_UpdateServiceConn_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_8, "testObject_UpdateServiceConn_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_9, "testObject_UpdateServiceConn_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_10, "testObject_UpdateServiceConn_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_11, "testObject_UpdateServiceConn_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_12, "testObject_UpdateServiceConn_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_13, "testObject_UpdateServiceConn_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_14, "testObject_UpdateServiceConn_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_15, "testObject_UpdateServiceConn_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_16, "testObject_UpdateServiceConn_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_17, "testObject_UpdateServiceConn_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_18, "testObject_UpdateServiceConn_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_19, "testObject_UpdateServiceConn_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateServiceConn_provider.testObject_UpdateServiceConn_provider_20, "testObject_UpdateServiceConn_provider_20.json")], + testGroup "Golden: DeleteService_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_1, "testObject_DeleteService_provider_1.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_2, "testObject_DeleteService_provider_2.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_3, "testObject_DeleteService_provider_3.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_4, "testObject_DeleteService_provider_4.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_5, "testObject_DeleteService_provider_5.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_6, "testObject_DeleteService_provider_6.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_7, "testObject_DeleteService_provider_7.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_8, "testObject_DeleteService_provider_8.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_9, "testObject_DeleteService_provider_9.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_10, "testObject_DeleteService_provider_10.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_11, "testObject_DeleteService_provider_11.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_12, "testObject_DeleteService_provider_12.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_13, "testObject_DeleteService_provider_13.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_14, "testObject_DeleteService_provider_14.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_15, "testObject_DeleteService_provider_15.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_16, "testObject_DeleteService_provider_16.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_17, "testObject_DeleteService_provider_17.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_18, "testObject_DeleteService_provider_18.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_19, "testObject_DeleteService_provider_19.json"), (Test.Wire.API.Golden.Generated.DeleteService_provider.testObject_DeleteService_provider_20, "testObject_DeleteService_provider_20.json")], + testGroup "Golden: UpdateServiceWhitelist_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_1, "testObject_UpdateServiceWhitelist_provider_1.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_2, "testObject_UpdateServiceWhitelist_provider_2.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_3, "testObject_UpdateServiceWhitelist_provider_3.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_4, "testObject_UpdateServiceWhitelist_provider_4.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_5, "testObject_UpdateServiceWhitelist_provider_5.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_6, "testObject_UpdateServiceWhitelist_provider_6.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_7, "testObject_UpdateServiceWhitelist_provider_7.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_8, "testObject_UpdateServiceWhitelist_provider_8.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_9, "testObject_UpdateServiceWhitelist_provider_9.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_10, "testObject_UpdateServiceWhitelist_provider_10.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_11, "testObject_UpdateServiceWhitelist_provider_11.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_12, "testObject_UpdateServiceWhitelist_provider_12.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_13, "testObject_UpdateServiceWhitelist_provider_13.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_14, "testObject_UpdateServiceWhitelist_provider_14.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_15, "testObject_UpdateServiceWhitelist_provider_15.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_16, "testObject_UpdateServiceWhitelist_provider_16.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_17, "testObject_UpdateServiceWhitelist_provider_17.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_18, "testObject_UpdateServiceWhitelist_provider_18.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_19, "testObject_UpdateServiceWhitelist_provider_19.json"), (Test.Wire.API.Golden.Generated.UpdateServiceWhitelist_provider.testObject_UpdateServiceWhitelist_provider_20, "testObject_UpdateServiceWhitelist_provider_20.json")], + testGroup "Golden: ServiceTag_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_1, "testObject_ServiceTag_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_2, "testObject_ServiceTag_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_3, "testObject_ServiceTag_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_4, "testObject_ServiceTag_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_5, "testObject_ServiceTag_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_6, "testObject_ServiceTag_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_7, "testObject_ServiceTag_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_8, "testObject_ServiceTag_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_9, "testObject_ServiceTag_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_10, "testObject_ServiceTag_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_11, "testObject_ServiceTag_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_12, "testObject_ServiceTag_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_13, "testObject_ServiceTag_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_14, "testObject_ServiceTag_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_15, "testObject_ServiceTag_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_16, "testObject_ServiceTag_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_17, "testObject_ServiceTag_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_18, "testObject_ServiceTag_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_19, "testObject_ServiceTag_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceTag_provider.testObject_ServiceTag_provider_20, "testObject_ServiceTag_provider_20.json")], + testGroup "Golden: ServiceTagList_provider" + $ testObjects [(Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_1, "testObject_ServiceTagList_provider_1.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_2, "testObject_ServiceTagList_provider_2.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_3, "testObject_ServiceTagList_provider_3.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_4, "testObject_ServiceTagList_provider_4.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_5, "testObject_ServiceTagList_provider_5.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_6, "testObject_ServiceTagList_provider_6.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_7, "testObject_ServiceTagList_provider_7.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_8, "testObject_ServiceTagList_provider_8.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_9, "testObject_ServiceTagList_provider_9.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_10, "testObject_ServiceTagList_provider_10.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_11, "testObject_ServiceTagList_provider_11.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_12, "testObject_ServiceTagList_provider_12.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_13, "testObject_ServiceTagList_provider_13.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_14, "testObject_ServiceTagList_provider_14.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_15, "testObject_ServiceTagList_provider_15.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_16, "testObject_ServiceTagList_provider_16.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_17, "testObject_ServiceTagList_provider_17.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_18, "testObject_ServiceTagList_provider_18.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_19, "testObject_ServiceTagList_provider_19.json"), (Test.Wire.API.Golden.Generated.ServiceTagList_provider.testObject_ServiceTagList_provider_20, "testObject_ServiceTagList_provider_20.json")], + testGroup "Golden: BindingNewTeam_team" + $ testObjects [(Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_1, "testObject_BindingNewTeam_team_1.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_2, "testObject_BindingNewTeam_team_2.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_3, "testObject_BindingNewTeam_team_3.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_4, "testObject_BindingNewTeam_team_4.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_5, "testObject_BindingNewTeam_team_5.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_6, "testObject_BindingNewTeam_team_6.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_7, "testObject_BindingNewTeam_team_7.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_8, "testObject_BindingNewTeam_team_8.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_9, "testObject_BindingNewTeam_team_9.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_10, "testObject_BindingNewTeam_team_10.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_11, "testObject_BindingNewTeam_team_11.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_12, "testObject_BindingNewTeam_team_12.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_13, "testObject_BindingNewTeam_team_13.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_14, "testObject_BindingNewTeam_team_14.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_15, "testObject_BindingNewTeam_team_15.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_16, "testObject_BindingNewTeam_team_16.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_17, "testObject_BindingNewTeam_team_17.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_18, "testObject_BindingNewTeam_team_18.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_19, "testObject_BindingNewTeam_team_19.json"), (Test.Wire.API.Golden.Generated.BindingNewTeam_team.testObject_BindingNewTeam_team_20, "testObject_BindingNewTeam_team_20.json")], + testGroup "Golden: TeamBinding_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_1, "testObject_TeamBinding_team_1.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_2, "testObject_TeamBinding_team_2.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_3, "testObject_TeamBinding_team_3.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_4, "testObject_TeamBinding_team_4.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_5, "testObject_TeamBinding_team_5.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_6, "testObject_TeamBinding_team_6.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_7, "testObject_TeamBinding_team_7.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_8, "testObject_TeamBinding_team_8.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_9, "testObject_TeamBinding_team_9.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_10, "testObject_TeamBinding_team_10.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_11, "testObject_TeamBinding_team_11.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_12, "testObject_TeamBinding_team_12.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_13, "testObject_TeamBinding_team_13.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_14, "testObject_TeamBinding_team_14.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_15, "testObject_TeamBinding_team_15.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_16, "testObject_TeamBinding_team_16.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_17, "testObject_TeamBinding_team_17.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_18, "testObject_TeamBinding_team_18.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_19, "testObject_TeamBinding_team_19.json"), (Test.Wire.API.Golden.Generated.TeamBinding_team.testObject_TeamBinding_team_20, "testObject_TeamBinding_team_20.json")], + testGroup "Golden: Team_team" + $ testObjects [(Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_1, "testObject_Team_team_1.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_2, "testObject_Team_team_2.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_3, "testObject_Team_team_3.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_4, "testObject_Team_team_4.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_5, "testObject_Team_team_5.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_6, "testObject_Team_team_6.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_7, "testObject_Team_team_7.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_8, "testObject_Team_team_8.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_9, "testObject_Team_team_9.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_10, "testObject_Team_team_10.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_11, "testObject_Team_team_11.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_12, "testObject_Team_team_12.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_13, "testObject_Team_team_13.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_14, "testObject_Team_team_14.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_15, "testObject_Team_team_15.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_16, "testObject_Team_team_16.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_17, "testObject_Team_team_17.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_18, "testObject_Team_team_18.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_19, "testObject_Team_team_19.json"), (Test.Wire.API.Golden.Generated.Team_team.testObject_Team_team_20, "testObject_Team_team_20.json")], + testGroup "Golden: TeamList_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_1, "testObject_TeamList_team_1.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_2, "testObject_TeamList_team_2.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_3, "testObject_TeamList_team_3.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_4, "testObject_TeamList_team_4.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_5, "testObject_TeamList_team_5.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_6, "testObject_TeamList_team_6.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_7, "testObject_TeamList_team_7.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_8, "testObject_TeamList_team_8.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_9, "testObject_TeamList_team_9.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_10, "testObject_TeamList_team_10.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_11, "testObject_TeamList_team_11.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_12, "testObject_TeamList_team_12.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_13, "testObject_TeamList_team_13.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_14, "testObject_TeamList_team_14.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_15, "testObject_TeamList_team_15.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_16, "testObject_TeamList_team_16.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_17, "testObject_TeamList_team_17.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_18, "testObject_TeamList_team_18.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_19, "testObject_TeamList_team_19.json"), (Test.Wire.API.Golden.Generated.TeamList_team.testObject_TeamList_team_20, "testObject_TeamList_team_20.json")], + testGroup "Golden: TeamUpdateData_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_1, "testObject_TeamUpdateData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_2, "testObject_TeamUpdateData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_3, "testObject_TeamUpdateData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_4, "testObject_TeamUpdateData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_5, "testObject_TeamUpdateData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_6, "testObject_TeamUpdateData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_7, "testObject_TeamUpdateData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_8, "testObject_TeamUpdateData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_9, "testObject_TeamUpdateData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_10, "testObject_TeamUpdateData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_11, "testObject_TeamUpdateData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_12, "testObject_TeamUpdateData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_13, "testObject_TeamUpdateData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_14, "testObject_TeamUpdateData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_15, "testObject_TeamUpdateData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_16, "testObject_TeamUpdateData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_17, "testObject_TeamUpdateData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_18, "testObject_TeamUpdateData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_19, "testObject_TeamUpdateData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamUpdateData_team.testObject_TeamUpdateData_team_20, "testObject_TeamUpdateData_team_20.json")], + testGroup "Golden: TeamDeleteData_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_1, "testObject_TeamDeleteData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_2, "testObject_TeamDeleteData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_3, "testObject_TeamDeleteData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_4, "testObject_TeamDeleteData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_5, "testObject_TeamDeleteData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_6, "testObject_TeamDeleteData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_7, "testObject_TeamDeleteData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_8, "testObject_TeamDeleteData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_9, "testObject_TeamDeleteData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_10, "testObject_TeamDeleteData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_11, "testObject_TeamDeleteData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_12, "testObject_TeamDeleteData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_13, "testObject_TeamDeleteData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_14, "testObject_TeamDeleteData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_15, "testObject_TeamDeleteData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_16, "testObject_TeamDeleteData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_17, "testObject_TeamDeleteData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_18, "testObject_TeamDeleteData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_19, "testObject_TeamDeleteData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamDeleteData_team.testObject_TeamDeleteData_team_20, "testObject_TeamDeleteData_team_20.json")], + testGroup "Golden: TeamConversation_team" + $ testObjects [ ( Test.Wire.API.Golden.Generated.TeamConversation_team.testObject_TeamConversation_team_1, "testObject_TeamConversation_team_1.json" ), @@ -1184,8 +1184,8 @@ tests = "testObject_TeamConversation_team_2.json" ) ], - testGroup "Golden: TeamConversationList_team" $ - testObjects + testGroup "Golden: TeamConversationList_team" + $ testObjects [ ( Test.Wire.API.Golden.Generated.TeamConversationList_team.testObject_TeamConversationList_team_1, "testObject_TeamConversationList_team_1.json" ), @@ -1193,159 +1193,159 @@ tests = "testObject_TeamConversationList_team_2.json" ) ], - testGroup "Golden: WithStatusNoLock_team 1" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 1" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_1, "testObject_WithStatusNoLock_team_1.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_2, "testObject_WithStatusNoLock_team_2.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_3, "testObject_WithStatusNoLock_team_3.json") ], - testGroup "Golden: WithStatusNoLock_team 2" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 2" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_4, "testObject_WithStatusNoLock_team_4.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_5, "testObject_WithStatusNoLock_team_5.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_6, "testObject_WithStatusNoLock_team_6.json") ], - testGroup "Golden: WithStatusNoLock_team 3" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 3" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_7, "testObject_WithStatusNoLock_team_7.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_8, "testObject_WithStatusNoLock_team_8.json"), (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_9, "testObject_WithStatusNoLock_team_9.json") ], - testGroup "Golden: WithStatusNoLock_team 4" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 4" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_10, "testObject_WithStatusNoLock_team_10.json") ], - testGroup "Golden: WithStatusNoLock_team 5" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 5" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_11, "testObject_WithStatusNoLock_team_11.json") ], - testGroup "Golden: WithStatusNoLock_team 6" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 6" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_12, "testObject_WithStatusNoLock_team_12.json") ], - testGroup "Golden: WithStatusNoLock_team 7" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 7" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_13, "testObject_WithStatusNoLock_team_13.json") ], - testGroup "Golden: WithStatusNoLock_team 8" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 8" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_14, "testObject_WithStatusNoLock_team_14.json") ], - testGroup "Golden: WithStatusNoLock_team 9" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 9" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_15, "testObject_WithStatusNoLock_team_15.json") ], - testGroup "Golden: WithStatusNoLock_team 10" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 10" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_16, "testObject_WithStatusNoLock_team_16.json") ], - testGroup "Golden: WithStatusNoLock_team 11" $ - testObjects + testGroup "Golden: WithStatusNoLock_team 11" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatusNoLock_team.testObject_WithStatusNoLock_team_17, "testObject_WithStatusNoLock_team_17.json") ], - testGroup "Golden: WithStatus_team 1" $ - testObjects + testGroup "Golden: WithStatus_team 1" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_1, "testObject_WithStatus_team_1.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_2, "testObject_WithStatus_team_2.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_3, "testObject_WithStatus_team_3.json") ], - testGroup "Golden: WithStatus_team 2" $ - testObjects + testGroup "Golden: WithStatus_team 2" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_4, "testObject_WithStatus_team_4.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_5, "testObject_WithStatus_team_5.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_6, "testObject_WithStatus_team_6.json") ], - testGroup "Golden: WithStatus_team 3" $ - testObjects + testGroup "Golden: WithStatus_team 3" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_7, "testObject_WithStatus_team_7.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_8, "testObject_WithStatus_team_8.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_9, "testObject_WithStatus_team_9.json") ], - testGroup "Golden: WithStatus_team 4" $ - testObjects + testGroup "Golden: WithStatus_team 4" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_10, "testObject_WithStatus_team_10.json") ], - testGroup "Golden: WithStatus_team 5" $ - testObjects + testGroup "Golden: WithStatus_team 5" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_11, "testObject_WithStatus_team_11.json") ], - testGroup "Golden: WithStatus_team 6" $ - testObjects + testGroup "Golden: WithStatus_team 6" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_12, "testObject_WithStatus_team_12.json") ], - testGroup "Golden: WithStatus_team 7" $ - testObjects + testGroup "Golden: WithStatus_team 7" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_13, "testObject_WithStatus_team_13.json") ], - testGroup "Golden: WithStatus_team 8" $ - testObjects + testGroup "Golden: WithStatus_team 8" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_14, "testObject_WithStatus_team_14.json") ], - testGroup "Golden: WithStatus_team 9" $ - testObjects + testGroup "Golden: WithStatus_team 9" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_15, "testObject_WithStatus_team_15.json") ], - testGroup "Golden: WithStatus_team 10" $ - testObjects + testGroup "Golden: WithStatus_team 10" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_16, "testObject_WithStatus_team_16.json") ], - testGroup "Golden: WithStatus_team 11" $ - testObjects + testGroup "Golden: WithStatus_team 11" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_17, "testObject_WithStatus_team_17.json") ], - testGroup "Golden: WithStatus_team 12" $ - testObjects + testGroup "Golden: WithStatus_team 12" + $ testObjects [ (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_18, "testObject_WithStatus_team_18.json"), (Test.Wire.API.Golden.Generated.WithStatus_team.testObject_WithStatus_team_19, "testObject_WithStatus_team_19.json") ], - testGroup "Golden: InvitationRequest_team" $ - testObjects [(Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_1, "testObject_InvitationRequest_team_1.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_2, "testObject_InvitationRequest_team_2.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_3, "testObject_InvitationRequest_team_3.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_4, "testObject_InvitationRequest_team_4.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_5, "testObject_InvitationRequest_team_5.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_6, "testObject_InvitationRequest_team_6.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_7, "testObject_InvitationRequest_team_7.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_8, "testObject_InvitationRequest_team_8.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_9, "testObject_InvitationRequest_team_9.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_10, "testObject_InvitationRequest_team_10.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_11, "testObject_InvitationRequest_team_11.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_12, "testObject_InvitationRequest_team_12.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_13, "testObject_InvitationRequest_team_13.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_14, "testObject_InvitationRequest_team_14.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_15, "testObject_InvitationRequest_team_15.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_16, "testObject_InvitationRequest_team_16.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_17, "testObject_InvitationRequest_team_17.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_18, "testObject_InvitationRequest_team_18.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_19, "testObject_InvitationRequest_team_19.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_20, "testObject_InvitationRequest_team_20.json")], - testGroup "Golden: Invitation_team" $ - testObjects [(Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_1, "testObject_Invitation_team_1.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_2, "testObject_Invitation_team_2.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_3, "testObject_Invitation_team_3.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_4, "testObject_Invitation_team_4.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_5, "testObject_Invitation_team_5.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_6, "testObject_Invitation_team_6.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_7, "testObject_Invitation_team_7.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_8, "testObject_Invitation_team_8.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_9, "testObject_Invitation_team_9.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_10, "testObject_Invitation_team_10.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_11, "testObject_Invitation_team_11.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_12, "testObject_Invitation_team_12.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_13, "testObject_Invitation_team_13.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_14, "testObject_Invitation_team_14.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_15, "testObject_Invitation_team_15.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_16, "testObject_Invitation_team_16.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_17, "testObject_Invitation_team_17.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_18, "testObject_Invitation_team_18.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_19, "testObject_Invitation_team_19.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_20, "testObject_Invitation_team_20.json")], - testGroup "Golden: InvitationList_team" $ - testObjects [(Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_1, "testObject_InvitationList_team_1.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_2, "testObject_InvitationList_team_2.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_3, "testObject_InvitationList_team_3.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_4, "testObject_InvitationList_team_4.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_5, "testObject_InvitationList_team_5.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_6, "testObject_InvitationList_team_6.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_7, "testObject_InvitationList_team_7.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_8, "testObject_InvitationList_team_8.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_9, "testObject_InvitationList_team_9.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_10, "testObject_InvitationList_team_10.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_11, "testObject_InvitationList_team_11.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_12, "testObject_InvitationList_team_12.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_13, "testObject_InvitationList_team_13.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_14, "testObject_InvitationList_team_14.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_15, "testObject_InvitationList_team_15.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_16, "testObject_InvitationList_team_16.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_17, "testObject_InvitationList_team_17.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_18, "testObject_InvitationList_team_18.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_19, "testObject_InvitationList_team_19.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_20, "testObject_InvitationList_team_20.json")], - testGroup "Golden: NewLegalHoldService_team" $ - testObjects [(Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_1, "testObject_NewLegalHoldService_team_1.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_2, "testObject_NewLegalHoldService_team_2.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_3, "testObject_NewLegalHoldService_team_3.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_4, "testObject_NewLegalHoldService_team_4.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_5, "testObject_NewLegalHoldService_team_5.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_6, "testObject_NewLegalHoldService_team_6.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_7, "testObject_NewLegalHoldService_team_7.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_8, "testObject_NewLegalHoldService_team_8.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_9, "testObject_NewLegalHoldService_team_9.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_10, "testObject_NewLegalHoldService_team_10.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_11, "testObject_NewLegalHoldService_team_11.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_12, "testObject_NewLegalHoldService_team_12.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_13, "testObject_NewLegalHoldService_team_13.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_14, "testObject_NewLegalHoldService_team_14.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_15, "testObject_NewLegalHoldService_team_15.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_16, "testObject_NewLegalHoldService_team_16.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_17, "testObject_NewLegalHoldService_team_17.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_18, "testObject_NewLegalHoldService_team_18.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_19, "testObject_NewLegalHoldService_team_19.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_20, "testObject_NewLegalHoldService_team_20.json")], - testGroup "Golden: ViewLegalHoldServiceInfo_team" $ - testObjects [(Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_1, "testObject_ViewLegalHoldServiceInfo_team_1.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_2, "testObject_ViewLegalHoldServiceInfo_team_2.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_3, "testObject_ViewLegalHoldServiceInfo_team_3.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_4, "testObject_ViewLegalHoldServiceInfo_team_4.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_5, "testObject_ViewLegalHoldServiceInfo_team_5.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_6, "testObject_ViewLegalHoldServiceInfo_team_6.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_7, "testObject_ViewLegalHoldServiceInfo_team_7.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_8, "testObject_ViewLegalHoldServiceInfo_team_8.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_9, "testObject_ViewLegalHoldServiceInfo_team_9.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_10, "testObject_ViewLegalHoldServiceInfo_team_10.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_11, "testObject_ViewLegalHoldServiceInfo_team_11.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_12, "testObject_ViewLegalHoldServiceInfo_team_12.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_13, "testObject_ViewLegalHoldServiceInfo_team_13.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_14, "testObject_ViewLegalHoldServiceInfo_team_14.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_15, "testObject_ViewLegalHoldServiceInfo_team_15.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_16, "testObject_ViewLegalHoldServiceInfo_team_16.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_17, "testObject_ViewLegalHoldServiceInfo_team_17.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_18, "testObject_ViewLegalHoldServiceInfo_team_18.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_19, "testObject_ViewLegalHoldServiceInfo_team_19.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_20, "testObject_ViewLegalHoldServiceInfo_team_20.json")], - testGroup "Golden: ViewLegalHoldService_team" $ - testObjects [(Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_1, "testObject_ViewLegalHoldService_team_1.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_2, "testObject_ViewLegalHoldService_team_2.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_3, "testObject_ViewLegalHoldService_team_3.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_4, "testObject_ViewLegalHoldService_team_4.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_5, "testObject_ViewLegalHoldService_team_5.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_6, "testObject_ViewLegalHoldService_team_6.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_7, "testObject_ViewLegalHoldService_team_7.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_8, "testObject_ViewLegalHoldService_team_8.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_9, "testObject_ViewLegalHoldService_team_9.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_10, "testObject_ViewLegalHoldService_team_10.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_11, "testObject_ViewLegalHoldService_team_11.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_12, "testObject_ViewLegalHoldService_team_12.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_13, "testObject_ViewLegalHoldService_team_13.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_14, "testObject_ViewLegalHoldService_team_14.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_15, "testObject_ViewLegalHoldService_team_15.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_16, "testObject_ViewLegalHoldService_team_16.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_17, "testObject_ViewLegalHoldService_team_17.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_18, "testObject_ViewLegalHoldService_team_18.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_19, "testObject_ViewLegalHoldService_team_19.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_20, "testObject_ViewLegalHoldService_team_20.json")], - testGroup "Golden: UserLegalHoldStatusResponse_team" $ - testObjects [(Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_1, "testObject_UserLegalHoldStatusResponse_team_1.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_2, "testObject_UserLegalHoldStatusResponse_team_2.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_3, "testObject_UserLegalHoldStatusResponse_team_3.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_4, "testObject_UserLegalHoldStatusResponse_team_4.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_5, "testObject_UserLegalHoldStatusResponse_team_5.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_6, "testObject_UserLegalHoldStatusResponse_team_6.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_7, "testObject_UserLegalHoldStatusResponse_team_7.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_8, "testObject_UserLegalHoldStatusResponse_team_8.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_9, "testObject_UserLegalHoldStatusResponse_team_9.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_10, "testObject_UserLegalHoldStatusResponse_team_10.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_11, "testObject_UserLegalHoldStatusResponse_team_11.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_12, "testObject_UserLegalHoldStatusResponse_team_12.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_13, "testObject_UserLegalHoldStatusResponse_team_13.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_14, "testObject_UserLegalHoldStatusResponse_team_14.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_15, "testObject_UserLegalHoldStatusResponse_team_15.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_16, "testObject_UserLegalHoldStatusResponse_team_16.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_17, "testObject_UserLegalHoldStatusResponse_team_17.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_18, "testObject_UserLegalHoldStatusResponse_team_18.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_19, "testObject_UserLegalHoldStatusResponse_team_19.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_20, "testObject_UserLegalHoldStatusResponse_team_20.json")], - testGroup "Golden: RemoveLegalHoldSettingsRequest_team" $ - testObjects [(Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_1, "testObject_RemoveLegalHoldSettingsRequest_team_1.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_2, "testObject_RemoveLegalHoldSettingsRequest_team_2.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_3, "testObject_RemoveLegalHoldSettingsRequest_team_3.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_4, "testObject_RemoveLegalHoldSettingsRequest_team_4.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_5, "testObject_RemoveLegalHoldSettingsRequest_team_5.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_6, "testObject_RemoveLegalHoldSettingsRequest_team_6.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_7, "testObject_RemoveLegalHoldSettingsRequest_team_7.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_8, "testObject_RemoveLegalHoldSettingsRequest_team_8.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_9, "testObject_RemoveLegalHoldSettingsRequest_team_9.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_10, "testObject_RemoveLegalHoldSettingsRequest_team_10.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_11, "testObject_RemoveLegalHoldSettingsRequest_team_11.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_12, "testObject_RemoveLegalHoldSettingsRequest_team_12.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_13, "testObject_RemoveLegalHoldSettingsRequest_team_13.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_14, "testObject_RemoveLegalHoldSettingsRequest_team_14.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_15, "testObject_RemoveLegalHoldSettingsRequest_team_15.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_16, "testObject_RemoveLegalHoldSettingsRequest_team_16.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_17, "testObject_RemoveLegalHoldSettingsRequest_team_17.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_18, "testObject_RemoveLegalHoldSettingsRequest_team_18.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_19, "testObject_RemoveLegalHoldSettingsRequest_team_19.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_20, "testObject_RemoveLegalHoldSettingsRequest_team_20.json")], - testGroup "Golden: DisableLegalHoldForUserRequest_team" $ - testObjects [(Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_1, "testObject_DisableLegalHoldForUserRequest_team_1.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_2, "testObject_DisableLegalHoldForUserRequest_team_2.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_3, "testObject_DisableLegalHoldForUserRequest_team_3.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_4, "testObject_DisableLegalHoldForUserRequest_team_4.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_5, "testObject_DisableLegalHoldForUserRequest_team_5.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_6, "testObject_DisableLegalHoldForUserRequest_team_6.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_7, "testObject_DisableLegalHoldForUserRequest_team_7.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_8, "testObject_DisableLegalHoldForUserRequest_team_8.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_9, "testObject_DisableLegalHoldForUserRequest_team_9.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_10, "testObject_DisableLegalHoldForUserRequest_team_10.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_11, "testObject_DisableLegalHoldForUserRequest_team_11.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_12, "testObject_DisableLegalHoldForUserRequest_team_12.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_13, "testObject_DisableLegalHoldForUserRequest_team_13.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_14, "testObject_DisableLegalHoldForUserRequest_team_14.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_15, "testObject_DisableLegalHoldForUserRequest_team_15.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_16, "testObject_DisableLegalHoldForUserRequest_team_16.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_17, "testObject_DisableLegalHoldForUserRequest_team_17.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_18, "testObject_DisableLegalHoldForUserRequest_team_18.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_19, "testObject_DisableLegalHoldForUserRequest_team_19.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_20, "testObject_DisableLegalHoldForUserRequest_team_20.json")], - testGroup "Golden: ApproveLegalHoldForUserRequest_team" $ - testObjects [(Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_1, "testObject_ApproveLegalHoldForUserRequest_team_1.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_2, "testObject_ApproveLegalHoldForUserRequest_team_2.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_3, "testObject_ApproveLegalHoldForUserRequest_team_3.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_4, "testObject_ApproveLegalHoldForUserRequest_team_4.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_5, "testObject_ApproveLegalHoldForUserRequest_team_5.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_6, "testObject_ApproveLegalHoldForUserRequest_team_6.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_7, "testObject_ApproveLegalHoldForUserRequest_team_7.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_8, "testObject_ApproveLegalHoldForUserRequest_team_8.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_9, "testObject_ApproveLegalHoldForUserRequest_team_9.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_10, "testObject_ApproveLegalHoldForUserRequest_team_10.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_11, "testObject_ApproveLegalHoldForUserRequest_team_11.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_12, "testObject_ApproveLegalHoldForUserRequest_team_12.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_13, "testObject_ApproveLegalHoldForUserRequest_team_13.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_14, "testObject_ApproveLegalHoldForUserRequest_team_14.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_15, "testObject_ApproveLegalHoldForUserRequest_team_15.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_16, "testObject_ApproveLegalHoldForUserRequest_team_16.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_17, "testObject_ApproveLegalHoldForUserRequest_team_17.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_18, "testObject_ApproveLegalHoldForUserRequest_team_18.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_19, "testObject_ApproveLegalHoldForUserRequest_team_19.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_20, "testObject_ApproveLegalHoldForUserRequest_team_20.json")], - testGroup "Golden: RequestNewLegalHoldClient_team" $ - testObjects [(Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_1, "testObject_RequestNewLegalHoldClient_team_1.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_2, "testObject_RequestNewLegalHoldClient_team_2.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_3, "testObject_RequestNewLegalHoldClient_team_3.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_4, "testObject_RequestNewLegalHoldClient_team_4.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_5, "testObject_RequestNewLegalHoldClient_team_5.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_6, "testObject_RequestNewLegalHoldClient_team_6.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_7, "testObject_RequestNewLegalHoldClient_team_7.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_8, "testObject_RequestNewLegalHoldClient_team_8.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_9, "testObject_RequestNewLegalHoldClient_team_9.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_10, "testObject_RequestNewLegalHoldClient_team_10.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_11, "testObject_RequestNewLegalHoldClient_team_11.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_12, "testObject_RequestNewLegalHoldClient_team_12.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_13, "testObject_RequestNewLegalHoldClient_team_13.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_14, "testObject_RequestNewLegalHoldClient_team_14.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_15, "testObject_RequestNewLegalHoldClient_team_15.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_16, "testObject_RequestNewLegalHoldClient_team_16.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_17, "testObject_RequestNewLegalHoldClient_team_17.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_18, "testObject_RequestNewLegalHoldClient_team_18.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_19, "testObject_RequestNewLegalHoldClient_team_19.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_20, "testObject_RequestNewLegalHoldClient_team_20.json")], - testGroup "Golden: NewLegalHoldClient_team" $ - testObjects [(Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_1, "testObject_NewLegalHoldClient_team_1.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_2, "testObject_NewLegalHoldClient_team_2.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_3, "testObject_NewLegalHoldClient_team_3.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_4, "testObject_NewLegalHoldClient_team_4.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_5, "testObject_NewLegalHoldClient_team_5.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_6, "testObject_NewLegalHoldClient_team_6.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_7, "testObject_NewLegalHoldClient_team_7.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_8, "testObject_NewLegalHoldClient_team_8.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_9, "testObject_NewLegalHoldClient_team_9.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_10, "testObject_NewLegalHoldClient_team_10.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_11, "testObject_NewLegalHoldClient_team_11.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_12, "testObject_NewLegalHoldClient_team_12.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_13, "testObject_NewLegalHoldClient_team_13.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_14, "testObject_NewLegalHoldClient_team_14.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_15, "testObject_NewLegalHoldClient_team_15.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_16, "testObject_NewLegalHoldClient_team_16.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_17, "testObject_NewLegalHoldClient_team_17.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_18, "testObject_NewLegalHoldClient_team_18.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_19, "testObject_NewLegalHoldClient_team_19.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_20, "testObject_NewLegalHoldClient_team_20.json")], - testGroup "Golden: LegalHoldServiceConfirm_team" $ - testObjects [(Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_1, "testObject_LegalHoldServiceConfirm_team_1.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_2, "testObject_LegalHoldServiceConfirm_team_2.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_3, "testObject_LegalHoldServiceConfirm_team_3.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_4, "testObject_LegalHoldServiceConfirm_team_4.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_5, "testObject_LegalHoldServiceConfirm_team_5.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_6, "testObject_LegalHoldServiceConfirm_team_6.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_7, "testObject_LegalHoldServiceConfirm_team_7.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_8, "testObject_LegalHoldServiceConfirm_team_8.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_9, "testObject_LegalHoldServiceConfirm_team_9.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_10, "testObject_LegalHoldServiceConfirm_team_10.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_11, "testObject_LegalHoldServiceConfirm_team_11.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_12, "testObject_LegalHoldServiceConfirm_team_12.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_13, "testObject_LegalHoldServiceConfirm_team_13.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_14, "testObject_LegalHoldServiceConfirm_team_14.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_15, "testObject_LegalHoldServiceConfirm_team_15.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_16, "testObject_LegalHoldServiceConfirm_team_16.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_17, "testObject_LegalHoldServiceConfirm_team_17.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_18, "testObject_LegalHoldServiceConfirm_team_18.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_19, "testObject_LegalHoldServiceConfirm_team_19.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_20, "testObject_LegalHoldServiceConfirm_team_20.json")], - testGroup "Golden: LegalHoldServiceRemove_team" $ - testObjects [(Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_1, "testObject_LegalHoldServiceRemove_team_1.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_2, "testObject_LegalHoldServiceRemove_team_2.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_3, "testObject_LegalHoldServiceRemove_team_3.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_4, "testObject_LegalHoldServiceRemove_team_4.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_5, "testObject_LegalHoldServiceRemove_team_5.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_6, "testObject_LegalHoldServiceRemove_team_6.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_7, "testObject_LegalHoldServiceRemove_team_7.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_8, "testObject_LegalHoldServiceRemove_team_8.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_9, "testObject_LegalHoldServiceRemove_team_9.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_10, "testObject_LegalHoldServiceRemove_team_10.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_11, "testObject_LegalHoldServiceRemove_team_11.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_12, "testObject_LegalHoldServiceRemove_team_12.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_13, "testObject_LegalHoldServiceRemove_team_13.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_14, "testObject_LegalHoldServiceRemove_team_14.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_15, "testObject_LegalHoldServiceRemove_team_15.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_16, "testObject_LegalHoldServiceRemove_team_16.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_17, "testObject_LegalHoldServiceRemove_team_17.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_18, "testObject_LegalHoldServiceRemove_team_18.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_19, "testObject_LegalHoldServiceRemove_team_19.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_20, "testObject_LegalHoldServiceRemove_team_20.json")], - testGroup "Golden: TeamMember_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_1, "testObject_TeamMember_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_2, "testObject_TeamMember_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_3, "testObject_TeamMember_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_4, "testObject_TeamMember_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_5, "testObject_TeamMember_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_6, "testObject_TeamMember_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_7, "testObject_TeamMember_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_8, "testObject_TeamMember_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_9, "testObject_TeamMember_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_10, "testObject_TeamMember_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_11, "testObject_TeamMember_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_12, "testObject_TeamMember_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_13, "testObject_TeamMember_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_14, "testObject_TeamMember_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_15, "testObject_TeamMember_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_16, "testObject_TeamMember_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_17, "testObject_TeamMember_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_18, "testObject_TeamMember_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_19, "testObject_TeamMember_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_20, "testObject_TeamMember_team_20.json")], - testGroup "Golden: ListType_team" $ - testObjects [(Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_1, "testObject_ListType_team_1.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_2, "testObject_ListType_team_2.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_3, "testObject_ListType_team_3.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_4, "testObject_ListType_team_4.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_5, "testObject_ListType_team_5.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_6, "testObject_ListType_team_6.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_7, "testObject_ListType_team_7.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_8, "testObject_ListType_team_8.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_9, "testObject_ListType_team_9.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_10, "testObject_ListType_team_10.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_11, "testObject_ListType_team_11.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_12, "testObject_ListType_team_12.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_13, "testObject_ListType_team_13.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_14, "testObject_ListType_team_14.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_15, "testObject_ListType_team_15.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_16, "testObject_ListType_team_16.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_17, "testObject_ListType_team_17.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_18, "testObject_ListType_team_18.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_19, "testObject_ListType_team_19.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_20, "testObject_ListType_team_20.json")], - testGroup "Golden: TeamMemberList_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_1, "testObject_TeamMemberList_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_2, "testObject_TeamMemberList_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_3, "testObject_TeamMemberList_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_4, "testObject_TeamMemberList_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_5, "testObject_TeamMemberList_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_6, "testObject_TeamMemberList_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_7, "testObject_TeamMemberList_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_8, "testObject_TeamMemberList_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_9, "testObject_TeamMemberList_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_10, "testObject_TeamMemberList_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_11, "testObject_TeamMemberList_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_12, "testObject_TeamMemberList_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_13, "testObject_TeamMemberList_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_14, "testObject_TeamMemberList_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_15, "testObject_TeamMemberList_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_16, "testObject_TeamMemberList_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_17, "testObject_TeamMemberList_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_18, "testObject_TeamMemberList_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_19, "testObject_TeamMemberList_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_20, "testObject_TeamMemberList_team_20.json")], - testGroup "Golden: NewTeamMember_team" $ - testObjects [(Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_1, "testObject_NewTeamMember_team_1.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_2, "testObject_NewTeamMember_team_2.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_3, "testObject_NewTeamMember_team_3.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_4, "testObject_NewTeamMember_team_4.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_5, "testObject_NewTeamMember_team_5.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_6, "testObject_NewTeamMember_team_6.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_7, "testObject_NewTeamMember_team_7.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_8, "testObject_NewTeamMember_team_8.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_9, "testObject_NewTeamMember_team_9.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_10, "testObject_NewTeamMember_team_10.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_11, "testObject_NewTeamMember_team_11.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_12, "testObject_NewTeamMember_team_12.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_13, "testObject_NewTeamMember_team_13.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_14, "testObject_NewTeamMember_team_14.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_15, "testObject_NewTeamMember_team_15.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_16, "testObject_NewTeamMember_team_16.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_17, "testObject_NewTeamMember_team_17.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_18, "testObject_NewTeamMember_team_18.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_19, "testObject_NewTeamMember_team_19.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_20, "testObject_NewTeamMember_team_20.json")], - testGroup "Golden: TeamMemberDeleteData_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_1, "testObject_TeamMemberDeleteData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_2, "testObject_TeamMemberDeleteData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_3, "testObject_TeamMemberDeleteData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_4, "testObject_TeamMemberDeleteData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_5, "testObject_TeamMemberDeleteData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_6, "testObject_TeamMemberDeleteData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_7, "testObject_TeamMemberDeleteData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_8, "testObject_TeamMemberDeleteData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_9, "testObject_TeamMemberDeleteData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_10, "testObject_TeamMemberDeleteData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_11, "testObject_TeamMemberDeleteData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_12, "testObject_TeamMemberDeleteData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_13, "testObject_TeamMemberDeleteData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_14, "testObject_TeamMemberDeleteData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_15, "testObject_TeamMemberDeleteData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_16, "testObject_TeamMemberDeleteData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_17, "testObject_TeamMemberDeleteData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_18, "testObject_TeamMemberDeleteData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_19, "testObject_TeamMemberDeleteData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_20, "testObject_TeamMemberDeleteData_team_20.json")], - testGroup "Golden: Permissions_team" $ - testObjects [(Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_1, "testObject_Permissions_team_1.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_2, "testObject_Permissions_team_2.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_3, "testObject_Permissions_team_3.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_4, "testObject_Permissions_team_4.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_5, "testObject_Permissions_team_5.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_6, "testObject_Permissions_team_6.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_7, "testObject_Permissions_team_7.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_8, "testObject_Permissions_team_8.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_9, "testObject_Permissions_team_9.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_10, "testObject_Permissions_team_10.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_11, "testObject_Permissions_team_11.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_12, "testObject_Permissions_team_12.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_13, "testObject_Permissions_team_13.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_14, "testObject_Permissions_team_14.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_15, "testObject_Permissions_team_15.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_16, "testObject_Permissions_team_16.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_17, "testObject_Permissions_team_17.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_18, "testObject_Permissions_team_18.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_19, "testObject_Permissions_team_19.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_20, "testObject_Permissions_team_20.json")], - testGroup "Golden: Role_team" $ - testObjects [(Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_1, "testObject_Role_team_1.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_2, "testObject_Role_team_2.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_3, "testObject_Role_team_3.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_4, "testObject_Role_team_4.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_5, "testObject_Role_team_5.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_6, "testObject_Role_team_6.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_7, "testObject_Role_team_7.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_8, "testObject_Role_team_8.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_9, "testObject_Role_team_9.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_10, "testObject_Role_team_10.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_11, "testObject_Role_team_11.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_12, "testObject_Role_team_12.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_13, "testObject_Role_team_13.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_14, "testObject_Role_team_14.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_15, "testObject_Role_team_15.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_16, "testObject_Role_team_16.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_17, "testObject_Role_team_17.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_18, "testObject_Role_team_18.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_19, "testObject_Role_team_19.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_20, "testObject_Role_team_20.json")], - testGroup "Golden: TeamSearchVisibility_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_1, "testObject_TeamSearchVisibility_team_1.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_2, "testObject_TeamSearchVisibility_team_2.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_3, "testObject_TeamSearchVisibility_team_3.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_4, "testObject_TeamSearchVisibility_team_4.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_5, "testObject_TeamSearchVisibility_team_5.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_6, "testObject_TeamSearchVisibility_team_6.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_7, "testObject_TeamSearchVisibility_team_7.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_8, "testObject_TeamSearchVisibility_team_8.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_9, "testObject_TeamSearchVisibility_team_9.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_10, "testObject_TeamSearchVisibility_team_10.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_11, "testObject_TeamSearchVisibility_team_11.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_12, "testObject_TeamSearchVisibility_team_12.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_13, "testObject_TeamSearchVisibility_team_13.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_14, "testObject_TeamSearchVisibility_team_14.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_15, "testObject_TeamSearchVisibility_team_15.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_16, "testObject_TeamSearchVisibility_team_16.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_17, "testObject_TeamSearchVisibility_team_17.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_18, "testObject_TeamSearchVisibility_team_18.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_19, "testObject_TeamSearchVisibility_team_19.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_20, "testObject_TeamSearchVisibility_team_20.json")], - testGroup "Golden: TeamSearchVisibilityView_team" $ - testObjects [(Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_1, "testObject_TeamSearchVisibilityView_team_1.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_2, "testObject_TeamSearchVisibilityView_team_2.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_3, "testObject_TeamSearchVisibilityView_team_3.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_4, "testObject_TeamSearchVisibilityView_team_4.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_5, "testObject_TeamSearchVisibilityView_team_5.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_6, "testObject_TeamSearchVisibilityView_team_6.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_7, "testObject_TeamSearchVisibilityView_team_7.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_8, "testObject_TeamSearchVisibilityView_team_8.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_9, "testObject_TeamSearchVisibilityView_team_9.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_10, "testObject_TeamSearchVisibilityView_team_10.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_11, "testObject_TeamSearchVisibilityView_team_11.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_12, "testObject_TeamSearchVisibilityView_team_12.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_13, "testObject_TeamSearchVisibilityView_team_13.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_14, "testObject_TeamSearchVisibilityView_team_14.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_15, "testObject_TeamSearchVisibilityView_team_15.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_16, "testObject_TeamSearchVisibilityView_team_16.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_17, "testObject_TeamSearchVisibilityView_team_17.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_18, "testObject_TeamSearchVisibilityView_team_18.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_19, "testObject_TeamSearchVisibilityView_team_19.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_20, "testObject_TeamSearchVisibilityView_team_20.json")], - testGroup "Golden: VerificationAction_user" $ - testObjects + testGroup "Golden: InvitationRequest_team" + $ testObjects [(Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_1, "testObject_InvitationRequest_team_1.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_2, "testObject_InvitationRequest_team_2.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_3, "testObject_InvitationRequest_team_3.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_4, "testObject_InvitationRequest_team_4.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_5, "testObject_InvitationRequest_team_5.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_6, "testObject_InvitationRequest_team_6.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_7, "testObject_InvitationRequest_team_7.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_8, "testObject_InvitationRequest_team_8.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_9, "testObject_InvitationRequest_team_9.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_10, "testObject_InvitationRequest_team_10.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_11, "testObject_InvitationRequest_team_11.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_12, "testObject_InvitationRequest_team_12.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_13, "testObject_InvitationRequest_team_13.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_14, "testObject_InvitationRequest_team_14.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_15, "testObject_InvitationRequest_team_15.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_16, "testObject_InvitationRequest_team_16.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_17, "testObject_InvitationRequest_team_17.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_18, "testObject_InvitationRequest_team_18.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_19, "testObject_InvitationRequest_team_19.json"), (Test.Wire.API.Golden.Generated.InvitationRequest_team.testObject_InvitationRequest_team_20, "testObject_InvitationRequest_team_20.json")], + testGroup "Golden: Invitation_team" + $ testObjects [(Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_1, "testObject_Invitation_team_1.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_2, "testObject_Invitation_team_2.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_3, "testObject_Invitation_team_3.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_4, "testObject_Invitation_team_4.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_5, "testObject_Invitation_team_5.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_6, "testObject_Invitation_team_6.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_7, "testObject_Invitation_team_7.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_8, "testObject_Invitation_team_8.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_9, "testObject_Invitation_team_9.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_10, "testObject_Invitation_team_10.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_11, "testObject_Invitation_team_11.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_12, "testObject_Invitation_team_12.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_13, "testObject_Invitation_team_13.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_14, "testObject_Invitation_team_14.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_15, "testObject_Invitation_team_15.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_16, "testObject_Invitation_team_16.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_17, "testObject_Invitation_team_17.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_18, "testObject_Invitation_team_18.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_19, "testObject_Invitation_team_19.json"), (Test.Wire.API.Golden.Generated.Invitation_team.testObject_Invitation_team_20, "testObject_Invitation_team_20.json")], + testGroup "Golden: InvitationList_team" + $ testObjects [(Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_1, "testObject_InvitationList_team_1.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_2, "testObject_InvitationList_team_2.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_3, "testObject_InvitationList_team_3.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_4, "testObject_InvitationList_team_4.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_5, "testObject_InvitationList_team_5.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_6, "testObject_InvitationList_team_6.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_7, "testObject_InvitationList_team_7.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_8, "testObject_InvitationList_team_8.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_9, "testObject_InvitationList_team_9.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_10, "testObject_InvitationList_team_10.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_11, "testObject_InvitationList_team_11.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_12, "testObject_InvitationList_team_12.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_13, "testObject_InvitationList_team_13.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_14, "testObject_InvitationList_team_14.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_15, "testObject_InvitationList_team_15.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_16, "testObject_InvitationList_team_16.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_17, "testObject_InvitationList_team_17.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_18, "testObject_InvitationList_team_18.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_19, "testObject_InvitationList_team_19.json"), (Test.Wire.API.Golden.Generated.InvitationList_team.testObject_InvitationList_team_20, "testObject_InvitationList_team_20.json")], + testGroup "Golden: NewLegalHoldService_team" + $ testObjects [(Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_1, "testObject_NewLegalHoldService_team_1.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_2, "testObject_NewLegalHoldService_team_2.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_3, "testObject_NewLegalHoldService_team_3.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_4, "testObject_NewLegalHoldService_team_4.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_5, "testObject_NewLegalHoldService_team_5.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_6, "testObject_NewLegalHoldService_team_6.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_7, "testObject_NewLegalHoldService_team_7.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_8, "testObject_NewLegalHoldService_team_8.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_9, "testObject_NewLegalHoldService_team_9.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_10, "testObject_NewLegalHoldService_team_10.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_11, "testObject_NewLegalHoldService_team_11.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_12, "testObject_NewLegalHoldService_team_12.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_13, "testObject_NewLegalHoldService_team_13.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_14, "testObject_NewLegalHoldService_team_14.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_15, "testObject_NewLegalHoldService_team_15.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_16, "testObject_NewLegalHoldService_team_16.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_17, "testObject_NewLegalHoldService_team_17.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_18, "testObject_NewLegalHoldService_team_18.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_19, "testObject_NewLegalHoldService_team_19.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldService_team.testObject_NewLegalHoldService_team_20, "testObject_NewLegalHoldService_team_20.json")], + testGroup "Golden: ViewLegalHoldServiceInfo_team" + $ testObjects [(Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_1, "testObject_ViewLegalHoldServiceInfo_team_1.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_2, "testObject_ViewLegalHoldServiceInfo_team_2.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_3, "testObject_ViewLegalHoldServiceInfo_team_3.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_4, "testObject_ViewLegalHoldServiceInfo_team_4.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_5, "testObject_ViewLegalHoldServiceInfo_team_5.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_6, "testObject_ViewLegalHoldServiceInfo_team_6.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_7, "testObject_ViewLegalHoldServiceInfo_team_7.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_8, "testObject_ViewLegalHoldServiceInfo_team_8.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_9, "testObject_ViewLegalHoldServiceInfo_team_9.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_10, "testObject_ViewLegalHoldServiceInfo_team_10.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_11, "testObject_ViewLegalHoldServiceInfo_team_11.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_12, "testObject_ViewLegalHoldServiceInfo_team_12.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_13, "testObject_ViewLegalHoldServiceInfo_team_13.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_14, "testObject_ViewLegalHoldServiceInfo_team_14.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_15, "testObject_ViewLegalHoldServiceInfo_team_15.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_16, "testObject_ViewLegalHoldServiceInfo_team_16.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_17, "testObject_ViewLegalHoldServiceInfo_team_17.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_18, "testObject_ViewLegalHoldServiceInfo_team_18.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_19, "testObject_ViewLegalHoldServiceInfo_team_19.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldServiceInfo_team.testObject_ViewLegalHoldServiceInfo_team_20, "testObject_ViewLegalHoldServiceInfo_team_20.json")], + testGroup "Golden: ViewLegalHoldService_team" + $ testObjects [(Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_1, "testObject_ViewLegalHoldService_team_1.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_2, "testObject_ViewLegalHoldService_team_2.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_3, "testObject_ViewLegalHoldService_team_3.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_4, "testObject_ViewLegalHoldService_team_4.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_5, "testObject_ViewLegalHoldService_team_5.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_6, "testObject_ViewLegalHoldService_team_6.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_7, "testObject_ViewLegalHoldService_team_7.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_8, "testObject_ViewLegalHoldService_team_8.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_9, "testObject_ViewLegalHoldService_team_9.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_10, "testObject_ViewLegalHoldService_team_10.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_11, "testObject_ViewLegalHoldService_team_11.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_12, "testObject_ViewLegalHoldService_team_12.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_13, "testObject_ViewLegalHoldService_team_13.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_14, "testObject_ViewLegalHoldService_team_14.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_15, "testObject_ViewLegalHoldService_team_15.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_16, "testObject_ViewLegalHoldService_team_16.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_17, "testObject_ViewLegalHoldService_team_17.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_18, "testObject_ViewLegalHoldService_team_18.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_19, "testObject_ViewLegalHoldService_team_19.json"), (Test.Wire.API.Golden.Generated.ViewLegalHoldService_team.testObject_ViewLegalHoldService_team_20, "testObject_ViewLegalHoldService_team_20.json")], + testGroup "Golden: UserLegalHoldStatusResponse_team" + $ testObjects [(Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_1, "testObject_UserLegalHoldStatusResponse_team_1.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_2, "testObject_UserLegalHoldStatusResponse_team_2.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_3, "testObject_UserLegalHoldStatusResponse_team_3.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_4, "testObject_UserLegalHoldStatusResponse_team_4.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_5, "testObject_UserLegalHoldStatusResponse_team_5.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_6, "testObject_UserLegalHoldStatusResponse_team_6.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_7, "testObject_UserLegalHoldStatusResponse_team_7.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_8, "testObject_UserLegalHoldStatusResponse_team_8.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_9, "testObject_UserLegalHoldStatusResponse_team_9.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_10, "testObject_UserLegalHoldStatusResponse_team_10.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_11, "testObject_UserLegalHoldStatusResponse_team_11.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_12, "testObject_UserLegalHoldStatusResponse_team_12.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_13, "testObject_UserLegalHoldStatusResponse_team_13.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_14, "testObject_UserLegalHoldStatusResponse_team_14.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_15, "testObject_UserLegalHoldStatusResponse_team_15.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_16, "testObject_UserLegalHoldStatusResponse_team_16.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_17, "testObject_UserLegalHoldStatusResponse_team_17.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_18, "testObject_UserLegalHoldStatusResponse_team_18.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_19, "testObject_UserLegalHoldStatusResponse_team_19.json"), (Test.Wire.API.Golden.Generated.UserLegalHoldStatusResponse_team.testObject_UserLegalHoldStatusResponse_team_20, "testObject_UserLegalHoldStatusResponse_team_20.json")], + testGroup "Golden: RemoveLegalHoldSettingsRequest_team" + $ testObjects [(Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_1, "testObject_RemoveLegalHoldSettingsRequest_team_1.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_2, "testObject_RemoveLegalHoldSettingsRequest_team_2.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_3, "testObject_RemoveLegalHoldSettingsRequest_team_3.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_4, "testObject_RemoveLegalHoldSettingsRequest_team_4.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_5, "testObject_RemoveLegalHoldSettingsRequest_team_5.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_6, "testObject_RemoveLegalHoldSettingsRequest_team_6.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_7, "testObject_RemoveLegalHoldSettingsRequest_team_7.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_8, "testObject_RemoveLegalHoldSettingsRequest_team_8.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_9, "testObject_RemoveLegalHoldSettingsRequest_team_9.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_10, "testObject_RemoveLegalHoldSettingsRequest_team_10.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_11, "testObject_RemoveLegalHoldSettingsRequest_team_11.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_12, "testObject_RemoveLegalHoldSettingsRequest_team_12.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_13, "testObject_RemoveLegalHoldSettingsRequest_team_13.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_14, "testObject_RemoveLegalHoldSettingsRequest_team_14.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_15, "testObject_RemoveLegalHoldSettingsRequest_team_15.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_16, "testObject_RemoveLegalHoldSettingsRequest_team_16.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_17, "testObject_RemoveLegalHoldSettingsRequest_team_17.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_18, "testObject_RemoveLegalHoldSettingsRequest_team_18.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_19, "testObject_RemoveLegalHoldSettingsRequest_team_19.json"), (Test.Wire.API.Golden.Generated.RemoveLegalHoldSettingsRequest_team.testObject_RemoveLegalHoldSettingsRequest_team_20, "testObject_RemoveLegalHoldSettingsRequest_team_20.json")], + testGroup "Golden: DisableLegalHoldForUserRequest_team" + $ testObjects [(Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_1, "testObject_DisableLegalHoldForUserRequest_team_1.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_2, "testObject_DisableLegalHoldForUserRequest_team_2.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_3, "testObject_DisableLegalHoldForUserRequest_team_3.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_4, "testObject_DisableLegalHoldForUserRequest_team_4.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_5, "testObject_DisableLegalHoldForUserRequest_team_5.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_6, "testObject_DisableLegalHoldForUserRequest_team_6.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_7, "testObject_DisableLegalHoldForUserRequest_team_7.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_8, "testObject_DisableLegalHoldForUserRequest_team_8.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_9, "testObject_DisableLegalHoldForUserRequest_team_9.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_10, "testObject_DisableLegalHoldForUserRequest_team_10.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_11, "testObject_DisableLegalHoldForUserRequest_team_11.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_12, "testObject_DisableLegalHoldForUserRequest_team_12.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_13, "testObject_DisableLegalHoldForUserRequest_team_13.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_14, "testObject_DisableLegalHoldForUserRequest_team_14.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_15, "testObject_DisableLegalHoldForUserRequest_team_15.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_16, "testObject_DisableLegalHoldForUserRequest_team_16.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_17, "testObject_DisableLegalHoldForUserRequest_team_17.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_18, "testObject_DisableLegalHoldForUserRequest_team_18.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_19, "testObject_DisableLegalHoldForUserRequest_team_19.json"), (Test.Wire.API.Golden.Generated.DisableLegalHoldForUserRequest_team.testObject_DisableLegalHoldForUserRequest_team_20, "testObject_DisableLegalHoldForUserRequest_team_20.json")], + testGroup "Golden: ApproveLegalHoldForUserRequest_team" + $ testObjects [(Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_1, "testObject_ApproveLegalHoldForUserRequest_team_1.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_2, "testObject_ApproveLegalHoldForUserRequest_team_2.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_3, "testObject_ApproveLegalHoldForUserRequest_team_3.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_4, "testObject_ApproveLegalHoldForUserRequest_team_4.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_5, "testObject_ApproveLegalHoldForUserRequest_team_5.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_6, "testObject_ApproveLegalHoldForUserRequest_team_6.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_7, "testObject_ApproveLegalHoldForUserRequest_team_7.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_8, "testObject_ApproveLegalHoldForUserRequest_team_8.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_9, "testObject_ApproveLegalHoldForUserRequest_team_9.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_10, "testObject_ApproveLegalHoldForUserRequest_team_10.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_11, "testObject_ApproveLegalHoldForUserRequest_team_11.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_12, "testObject_ApproveLegalHoldForUserRequest_team_12.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_13, "testObject_ApproveLegalHoldForUserRequest_team_13.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_14, "testObject_ApproveLegalHoldForUserRequest_team_14.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_15, "testObject_ApproveLegalHoldForUserRequest_team_15.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_16, "testObject_ApproveLegalHoldForUserRequest_team_16.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_17, "testObject_ApproveLegalHoldForUserRequest_team_17.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_18, "testObject_ApproveLegalHoldForUserRequest_team_18.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_19, "testObject_ApproveLegalHoldForUserRequest_team_19.json"), (Test.Wire.API.Golden.Generated.ApproveLegalHoldForUserRequest_team.testObject_ApproveLegalHoldForUserRequest_team_20, "testObject_ApproveLegalHoldForUserRequest_team_20.json")], + testGroup "Golden: RequestNewLegalHoldClient_team" + $ testObjects [(Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_1, "testObject_RequestNewLegalHoldClient_team_1.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_2, "testObject_RequestNewLegalHoldClient_team_2.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_3, "testObject_RequestNewLegalHoldClient_team_3.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_4, "testObject_RequestNewLegalHoldClient_team_4.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_5, "testObject_RequestNewLegalHoldClient_team_5.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_6, "testObject_RequestNewLegalHoldClient_team_6.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_7, "testObject_RequestNewLegalHoldClient_team_7.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_8, "testObject_RequestNewLegalHoldClient_team_8.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_9, "testObject_RequestNewLegalHoldClient_team_9.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_10, "testObject_RequestNewLegalHoldClient_team_10.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_11, "testObject_RequestNewLegalHoldClient_team_11.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_12, "testObject_RequestNewLegalHoldClient_team_12.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_13, "testObject_RequestNewLegalHoldClient_team_13.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_14, "testObject_RequestNewLegalHoldClient_team_14.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_15, "testObject_RequestNewLegalHoldClient_team_15.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_16, "testObject_RequestNewLegalHoldClient_team_16.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_17, "testObject_RequestNewLegalHoldClient_team_17.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_18, "testObject_RequestNewLegalHoldClient_team_18.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_19, "testObject_RequestNewLegalHoldClient_team_19.json"), (Test.Wire.API.Golden.Generated.RequestNewLegalHoldClient_team.testObject_RequestNewLegalHoldClient_team_20, "testObject_RequestNewLegalHoldClient_team_20.json")], + testGroup "Golden: NewLegalHoldClient_team" + $ testObjects [(Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_1, "testObject_NewLegalHoldClient_team_1.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_2, "testObject_NewLegalHoldClient_team_2.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_3, "testObject_NewLegalHoldClient_team_3.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_4, "testObject_NewLegalHoldClient_team_4.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_5, "testObject_NewLegalHoldClient_team_5.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_6, "testObject_NewLegalHoldClient_team_6.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_7, "testObject_NewLegalHoldClient_team_7.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_8, "testObject_NewLegalHoldClient_team_8.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_9, "testObject_NewLegalHoldClient_team_9.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_10, "testObject_NewLegalHoldClient_team_10.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_11, "testObject_NewLegalHoldClient_team_11.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_12, "testObject_NewLegalHoldClient_team_12.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_13, "testObject_NewLegalHoldClient_team_13.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_14, "testObject_NewLegalHoldClient_team_14.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_15, "testObject_NewLegalHoldClient_team_15.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_16, "testObject_NewLegalHoldClient_team_16.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_17, "testObject_NewLegalHoldClient_team_17.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_18, "testObject_NewLegalHoldClient_team_18.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_19, "testObject_NewLegalHoldClient_team_19.json"), (Test.Wire.API.Golden.Generated.NewLegalHoldClient_team.testObject_NewLegalHoldClient_team_20, "testObject_NewLegalHoldClient_team_20.json")], + testGroup "Golden: LegalHoldServiceConfirm_team" + $ testObjects [(Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_1, "testObject_LegalHoldServiceConfirm_team_1.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_2, "testObject_LegalHoldServiceConfirm_team_2.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_3, "testObject_LegalHoldServiceConfirm_team_3.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_4, "testObject_LegalHoldServiceConfirm_team_4.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_5, "testObject_LegalHoldServiceConfirm_team_5.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_6, "testObject_LegalHoldServiceConfirm_team_6.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_7, "testObject_LegalHoldServiceConfirm_team_7.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_8, "testObject_LegalHoldServiceConfirm_team_8.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_9, "testObject_LegalHoldServiceConfirm_team_9.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_10, "testObject_LegalHoldServiceConfirm_team_10.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_11, "testObject_LegalHoldServiceConfirm_team_11.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_12, "testObject_LegalHoldServiceConfirm_team_12.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_13, "testObject_LegalHoldServiceConfirm_team_13.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_14, "testObject_LegalHoldServiceConfirm_team_14.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_15, "testObject_LegalHoldServiceConfirm_team_15.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_16, "testObject_LegalHoldServiceConfirm_team_16.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_17, "testObject_LegalHoldServiceConfirm_team_17.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_18, "testObject_LegalHoldServiceConfirm_team_18.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_19, "testObject_LegalHoldServiceConfirm_team_19.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceConfirm_team.testObject_LegalHoldServiceConfirm_team_20, "testObject_LegalHoldServiceConfirm_team_20.json")], + testGroup "Golden: LegalHoldServiceRemove_team" + $ testObjects [(Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_1, "testObject_LegalHoldServiceRemove_team_1.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_2, "testObject_LegalHoldServiceRemove_team_2.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_3, "testObject_LegalHoldServiceRemove_team_3.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_4, "testObject_LegalHoldServiceRemove_team_4.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_5, "testObject_LegalHoldServiceRemove_team_5.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_6, "testObject_LegalHoldServiceRemove_team_6.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_7, "testObject_LegalHoldServiceRemove_team_7.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_8, "testObject_LegalHoldServiceRemove_team_8.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_9, "testObject_LegalHoldServiceRemove_team_9.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_10, "testObject_LegalHoldServiceRemove_team_10.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_11, "testObject_LegalHoldServiceRemove_team_11.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_12, "testObject_LegalHoldServiceRemove_team_12.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_13, "testObject_LegalHoldServiceRemove_team_13.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_14, "testObject_LegalHoldServiceRemove_team_14.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_15, "testObject_LegalHoldServiceRemove_team_15.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_16, "testObject_LegalHoldServiceRemove_team_16.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_17, "testObject_LegalHoldServiceRemove_team_17.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_18, "testObject_LegalHoldServiceRemove_team_18.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_19, "testObject_LegalHoldServiceRemove_team_19.json"), (Test.Wire.API.Golden.Generated.LegalHoldServiceRemove_team.testObject_LegalHoldServiceRemove_team_20, "testObject_LegalHoldServiceRemove_team_20.json")], + testGroup "Golden: TeamMember_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_1, "testObject_TeamMember_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_2, "testObject_TeamMember_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_3, "testObject_TeamMember_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_4, "testObject_TeamMember_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_5, "testObject_TeamMember_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_6, "testObject_TeamMember_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_7, "testObject_TeamMember_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_8, "testObject_TeamMember_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_9, "testObject_TeamMember_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_10, "testObject_TeamMember_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_11, "testObject_TeamMember_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_12, "testObject_TeamMember_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_13, "testObject_TeamMember_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_14, "testObject_TeamMember_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_15, "testObject_TeamMember_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_16, "testObject_TeamMember_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_17, "testObject_TeamMember_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_18, "testObject_TeamMember_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_19, "testObject_TeamMember_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMember_team.testObject_TeamMember_team_20, "testObject_TeamMember_team_20.json")], + testGroup "Golden: ListType_team" + $ testObjects [(Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_1, "testObject_ListType_team_1.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_2, "testObject_ListType_team_2.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_3, "testObject_ListType_team_3.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_4, "testObject_ListType_team_4.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_5, "testObject_ListType_team_5.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_6, "testObject_ListType_team_6.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_7, "testObject_ListType_team_7.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_8, "testObject_ListType_team_8.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_9, "testObject_ListType_team_9.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_10, "testObject_ListType_team_10.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_11, "testObject_ListType_team_11.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_12, "testObject_ListType_team_12.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_13, "testObject_ListType_team_13.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_14, "testObject_ListType_team_14.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_15, "testObject_ListType_team_15.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_16, "testObject_ListType_team_16.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_17, "testObject_ListType_team_17.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_18, "testObject_ListType_team_18.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_19, "testObject_ListType_team_19.json"), (Test.Wire.API.Golden.Generated.ListType_team.testObject_ListType_team_20, "testObject_ListType_team_20.json")], + testGroup "Golden: TeamMemberList_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_1, "testObject_TeamMemberList_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_2, "testObject_TeamMemberList_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_3, "testObject_TeamMemberList_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_4, "testObject_TeamMemberList_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_5, "testObject_TeamMemberList_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_6, "testObject_TeamMemberList_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_7, "testObject_TeamMemberList_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_8, "testObject_TeamMemberList_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_9, "testObject_TeamMemberList_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_10, "testObject_TeamMemberList_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_11, "testObject_TeamMemberList_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_12, "testObject_TeamMemberList_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_13, "testObject_TeamMemberList_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_14, "testObject_TeamMemberList_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_15, "testObject_TeamMemberList_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_16, "testObject_TeamMemberList_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_17, "testObject_TeamMemberList_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_18, "testObject_TeamMemberList_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_19, "testObject_TeamMemberList_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMemberList_team.testObject_TeamMemberList_team_20, "testObject_TeamMemberList_team_20.json")], + testGroup "Golden: NewTeamMember_team" + $ testObjects [(Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_1, "testObject_NewTeamMember_team_1.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_2, "testObject_NewTeamMember_team_2.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_3, "testObject_NewTeamMember_team_3.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_4, "testObject_NewTeamMember_team_4.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_5, "testObject_NewTeamMember_team_5.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_6, "testObject_NewTeamMember_team_6.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_7, "testObject_NewTeamMember_team_7.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_8, "testObject_NewTeamMember_team_8.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_9, "testObject_NewTeamMember_team_9.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_10, "testObject_NewTeamMember_team_10.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_11, "testObject_NewTeamMember_team_11.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_12, "testObject_NewTeamMember_team_12.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_13, "testObject_NewTeamMember_team_13.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_14, "testObject_NewTeamMember_team_14.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_15, "testObject_NewTeamMember_team_15.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_16, "testObject_NewTeamMember_team_16.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_17, "testObject_NewTeamMember_team_17.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_18, "testObject_NewTeamMember_team_18.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_19, "testObject_NewTeamMember_team_19.json"), (Test.Wire.API.Golden.Generated.NewTeamMember_team.testObject_NewTeamMember_team_20, "testObject_NewTeamMember_team_20.json")], + testGroup "Golden: TeamMemberDeleteData_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_1, "testObject_TeamMemberDeleteData_team_1.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_2, "testObject_TeamMemberDeleteData_team_2.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_3, "testObject_TeamMemberDeleteData_team_3.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_4, "testObject_TeamMemberDeleteData_team_4.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_5, "testObject_TeamMemberDeleteData_team_5.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_6, "testObject_TeamMemberDeleteData_team_6.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_7, "testObject_TeamMemberDeleteData_team_7.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_8, "testObject_TeamMemberDeleteData_team_8.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_9, "testObject_TeamMemberDeleteData_team_9.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_10, "testObject_TeamMemberDeleteData_team_10.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_11, "testObject_TeamMemberDeleteData_team_11.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_12, "testObject_TeamMemberDeleteData_team_12.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_13, "testObject_TeamMemberDeleteData_team_13.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_14, "testObject_TeamMemberDeleteData_team_14.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_15, "testObject_TeamMemberDeleteData_team_15.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_16, "testObject_TeamMemberDeleteData_team_16.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_17, "testObject_TeamMemberDeleteData_team_17.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_18, "testObject_TeamMemberDeleteData_team_18.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_19, "testObject_TeamMemberDeleteData_team_19.json"), (Test.Wire.API.Golden.Generated.TeamMemberDeleteData_team.testObject_TeamMemberDeleteData_team_20, "testObject_TeamMemberDeleteData_team_20.json")], + testGroup "Golden: Permissions_team" + $ testObjects [(Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_1, "testObject_Permissions_team_1.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_2, "testObject_Permissions_team_2.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_3, "testObject_Permissions_team_3.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_4, "testObject_Permissions_team_4.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_5, "testObject_Permissions_team_5.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_6, "testObject_Permissions_team_6.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_7, "testObject_Permissions_team_7.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_8, "testObject_Permissions_team_8.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_9, "testObject_Permissions_team_9.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_10, "testObject_Permissions_team_10.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_11, "testObject_Permissions_team_11.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_12, "testObject_Permissions_team_12.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_13, "testObject_Permissions_team_13.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_14, "testObject_Permissions_team_14.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_15, "testObject_Permissions_team_15.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_16, "testObject_Permissions_team_16.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_17, "testObject_Permissions_team_17.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_18, "testObject_Permissions_team_18.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_19, "testObject_Permissions_team_19.json"), (Test.Wire.API.Golden.Generated.Permissions_team.testObject_Permissions_team_20, "testObject_Permissions_team_20.json")], + testGroup "Golden: Role_team" + $ testObjects [(Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_1, "testObject_Role_team_1.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_2, "testObject_Role_team_2.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_3, "testObject_Role_team_3.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_4, "testObject_Role_team_4.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_5, "testObject_Role_team_5.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_6, "testObject_Role_team_6.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_7, "testObject_Role_team_7.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_8, "testObject_Role_team_8.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_9, "testObject_Role_team_9.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_10, "testObject_Role_team_10.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_11, "testObject_Role_team_11.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_12, "testObject_Role_team_12.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_13, "testObject_Role_team_13.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_14, "testObject_Role_team_14.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_15, "testObject_Role_team_15.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_16, "testObject_Role_team_16.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_17, "testObject_Role_team_17.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_18, "testObject_Role_team_18.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_19, "testObject_Role_team_19.json"), (Test.Wire.API.Golden.Generated.Role_team.testObject_Role_team_20, "testObject_Role_team_20.json")], + testGroup "Golden: TeamSearchVisibility_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_1, "testObject_TeamSearchVisibility_team_1.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_2, "testObject_TeamSearchVisibility_team_2.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_3, "testObject_TeamSearchVisibility_team_3.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_4, "testObject_TeamSearchVisibility_team_4.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_5, "testObject_TeamSearchVisibility_team_5.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_6, "testObject_TeamSearchVisibility_team_6.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_7, "testObject_TeamSearchVisibility_team_7.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_8, "testObject_TeamSearchVisibility_team_8.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_9, "testObject_TeamSearchVisibility_team_9.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_10, "testObject_TeamSearchVisibility_team_10.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_11, "testObject_TeamSearchVisibility_team_11.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_12, "testObject_TeamSearchVisibility_team_12.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_13, "testObject_TeamSearchVisibility_team_13.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_14, "testObject_TeamSearchVisibility_team_14.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_15, "testObject_TeamSearchVisibility_team_15.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_16, "testObject_TeamSearchVisibility_team_16.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_17, "testObject_TeamSearchVisibility_team_17.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_18, "testObject_TeamSearchVisibility_team_18.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_19, "testObject_TeamSearchVisibility_team_19.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibility_team.testObject_TeamSearchVisibility_team_20, "testObject_TeamSearchVisibility_team_20.json")], + testGroup "Golden: TeamSearchVisibilityView_team" + $ testObjects [(Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_1, "testObject_TeamSearchVisibilityView_team_1.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_2, "testObject_TeamSearchVisibilityView_team_2.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_3, "testObject_TeamSearchVisibilityView_team_3.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_4, "testObject_TeamSearchVisibilityView_team_4.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_5, "testObject_TeamSearchVisibilityView_team_5.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_6, "testObject_TeamSearchVisibilityView_team_6.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_7, "testObject_TeamSearchVisibilityView_team_7.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_8, "testObject_TeamSearchVisibilityView_team_8.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_9, "testObject_TeamSearchVisibilityView_team_9.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_10, "testObject_TeamSearchVisibilityView_team_10.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_11, "testObject_TeamSearchVisibilityView_team_11.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_12, "testObject_TeamSearchVisibilityView_team_12.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_13, "testObject_TeamSearchVisibilityView_team_13.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_14, "testObject_TeamSearchVisibilityView_team_14.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_15, "testObject_TeamSearchVisibilityView_team_15.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_16, "testObject_TeamSearchVisibilityView_team_16.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_17, "testObject_TeamSearchVisibilityView_team_17.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_18, "testObject_TeamSearchVisibilityView_team_18.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_19, "testObject_TeamSearchVisibilityView_team_19.json"), (Test.Wire.API.Golden.Generated.TeamSearchVisibilityView_team.testObject_TeamSearchVisibilityView_team_20, "testObject_TeamSearchVisibilityView_team_20.json")], + testGroup "Golden: VerificationAction_user" + $ testObjects [ (Test.Wire.API.Golden.Generated.VerificationAction_user.testObject_VerificationAction_user_1, "testObject_VerificationAction_user_1"), (Test.Wire.API.Golden.Generated.VerificationAction_user.testObject_VerificationAction_user_2, "testObject_VerificationAction_user_2"), (Test.Wire.API.Golden.Generated.VerificationAction_user.testObject_VerificationAction_user_3, "testObject_VerificationAction_user_3") @@ -1455,8 +1455,8 @@ tests = (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_11, "testObject_Event_conversation_11.json"), (Test.Wire.API.Golden.Generated.Event_conversation.testObject_Event_conversation_10, "testObject_Event_conversation_10.json") ], - testGroup "Golden: QualifiedUserClientPrekeyMapV4" $ - testObjects + testGroup "Golden: QualifiedUserClientPrekeyMapV4" + $ testObjects [ (Test.Wire.API.Golden.Generated.QualifiedUserClientPrekeyMapV4_user.testObject_QualifiedUserClientPrekeyMapV4_user_1, "testObject_QualifiedUserClientPrekeyMapV4_1.json"), (Test.Wire.API.Golden.Generated.QualifiedUserClientPrekeyMapV4_user.testObject_QualifiedUserClientPrekeyMapV4_user_2, "testObject_QualifiedUserClientPrekeyMapV4_2.json"), (Test.Wire.API.Golden.Generated.QualifiedUserClientPrekeyMapV4_user.testObject_QualifiedUserClientPrekeyMapV4_user_3, "testObject_QualifiedUserClientPrekeyMapV4_3.json") diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Asset_asset.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Asset_asset.hs index 025953e88a6..453dfc31822 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Asset_asset.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Asset_asset.hs @@ -29,126 +29,164 @@ import Wire.API.Asset testObject_Asset_asset_1 :: Asset testObject_Asset_asset_1 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "0000004b-0000-0017-0000-003e00000033"))) AssetExpiring) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-30 15:58:55.452 UTC") - & assetToken ?~ (AssetToken {assetTokenAscii = fromRight undefined (validate "Kun4JaxR6QuASXywDhzx")}) + & assetExpires + .~ fmap read (Just "1864-04-30 15:58:55.452 UTC") + & assetToken + ?~ (AssetToken {assetTokenAscii = fromRight undefined (validate "Kun4JaxR6QuASXywDhzx")}) testObject_Asset_asset_2 :: Asset testObject_Asset_asset_2 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000008-0000-006c-0000-001900000036"))) AssetEternalInfrequentAccess) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-06-04 17:39:43.924 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "mPuul678vuJVZ_u9lQ==")} + & assetExpires + .~ fmap read (Just "1864-06-04 17:39:43.924 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "mPuul678vuJVZ_u9lQ==")} testObject_Asset_asset_3 :: Asset testObject_Asset_asset_3 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000055-0000-0071-0000-002e00000020"))) AssetEternal) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-18 20:18:13.438 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-05-18 20:18:13.438 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_4 :: Asset testObject_Asset_asset_4 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000063-0000-0044-0000-003000000059"))) AssetEternalInfrequentAccess) (Domain "example.com")) - & assetExpires .~ fmap read Nothing - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "IRKruiPSiANiX1fL")} + & assetExpires + .~ fmap read Nothing + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "IRKruiPSiANiX1fL")} testObject_Asset_asset_5 :: Asset testObject_Asset_asset_5 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000019-0000-005b-0000-001d00000056"))) AssetVolatile) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-11 14:38:25.874 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "BrbiaM1RxJlqjlqq7quuPSc=")} + & assetExpires + .~ fmap read (Just "1864-05-11 14:38:25.874 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "BrbiaM1RxJlqjlqq7quuPSc=")} testObject_Asset_asset_6 :: Asset testObject_Asset_asset_6 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "0000000e-0000-0046-0000-00560000005e"))) AssetPersistent) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-25 01:19:16.676 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-05-25 01:19:16.676 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_7 :: Asset testObject_Asset_asset_7 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000013-0000-002e-0000-003000000042"))) AssetEternal) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-14 08:45:43.05 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "_N9ERJGmbZtd6XlW_6O12bxuNe4=")} + & assetExpires + .~ fmap read (Just "1864-04-14 08:45:43.05 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "_N9ERJGmbZtd6XlW_6O12bxuNe4=")} testObject_Asset_asset_8 :: Asset testObject_Asset_asset_8 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000073-0000-003e-0000-00120000000c"))) AssetEternal) (Domain "example.com")) - & assetExpires .~ fmap read Nothing - & assetToken .~ Nothing + & assetExpires + .~ fmap read Nothing + & assetToken + .~ Nothing testObject_Asset_asset_9 :: Asset testObject_Asset_asset_9 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000006-0000-004b-0000-004f00000025"))) AssetPersistent) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-21 01:34:09.726 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-05-21 01:34:09.726 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_10 :: Asset testObject_Asset_asset_10 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000065-0000-0080-0000-003400000061"))) AssetEternal) (Domain "example.com")) - & assetExpires .~ fmap read Nothing - & assetToken .~ Nothing + & assetExpires + .~ fmap read Nothing + & assetToken + .~ Nothing testObject_Asset_asset_11 :: Asset testObject_Asset_asset_11 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000014-0000-0077-0000-001e00000076"))) AssetEternalInfrequentAccess) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-11 16:58:59.746 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "DnlRW9Q=")} + & assetExpires + .~ fmap read (Just "1864-05-11 16:58:59.746 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "DnlRW9Q=")} testObject_Asset_asset_12 :: Asset testObject_Asset_asset_12 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "0000001d-0000-0076-0000-003800000021"))) AssetPersistent) (Domain "example.com")) - & assetExpires .~ fmap read Nothing - & assetToken .~ Nothing + & assetExpires + .~ fmap read Nothing + & assetToken + .~ Nothing testObject_Asset_asset_13 :: Asset testObject_Asset_asset_13 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000030-0000-0036-0000-003c0000000a"))) AssetEternalInfrequentAccess) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-30 19:37:57.302 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "n7CJBcdOSKznRmOypWXsGfEE0g==")} + & assetExpires + .~ fmap read (Just "1864-04-30 19:37:57.302 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "n7CJBcdOSKznRmOypWXsGfEE0g==")} testObject_Asset_asset_14 :: Asset testObject_Asset_asset_14 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000047-0000-0012-0000-005500000062"))) AssetEternalInfrequentAccess) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-06 09:09:55.146 UTC") - & assetToken ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "LYfUg4qlMjw=")} + & assetExpires + .~ fmap read (Just "1864-05-06 09:09:55.146 UTC") + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "LYfUg4qlMjw=")} testObject_Asset_asset_15 :: Asset testObject_Asset_asset_15 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000030-0000-0074-0000-00660000004c"))) AssetPersistent) (Domain "example.com")) - & assetExpires .~ fmap read Nothing - & assetToken .~ Nothing + & assetExpires + .~ fmap read Nothing + & assetToken + .~ Nothing testObject_Asset_asset_16 :: Asset testObject_Asset_asset_16 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000048-0000-0051-0000-005d00000070"))) AssetVolatile) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-05-04 02:19:12.52 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-05-04 02:19:12.52 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_17 :: Asset testObject_Asset_asset_17 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000017-0000-000d-0000-00680000003e"))) AssetPersistent) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-09 17:00:39.763 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-04-09 17:00:39.763 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_18 :: Asset testObject_Asset_asset_18 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "0000003e-0000-0032-0000-004d00000070"))) AssetEternal) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-12 20:53:21.25 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-04-12 20:53:21.25 UTC") + & assetToken + .~ Nothing testObject_Asset_asset_19 :: Asset testObject_Asset_asset_19 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000021-0000-0062-0000-002a0000006b"))) AssetVolatile) (Domain "example.com")) & assetExpires - .~ fmap read Nothing - & assetToken - ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "4wm3D03aqvZ_0oKFtwXCYnSTC7m_z1E=")} + .~ fmap read Nothing + & assetToken + ?~ AssetToken {assetTokenAscii = fromRight undefined (validate "4wm3D03aqvZ_0oKFtwXCYnSTC7m_z1E=")} testObject_Asset_asset_20 :: Asset testObject_Asset_asset_20 = mkAsset (Qualified (AssetKeyV3 (Id (fromJust (UUID.fromString "00000053-0000-0072-0000-001700000047"))) AssetVolatile) (Domain "example.com")) - & assetExpires .~ fmap read (Just "1864-04-25 16:48:39.986 UTC") - & assetToken .~ Nothing + & assetExpires + .~ fmap read (Just "1864-04-25 16:48:39.986 UTC") + & assetToken + .~ Nothing diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_team.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_team.hs index c80d19bea0e..148a81bcb64 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_team.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Event_team.hs @@ -55,7 +55,8 @@ testObject_Event_team_1 = "\EOTX\996492h" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ) ) @@ -189,7 +190,8 @@ testObject_Event_team_13 = "\b\DELh0\1027380" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ ",7\aS" + & teamIconKey + ?~ ",7\aS" ) ) diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/RTCIceServer_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/RTCIceServer_user.hs index 175d2e46ae0..4788ad11961 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/RTCIceServer_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/RTCIceServer_user.hs @@ -52,9 +52,12 @@ testObject_RTCIceServer_user_1 = ] ) ( turnUsername (secondsToNominalDiffTime 38.000000000000) "6vgzfba" - & tuVersion .~ 4 - & tuKeyindex .~ 24 - & tuT .~ '\DC1' + & tuVersion + .~ 4 + & tuKeyindex + .~ 24 + & tuT + .~ '\DC1' ) (fromRight undefined (validate "ZtBPgUaUYg==")) @@ -65,8 +68,11 @@ testObject_RTCIceServer_user_2 = :| [] ) ( turnUsername (secondsToNominalDiffTime 3.000000000000) "a8kdffu4" - & tuVersion .~ 5 - & tuKeyindex .~ 24 - & tuT .~ '\SOH' + & tuVersion + .~ 5 + & tuKeyindex + .~ 24 + & tuT + .~ '\SOH' ) (fromRight undefined (validate "d1VUzpxZ3TeM")) diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamList_team.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamList_team.hs index 00bce1fee1d..9ed4d8152ed 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamList_team.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamList_team.hs @@ -36,21 +36,24 @@ testObject_TeamList_team_1 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001"))) "" DefaultIcon NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = False } @@ -65,14 +68,16 @@ testObject_TeamList_team_2 = "7" DefaultIcon Binding - & teamIconKey ?~ "@", + & teamIconKey + ?~ "@", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = False } @@ -87,7 +92,8 @@ testObject_TeamList_team_3 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = False } @@ -102,14 +108,16 @@ testObject_TeamList_team_4 = "\1065164" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = False } @@ -124,49 +132,56 @@ testObject_TeamList_team_5 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = True } @@ -181,7 +196,8 @@ testObject_TeamList_team_6 = " " (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = True } @@ -196,14 +212,16 @@ testObject_TeamList_team_7 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = False } @@ -221,42 +239,48 @@ testObject_TeamList_team_9 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = True } @@ -277,7 +301,8 @@ testObject_TeamList_team_12 = "/\38175" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "" + & teamIconKey + ?~ "" ], _teamListHasMore = True } @@ -295,42 +320,48 @@ testObject_TeamList_team_14 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001"))) "" DefaultIcon NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) "" DefaultIcon NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) "" DefaultIcon NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))) "" DefaultIcon NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = True } @@ -345,35 +376,40 @@ testObject_TeamList_team_15 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001"))) (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = False } @@ -388,7 +424,8 @@ testObject_TeamList_team_16 = "\170783" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\1113463(" + & teamIconKey + ?~ "\1113463(" ], _teamListHasMore = True } @@ -406,7 +443,8 @@ testObject_TeamList_team_18 = "W1" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = True } @@ -421,7 +459,8 @@ testObject_TeamList_team_19 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\189413(" + & teamIconKey + ?~ "\189413(" ], _teamListHasMore = False } @@ -436,28 +475,32 @@ testObject_TeamList_team_20 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey .~ Nothing, + & teamIconKey + .~ Nothing, newTeam (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))) (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))) (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000001"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "", + & teamIconKey + ?~ "", newTeam (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001"))) (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000"))) "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing ], _teamListHasMore = False } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Team_team.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Team_team.hs index f6cbbc8254e..ce6479f8bde 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Team_team.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Team_team.hs @@ -32,7 +32,8 @@ testObject_Team_team_1 = "TJ\EOT" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\1040673V" + & teamIconKey + ?~ "\1040673V" testObject_Team_team_2 :: Team testObject_Team_team_2 = @@ -42,8 +43,10 @@ testObject_Team_team_2 = "Yc\5828" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "\34417R3q" - & teamSplashScreen .~ Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal) + & teamIconKey + ?~ "\34417R3q" + & teamSplashScreen + .~ Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal) testObject_Team_team_3 :: Team testObject_Team_team_3 = @@ -53,7 +56,8 @@ testObject_Team_team_3 = "2E\1092885" DefaultIcon NonBinding - & teamIconKey ?~ "s\1056436" + & teamIconKey + ?~ "s\1056436" testObject_Team_team_4 :: Team testObject_Team_team_4 = @@ -63,7 +67,8 @@ testObject_Team_team_4 = "\177218\bk" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "X" + & teamIconKey + ?~ "X" testObject_Team_team_5 :: Team testObject_Team_team_5 = @@ -73,7 +78,8 @@ testObject_Team_team_5 = "\ACK\99388\20164" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "?&\ESC" + & teamIconKey + ?~ "?&\ESC" testObject_Team_team_6 :: Team testObject_Team_team_6 = @@ -83,7 +89,8 @@ testObject_Team_team_6 = "\1018732x\1035024]\15985" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_7 :: Team testObject_Team_team_7 = @@ -93,7 +100,8 @@ testObject_Team_team_7 = "\9929\1053910\1017456\&7\1059453" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\96549" + & teamIconKey + ?~ "\96549" testObject_Team_team_8 :: Team testObject_Team_team_8 = @@ -103,7 +111,8 @@ testObject_Team_team_8 = "\r\37334{\DC3\\" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_9 :: Team testObject_Team_team_9 = @@ -113,7 +122,8 @@ testObject_Team_team_9 = "G[Hu{" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_10 :: Team testObject_Team_team_10 = @@ -123,7 +133,8 @@ testObject_Team_team_10 = "\1043846" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\1107305" + & teamIconKey + ?~ "\1107305" testObject_Team_team_11 :: Team testObject_Team_team_11 = @@ -133,7 +144,8 @@ testObject_Team_team_11 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_12 :: Team testObject_Team_team_12 = @@ -143,7 +155,8 @@ testObject_Team_team_12 = "yR\EOTU}" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "J\SI`\1074001\DEL" + & teamIconKey + ?~ "J\SI`\1074001\DEL" testObject_Team_team_13 :: Team testObject_Team_team_13 = @@ -153,7 +166,8 @@ testObject_Team_team_13 = "E\ESC" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_14 :: Team testObject_Team_team_14 = @@ -163,7 +177,8 @@ testObject_Team_team_14 = ".\27232," DefaultIcon NonBinding - & teamIconKey ?~ "N\EM\ETX" + & teamIconKey + ?~ "N\EM\ETX" testObject_Team_team_15 :: Team testObject_Team_team_15 = @@ -173,7 +188,8 @@ testObject_Team_team_15 = "#k\NUL,;" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "T\f)\tR" + & teamIconKey + ?~ "T\f)\tR" testObject_Team_team_16 :: Team testObject_Team_team_16 = @@ -183,7 +199,8 @@ testObject_Team_team_16 = "" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "\SOHC" + & teamIconKey + ?~ "\SOHC" testObject_Team_team_17 :: Team testObject_Team_team_17 = @@ -193,7 +210,8 @@ testObject_Team_team_17 = "\t\b " (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey .~ Nothing + & teamIconKey + .~ Nothing testObject_Team_team_18 :: Team testObject_Team_team_18 = @@ -203,7 +221,8 @@ testObject_Team_team_18 = "\23385\1046442" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "x:\40938L" + & teamIconKey + ?~ "x:\40938L" testObject_Team_team_19 :: Team testObject_Team_team_19 = @@ -213,7 +232,8 @@ testObject_Team_team_19 = "P\187859;gi" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) Binding - & teamIconKey ?~ "V>A" + & teamIconKey + ?~ "V>A" testObject_Team_team_20 :: Team testObject_Team_team_20 = @@ -223,4 +243,5 @@ testObject_Team_team_20 = "\191094c" (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal)) NonBinding - & teamIconKey ?~ "v0\1099892\&3" + & teamIconKey + ?~ "v0\1099892\&3" diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TurnUsername_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TurnUsername_user.hs index e76875324ca..f45895a4910 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TurnUsername_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TurnUsername_user.hs @@ -25,139 +25,199 @@ import Wire.API.Call.Config (TurnUsername, tuKeyindex, tuT, tuVersion, turnUsern testObject_TurnUsername_user_1 :: TurnUsername testObject_TurnUsername_user_1 = turnUsername (secondsToNominalDiffTime 15527713.000000000000) "ptwsd7g5za2solzq6qhub3" - & tuVersion .~ 18 - & tuKeyindex .~ 4829 - & tuT .~ ';' + & tuVersion + .~ 18 + & tuKeyindex + .~ 4829 + & tuT + .~ ';' testObject_TurnUsername_user_2 :: TurnUsername testObject_TurnUsername_user_2 = turnUsername (secondsToNominalDiffTime 13392461.000000000000) "ehn30n10n6op" - & tuVersion .~ 9 - & tuKeyindex .~ 13335 - & tuT .~ 'r' + & tuVersion + .~ 9 + & tuKeyindex + .~ 13335 + & tuT + .~ 'r' testObject_TurnUsername_user_3 :: TurnUsername testObject_TurnUsername_user_3 = turnUsername (secondsToNominalDiffTime 11177852.000000000000) "txrqjvuzw5uokh21hitqy070mjmj" - & tuVersion .~ 20 - & tuKeyindex .~ 10953 - & tuT .~ '9' + & tuVersion + .~ 20 + & tuKeyindex + .~ 10953 + & tuT + .~ '9' testObject_TurnUsername_user_4 :: TurnUsername testObject_TurnUsername_user_4 = turnUsername (secondsToNominalDiffTime 14690986.000000000000) "st5xpvjb3" - & tuVersion .~ 1 - & tuKeyindex .~ 2644 - & tuT .~ '+' + & tuVersion + .~ 1 + & tuKeyindex + .~ 2644 + & tuT + .~ '+' testObject_TurnUsername_user_5 :: TurnUsername testObject_TurnUsername_user_5 = turnUsername (secondsToNominalDiffTime 4615190.000000000000) "u86l0yvllw39" - & tuVersion .~ 8 - & tuKeyindex .~ 9984 - & tuT .~ 'S' + & tuVersion + .~ 8 + & tuKeyindex + .~ 9984 + & tuT + .~ 'S' testObject_TurnUsername_user_6 :: TurnUsername testObject_TurnUsername_user_6 = turnUsername (secondsToNominalDiffTime 13876542.000000000000) "eg21qov6rkavdo4etld2agglp6q" - & tuVersion .~ 9 - & tuKeyindex .~ 544 - & tuT .~ '\DC3' + & tuVersion + .~ 9 + & tuKeyindex + .~ 544 + & tuT + .~ '\DC3' testObject_TurnUsername_user_7 :: TurnUsername testObject_TurnUsername_user_7 = turnUsername (secondsToNominalDiffTime 604256.000000000000) "v3ectdcmttrhx8qi2jtqhmy" - & tuVersion .~ 28 - & tuKeyindex .~ 10304 - & tuT .~ '\1056774' + & tuVersion + .~ 28 + & tuKeyindex + .~ 10304 + & tuT + .~ '\1056774' testObject_TurnUsername_user_8 :: TurnUsername testObject_TurnUsername_user_8 = turnUsername (secondsToNominalDiffTime 11461340.000000000000) "55dox167gmdusgejbcu3p0kk" - & tuVersion .~ 30 - & tuKeyindex .~ 32328 - & tuT .~ '=' + & tuVersion + .~ 30 + & tuKeyindex + .~ 32328 + & tuT + .~ '=' testObject_TurnUsername_user_9 :: TurnUsername testObject_TurnUsername_user_9 = turnUsername (secondsToNominalDiffTime 9116692.000000000000) "9xedqmed5p" - & tuVersion .~ 12 - & tuKeyindex .~ 3780 - & tuT .~ '\'' + & tuVersion + .~ 12 + & tuKeyindex + .~ 3780 + & tuT + .~ '\'' testObject_TurnUsername_user_10 :: TurnUsername testObject_TurnUsername_user_10 = turnUsername (secondsToNominalDiffTime 2632630.000000000000) "yagwhzw2d8tddoj4" - & tuVersion .~ 30 - & tuKeyindex .~ 19902 - & tuT .~ '\v' + & tuVersion + .~ 30 + & tuKeyindex + .~ 19902 + & tuT + .~ '\v' testObject_TurnUsername_user_11 :: TurnUsername testObject_TurnUsername_user_11 = turnUsername (secondsToNominalDiffTime 3719294.000000000000) "xevuwd5vsfydbvo5" - & tuVersion .~ 15 - & tuKeyindex .~ 20428 - & tuT .~ '\28541' + & tuVersion + .~ 15 + & tuKeyindex + .~ 20428 + & tuT + .~ '\28541' testObject_TurnUsername_user_12 :: TurnUsername testObject_TurnUsername_user_12 = turnUsername (secondsToNominalDiffTime 11821785.000000000000) "1t2k2a3ua0pwp196rs" - & tuVersion .~ 29 - & tuKeyindex .~ 14407 - & tuT .~ '@' + & tuVersion + .~ 29 + & tuKeyindex + .~ 14407 + & tuT + .~ '@' testObject_TurnUsername_user_13 :: TurnUsername testObject_TurnUsername_user_13 = turnUsername (secondsToNominalDiffTime 5664368.000000000000) "w" - & tuVersion .~ 28 - & tuKeyindex .~ 1216 - & tuT .~ '\1076387' + & tuVersion + .~ 28 + & tuKeyindex + .~ 1216 + & tuT + .~ '\1076387' testObject_TurnUsername_user_14 :: TurnUsername testObject_TurnUsername_user_14 = turnUsername (secondsToNominalDiffTime 3247777.000000000000) "83sca0pn0dxoizci0g" - & tuVersion .~ 3 - & tuKeyindex .~ 21012 - & tuT .~ '`' + & tuVersion + .~ 3 + & tuKeyindex + .~ 21012 + & tuT + .~ '`' testObject_TurnUsername_user_15 :: TurnUsername testObject_TurnUsername_user_15 = turnUsername (secondsToNominalDiffTime 11893034.000000000000) "09x4jnuekod" - & tuVersion .~ 18 - & tuKeyindex .~ 28830 - & tuT .~ 'J' + & tuVersion + .~ 18 + & tuKeyindex + .~ 28830 + & tuT + .~ 'J' testObject_TurnUsername_user_16 :: TurnUsername testObject_TurnUsername_user_16 = turnUsername (secondsToNominalDiffTime 8117361.000000000000) "ao8bs8og70" - & tuVersion .~ 19 - & tuKeyindex .~ 2488 - & tuT .~ ',' + & tuVersion + .~ 19 + & tuKeyindex + .~ 2488 + & tuT + .~ ',' testObject_TurnUsername_user_17 :: TurnUsername testObject_TurnUsername_user_17 = turnUsername (secondsToNominalDiffTime 716501.000000000000) "nct4" - & tuVersion .~ 1 - & tuKeyindex .~ 5062 - & tuT .~ '\10507' + & tuVersion + .~ 1 + & tuKeyindex + .~ 5062 + & tuT + .~ '\10507' testObject_TurnUsername_user_18 :: TurnUsername testObject_TurnUsername_user_18 = turnUsername (secondsToNominalDiffTime 5517978.000000000000) "mxlyrynabc3fkdt9ze9" - & tuVersion .~ 11 - & tuKeyindex .~ 20637 - & tuT .~ '\FS' + & tuVersion + .~ 11 + & tuKeyindex + .~ 20637 + & tuT + .~ '\FS' testObject_TurnUsername_user_19 :: TurnUsername testObject_TurnUsername_user_19 = turnUsername (secondsToNominalDiffTime 12116794.000000000000) "pfa5lx43lko41m" - & tuVersion .~ 8 - & tuKeyindex .~ 19266 - & tuT .~ ':' + & tuVersion + .~ 8 + & tuKeyindex + .~ 19266 + & tuT + .~ ':' testObject_TurnUsername_user_20 :: TurnUsername testObject_TurnUsername_user_20 = turnUsername (secondsToNominalDiffTime 3040922.000000000000) "csp6eh0ti" - & tuVersion .~ 15 - & tuKeyindex .~ 30634 - & tuT .~ '\SI' + & tuVersion + .~ 15 + & tuKeyindex + .~ 30634 + & tuT + .~ '\SI' diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs index 57daad1dd22..eeafd400f9c 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs @@ -55,8 +55,8 @@ tests :: TestTree tests = testGroup "Manual golden tests" - [ testGroup "UserClientPrekeyMap" $ - testObjects + [ testGroup "UserClientPrekeyMap" + $ testObjects [ (testObject_UserClientPrekeyMap_1, "testObject_UserClientPrekeyMap_1.json"), (testObject_UserClientPrekeyMap_2, "testObject_UserClientPrekeyMap_2.json"), (testObject_UserClientPrekeyMap_3, "testObject_UserClientPrekeyMap_3.json"), @@ -66,44 +66,44 @@ tests = (testObject_UserClientPrekeyMap_7, "testObject_UserClientPrekeyMap_7.json"), (testObject_UserClientPrekeyMap_8, "testObject_UserClientPrekeyMap_8.json") ], - testGroup "QualifiedUserClientPrekeyMap" $ - testObjects + testGroup "QualifiedUserClientPrekeyMap" + $ testObjects [ (testObject_QualifiedUserClientPrekeyMap_1, "testObject_QualifiedUserClientPrekeyMap_1.json"), (testObject_QualifiedUserClientPrekeyMap_2, "testObject_QualifiedUserClientPrekeyMap_2.json") ], - testGroup "ConversationCoverView" $ - testObjects + testGroup "ConversationCoverView" + $ testObjects [ (testObject_ConversationCoverView_1, "testObject_ConversationCoverView_1.json"), (testObject_ConversationCoverView_2, "testObject_ConversationCoverView_2.json"), (testObject_ConversationCoverView_3, "testObject_ConversationCoverView_3.json") ], - testGroup "ConversationEvent" $ - testObjects + testGroup "ConversationEvent" + $ testObjects [ (testObject_Event_conversation_manual_1, "testObject_Event_conversation_manual_1.json"), (testObject_Event_conversation_manual_2, "testObject_Event_conversation_manual_2.json") ], - testGroup "GetPaginatedConversationIds" $ - testObjects + testGroup "GetPaginatedConversationIds" + $ testObjects [ (testObject_GetPaginatedConversationIds_1, "testObject_GetPaginatedConversationIds_1.json"), (testObject_GetPaginatedConversationIds_2, "testObject_GetPaginatedConversationIds_2.json") ], - testGroup "ConversationPagingState" $ - testObjects + testGroup "ConversationPagingState" + $ testObjects [ (testObject_ConversationPagingState_1, "testObject_ConversationPagingState_1.json"), (testObject_ConversationPagingState_2, "testObject_ConversationPagingState_2.json"), (testObject_ConversationPagingState_3, "testObject_ConversationPagingState_3.json"), (testObject_ConversationPagingState_4, "testObject_ConversationPagingState_4.json") ], - testGroup "ConvIdsPage" $ - testObjects + testGroup "ConvIdsPage" + $ testObjects [ (testObject_ConvIdsPage_1, "testObject_ConvIdsPage_1.json"), (testObject_ConvIdsPage_2, "testObject_ConvIdsPage_2.json") ], - testGroup "ClientCapability" $ - testObjects + testGroup "ClientCapability" + $ testObjects [(testObject_ClientCapability_1, "testObject_ClientCapability_1.json")], - testGroup "ClientCapabilityList" $ - testObjects + testGroup "ClientCapabilityList" + $ testObjects [ (testObject_ClientCapabilityList_1, "testObject_ClientCapabilityList_1.json"), (testObject_ClientCapabilityList_2, "testObject_ClientCapabilityList_2.json") ], @@ -114,51 +114,51 @@ tests = (testObject_FeatureConfigEvent_2, "testObject_FeatureConfigEvent_2.json"), (testObject_FeatureConfigEvent_3, "testObject_FeatureConfigEvent_3.json") ], - testGroup "UserIdsList" $ - testObjects + testGroup "UserIdsList" + $ testObjects [ (testObject_UserIdList_1, "testObject_UserIdList_1.json"), (testObject_UserIdList_2, "testObject_UserIdList_2.json") ], - testGroup "ListConversations" $ - testObjects + testGroup "ListConversations" + $ testObjects [(testObject_ListConversations_1, "testObject_ListConversations_1.json")], - testGroup "ConversationsResponse V2" $ - testObjects [(Versioned @'V2 testObject_ConversationsResponse_1, "testObject_ConversationsResponse_v2_1.json")], - testGroup "ConversationsResponse V5" $ - testObjects [(Versioned @'V5 testObject_ConversationsResponse_1, "testObject_ConversationsResponse_v5_1.json")], - testGroup "ConversationsResponse" $ - testObjects [(testObject_ConversationsResponse_1, "testObject_ConversationsResponse_1.json")], - testGroup "CreateScimToken" $ - testObjects + testGroup "ConversationsResponse V2" + $ testObjects [(Versioned @'V2 testObject_ConversationsResponse_1, "testObject_ConversationsResponse_v2_1.json")], + testGroup "ConversationsResponse V5" + $ testObjects [(Versioned @'V5 testObject_ConversationsResponse_1, "testObject_ConversationsResponse_v5_1.json")], + testGroup "ConversationsResponse" + $ testObjects [(testObject_ConversationsResponse_1, "testObject_ConversationsResponse_1.json")], + testGroup "CreateScimToken" + $ testObjects [ (testObject_CreateScimToken_1, "testObject_CreateScimToken_1.json"), (testObject_CreateScimToken_2, "testObject_CreateScimToken_2.json"), (testObject_CreateScimToken_3, "testObject_CreateScimToken_3.json"), (testObject_CreateScimToken_4, "testObject_CreateScimToken_4.json") ], - testGroup "Contact" $ - testObjects + testGroup "Contact" + $ testObjects [ (testObject_Contact_1, "testObject_Contact_1.json"), (testObject_Contact_2, "testObject_Contact_2.json") ], - testGroup "SearchResult Contact" $ - testObjects + testGroup "SearchResult Contact" + $ testObjects [ (testObject_SearchResultContact_1, "testObject_SearchResultContact_1.json"), (testObject_SearchResultContact_2, "testObject_SearchResultContact_2.json") ], - testGroup "GroupId" $ - testObjects + testGroup "GroupId" + $ testObjects [(testObject_GroupId_1, "testObject_GroupId_1.json")], - testGroup "PushToken" $ - testObjects + testGroup "PushToken" + $ testObjects [(testObject_Token_1, "testObject_Token_1.json")], - testGroup "TeamSize" $ - testObjects + testGroup "TeamSize" + $ testObjects [ (testObject_TeamSize_1, "testObject_TeamSize_1.json"), (testObject_TeamSize_2, "testObject_TeamSize_2.json"), (testObject_TeamSize_3, "testObject_TeamSize_3.json") ], - testGroup "PublicSubConversationV5" $ - testObjects + testGroup "PublicSubConversationV5" + $ testObjects [ ( Versioned @'V5 testObject_PublicSubConversation_1, "testObject_PublicSubConversation_v5_1.json" ), @@ -166,53 +166,53 @@ tests = "testObject_PublicSubConversation_v5_2.json" ) ], - testGroup "PublicSubConversation" $ - testObjects + testGroup "PublicSubConversation" + $ testObjects [ (testObject_PublicSubConversation_1, "testObject_PublicSubConversation_1.json"), (testObject_PublicSubConversation_2, "testObject_PublicSubConversation_2.json") ], - testGroup "ListUsersById" $ - testObjects + testGroup "ListUsersById" + $ testObjects [ (testObject_ListUsersById_user_1, "testObject_ListUsersById_user_1.json"), (testObject_ListUsersById_user_2, "testObject_ListUsersById_user_2.json"), (testObject_ListUsersById_user_3, "testObject_ListUsersById_user_3.json") ], - testGroup "CreateGroupConversation" $ - testObjects + testGroup "CreateGroupConversation" + $ testObjects [ (testObject_CreateGroupConversation_1, "testObject_CreateGroupConversation_1.json"), (testObject_CreateGroupConversation_2, "testObject_CreateGroupConversation_2.json"), (testObject_CreateGroupConversation_3, "testObject_CreateGroupConversation_3.json") ], - testGroup "FederationStatus" $ - testObjects + testGroup "FederationStatus" + $ testObjects [ (testObject_FederationStatus_1, "testObject_FederationStatus_1.json"), (testObject_FederationStatus_2, "testObject_FederationStatus_2.json") ], - testGroup "FederationStatus.RemoteDomains" $ - testObjects + testGroup "FederationStatus.RemoteDomains" + $ testObjects [ (testObject_RemoteDomains_1, "testObject_RemoteDomains_1.json"), (testObject_RemoteDomains_2, "testObject_RemoteDomains_2.json") ], - testGroup "FederationDomainConfig" $ - testObjects + testGroup "FederationDomainConfig" + $ testObjects [ (testObject_FederationDomainConfig_1, "testObject_FederationDomainConfig_1.json"), (testObject_FederationDomainConfig_2, "testObject_FederationDomainConfig_2.json"), (testObject_FederationDomainConfig_3, "testObject_FederationDomainConfig_3.json") ], - testGroup "FederationRestriction" $ - testObjects + testGroup "FederationRestriction" + $ testObjects [ (testObject_FederationRestriction_1, "testObject_FederationRestriction_1.json"), (testObject_FederationRestriction_2, "testObject_FederationRestriction_2.json"), (testObject_FederationRestriction_3, "testObject_FederationRestriction_3.json") ], - testGroup "ConversationRemoveMembers" $ - testObjects + testGroup "ConversationRemoveMembers" + $ testObjects [ (testObject_ConversationRemoveMembers_1, "testObject_ConversationRemoveMembers_1.json"), (testObject_ConversationRemoveMembers_2, "testObject_ConversationRemoveMembers_2.json"), (testObject_ConversationRemoveMembers_3, "testObject_ConversationRemoveMembers_3.json") ], - testGroup "UserEvent" $ - testObjects + testGroup "UserEvent" + $ testObjects [ (testObject_UserEvent_1, "testObject_UserEvent_1.json"), (testObject_UserEvent_2, "testObject_UserEvent_2.json"), (testObject_UserEvent_3, "testObject_UserEvent_3.json"), @@ -231,12 +231,12 @@ tests = (testObject_UserEvent_16, "testObject_UserEvent_16.json"), (testObject_UserEvent_17, "testObject_UserEvent_17.json") ], - testGroup "MLSPublicKeys" $ - testObjects + testGroup "MLSPublicKeys" + $ testObjects [ (testObject_MLSPublicKeys1, "testObject_MLSPublicKeys_1.json") ], - testGroup "MLSKeysByPurpose" $ - testObjects + testGroup "MLSKeysByPurpose" + $ testObjects [ (testObject_MLSKeysByPurpose1, "testObject_MLSKeysByPurpose_1.json") ] ] diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationDomainConfig.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationDomainConfig.hs index 6f06862589b..86a993e2fd3 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationDomainConfig.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationDomainConfig.hs @@ -33,8 +33,8 @@ testObject_FederationDomainConfig_2 = FederationDomainConfig (Domain "foo.exampl testObject_FederationDomainConfig_3 :: FederationDomainConfig testObject_FederationDomainConfig_3 = - FederationDomainConfig (Domain "foo.example.com") FullSearch $ - FederationRestrictionByTeam + FederationDomainConfig (Domain "foo.example.com") FullSearch + $ FederationRestrictionByTeam [ Id (fromJust (UUID.fromString "0000304a-0000-0d5e-0000-3fac00003993")), Id (fromJust (UUID.fromString "00003c90-0000-2207-0000-5249000018b1")) ] diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationStatus.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationStatus.hs index d5118663f59..70c782edca0 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationStatus.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/FederationStatus.hs @@ -31,8 +31,10 @@ testObject_FederationStatus_2 = NotConnectedDomains (Domain "d.example.com") (Do testObject_RemoteDomains_1 :: RemoteDomains testObject_RemoteDomains_1 = - RemoteDomains . Set.fromList $ - flip toRemoteUnsafe () <$> [Domain "a.example.com", Domain "b.example.com"] + RemoteDomains + . Set.fromList + $ flip toRemoteUnsafe () + <$> [Domain "a.example.com", Domain "b.example.com"] testObject_RemoteDomains_2 :: RemoteDomains testObject_RemoteDomains_2 = RemoteDomains mempty diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/QualifiedUserClientPrekeyMap.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/QualifiedUserClientPrekeyMap.hs index 8f25987a882..1ab16432b52 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/QualifiedUserClientPrekeyMap.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/QualifiedUserClientPrekeyMap.hs @@ -30,13 +30,14 @@ testObject_QualifiedUserClientPrekeyMap_1 = mkQualifiedUserClientPrekeyMap mempt testObject_QualifiedUserClientPrekeyMap_2 :: QualifiedUserClientPrekeyMap testObject_QualifiedUserClientPrekeyMap_2 = - mkQualifiedUserClientPrekeyMap . fromList $ - [ (Domain "alpha.example.com", testObject_UserClientPrekeyMap_1), - (Domain "beta.example.com", testObject_UserClientPrekeyMap_2), - (Domain "gamma.example.com", testObject_UserClientPrekeyMap_3), - (Domain "delta.example.com", testObject_UserClientPrekeyMap_4), - (Domain "epsilon.example.com", testObject_UserClientPrekeyMap_5), - (Domain "zeta.example.com", testObject_UserClientPrekeyMap_6), - (Domain "eta.example.com", testObject_UserClientPrekeyMap_7), - (Domain "theta.example.com", testObject_UserClientPrekeyMap_8) - ] + mkQualifiedUserClientPrekeyMap + . fromList + $ [ (Domain "alpha.example.com", testObject_UserClientPrekeyMap_1), + (Domain "beta.example.com", testObject_UserClientPrekeyMap_2), + (Domain "gamma.example.com", testObject_UserClientPrekeyMap_3), + (Domain "delta.example.com", testObject_UserClientPrekeyMap_4), + (Domain "epsilon.example.com", testObject_UserClientPrekeyMap_5), + (Domain "zeta.example.com", testObject_UserClientPrekeyMap_6), + (Domain "eta.example.com", testObject_UserClientPrekeyMap_7), + (Domain "theta.example.com", testObject_UserClientPrekeyMap_8) + ] diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs index 81b85c39424..d51bff46b56 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs @@ -28,8 +28,8 @@ tests :: TestTree tests = testGroup "Protobuf golden tests" - [ testCase "QualifiedNewOtrMessage" $ - protoTestObjects @Proto.Otr.QualifiedNewOtrMessage + [ testCase "QualifiedNewOtrMessage" + $ protoTestObjects @Proto.Otr.QualifiedNewOtrMessage [ ( testObject_QualifiedNewOtrMessage_user_1, "testObject_QualifiedNewOtrMessage_user_1.protobuf" ), diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Run.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Run.hs index 3ce3befcd26..15122f96c55 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Run.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Run.hs @@ -26,8 +26,8 @@ import Test.Wire.API.Golden.Protobuf qualified as Golden.Protobuf main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Golden.Generated.tests, Golden.Manual.tests, diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Runner.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Runner.hs index 6a458413d84..a7db1f7594d 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Runner.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Runner.hs @@ -147,7 +147,7 @@ testFromJSONFailureWithMsg msg path = do where failurePrefix = show (typeRep @a) <> ": FromJSON of " <> path -assertRight :: Show a => Either a b -> IO b +assertRight :: (Show a) => Either a b -> IO b assertRight = \case Left a -> assertFailure $ "Expected Right, got Left: " <> show a diff --git a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs index e98ae87e01f..1a8159a4bbc 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs @@ -54,16 +54,16 @@ import Wire.API.MLS.Welcome tests :: TestTree tests = - testGroup "MLS" $ - [ testCase "parse key package" testParseKeyPackage, - testCase "parse capabilities in key package" testParseKeyPackageWithCapabilities, - testCase "parse commit message" testParseCommit, - testCase "parse application message" testParseApplication, - testCase "parse welcome and groupinfo message" testParseWelcomeAndGroupInfo, - testCase "key package ref" testKeyPackageRef, - testCase "create signed remove proposal" testRemoveProposalMessageSignature, - testCase "parse client identity" testParseClientIdentity - ] + testGroup "MLS" + $ [ testCase "parse key package" testParseKeyPackage, + testCase "parse capabilities in key package" testParseKeyPackageWithCapabilities, + testCase "parse commit message" testParseCommit, + testCase "parse application message" testParseApplication, + testCase "parse welcome and groupinfo message" testParseWelcomeAndGroupInfo, + testCase "key package ref" testKeyPackageRef, + testCase "create signed remove proposal" testRemoveProposalMessageSignature, + testCase "parse client identity" testParseClientIdentity + ] testParseClientIdentity :: IO () testParseClientIdentity = do @@ -155,8 +155,8 @@ testParseWelcomeAndGroupInfo = do groupJSON <- spawn (cli qcid tmp ["group", "create", "Zm9v"]) Nothing kp <- spawn (cli qcid2 tmp ["key-package", "create"]) Nothing BS.writeFile (tmp "kp") kp - void $ - spawn + void + $ spawn ( cli qcid tmp @@ -249,8 +249,8 @@ testRemoveProposalMessageSignature = withSystemTempDirectory "mls" $ \tmp -> do BS.writeFile (tmp messageFilename) (raw (mkRawMLS message)) - void $ - spawn + void + $ spawn ( cli qcid tmp @@ -265,8 +265,8 @@ testRemoveProposalMessageSignature = withSystemTempDirectory "mls" $ \tmp -> do createGroup :: FilePath -> String -> String -> String -> GroupId -> IO () createGroup tmp store groupName removalKey gid = do groupJSON <- - liftIO $ - spawn + liftIO + $ spawn ( cli store tmp @@ -280,7 +280,7 @@ createGroup tmp store groupName removalKey gid = do Nothing liftIO $ BS.writeFile (tmp groupName) groupJSON -decodeMLSError :: ParseMLS a => ByteString -> a +decodeMLSError :: (ParseMLS a) => ByteString -> a decodeMLSError s = case decodeMLS' s of Left e -> error ("Could not parse MLS object: " <> Text.unpack e) Right x -> x @@ -293,7 +293,7 @@ userClientQid usr c = <> "@" <> T.unpack (domainText (qDomain usr)) -spawn :: HasCallStack => CreateProcess -> Maybe ByteString -> IO ByteString +spawn :: (HasCallStack) => CreateProcess -> Maybe ByteString -> IO ByteString spawn cp minput = do (mout, ex) <- withCreateProcess cp @@ -312,8 +312,9 @@ spawn cp minput = do cli :: String -> FilePath -> [String] -> CreateProcess cli store tmp args = - proc "mls-test-cli" $ - ["--store", tmp (store <> ".db")] <> args + proc "mls-test-cli" + $ ["--store", tmp (store <> ".db")] + <> args randomIdentity :: IO ClientIdentity randomIdentity = do diff --git a/libs/wire-api/test/unit/Test/Wire/API/OAuth.hs b/libs/wire-api/test/unit/Test/Wire/API/OAuth.hs index a7775f8af1b..8ee152914d6 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/OAuth.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/OAuth.hs @@ -27,11 +27,11 @@ import Wire.API.OAuth tests :: TestTree tests = - testGroup "Oauth" $ - [ testGroup "code challenge verification should succeed" $ - [ testCase "should" testCodeChallengeVerification - ] - ] + testGroup "Oauth" + $ [ testGroup "code challenge verification should succeed" + $ [ testCase "should" testCodeChallengeVerification + ] + ] testCodeChallengeVerification :: Assertion testCodeChallengeVerification = do diff --git a/libs/wire-api/test/unit/Test/Wire/API/Password.hs b/libs/wire-api/test/unit/Test/Wire/API/Password.hs index 43f5e5c7728..406599f7beb 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Password.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Password.hs @@ -26,11 +26,11 @@ import Wire.API.Password tests :: TestTree tests = - testGroup "Password" $ - [ testCase "hash password argon2id" testHashPasswordArgon2id, - testCase "update pwd hash" testUpdateHash, - testCase "verify old scrypt password still works" testHashingOldScrypt - ] + testGroup "Password" + $ [ testCase "hash password argon2id" testHashPasswordArgon2id, + testCase "update pwd hash" testUpdateHash, + testCase "verify old scrypt password still works" testHashingOldScrypt + ] testHashPasswordArgon2id :: IO () testHashPasswordArgon2id = do diff --git a/libs/wire-api/test/unit/Test/Wire/API/RawJson.hs b/libs/wire-api/test/unit/Test/Wire/API/RawJson.hs index 4d4e1788cf8..712d7009170 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/RawJson.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/RawJson.hs @@ -9,9 +9,9 @@ import Wire.API.RawJson tests :: TestTree tests = - testGroup "RawJson" $ - [ testProperty "MimeUnrender lifts any string to RawJson" testMimeUnrender - ] + testGroup "RawJson" + $ [ testProperty "MimeUnrender lifts any string to RawJson" testMimeUnrender + ] testMimeUnrender :: Property testMimeUnrender = diff --git a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/Aeson.hs b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/Aeson.hs index 5e464d36dec..550fc6e25da 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/Aeson.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/Aeson.hs @@ -81,268 +81,269 @@ import Wire.API.Wrapped qualified as Wrapped -- (either fixing Arbitrary or serialization instance) tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "JSON roundtrip tests" $ - [ testRoundTrip @Asset.AssetToken, - testRoundTrip @Asset.NewAssetToken, - testRoundTrip @Asset.AssetRetention, - testRoundTrip @Asset.AssetSettings, - testRoundTrip @Asset.AssetKey, - testRoundTrip @Asset.Asset, - testRoundTrip @Call.Config.TurnHost, - testRoundTrip @Call.Config.Scheme, - testRoundTrip @Call.Config.Transport, - testRoundTrip @Call.Config.TurnURI, - testRoundTrip @Call.Config.TurnUsername, - testRoundTrip @Call.Config.RTCIceServer, - testRoundTrip @Call.Config.RTCConfiguration, - testRoundTrip @Call.Config.SFTServer, - testRoundTrip @Connection.ConnectionRequest, - testRoundTrip @Connection.Relation, - testRoundTrip @Connection.UserConnection, - testRoundTrip @Connection.UserConnectionList, - testRoundTrip @Connection.ConnectionUpdate, - testRoundTrip @Conversation.Conversation, - testRoundTrip @(Conversation.ConversationList ConvId), - testRoundTrip @(Conversation.ConversationList Conversation.Conversation), - testRoundTrip @Conversation.Access, - testRoundTrip @Conversation.AccessRoleLegacy, - testRoundTrip @Conversation.AccessRole, - testRoundTrip @Conversation.ConvType, - testRoundTrip @Conversation.ReceiptMode, - testRoundTrip @Conversation.ConvTeamInfo, - testRoundTrip @Conversation.ConversationCoverView, - testRoundTrip @Conversation.Invite, - testRoundTrip @Conversation.ConversationRename, - testRoundTrip @Conversation.ConversationAccessData, - testRoundTrip @Conversation.ConversationReceiptModeUpdate, - testRoundTrip @Conversation.ConversationMessageTimerUpdate, - testRoundTrip @Conversation.ConversationMetadata, - testRoundTrip @Conversation.Bot.AddBot, - testRoundTrip @Conversation.Bot.AddBotResponse, - testRoundTrip @Conversation.Bot.RemoveBotResponse, - testRoundTrip @Conversation.Bot.UpdateBotPrekeys, - testRoundTrip @Conversation.Code.ConversationCode, - testRoundTrip @Conversation.Code.ConversationCodeInfo, - testRoundTrip @Conversation.Code.JoinConversationByCode, - testRoundTrip @Conversation.Code.CreateConversationCodeRequest, - testRoundTrip @Conversation.Member.MemberUpdate, - testRoundTrip @Conversation.Member.MutedStatus, - testRoundTrip @Conversation.Member.Member, - testRoundTrip @Conversation.Member.OtherMember, - testRoundTrip @Conversation.Member.ConvMembers, - testRoundTrip @Conversation.Member.OtherMemberUpdate, - testRoundTrip @Conversation.Role.RoleName, - testRoundTrip @Conversation.Role.Action, - testRoundTrip @Conversation.Role.ConversationRole, - testRoundTrip @Conversation.Role.ConversationRolesList, - testRoundTrip @Conversation.Typing.TypingStatus, - testRoundTrip @CustomBackend.CustomBackend, - testRoundTrip @EJPD.EJPDContact, - testRoundTrip @Event.Conversation.Event, - testRoundTrip @Event.Conversation.EventType, - testRoundTrip @Event.Conversation.SimpleMember, - testRoundTrip @Event.Conversation.SimpleMembers, - testRoundTrip @Event.Conversation.Connect, - testRoundTrip @Event.Conversation.MemberUpdateData, - testRoundTrip @Event.Conversation.OtrMessage, - testRoundTrip @Event.Team.Event, - testRoundTrip @Event.Team.EventType, - testRoundTrip @FederationDomainConfig.FederationDomainConfigs, - testRoundTrip @FederationDomainConfig.FederationStrategy, - testRoundTrip @FederationStatus.FederationStatus, - testRoundTrip @FederationStatus.RemoteDomains, - testRoundTrip @Message.Priority, - testRoundTrip @Message.OtrRecipients, - testRoundTrip @Message.NewOtrMessage, - testRoundTrip @Message.ClientMismatch, - testRoundTrip @OAuth.RedirectUrl, - testRoundTrip @OAuth.OAuthApplicationName, - testRoundTrip @OAuth.OAuthClientConfig, - testRoundTrip @OAuth.OAuthClient, - testRoundTrip @OAuth.CreateOAuthAuthorizationCodeRequest, - testRoundTrip @OAuth.OAuthAccessTokenRequest, - testRoundTrip @OAuth.OAuthApplication, - testRoundTrip @Properties.PropertyKey, - testRoundTrip @Provider.Provider, - testRoundTrip @Provider.ProviderProfile, - testRoundTrip @Provider.NewProvider, - testRoundTrip @Provider.NewProviderResponse, - testRoundTrip @Provider.UpdateProvider, - testRoundTrip @Provider.ProviderActivationResponse, - testRoundTrip @Provider.ProviderLogin, - testRoundTrip @Provider.DeleteProvider, - testRoundTrip @Provider.PasswordReset, - testRoundTrip @Provider.CompletePasswordReset, - testRoundTrip @Provider.PasswordChange, - testRoundTrip @Provider.EmailUpdate, - testRoundTrip @Provider.Bot.BotConvView, - testRoundTrip @Provider.Bot.BotUserView, - testRoundTrip @Provider.External.NewBotRequest, - testRoundTrip @Provider.External.NewBotResponse, - testRoundTrip @Provider.Service.ServiceRef, - testRoundTrip @Provider.Service.ServiceKeyPEM, - testRoundTrip @Provider.Service.ServiceKeyType, - testRoundTrip @Provider.Service.ServiceKey, - testRoundTrip @Provider.Service.ServiceToken, - testRoundTrip @Provider.Service.Service, - testRoundTrip @Provider.Service.ServiceProfile, - testRoundTrip @Provider.Service.ServiceProfilePage, - testRoundTrip @Provider.Service.NewService, - testRoundTrip @Provider.Service.NewServiceResponse, - testRoundTrip @Provider.Service.UpdateService, - testRoundTrip @Provider.Service.UpdateServiceConn, - testRoundTrip @Provider.Service.DeleteService, - testRoundTrip @Provider.Service.UpdateServiceWhitelist, - testRoundTrip @Provider.Service.Tag.ServiceTag, - testRoundTrip @Provider.Service.Tag.ServiceTagList, - testRoundTrip @Push.Token.Transport, - testRoundTrip @Push.Token.Token, - testRoundTrip @Push.Token.AppName, - testRoundTrip @Push.Token.PushToken, - testRoundTrip @Push.Token.PushTokenList, - testRoundTrip @Scim.CreateScimToken, - testRoundTrip @SystemSettings.SystemSettings, - testRoundTrip @SystemSettings.SystemSettingsPublic, - testRoundTrip @SystemSettings.SystemSettingsInternal, - testRoundTrip @Team.BindingNewTeam, - testRoundTrip @Team.TeamBinding, - testRoundTrip @Team.Team, - testRoundTrip @Team.TeamList, - testRoundTrip @Team.TeamUpdateData, - testRoundTrip @Team.TeamDeleteData, - testRoundTrip @Team.Conversation.TeamConversation, - testRoundTrip @Team.Conversation.TeamConversationList, - testRoundTrip @(Team.Feature.WithStatus Team.Feature.LegalholdConfig), - testRoundTrip @(Team.Feature.WithStatusPatch Team.Feature.LegalholdConfig), - testRoundTrip @(Team.Feature.WithStatusPatch Team.Feature.SelfDeletingMessagesConfig), - testRoundTrip @(Team.Feature.WithStatusNoLock Team.Feature.LegalholdConfig), - testRoundTrip @Team.Feature.AllFeatureConfigs, - testRoundTrip @Team.Feature.FeatureStatus, - testRoundTrip @Team.Feature.LockStatus, - testRoundTrip @Team.Invitation.InvitationRequest, - testRoundTrip @Team.Invitation.Invitation, - testRoundTrip @Team.Invitation.InvitationList, - testRoundTrip @Team.LegalHold.ViewLegalHoldServiceInfo, - testRoundTrip @Team.LegalHold.NewLegalHoldService, - testRoundTrip @Team.LegalHold.ViewLegalHoldService, - testRoundTrip @Team.LegalHold.UserLegalHoldStatusResponse, - testRoundTrip @Team.LegalHold.RemoveLegalHoldSettingsRequest, - testRoundTrip @Team.LegalHold.DisableLegalHoldForUserRequest, - testRoundTrip @Team.LegalHold.ApproveLegalHoldForUserRequest, - testRoundTrip @Team.LegalHold.External.RequestNewLegalHoldClient, - testRoundTrip @Team.LegalHold.External.NewLegalHoldClient, - testRoundTrip @Team.LegalHold.External.LegalHoldServiceConfirm, - testRoundTrip @Team.LegalHold.External.LegalHoldServiceRemove, - testRoundTrip @Team.LegalHold.LegalholdProtectee, - testRoundTrip @Team.Member.TeamMember, - testRoundTrip @Team.Member.ListType, - testRoundTrip @Team.Member.NewListType, - testRoundTrip @Team.Member.TeamMemberList, - testRoundTrip @Team.Member.NewTeamMember, - testRoundTrip @Team.Member.TeamMemberDeleteData, - testRoundTrip @Team.Permission.Permissions, - testRoundTrip @Team.Role.Role, - testRoundTrip @Team.SearchVisibility.TeamSearchVisibility, - testRoundTrip @Team.SearchVisibility.TeamSearchVisibilityView, - testRoundTrip @User.NameUpdate, - testRoundTrip @User.NewUser, - testRoundTrip @User.NewUserPublic, - testRoundTrip @User.UserIdList, - testRoundTrip @(User.LimitedQualifiedUserIdList 20), - testRoundTrip @User.UserProfile, - testRoundTrip @User.User, - testRoundTrip @User.UserSet, - testRoundTrip @User.SelfProfile, - testRoundTrip @User.InvitationCode, - testRoundTrip @User.BindingNewTeamUser, - -- FUTUREWORK: this should probably be tested individually, - -- but NewUserOrigin doesn't have JSON instances, just plain functions. - -- testRoundTrip @User.NewUserOrigin, - testRoundTrip @User.UserUpdate, - testRoundTrip @User.PasswordChange, - testRoundTrip @User.LocaleUpdate, - testRoundTrip @User.EmailUpdate, - testRoundTrip @User.PhoneUpdate, - testRoundTrip @User.HandleUpdate, - testRoundTrip @User.DeleteUser, - testRoundTrip @User.VerifyDeleteUser, - testRoundTrip @User.DeletionCodeTimeout, - testRoundTrip @User.VerificationAction, - testRoundTrip @User.SendVerificationCode, - testRoundTrip @User.Activation.ActivationKey, - -- FUTUREWORK: this should probably be tested individually, - -- but ActivationTarget currently doesn't have JSON instances itself. - -- testRoundTrip @User.Activation.ActivationTarget, - testRoundTrip @User.Activation.ActivationCode, - testRoundTrip @User.Activation.Activate, - testRoundTrip @User.Activation.ActivationResponse, - testRoundTrip @User.Activation.SendActivationCode, - testRoundTrip @User.Auth.LoginId, - testRoundTrip @User.Auth.LoginCode, - testRoundTrip @User.Auth.PendingLoginCode, - testRoundTrip @User.Auth.SendLoginCode, - testRoundTrip @User.Auth.LoginCodeTimeout, - testRoundTrip @User.Auth.CookieLabel, - testRoundTrip @User.Auth.Login, - testRoundTrip @User.Auth.CookieId, - testRoundTrip @User.Auth.CookieType, - testRoundTrip @(User.Auth.Cookie ()), - testRoundTrip @User.Auth.CookieList, - testRoundTrip @User.Auth.RemoveCookies, - testRoundTrip @User.Auth.TokenType, - testRoundTrip @User.Auth.AccessToken, - testRoundTrip @(User.Client.UserClientMap Int), - testRoundTrip @User.Client.UserClients, - testRoundTrip @User.Client.UserClientsFull, - testRoundTrip @User.Client.ClientType, - testRoundTrip @User.Client.ClientClass, - testRoundTrip @User.Client.PubClient, - testRoundTrip @User.Client.Client, - testRoundTrip @User.Client.NewClient, - testRoundTrip @User.Client.UpdateClient, - testRoundTripWithSwagger @User.Client.ClientCapability, - testRoundTripWithSwagger @User.Client.ClientCapabilityList, - testRoundTrip @User.Client.RmClient, - testRoundTrip @User.Client.Prekey.LastPrekey, - testRoundTrip @User.Client.Prekey.PrekeyId, - testRoundTrip @User.Client.Prekey.Prekey, - testRoundTrip @User.Client.Prekey.ClientPrekey, - testRoundTrip @User.Client.Prekey.PrekeyBundle, - testRoundTrip @User.Handle.UserHandleInfo, - testRoundTrip @User.Handle.CheckHandles, - testRoundTrip @User.Identity.Email, - testRoundTrip @User.Identity.Phone, - testRoundTrip @User.Identity.UserSSOId, - testRoundTrip @User.Password.NewPasswordReset, - testRoundTrip @User.Password.PasswordResetKey, - -- FUTUREWORK: this should probably be tested individually, - -- but PasswordResetIdentity currently doesn't have JSON instances itself. - -- testRoundTrip @User.Password.PasswordResetIdentity, - testRoundTrip @User.Password.PasswordResetCode, - testRoundTrip @User.Password.CompletePasswordReset, - testRoundTrip @User.Profile.Pict, - testRoundTrip @User.Profile.Name, - testRoundTrip @User.Profile.ColourId, - testRoundTrip @User.Profile.AssetSize, - testRoundTrip @User.Profile.Asset, - testRoundTrip @User.Profile.Locale, - testRoundTrip @User.Profile.ManagedBy, - testRoundTrip @User.RichInfo.RichField, - testRoundTrip @User.RichInfo.RichInfoAssocList, - testRoundTrip @User.RichInfo.RichInfo, - testRoundTrip @(User.Search.SearchResult User.Search.TeamContact), - testRoundTrip @User.Search.PagingState, - testRoundTrip @User.Search.TeamContact, - testRoundTrip @(Wrapped.Wrapped "some_int" Int), - testRoundTrip @Conversation.Action.SomeConversationAction, - testRoundTrip @Routes.Version.Version, - testRoundTrip @Routes.Version.VersionNumber, - testRoundTrip @TeamsIntra.GuardLegalholdPolicyConflicts, - testRoundTrip @TeamsIntra.TeamStatus, - testRoundTrip @TeamsIntra.TeamStatusUpdate, - testRoundTrip @TeamsIntra.TeamData, - testRoundTrip @TeamsIntra.TeamName - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "JSON roundtrip tests" + $ [ testRoundTrip @Asset.AssetToken, + testRoundTrip @Asset.NewAssetToken, + testRoundTrip @Asset.AssetRetention, + testRoundTrip @Asset.AssetSettings, + testRoundTrip @Asset.AssetKey, + testRoundTrip @Asset.Asset, + testRoundTrip @Call.Config.TurnHost, + testRoundTrip @Call.Config.Scheme, + testRoundTrip @Call.Config.Transport, + testRoundTrip @Call.Config.TurnURI, + testRoundTrip @Call.Config.TurnUsername, + testRoundTrip @Call.Config.RTCIceServer, + testRoundTrip @Call.Config.RTCConfiguration, + testRoundTrip @Call.Config.SFTServer, + testRoundTrip @Connection.ConnectionRequest, + testRoundTrip @Connection.Relation, + testRoundTrip @Connection.UserConnection, + testRoundTrip @Connection.UserConnectionList, + testRoundTrip @Connection.ConnectionUpdate, + testRoundTrip @Conversation.Conversation, + testRoundTrip @(Conversation.ConversationList ConvId), + testRoundTrip @(Conversation.ConversationList Conversation.Conversation), + testRoundTrip @Conversation.Access, + testRoundTrip @Conversation.AccessRoleLegacy, + testRoundTrip @Conversation.AccessRole, + testRoundTrip @Conversation.ConvType, + testRoundTrip @Conversation.ReceiptMode, + testRoundTrip @Conversation.ConvTeamInfo, + testRoundTrip @Conversation.ConversationCoverView, + testRoundTrip @Conversation.Invite, + testRoundTrip @Conversation.ConversationRename, + testRoundTrip @Conversation.ConversationAccessData, + testRoundTrip @Conversation.ConversationReceiptModeUpdate, + testRoundTrip @Conversation.ConversationMessageTimerUpdate, + testRoundTrip @Conversation.ConversationMetadata, + testRoundTrip @Conversation.Bot.AddBot, + testRoundTrip @Conversation.Bot.AddBotResponse, + testRoundTrip @Conversation.Bot.RemoveBotResponse, + testRoundTrip @Conversation.Bot.UpdateBotPrekeys, + testRoundTrip @Conversation.Code.ConversationCode, + testRoundTrip @Conversation.Code.ConversationCodeInfo, + testRoundTrip @Conversation.Code.JoinConversationByCode, + testRoundTrip @Conversation.Code.CreateConversationCodeRequest, + testRoundTrip @Conversation.Member.MemberUpdate, + testRoundTrip @Conversation.Member.MutedStatus, + testRoundTrip @Conversation.Member.Member, + testRoundTrip @Conversation.Member.OtherMember, + testRoundTrip @Conversation.Member.ConvMembers, + testRoundTrip @Conversation.Member.OtherMemberUpdate, + testRoundTrip @Conversation.Role.RoleName, + testRoundTrip @Conversation.Role.Action, + testRoundTrip @Conversation.Role.ConversationRole, + testRoundTrip @Conversation.Role.ConversationRolesList, + testRoundTrip @Conversation.Typing.TypingStatus, + testRoundTrip @CustomBackend.CustomBackend, + testRoundTrip @EJPD.EJPDContact, + testRoundTrip @Event.Conversation.Event, + testRoundTrip @Event.Conversation.EventType, + testRoundTrip @Event.Conversation.SimpleMember, + testRoundTrip @Event.Conversation.SimpleMembers, + testRoundTrip @Event.Conversation.Connect, + testRoundTrip @Event.Conversation.MemberUpdateData, + testRoundTrip @Event.Conversation.OtrMessage, + testRoundTrip @Event.Team.Event, + testRoundTrip @Event.Team.EventType, + testRoundTrip @FederationDomainConfig.FederationDomainConfigs, + testRoundTrip @FederationDomainConfig.FederationStrategy, + testRoundTrip @FederationStatus.FederationStatus, + testRoundTrip @FederationStatus.RemoteDomains, + testRoundTrip @Message.Priority, + testRoundTrip @Message.OtrRecipients, + testRoundTrip @Message.NewOtrMessage, + testRoundTrip @Message.ClientMismatch, + testRoundTrip @OAuth.RedirectUrl, + testRoundTrip @OAuth.OAuthApplicationName, + testRoundTrip @OAuth.OAuthClientConfig, + testRoundTrip @OAuth.OAuthClient, + testRoundTrip @OAuth.CreateOAuthAuthorizationCodeRequest, + testRoundTrip @OAuth.OAuthAccessTokenRequest, + testRoundTrip @OAuth.OAuthApplication, + testRoundTrip @Properties.PropertyKey, + testRoundTrip @Provider.Provider, + testRoundTrip @Provider.ProviderProfile, + testRoundTrip @Provider.NewProvider, + testRoundTrip @Provider.NewProviderResponse, + testRoundTrip @Provider.UpdateProvider, + testRoundTrip @Provider.ProviderActivationResponse, + testRoundTrip @Provider.ProviderLogin, + testRoundTrip @Provider.DeleteProvider, + testRoundTrip @Provider.PasswordReset, + testRoundTrip @Provider.CompletePasswordReset, + testRoundTrip @Provider.PasswordChange, + testRoundTrip @Provider.EmailUpdate, + testRoundTrip @Provider.Bot.BotConvView, + testRoundTrip @Provider.Bot.BotUserView, + testRoundTrip @Provider.External.NewBotRequest, + testRoundTrip @Provider.External.NewBotResponse, + testRoundTrip @Provider.Service.ServiceRef, + testRoundTrip @Provider.Service.ServiceKeyPEM, + testRoundTrip @Provider.Service.ServiceKeyType, + testRoundTrip @Provider.Service.ServiceKey, + testRoundTrip @Provider.Service.ServiceToken, + testRoundTrip @Provider.Service.Service, + testRoundTrip @Provider.Service.ServiceProfile, + testRoundTrip @Provider.Service.ServiceProfilePage, + testRoundTrip @Provider.Service.NewService, + testRoundTrip @Provider.Service.NewServiceResponse, + testRoundTrip @Provider.Service.UpdateService, + testRoundTrip @Provider.Service.UpdateServiceConn, + testRoundTrip @Provider.Service.DeleteService, + testRoundTrip @Provider.Service.UpdateServiceWhitelist, + testRoundTrip @Provider.Service.Tag.ServiceTag, + testRoundTrip @Provider.Service.Tag.ServiceTagList, + testRoundTrip @Push.Token.Transport, + testRoundTrip @Push.Token.Token, + testRoundTrip @Push.Token.AppName, + testRoundTrip @Push.Token.PushToken, + testRoundTrip @Push.Token.PushTokenList, + testRoundTrip @Scim.CreateScimToken, + testRoundTrip @SystemSettings.SystemSettings, + testRoundTrip @SystemSettings.SystemSettingsPublic, + testRoundTrip @SystemSettings.SystemSettingsInternal, + testRoundTrip @Team.BindingNewTeam, + testRoundTrip @Team.TeamBinding, + testRoundTrip @Team.Team, + testRoundTrip @Team.TeamList, + testRoundTrip @Team.TeamUpdateData, + testRoundTrip @Team.TeamDeleteData, + testRoundTrip @Team.Conversation.TeamConversation, + testRoundTrip @Team.Conversation.TeamConversationList, + testRoundTrip @(Team.Feature.WithStatus Team.Feature.LegalholdConfig), + testRoundTrip @(Team.Feature.WithStatusPatch Team.Feature.LegalholdConfig), + testRoundTrip @(Team.Feature.WithStatusPatch Team.Feature.SelfDeletingMessagesConfig), + testRoundTrip @(Team.Feature.WithStatusNoLock Team.Feature.LegalholdConfig), + testRoundTrip @Team.Feature.AllFeatureConfigs, + testRoundTrip @Team.Feature.FeatureStatus, + testRoundTrip @Team.Feature.LockStatus, + testRoundTrip @Team.Invitation.InvitationRequest, + testRoundTrip @Team.Invitation.Invitation, + testRoundTrip @Team.Invitation.InvitationList, + testRoundTrip @Team.LegalHold.ViewLegalHoldServiceInfo, + testRoundTrip @Team.LegalHold.NewLegalHoldService, + testRoundTrip @Team.LegalHold.ViewLegalHoldService, + testRoundTrip @Team.LegalHold.UserLegalHoldStatusResponse, + testRoundTrip @Team.LegalHold.RemoveLegalHoldSettingsRequest, + testRoundTrip @Team.LegalHold.DisableLegalHoldForUserRequest, + testRoundTrip @Team.LegalHold.ApproveLegalHoldForUserRequest, + testRoundTrip @Team.LegalHold.External.RequestNewLegalHoldClient, + testRoundTrip @Team.LegalHold.External.NewLegalHoldClient, + testRoundTrip @Team.LegalHold.External.LegalHoldServiceConfirm, + testRoundTrip @Team.LegalHold.External.LegalHoldServiceRemove, + testRoundTrip @Team.LegalHold.LegalholdProtectee, + testRoundTrip @Team.Member.TeamMember, + testRoundTrip @Team.Member.ListType, + testRoundTrip @Team.Member.NewListType, + testRoundTrip @Team.Member.TeamMemberList, + testRoundTrip @Team.Member.NewTeamMember, + testRoundTrip @Team.Member.TeamMemberDeleteData, + testRoundTrip @Team.Permission.Permissions, + testRoundTrip @Team.Role.Role, + testRoundTrip @Team.SearchVisibility.TeamSearchVisibility, + testRoundTrip @Team.SearchVisibility.TeamSearchVisibilityView, + testRoundTrip @User.NameUpdate, + testRoundTrip @User.NewUser, + testRoundTrip @User.NewUserPublic, + testRoundTrip @User.UserIdList, + testRoundTrip @(User.LimitedQualifiedUserIdList 20), + testRoundTrip @User.UserProfile, + testRoundTrip @User.User, + testRoundTrip @User.UserSet, + testRoundTrip @User.SelfProfile, + testRoundTrip @User.InvitationCode, + testRoundTrip @User.BindingNewTeamUser, + -- FUTUREWORK: this should probably be tested individually, + -- but NewUserOrigin doesn't have JSON instances, just plain functions. + -- testRoundTrip @User.NewUserOrigin, + testRoundTrip @User.UserUpdate, + testRoundTrip @User.PasswordChange, + testRoundTrip @User.LocaleUpdate, + testRoundTrip @User.EmailUpdate, + testRoundTrip @User.PhoneUpdate, + testRoundTrip @User.HandleUpdate, + testRoundTrip @User.DeleteUser, + testRoundTrip @User.VerifyDeleteUser, + testRoundTrip @User.DeletionCodeTimeout, + testRoundTrip @User.VerificationAction, + testRoundTrip @User.SendVerificationCode, + testRoundTrip @User.Activation.ActivationKey, + -- FUTUREWORK: this should probably be tested individually, + -- but ActivationTarget currently doesn't have JSON instances itself. + -- testRoundTrip @User.Activation.ActivationTarget, + testRoundTrip @User.Activation.ActivationCode, + testRoundTrip @User.Activation.Activate, + testRoundTrip @User.Activation.ActivationResponse, + testRoundTrip @User.Activation.SendActivationCode, + testRoundTrip @User.Auth.LoginId, + testRoundTrip @User.Auth.LoginCode, + testRoundTrip @User.Auth.PendingLoginCode, + testRoundTrip @User.Auth.SendLoginCode, + testRoundTrip @User.Auth.LoginCodeTimeout, + testRoundTrip @User.Auth.CookieLabel, + testRoundTrip @User.Auth.Login, + testRoundTrip @User.Auth.CookieId, + testRoundTrip @User.Auth.CookieType, + testRoundTrip @(User.Auth.Cookie ()), + testRoundTrip @User.Auth.CookieList, + testRoundTrip @User.Auth.RemoveCookies, + testRoundTrip @User.Auth.TokenType, + testRoundTrip @User.Auth.AccessToken, + testRoundTrip @(User.Client.UserClientMap Int), + testRoundTrip @User.Client.UserClients, + testRoundTrip @User.Client.UserClientsFull, + testRoundTrip @User.Client.ClientType, + testRoundTrip @User.Client.ClientClass, + testRoundTrip @User.Client.PubClient, + testRoundTrip @User.Client.Client, + testRoundTrip @User.Client.NewClient, + testRoundTrip @User.Client.UpdateClient, + testRoundTripWithSwagger @User.Client.ClientCapability, + testRoundTripWithSwagger @User.Client.ClientCapabilityList, + testRoundTrip @User.Client.RmClient, + testRoundTrip @User.Client.Prekey.LastPrekey, + testRoundTrip @User.Client.Prekey.PrekeyId, + testRoundTrip @User.Client.Prekey.Prekey, + testRoundTrip @User.Client.Prekey.ClientPrekey, + testRoundTrip @User.Client.Prekey.PrekeyBundle, + testRoundTrip @User.Handle.UserHandleInfo, + testRoundTrip @User.Handle.CheckHandles, + testRoundTrip @User.Identity.Email, + testRoundTrip @User.Identity.Phone, + testRoundTrip @User.Identity.UserSSOId, + testRoundTrip @User.Password.NewPasswordReset, + testRoundTrip @User.Password.PasswordResetKey, + -- FUTUREWORK: this should probably be tested individually, + -- but PasswordResetIdentity currently doesn't have JSON instances itself. + -- testRoundTrip @User.Password.PasswordResetIdentity, + testRoundTrip @User.Password.PasswordResetCode, + testRoundTrip @User.Password.CompletePasswordReset, + testRoundTrip @User.Profile.Pict, + testRoundTrip @User.Profile.Name, + testRoundTrip @User.Profile.ColourId, + testRoundTrip @User.Profile.AssetSize, + testRoundTrip @User.Profile.Asset, + testRoundTrip @User.Profile.Locale, + testRoundTrip @User.Profile.ManagedBy, + testRoundTrip @User.RichInfo.RichField, + testRoundTrip @User.RichInfo.RichInfoAssocList, + testRoundTrip @User.RichInfo.RichInfo, + testRoundTrip @(User.Search.SearchResult User.Search.TeamContact), + testRoundTrip @User.Search.PagingState, + testRoundTrip @User.Search.TeamContact, + testRoundTrip @(Wrapped.Wrapped "some_int" Int), + testRoundTrip @Conversation.Action.SomeConversationAction, + testRoundTrip @Routes.Version.Version, + testRoundTrip @Routes.Version.VersionNumber, + testRoundTrip @TeamsIntra.GuardLegalholdPolicyConflicts, + testRoundTrip @TeamsIntra.TeamStatus, + testRoundTrip @TeamsIntra.TeamStatusUpdate, + testRoundTrip @TeamsIntra.TeamData, + testRoundTrip @TeamsIntra.TeamName + ] testRoundTrip :: forall a. @@ -352,8 +353,9 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v testRoundTripWithSwagger :: forall a. @@ -364,12 +366,13 @@ testRoundTripWithSwagger = testProperty msg (trip .&&. scm) msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v scm (v :: a) = counterexample - ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" $ - validatePrettyToJSON v + ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" + $ validatePrettyToJSON v ) $ isNothing (validatePrettyToJSON v) diff --git a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/ByteString.hs b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/ByteString.hs index 2ecbfa31def..637046094f8 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/ByteString.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/ByteString.hs @@ -46,48 +46,49 @@ import Wire.Arbitrary qualified as Arbitrary () tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "ByteString roundtrip tests" $ - [ testRoundTrip @Asset.AssetKey, - testRoundTrip @Asset.AssetRetention, - testRoundTrip @Asset.AssetToken, - testRoundTrip @Call.Config.Scheme, - testRoundTrip @Call.Config.Transport, - testRoundTrip @Call.Config.TurnHost, - testRoundTrip @Call.Config.TurnURI, - testRoundTrip @Conversation.Code.Key, - testRoundTrip @Conversation.Code.Value, - testRoundTrip @Conversation.Role.RoleName, - testRoundTrip @Properties.PropertyKey, - testRoundTrip @Provider.HttpsUrl, - testRoundTrip @Provider.Service.ServiceKeyPEM, - testRoundTrip @Provider.Service.ServiceToken, - testRoundTrip @(Provider.Service.Tag.QueryAllTags 3 5), - testRoundTrip @(Provider.Service.Tag.QueryAnyTags 3 5), - testRoundTrip @Provider.Service.Tag.ServiceTag, - testRoundTrip @Push.V2.Token.Token, - testRoundTrip @Team.Feature.FeatureTTL, - testRoundTrip @Team.Feature.FeatureStatus, - testRoundTrip @User.Activation.ActivationCode, - testRoundTrip @User.Activation.ActivationKey, - testRoundTrip @User.Auth.CookieLabel, - testRoundTrip @User.Identity.Email, - testRoundTrip @User.Identity.Phone, - testRoundTrip @User.InvitationCode, - testRoundTrip @User.Password.PasswordResetCode, - testRoundTrip @User.Password.PasswordResetKey, - testRoundTrip @User.Profile.ManagedBy, - testRoundTrip @User.Profile.Name, - testRoundTrip @Team.Role.Role, - testRoundTrip @User.Search.PagingState, - testRoundTrip @User.Search.TeamUserSearchSortBy, - testRoundTrip @User.Search.TeamUserSearchSortOrder, - testRoundTrip @User.Search.RoleFilter, - testRoundTrip @User.IdentityProvider.WireIdPAPIVersion, - testRoundTrip @OAuth.OAuthScope - -- FUTUREWORK: - -- testCase "Call.Config.TurnUsername (doesn't have FromByteString)" ... - -- testCase "User.Activation.ActivationTarget (doesn't have FromByteString)" ... - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "ByteString roundtrip tests" + $ [ testRoundTrip @Asset.AssetKey, + testRoundTrip @Asset.AssetRetention, + testRoundTrip @Asset.AssetToken, + testRoundTrip @Call.Config.Scheme, + testRoundTrip @Call.Config.Transport, + testRoundTrip @Call.Config.TurnHost, + testRoundTrip @Call.Config.TurnURI, + testRoundTrip @Conversation.Code.Key, + testRoundTrip @Conversation.Code.Value, + testRoundTrip @Conversation.Role.RoleName, + testRoundTrip @Properties.PropertyKey, + testRoundTrip @Provider.HttpsUrl, + testRoundTrip @Provider.Service.ServiceKeyPEM, + testRoundTrip @Provider.Service.ServiceToken, + testRoundTrip @(Provider.Service.Tag.QueryAllTags 3 5), + testRoundTrip @(Provider.Service.Tag.QueryAnyTags 3 5), + testRoundTrip @Provider.Service.Tag.ServiceTag, + testRoundTrip @Push.V2.Token.Token, + testRoundTrip @Team.Feature.FeatureTTL, + testRoundTrip @Team.Feature.FeatureStatus, + testRoundTrip @User.Activation.ActivationCode, + testRoundTrip @User.Activation.ActivationKey, + testRoundTrip @User.Auth.CookieLabel, + testRoundTrip @User.Identity.Email, + testRoundTrip @User.Identity.Phone, + testRoundTrip @User.InvitationCode, + testRoundTrip @User.Password.PasswordResetCode, + testRoundTrip @User.Password.PasswordResetKey, + testRoundTrip @User.Profile.ManagedBy, + testRoundTrip @User.Profile.Name, + testRoundTrip @Team.Role.Role, + testRoundTrip @User.Search.PagingState, + testRoundTrip @User.Search.TeamUserSearchSortBy, + testRoundTrip @User.Search.TeamUserSearchSortOrder, + testRoundTrip @User.Search.RoleFilter, + testRoundTrip @User.IdentityProvider.WireIdPAPIVersion, + testRoundTrip @OAuth.OAuthScope + -- FUTUREWORK: + -- testCase "Call.Config.TurnUsername (doesn't have FromByteString)" ... + -- testCase "User.Activation.ActivationTarget (doesn't have FromByteString)" ... + ] testRoundTrip :: forall a. @@ -97,5 +98,6 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toByteString' v) $ - Just v === (fromByteString . toByteString') v + counterexample (show $ toByteString' v) + $ Just v + === (fromByteString . toByteString') v diff --git a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/CSV.hs b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/CSV.hs index 3844143e128..944f0c90a6b 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/CSV.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/CSV.hs @@ -28,8 +28,9 @@ import Wire.API.Team.Export qualified as Team.Export tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "CSV roundtrip tests" $ - [testRoundTrip @Team.Export.TeamExportUser] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "CSV roundtrip tests" + $ [testRoundTrip @Team.Export.TeamExportUser] testRoundTrip :: forall a. @@ -40,8 +41,9 @@ testRoundTrip = testProperty msg trip msg = show (typeRep @[a]) trip (v :: [a]) = - counterexample (show $ encodeCSV v) $ - Right v === (decodeCSV . encodeCSV) v + counterexample (show $ encodeCSV v) + $ Right v + === (decodeCSV . encodeCSV) v encodeCSV :: [a] -> LByteString encodeCSV = encodeDefaultOrderedByName diff --git a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/HttpApiData.hs b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/HttpApiData.hs index 248d1815ecc..654fbe37cbb 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/HttpApiData.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/HttpApiData.hs @@ -29,12 +29,13 @@ import Wire.Arbitrary qualified as Arbitrary () tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "HttpApiData roundtrip tests" $ - [ testRoundTrip @Wire.API.User.InvitationCode, - testRoundTrip @Wire.API.User.Search.PagingState, - testRoundTrip @Wire.API.Routes.Version.Version, - testRoundTrip @Wire.API.Routes.Version.VersionNumber - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "HttpApiData roundtrip tests" + $ [ testRoundTrip @Wire.API.User.InvitationCode, + testRoundTrip @Wire.API.User.Search.PagingState, + testRoundTrip @Wire.API.Routes.Version.Version, + testRoundTrip @Wire.API.Routes.Version.VersionNumber + ] testRoundTrip :: forall a. @@ -44,5 +45,6 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ v) $ - Right v === (parseQueryParam . toQueryParam) v + counterexample (show $ v) + $ Right v + === (parseQueryParam . toQueryParam) v diff --git a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/MLS.hs b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/MLS.hs index d8b6ec7f552..644adb8b6a3 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/MLS.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Roundtrip/MLS.hs @@ -38,24 +38,25 @@ import Wire.API.MLS.Welcome tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "MLS roundtrip tests" $ - [ testRoundTrip @KeyPackageRef, - testRoundTrip @LeafNode, - testRoundTrip @LeafNodeCore, - testRoundTrip @KeyPackageTBS, - testRoundTrip @Credential, - testRoundTrip @ClientIdentity, - testRoundTrip @TestPreconfiguredSender, - testRoundTrip @RemoveProposalMessage, - testRoundTrip @RemoveProposalPayload, - testRoundTrip @ExtensionVector, - testRoundTrip @GroupInfoData, - testRoundTrip @TestCommitBundle, - testRoundTrip @Welcome, - testRoundTrip @Proposal, - testRoundTrip @ProposalRef, - testRoundTrip @VarInt - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "MLS roundtrip tests" + $ [ testRoundTrip @KeyPackageRef, + testRoundTrip @LeafNode, + testRoundTrip @LeafNodeCore, + testRoundTrip @KeyPackageTBS, + testRoundTrip @Credential, + testRoundTrip @ClientIdentity, + testRoundTrip @TestPreconfiguredSender, + testRoundTrip @RemoveProposalMessage, + testRoundTrip @RemoveProposalPayload, + testRoundTrip @ExtensionVector, + testRoundTrip @GroupInfoData, + testRoundTrip @TestCommitBundle, + testRoundTrip @Welcome, + testRoundTrip @Proposal, + testRoundTrip @ProposalRef, + testRoundTrip @VarInt + ] testRoundTrip :: forall a. @@ -67,8 +68,9 @@ testRoundTrip = testProperty msg trip trip (v :: a) = let serialised = encodeMLS v parsed = decodeMLS serialised - in counterexample (show $ hex serialised) $ - Right v === parsed + in counterexample (show $ hex serialised) + $ Right v + === parsed -------------------------------------------------------------------------------- -- auxiliary types @@ -88,7 +90,7 @@ class ArbitraryFramedContent a where newtype MessageGenerator fc = MessageGenerator {unMessageGenerator :: Message} deriving newtype (ParseMLS, SerialiseMLS, Eq, Show) -instance ArbitraryFramedContent fc => Arbitrary (MessageGenerator fc) where +instance (ArbitraryFramedContent fc) => Arbitrary (MessageGenerator fc) where arbitrary = fmap MessageGenerator $ do fc <- arbitraryFramedContent @fc @@ -177,7 +179,8 @@ instance Arbitrary TestCommitBundle where arbitrary = TestCommitBundle <$> do commitMsg <- - mkRawMLS . unMessageGenerator @(FramedContentGenerator Sender CommitPayload) + mkRawMLS + . unMessageGenerator @(FramedContentGenerator Sender CommitPayload) <$> arbitrary welcome <- arbitrary CommitBundle commitMsg welcome <$> arbitrary diff --git a/libs/wire-api/test/unit/Test/Wire/API/Routes.hs b/libs/wire-api/test/unit/Test/Wire/API/Routes.hs index 6e9888e6d6c..c209f7cec3f 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Routes.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Routes.hs @@ -27,8 +27,8 @@ import Wire.API.Routes.QualifiedCapture tests :: T.TestTree tests = - T.testGroup "Routes" $ - [T.testGroup "QualifiedCapture" [testCase "must expose the captures in metrics" qualifiedCaptureMetrics]] + T.testGroup "Routes" + $ [T.testGroup "QualifiedCapture" [testCase "must expose the captures in metrics" qualifiedCaptureMetrics]] type QualifiedCaptureAPI = "users" :> QualifiedCapture' '[] "uid" Int :> Get '[] Int diff --git a/libs/wire-api/test/unit/Test/Wire/API/Routes/Version.hs b/libs/wire-api/test/unit/Test/Wire/API/Routes/Version.hs index b6224933398..04992f01b0f 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Routes/Version.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Routes/Version.hs @@ -29,21 +29,21 @@ tests = testCase "toHeader" $ fmap toLower . show <$> allVersions @=? cs . toHeader <$> allVersions, testCase "toQueryParam" $ fmap toLower . show <$> allVersions @=? cs . toQueryParam <$> allVersions ], - testGroup "VersionNumber: all serializations are the same as `tail . show . fromVersionNumber`, up to string type" $ - [ testCase "toByteString'" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toByteString' <$> allVersionNumbers, - testCase "encode" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . encode <$> allVersionNumbers, - testCase "toUrlPiece" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toUrlPiece <$> allVersionNumbers, - testCase "toEncodedUrlPiece" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toLazyByteString . toEncodedUrlPiece <$> allVersionNumbers, - testCase "toHeader" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toHeader <$> allVersionNumbers, - testCase "toQueryParam" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toQueryParam <$> allVersionNumbers - ], - testGroup "Version: maxAvailableVersion" $ - [ testCase "no version disable" $ maxAvailableVersion mempty @=? Just (maximum allVersions), - testCase "all versions disabled" $ maxAvailableVersion (Set.fromList allVersions) @=? Nothing, - testCase "all but the min version disabled" $ maxAvailableVersion (Set.fromList (tail allVersions)) @=? Just (minimum allVersions), - testCase "all but the max version disabled" $ maxAvailableVersion (Set.fromList (init allVersions)) @=? Just (maximum allVersions), - testCase "highest version disabled" $ maxAvailableVersion (Set.singleton (last allVersions)) @=? Just (maximum (init allVersions)) - ] + testGroup "VersionNumber: all serializations are the same as `tail . show . fromVersionNumber`, up to string type" + $ [ testCase "toByteString'" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toByteString' <$> allVersionNumbers, + testCase "encode" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . encode <$> allVersionNumbers, + testCase "toUrlPiece" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toUrlPiece <$> allVersionNumbers, + testCase "toEncodedUrlPiece" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toLazyByteString . toEncodedUrlPiece <$> allVersionNumbers, + testCase "toHeader" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toHeader <$> allVersionNumbers, + testCase "toQueryParam" $ tail . show . fromVersionNumber <$> allVersionNumbers @=? cs . toQueryParam <$> allVersionNumbers + ], + testGroup "Version: maxAvailableVersion" + $ [ testCase "no version disable" $ maxAvailableVersion mempty @=? Just (maximum allVersions), + testCase "all versions disabled" $ maxAvailableVersion (Set.fromList allVersions) @=? Nothing, + testCase "all but the min version disabled" $ maxAvailableVersion (Set.fromList (tail allVersions)) @=? Just (minimum allVersions), + testCase "all but the max version disabled" $ maxAvailableVersion (Set.fromList (init allVersions)) @=? Just (maximum allVersions), + testCase "highest version disabled" $ maxAvailableVersion (Set.singleton (last allVersions)) @=? Just (maximum (init allVersions)) + ] ] allVersions :: [Version] diff --git a/libs/wire-api/test/unit/Test/Wire/API/Routes/Version/Wai.hs b/libs/wire-api/test/unit/Test/Wire/API/Routes/Version/Wai.hs index 2e87537f60b..65188e0f766 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Routes/Version/Wai.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Routes/Version/Wai.hs @@ -60,8 +60,8 @@ testApp = pure $ versionMiddleware (Set.singleton disabledVersionTyped) (serve ( testHandler :: Server TestAPI testHandler mVersionNumber = Tagged $ \req cont -> - cont $ - let headerVersion = lookup "X-Wire-API-Version" (requestHeaders req) - in if headerVersion == (cs . show <$> mVersionNumber) - then responseLBS status200 [] "good" - else responseLBS status400 [] (cs $ "mismatch: " <> show (headerVersion, mVersionNumber)) + cont + $ let headerVersion = lookup "X-Wire-API-Version" (requestHeaders req) + in if headerVersion == (cs . show <$> mVersionNumber) + then responseLBS status200 [] "good" + else responseLBS status400 [] (cs $ "mismatch: " <> show (headerVersion, mVersionNumber)) diff --git a/libs/wire-api/test/unit/Test/Wire/API/Run.hs b/libs/wire-api/test/unit/Test/Wire/API/Run.hs index 417d543e0e4..801788b159d 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Run.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Run.hs @@ -46,8 +46,8 @@ import Test.Wire.API.User.Search qualified as User.Search main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Call.Config.tests, Team.Member.tests, diff --git a/libs/wire-api/test/unit/Test/Wire/API/Swagger.hs b/libs/wire-api/test/unit/Test/Wire/API/Swagger.hs index bbb37e6e2a4..bcc7fd8b71a 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Swagger.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Swagger.hs @@ -33,28 +33,29 @@ import Wire.API.Wrapped qualified as Wrapped tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "JSON roundtrip tests" $ - [ testToJSON @User.UserProfile, - testToJSON @User.User, - testToJSON @User.SelfProfile, - testToJSON @(User.LimitedQualifiedUserIdList 20), - testToJSON @Handle.UserHandleInfo, - testToJSON @Client.Client, - testToJSON @Client.PubClient, - testToJSON @(UserMap.UserMap (Set Client.Client)), - testToJSON @(UserMap.UserMap (Set Client.PubClient)), - testToJSON @(UserMap.QualifiedUserMap (Set Client.Client)), - testToJSON @Client.UserClientPrekeyMap, - testToJSON @Client.UserClients, - testToJSON @Prekey.Prekey, - testToJSON @Prekey.PrekeyBundle, - testToJSON @Prekey.ClientPrekey, - testToJSON @Client.QualifiedUserClientPrekeyMap, - testToJSON @Client.QualifiedUserClients, - testToJSON @Search.Contact, - testToJSON @(Search.SearchResult Search.Contact), - testToJSON @(Wrapped.Wrapped "some_user" User.User) - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "JSON roundtrip tests" + $ [ testToJSON @User.UserProfile, + testToJSON @User.User, + testToJSON @User.SelfProfile, + testToJSON @(User.LimitedQualifiedUserIdList 20), + testToJSON @Handle.UserHandleInfo, + testToJSON @Client.Client, + testToJSON @Client.PubClient, + testToJSON @(UserMap.UserMap (Set Client.Client)), + testToJSON @(UserMap.UserMap (Set Client.PubClient)), + testToJSON @(UserMap.QualifiedUserMap (Set Client.Client)), + testToJSON @Client.UserClientPrekeyMap, + testToJSON @Client.UserClients, + testToJSON @Prekey.Prekey, + testToJSON @Prekey.PrekeyBundle, + testToJSON @Prekey.ClientPrekey, + testToJSON @Client.QualifiedUserClientPrekeyMap, + testToJSON @Client.QualifiedUserClients, + testToJSON @Search.Contact, + testToJSON @(Search.SearchResult Search.Contact), + testToJSON @(Wrapped.Wrapped "some_user" User.User) + ] testToJSON :: forall a. (Arbitrary a, ToJSON a, ToSchema a, Show a) => T.TestTree testToJSON = testProperty msg trip @@ -62,7 +63,7 @@ testToJSON = testProperty msg trip msg = show (typeRep @a) trip (v :: a) = counterexample - ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" $ - validatePrettyToJSON v + ( fromMaybe "Schema validation failed, but there were no errors. This looks like a bug in swagger2!" + $ validatePrettyToJSON v ) $ isNothing (validatePrettyToJSON v) diff --git a/libs/wire-api/test/unit/Test/Wire/API/Team/Feature.hs b/libs/wire-api/test/unit/Test/Wire/API/Team/Feature.hs index 60b634c9d17..cd79ec4af8e 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Team/Feature.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Team/Feature.hs @@ -79,8 +79,9 @@ testComputeFeatureConfigForTeamUserUnlocked = do testComputeFeatureConfigForTeamWithDbStatus :: Assertion testComputeFeatureConfigForTeamWithDbStatus = do let mStatusDb = - Just . forgetLock $ - withStatus + Just + . forgetLock + $ withStatus FeatureStatusDisabled LockStatusUnlocked ExposeInvitationURLsToTeamAdminConfig diff --git a/libs/wire-api/test/unit/Test/Wire/API/Team/Member.hs b/libs/wire-api/test/unit/Test/Wire/API/Team/Member.hs index 8a44da25f23..2329141dec1 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/Team/Member.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/Team/Member.hs @@ -50,15 +50,17 @@ permissionTests :: TestTree permissionTests = testGroup "Permissions" - [ testCase "owner has all permissions" $ - rolePermissions RoleOwner @=? fullPermissions, - testCase "smaller roles (further to the left/top in the type def) are strictly more powerful" $ + [ testCase "owner has all permissions" + $ rolePermissions RoleOwner + @=? fullPermissions, + testCase "smaller roles (further to the left/top in the type def) are strictly more powerful" + $ -- we may not want to maintain this property in the future when adding more roles, but for -- now it's true, and it's nice to have that written down somewhere. - forM_ [(r1, r2) | r1 <- [minBound ..], r2 <- drop 1 [r1 ..]] $ - \(r1, r2) -> do - assertBool "owner.self" ((rolePermissions r2 ^. self) `isSubsetOf` (rolePermissions r1 ^. self)) - assertBool "owner.copy" ((rolePermissions r2 ^. copy) `isSubsetOf` (rolePermissions r1 ^. copy)), + forM_ [(r1, r2) | r1 <- [minBound ..], r2 <- drop 1 [r1 ..]] + $ \(r1, r2) -> do + assertBool "owner.self" ((rolePermissions r2 ^. self) `isSubsetOf` (rolePermissions r1 ^. self)) + assertBool "owner.copy" ((rolePermissions r2 ^. copy) `isSubsetOf` (rolePermissions r1 ^. copy)), testGroup "permissionsRole, rolePermissions" [ testCase "'Role' maps to expected permissions" $ do @@ -69,23 +71,25 @@ permissionTests = assertEqual "external partner" (permissionsRole =<< newPermissions (intToPerms 1025) (intToPerms 1025)) (Just RoleExternalPartner), testCase "Role <-> Permissions roundtrip" $ do assertEqual "admin" (permissionsRole . rolePermissions <$> [minBound ..]) (Just <$> [minBound ..]), - testProperty "Random, incoherent 'Permission' values gracefully translate to subsets." $ - let fakeSort (w, w') = (w `Set.union` w', w') - in \(fakeSort -> (w, w')) -> do - let Just perms = newPermissions w w' - case permissionsRole perms of - Just role -> do - let perms' = rolePermissions role - assertEqual "eq" (perms' ^. self) (perms' ^. copy) - assertBool "self" ((perms' ^. self) `Set.isSubsetOf` (perms ^. self)) - assertBool "copy" ((perms' ^. copy) `Set.isSubsetOf` (perms ^. copy)) - Nothing -> do - let leastPermissions = rolePermissions maxBound - assertBool "no role for perms, but strictly more perms than max role" $ - not - ( (leastPermissions ^. self) `Set.isSubsetOf` w - && (leastPermissions ^. copy) `Set.isSubsetOf` w' - ) + testProperty "Random, incoherent 'Permission' values gracefully translate to subsets." + $ let fakeSort (w, w') = (w `Set.union` w', w') + in \(fakeSort -> (w, w')) -> do + let Just perms = newPermissions w w' + case permissionsRole perms of + Just role -> do + let perms' = rolePermissions role + assertEqual "eq" (perms' ^. self) (perms' ^. copy) + assertBool "self" ((perms' ^. self) `Set.isSubsetOf` (perms ^. self)) + assertBool "copy" ((perms' ^. copy) `Set.isSubsetOf` (perms ^. copy)) + Nothing -> do + let leastPermissions = rolePermissions maxBound + assertBool "no role for perms, but strictly more perms than max role" + $ not + ( (leastPermissions ^. self) + `Set.isSubsetOf` w + && (leastPermissions ^. copy) + `Set.isSubsetOf` w' + ) ] ] diff --git a/libs/wire-api/test/unit/Test/Wire/API/User.hs b/libs/wire-api/test/unit/Test/Wire/API/User.hs index d8f9a115376..ce6b62a6ff8 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/User.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/User.hs @@ -61,16 +61,16 @@ testMkUserProfile = testEmailVisibleToSelf :: TestTree testEmailVisibleToSelf = - testProperty "should not contain email when email visibility is EmailVisibleToSelf" $ - \user lhStatus -> + testProperty "should not contain email when email visibility is EmailVisibleToSelf" + $ \user lhStatus -> let profile = mkUserProfile EmailVisibleToSelf user lhStatus in profileEmail profile === Nothing .&&. profileLegalholdStatus profile === lhStatus testEmailVisibleIfOnTeam :: TestTree testEmailVisibleIfOnTeam = - testProperty "should contain email only if the user has one and is part of a team when email visibility is EmailVisibleIfOnTeam" $ - \user lhStatus -> + testProperty "should contain email only if the user has one and is part of a team when email visibility is EmailVisibleIfOnTeam" + $ \user lhStatus -> let profile = mkUserProfile EmailVisibleIfOnTeam user lhStatus in (profileEmail profile === (userTeam user *> userEmail user)) .&&. profileLegalholdStatus profile === lhStatus @@ -79,22 +79,22 @@ testEmailVisibleIfOnSameTeam :: TestTree testEmailVisibleIfOnSameTeam = testGroup "when email visibility is EmailVisibleIfOnSameTeam" [testNoViewerTeam, testViewerDifferentTeam, testViewerSameTeamExternal, testViewerSameTeamNotExternal] where - testNoViewerTeam = testProperty "should not contain email when viewer is not part of a team" $ - \user lhStatus -> + testNoViewerTeam = testProperty "should not contain email when viewer is not part of a team" + $ \user lhStatus -> let profile = mkUserProfile (EmailVisibleIfOnSameTeam Nothing) user lhStatus in (profileEmail profile === Nothing) .&&. profileLegalholdStatus profile === lhStatus - testViewerDifferentTeam = testProperty "should not contain email when viewer is not part of the same team" $ - \viewerTeamId viewerMembership user lhStatus -> + testViewerDifferentTeam = testProperty "should not contain email when viewer is not part of the same team" + $ \viewerTeamId viewerMembership user lhStatus -> let profile = mkUserProfile (EmailVisibleIfOnSameTeam (Just (viewerTeamId, viewerMembership))) user lhStatus in Just viewerTeamId /= userTeam user ==> ( profileEmail profile === Nothing .&&. profileLegalholdStatus profile === lhStatus ) - testViewerSameTeamExternal = testProperty "should not contain email when viewer is part of the same team and is an external member" $ - \viewerTeamId (viewerMembershipNoRole :: TeamMember) userNoTeam lhStatus -> + testViewerSameTeamExternal = testProperty "should not contain email when viewer is part of the same team and is an external member" + $ \viewerTeamId (viewerMembershipNoRole :: TeamMember) userNoTeam lhStatus -> let user = userNoTeam {userTeam = Just viewerTeamId} viewerMembership = viewerMembershipNoRole & TeamMember.permissions .~ TeamMember.rolePermissions RoleExternalPartner profile = mkUserProfile (EmailVisibleIfOnSameTeam (Just (viewerTeamId, viewerMembership))) user lhStatus @@ -102,8 +102,8 @@ testEmailVisibleIfOnSameTeam = .&&. profileLegalholdStatus profile === lhStatus ) - testViewerSameTeamNotExternal = testProperty "should contain email when viewer is part of the same team and is not an external member" $ - \viewerTeamId (viewerMembershipNoRole :: TeamMember) viewerRole userNoTeam lhStatus -> + testViewerSameTeamNotExternal = testProperty "should contain email when viewer is part of the same team and is not an external member" + $ \viewerTeamId (viewerMembershipNoRole :: TeamMember) viewerRole userNoTeam lhStatus -> let user = userNoTeam {userTeam = Just viewerTeamId} viewerMembership = viewerMembershipNoRole & TeamMember.permissions .~ TeamMember.rolePermissions viewerRole profile = mkUserProfile (EmailVisibleIfOnSameTeam (Just (viewerTeamId, viewerMembership))) user lhStatus @@ -129,23 +129,29 @@ parseIdentityTests = (=#=) _ bad = error $ "=#=: impossible: " <> show bad in testGroup "parseIdentity" - [ testCase "FullIdentity" $ - Right (Just (FullIdentity hemail hphone)) =#= [email, phone], - testCase "EmailIdentity" $ - Right (Just (EmailIdentity hemail)) =#= [email], - testCase "PhoneIdentity" $ - Right (Just (PhoneIdentity hphone)) =#= [phone], + [ testCase "FullIdentity" + $ Right (Just (FullIdentity hemail hphone)) + =#= [email, phone], + testCase "EmailIdentity" + $ Right (Just (EmailIdentity hemail)) + =#= [email], + testCase "PhoneIdentity" + $ Right (Just (PhoneIdentity hphone)) + =#= [phone], testCase "SSOIdentity" $ do Right (Just (SSOIdentity hssoid Nothing Nothing)) =#= [ssoid] Right (Just (SSOIdentity hssoid Nothing (Just hphone))) =#= [ssoid, phone] Right (Just (SSOIdentity hssoid (Just hemail) Nothing)) =#= [ssoid, email] Right (Just (SSOIdentity hssoid (Just hemail) (Just hphone))) =#= [ssoid, email, phone], - testCase "Bad phone" $ - Left "Error in $.phone: Invalid phone number. Expected E.164 format." =#= [badphone], - testCase "Bad email" $ - Left "Error in $.email: Invalid email. Expected '@'." =#= [bademail], - testCase "Nothing" $ - Right Nothing =#= [("something_unrelated", "#")] + testCase "Bad phone" + $ Left "Error in $.phone: Invalid phone number. Expected E.164 format." + =#= [badphone], + testCase "Bad email" + $ Left "Error in $.email: Invalid email. Expected '@'." + =#= [bademail], + testCase "Nothing" + $ Right Nothing + =#= [("something_unrelated", "#")] ] where hemail = Email "me" "example.com" diff --git a/libs/wire-subsystems/src/Wire/DeleteQueue/InMemory.hs b/libs/wire-subsystems/src/Wire/DeleteQueue/InMemory.hs index cd9400c7f54..9818ea7228a 100644 --- a/libs/wire-subsystems/src/Wire/DeleteQueue/InMemory.hs +++ b/libs/wire-subsystems/src/Wire/DeleteQueue/InMemory.hs @@ -6,7 +6,7 @@ import Polysemy.State import Wire.DeleteQueue import Wire.InternalEvent -inMemoryDeleteQueueInterpreter :: Member (State [InternalNotification]) r => InterpreterFor DeleteQueue r +inMemoryDeleteQueueInterpreter :: (Member (State [InternalNotification]) r) => InterpreterFor DeleteQueue r inMemoryDeleteQueueInterpreter = interpret $ \case EnqueueUserDeletion uid -> modify (\l -> DeleteUser uid : l) EnqueueClientDeletion cid uid mConnId -> modify (\l -> DeleteClient cid uid mConnId : l) diff --git a/libs/wire-subsystems/src/Wire/FederationAPIAccess.hs b/libs/wire-subsystems/src/Wire/FederationAPIAccess.hs index 9065f9f8c3b..e251043c8ae 100644 --- a/libs/wire-subsystems/src/Wire/FederationAPIAccess.hs +++ b/libs/wire-subsystems/src/Wire/FederationAPIAccess.hs @@ -12,7 +12,7 @@ import Wire.API.Federation.Error data FederationAPIAccess (fedM :: Component -> Type -> Type) m a where RunFederatedEither :: - KnownComponent c => + (KnownComponent c) => Remote x -> fedM c a -> FederationAPIAccess fedM m (Either FederationError a) diff --git a/libs/wire-subsystems/src/Wire/FederationAPIAccess/Interpreter.hs b/libs/wire-subsystems/src/Wire/FederationAPIAccess/Interpreter.hs index 8520f11ff69..e191db9195d 100644 --- a/libs/wire-subsystems/src/Wire/FederationAPIAccess/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/FederationAPIAccess/Interpreter.hs @@ -52,8 +52,8 @@ interpretFederationAPIAccessGeneral :: (Sem r Bool) -> InterpreterFor (FederationAPIAccess fedM) r interpretFederationAPIAccessGeneral runFedM isFederationConfigured = - interpret $ - \case + interpret + $ \case RunFederatedEither remote rpc -> runFederatedEither runFedM remote rpc RunFederatedConcurrently remotes rpc -> runFederatedConcurrently runFedM remotes rpc RunFederatedBucketed remotes rpc -> runFederatedBucketed runFedM remotes rpc diff --git a/libs/wire-subsystems/src/Wire/GalleyAPIAccess/Rpc.hs b/libs/wire-subsystems/src/Wire/GalleyAPIAccess/Rpc.hs index e05584e9a36..e92dbf0637b 100644 --- a/libs/wire-subsystems/src/Wire/GalleyAPIAccess/Rpc.hs +++ b/libs/wire-subsystems/src/Wire/GalleyAPIAccess/Rpc.hs @@ -64,8 +64,9 @@ interpretGalleyAPIAccessToRpc :: Sem r a interpretGalleyAPIAccessToRpc disabledVersions galleyEndpoint = let v = fromMaybe (error "service can't run with undefined API version") $ maxAvailableVersion disabledVersions - in interpret $ - runInputConst galleyEndpoint . \case + in interpret + $ runInputConst galleyEndpoint + . \case CreateSelfConv id' -> createSelfConv v id' GetConv id' id'' -> getConv v id' id'' GetTeamConv id' id'' id'2 -> getTeamConv v id' id'' id'2 @@ -104,15 +105,15 @@ createSelfConv :: UserId -> Sem r () createSelfConv v u = do - debug $ - remote "galley" - . msg (val "Creating self conversation") - void $ - galleyRequest $ - method POST - . paths [toHeader v, "conversations", "self"] - . zUser u - . expect2xx + debug + $ remote "galley" + . msg (val "Creating self conversation") + void + $ galleyRequest + $ method POST + . paths [toHeader v, "conversations", "self"] + . zUser u + . expect2xx -- | Calls 'Galley.API.getConversationH'. getConv :: @@ -126,11 +127,11 @@ getConv :: Local ConvId -> Sem r (Maybe Conversation) getConv v usr lcnv = do - debug $ - remote "galley" - . field "domain" (toByteString (tDomain lcnv)) - . field "conv" (toByteString (tUnqualified lcnv)) - . msg (val "Getting conversation") + debug + $ remote "galley" + . field "domain" (toByteString (tDomain lcnv)) + . field "conv" (toByteString (tUnqualified lcnv)) + . msg (val "Getting conversation") rs <- galleyRequest req case Bilge.statusCode rs of 200 -> Just <$> decodeBodyOrThrow "galley" rs @@ -160,10 +161,10 @@ getTeamConv :: ConvId -> Sem r (Maybe Conv.TeamConversation) getTeamConv v usr tid cnv = do - debug $ - remote "galley" - . field "conv" (toByteString cnv) - . msg (val "Getting team conversation") + debug + $ remote "galley" + . field "conv" (toByteString cnv) + . msg (val "Getting team conversation") rs <- galleyRequest req case Bilge.statusCode rs of 200 -> Just <$> decodeBodyOrThrow "galley" rs @@ -191,16 +192,17 @@ newClient :: ClientId -> Sem r () newClient u c = do - debug $ - remote "galley" - . field "user" (toByteString u) - . field "client" (toByteString c) - . msg (val "new client") - void . galleyRequest $ - method POST - . paths ["i", "clients", toByteString' c] - . zUser u - . expect2xx + debug + $ remote "galley" + . field "user" (toByteString u) + . field "client" (toByteString c) + . msg (val "new client") + void + . galleyRequest + $ method POST + . paths ["i", "clients", toByteString' c] + . zUser u + . expect2xx -- | Calls 'Galley.API.canUserJoinTeamH'. checkUserCanJoinTeam :: @@ -211,9 +213,9 @@ checkUserCanJoinTeam :: TeamId -> Sem r (Maybe Wai.Error) checkUserCanJoinTeam tid = do - debug $ - remote "galley" - . msg (val "Check if can add member to team") + debug + $ remote "galley" + . msg (val "Check if can add member to team") rs <- galleyRequest req pure $ case Bilge.statusCode rs of 200 -> Nothing @@ -237,9 +239,9 @@ addTeamMember :: (Maybe (UserId, UTCTimeMillis), Role) -> Sem r Bool addTeamMember u tid (minvmeta, role) = do - debug $ - remote "galley" - . msg (val "Adding member to team") + debug + $ remote "galley" + . msg (val "Adding member to team") rs <- galleyRequest req pure $ case Bilge.statusCode rs of 200 -> True @@ -266,9 +268,9 @@ createTeam :: TeamId -> Sem r () createTeam u t teamid = do - debug $ - remote "galley" - . msg (val "Creating Team") + debug + $ remote "galley" + . msg (val "Creating Team") void $ galleyRequest $ req teamid where req tid = @@ -290,9 +292,9 @@ getTeamMember :: TeamId -> Sem r (Maybe TeamMember) getTeamMember u tid = do - debug $ - remote "galley" - . msg (val "Get team member") + debug + $ remote "galley" + . msg (val "Get team member") rs <- galleyRequest req case Bilge.statusCode rs of 200 -> Just <$> decodeBodyOrThrow "galley" rs @@ -333,9 +335,9 @@ memberIsTeamOwner :: Sem r Bool memberIsTeamOwner tid uid = do r <- - galleyRequest $ - method GET - . paths ["i", "teams", toByteString' tid, "is-team-owner", toByteString' uid] + galleyRequest + $ method GET + . paths ["i", "teams", toByteString' tid, "is-team-owner", toByteString' uid] pure $ responseStatus r /= status403 -- | Calls 'Galley.API.getBindingTeamIdH'. @@ -554,11 +556,11 @@ unblockConversation :: Qualified ConvId -> Sem r Conversation unblockConversation v lusr mconn (Qualified cnv cdom) = do - debug $ - remote "galley" - . field "conv" (toByteString cnv) - . field "domain" (toByteString cdom) - . msg (val "Unblocking conversation") + debug + $ remote "galley" + . field "conv" (toByteString cnv) + . field "domain" (toByteString cdom) + . msg (val "Unblocking conversation") void $ galleyRequest putReq galleyRequest getReq >>= decodeBodyOrThrow @Conversation "galley" where @@ -587,9 +589,9 @@ getEJPDConvInfo :: UserId -> Sem r [EJPDConvInfo] getEJPDConvInfo uid = do - debug $ - remote "galley" - . msg (val "get conversation info for ejpd") + debug + $ remote "galley" + . msg (val "get conversation info for ejpd") decodeBodyOrThrow "galley" =<< galleyRequest getReq where getReq = diff --git a/libs/wire-subsystems/src/Wire/GundeckAPIAccess.hs b/libs/wire-subsystems/src/Wire/GundeckAPIAccess.hs index 1d0666880cf..59f94ab3d98 100644 --- a/libs/wire-subsystems/src/Wire/GundeckAPIAccess.hs +++ b/libs/wire-subsystems/src/Wire/GundeckAPIAccess.hs @@ -25,28 +25,31 @@ runGundeckAPIAccess ep = interpret $ \case PushV2 pushes -> do chunkedReq <- jsonChunkedIO pushes -- No retries because the chunked request body cannot be replayed. - void . rpc "gundeck" ep $ - method POST - . path "/i/push/v2" - . expect2xx - . chunkedReq + void + . rpc "gundeck" ep + $ method POST + . path "/i/push/v2" + . expect2xx + . chunkedReq UserDeleted uid -> do - void . rpcWithRetries "gundeck" ep $ - method DELETE - . path "/i/user" - . zUser uid - . expect2xx + void + . rpcWithRetries "gundeck" ep + $ method DELETE + . path "/i/user" + . zUser uid + . expect2xx UnregisterPushClient uid cid -> do - void . rpcWithRetries "gundeck" ep $ - method DELETE - . paths ["i", "clients", toByteString' cid] - . zUser uid - . expect [status200, status204, status404] + void + . rpcWithRetries "gundeck" ep + $ method DELETE + . paths ["i", "clients", toByteString' cid] + . zUser uid + . expect [status200, status204, status404] GetPushTokens uid -> do rsp <- - rpcWithRetries "gundeck" ep $ - method GET - . paths ["i", "push-tokens", toByteString' uid] - . zUser uid - . expect2xx + rpcWithRetries "gundeck" ep + $ method GET + . paths ["i", "push-tokens", toByteString' uid] + . zUser uid + . expect2xx responseJsonMaybe rsp & maybe (pure []) (pure . V2.pushTokens) diff --git a/libs/wire-subsystems/src/Wire/MiniBackend.hs b/libs/wire-subsystems/src/Wire/MiniBackend.hs index 4a915049448..182ba097f3e 100644 --- a/libs/wire-subsystems/src/Wire/MiniBackend.hs +++ b/libs/wire-subsystems/src/Wire/MiniBackend.hs @@ -137,12 +137,12 @@ instance RunClient (MiniFederationMonad comp) where data SubsystemOperationList where TNil :: SubsystemOperationList - (:::) :: Typeable a => (Component, Text, a) -> SubsystemOperationList -> SubsystemOperationList + (:::) :: (Typeable a) => (Component, Text, a) -> SubsystemOperationList -> SubsystemOperationList infixr 5 ::: lookupSubsystemOperation :: - Typeable a => + (Typeable a) => -- | The type to compare to (Component, Text, Proxy a) -> -- | what to return when none of the types match @@ -201,8 +201,8 @@ miniGetAllProfiles :: miniGetAllProfiles = do users <- gets (.users) dom <- input - pure $ - map + pure + $ map (\u -> mkUserProfileWithEmail Nothing (mkUserFromStored dom miniLocale u) defUserLegalHoldStatus) users @@ -214,8 +214,9 @@ miniGetUsersByIds userIds = runOnOwnBackend do miniGetUserById :: UserId -> MiniFederationMonad 'Brig (Maybe UserProfile) miniGetUserById uid = - runOnOwnBackend $ - find (\u -> u.profileQualifiedId.qUnqualified == uid) <$> miniGetAllProfiles + runOnOwnBackend + $ find (\u -> u.profileQualifiedId.qUnqualified == uid) + <$> miniGetAllProfiles runMiniFederation :: Domain -> Map Domain MiniBackend -> MiniFederationMonad c a -> a runMiniFederation ownDomain backends = @@ -305,7 +306,7 @@ interpretNoFederationStack localBackend teamMember galleyConfigs cfg = . miniGalleyAPIAccess teamMember galleyConfigs . runUserSubsystem cfg -runErrorUnsafe :: Exception e => InterpreterFor (Error e) r +runErrorUnsafe :: (Exception e) => InterpreterFor (Error e) r runErrorUnsafe action = do res <- runError action case res of @@ -336,11 +337,11 @@ miniFederationAPIAccess online = do RunFederatedBucketed _domain _rpc -> error "unimplemented: RunFederatedBucketed" IsFederationConfigured -> pure True -getLocalUsers :: Member (State MiniBackend) r => Sem r [StoredUser] +getLocalUsers :: (Member (State MiniBackend) r) => Sem r [StoredUser] getLocalUsers = gets (.users) modifyLocalUsers :: - Member (State MiniBackend) r => + (Member (State MiniBackend) r) => ([StoredUser] -> Sem r [StoredUser]) -> Sem r () modifyLocalUsers f = do @@ -350,7 +351,7 @@ modifyLocalUsers f = do staticUserStoreInterpreter :: forall r. - Member (State MiniBackend) r => + (Member (State MiniBackend) r) => InterpreterFor UserStore r staticUserStoreInterpreter = interpret $ \case GetUser uid -> find (\user -> user.id == uid) <$> getLocalUsers @@ -375,7 +376,8 @@ staticUserStoreInterpreter = interpret $ \case | u.id == uid = do handles <- mapMaybe (.handle) <$> gets (.users) when - ( hUpdate.old /= Just hUpdate.new + ( hUpdate.old + /= Just hUpdate.new && elem hUpdate.new handles ) $ throw StoredUserUpdateHandleExists @@ -387,7 +389,7 @@ staticUserStoreInterpreter = interpret $ \case GlimpseHandle h -> miniBackendLookupHandle h miniBackendLookupHandle :: - Member (State MiniBackend) r => + (Member (State MiniBackend) r) => Handle -> Sem r (Maybe UserId) miniBackendLookupHandle h = do @@ -407,7 +409,7 @@ miniGalleyAPIAccess member configs = interpret $ \case _ -> error "uninterpreted effect: GalleyAPIAccess" miniEventInterpreter :: - Member (State [MiniEvent]) r => + (Member (State [MiniEvent]) r) => InterpreterFor UserEvents r miniEventInterpreter = interpret \case GenerateUserEvent uid _mconn e -> modify (MkMiniEvent uid e :) diff --git a/libs/wire-subsystems/src/Wire/NotificationSubsystem/Interpreter.hs b/libs/wire-subsystems/src/Wire/NotificationSubsystem/Interpreter.hs index f59c79d0c2d..8951e78be46 100644 --- a/libs/wire-subsystems/src/Wire/NotificationSubsystem/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/NotificationSubsystem/Interpreter.hs @@ -81,10 +81,10 @@ pushAsyncImpl ps = async $ do reqId <- inputs requestId errorToIOFinal @SomeException (fromExceptionSem @SomeException $ pushImpl ps) >>= \case Left e -> - P.err $ - Log.msg (Log.val "Error while pushing notifications") - . Log.field "requestId" reqId - . Log.field "error" (displayException e) + P.err + $ Log.msg (Log.val "Error while pushing notifications") + . Log.field "requestId" reqId + . Log.field "error" (displayException e) Right _ -> pure () pushImpl :: @@ -100,11 +100,12 @@ pushImpl ps = do pushChunkSize <- inputs chunkSize let pushes :: [[V2.Push]] = - mkPushes pushChunkSize $ - removeIfLargeFanout currentFanoutLimit ps - void $ - sequenceConcurrently $ - GundeckAPIAccess.pushV2 <$> pushes + mkPushes pushChunkSize + $ removeIfLargeFanout currentFanoutLimit ps + void + $ sequenceConcurrently + $ GundeckAPIAccess.pushV2 + <$> pushes removeIfLargeFanout :: Range n m Int32 -> [Push] -> [Push] removeIfLargeFanout limit = @@ -118,9 +119,11 @@ mkPushes chunkSize = map (map toV2Push) . chunkPushes chunkSize toV2Push :: Push -> V2.Push toV2Push p = (V2.newPush p.pushOrigin (unsafeRange (Set.fromList recipients)) pload) - & V2.pushOriginConnection .~ _pushConn p - & V2.pushTransient .~ _pushTransient p - & maybe id (set V2.pushNativePriority) p._pushNativePriority + & V2.pushOriginConnection + .~ _pushConn p + & V2.pushTransient + .~ _pushTransient p + & maybe id (set V2.pushNativePriority) p._pushNativePriority where pload :: List1 Object pload = List1.singleton (pushJson p) diff --git a/libs/wire-subsystems/src/Wire/Rpc.hs b/libs/wire-subsystems/src/Wire/Rpc.hs index b7589d6128f..2dbc9849440 100644 --- a/libs/wire-subsystems/src/Wire/Rpc.hs +++ b/libs/wire-subsystems/src/Wire/Rpc.hs @@ -35,7 +35,7 @@ data Rpc m a where makeSem ''Rpc -runRpcWithHttp :: Member (Embed IO) r => Manager -> RequestId -> Sem (Rpc : r) a -> Sem r a +runRpcWithHttp :: (Member (Embed IO) r) => Manager -> RequestId -> Sem (Rpc : r) a -> Sem r a runRpcWithHttp mgr reqId = interpret $ \case Rpc serviceName ep req -> embed $ runHttpRpc mgr reqId $ rpcImpl serviceName ep req @@ -44,16 +44,16 @@ runRpcWithHttp mgr reqId = interpret $ \case rpcImpl :: ServiceName -> Endpoint -> (Request -> Request) -> HttpRpc (Response (Maybe LByteString)) rpcImpl serviceName ep req = - rpc' serviceName empty $ - req - . Bilge.host (encodeUtf8 ep._host) - . Bilge.port ep._port + rpc' serviceName empty + $ req + . Bilge.host (encodeUtf8 ep._host) + . Bilge.port ep._port rpcWithRetriesImpl :: ServiceName -> Endpoint -> (Request -> Request) -> HttpRpc (Response (Maybe LByteString)) rpcWithRetriesImpl serviceName ep req = - recovering x3 rpcHandlers $ - const $ - rpcImpl serviceName ep req + recovering x3 rpcHandlers + $ const + $ rpcImpl serviceName ep req -- * Helpers @@ -69,9 +69,9 @@ expect ss rq = rq {HTTP.checkResponse = check} check rq' rs = do let s = responseStatus rs rs' = rs {responseBody = ()} - when (statusIsServerError s || s `notElem` ss) $ - throwM $ - HttpExceptionRequest rq' (HTTP.StatusCodeException rs' mempty) + when (statusIsServerError s || s `notElem` ss) + $ throwM + $ HttpExceptionRequest rq' (HTTP.StatusCodeException rs' mempty) -- * Internals diff --git a/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs b/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs index 4f3be239832..dff6b4b2c1f 100644 --- a/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs +++ b/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs @@ -13,10 +13,11 @@ import Wire.StoredUser import Wire.UserStore import Wire.UserStore.Unique -interpretUserStoreCassandra :: Member (Embed IO) r => ClientState -> InterpreterFor UserStore r +interpretUserStoreCassandra :: (Member (Embed IO) r) => ClientState -> InterpreterFor UserStore r interpretUserStoreCassandra casClient = - interpret $ - runEmbedded (runClient casClient) . \case + interpret + $ runEmbedded (runClient casClient) + . \case GetUser uid -> getUserImpl uid UpdateUser uid update -> embed $ updateUserImpl uid update UpdateUserHandleEither uid update -> embed $ updateUserHandleEitherImpl uid update @@ -24,7 +25,7 @@ interpretUserStoreCassandra casClient = LookupHandle hdl -> embed $ lookupHandleImpl LocalQuorum hdl GlimpseHandle hdl -> embed $ lookupHandleImpl One hdl -getUserImpl :: Member (Embed Client) r => UserId -> Sem r (Maybe StoredUser) +getUserImpl :: (Member (Embed Client) r) => UserId -> Sem r (Maybe StoredUser) getUserImpl uid = embed $ do mUserTuple <- retry x1 $ query1 selectUser (params LocalQuorum (Identity uid)) pure $ asRecord <$> mUserTuple @@ -61,15 +62,15 @@ claimHandleImpl uid oldHandle newHandle = Just uid' | uid /= uid' -> pure Nothing _ -> do let key = "@" <> fromHandle newHandle - withClaim uid key (30 # Minute) $ - do + withClaim uid key (30 # Minute) + $ do -- Record ownership retry x5 $ write handleInsert (params LocalQuorum (newHandle, uid)) -- Update profile result <- updateHandle uid newHandle -- Free old handle (if it changed) - for_ (mfilter (/= newHandle) oldHandle) $ - freeHandleImpl uid + for_ (mfilter (/= newHandle) oldHandle) + $ freeHandleImpl uid pure result where updateHandle :: UserId -> Handle -> Client () @@ -97,8 +98,8 @@ deleteUserImpl :: User -> Client () deleteUserImpl user = do for_ (userHandle user) \h -> freeHandleImpl (userId user) h - retry x5 $ - write + retry x5 + $ write updateUserToTombstone ( params LocalQuorum diff --git a/libs/wire-subsystems/src/Wire/UserStore/Unique.hs b/libs/wire-subsystems/src/Wire/UserStore/Unique.hs index f85b26fd4a0..b6a09312147 100644 --- a/libs/wire-subsystems/src/Wire/UserStore/Unique.hs +++ b/libs/wire-subsystems/src/Wire/UserStore/Unique.hs @@ -93,12 +93,12 @@ deleteClaim u v t = do cql = "UPDATE unique_claims USING TTL ? SET claims = claims - ? WHERE value = ?" -- | Lookup the current claims on a value. -lookupClaims :: MonadClient m => Text -> m [Id a] +lookupClaims :: (MonadClient m) => Text -> m [Id a] lookupClaims v = - fmap (maybe [] (fromSet . runIdentity)) $ - retry x1 $ - query1 cql $ - params LocalQuorum (Identity v) + fmap (maybe [] (fromSet . runIdentity)) + $ retry x1 + $ query1 cql + $ params LocalQuorum (Identity v) where cql :: PrepQuery R (Identity Text) (Identity (C.Set (Id a))) cql = "SELECT claims FROM unique_claims WHERE value = ?" diff --git a/libs/wire-subsystems/src/Wire/UserSubsystem.hs b/libs/wire-subsystems/src/Wire/UserSubsystem.hs index 7c7df86d92b..c7bc75edc7d 100644 --- a/libs/wire-subsystems/src/Wire/UserSubsystem.hs +++ b/libs/wire-subsystems/src/Wire/UserSubsystem.hs @@ -106,13 +106,13 @@ data CheckHandleResp makeSem ''UserSubsystem -getUserProfile :: Member UserSubsystem r => Local UserId -> Qualified UserId -> Sem r (Maybe UserProfile) +getUserProfile :: (Member UserSubsystem r) => Local UserId -> Qualified UserId -> Sem r (Maybe UserProfile) getUserProfile luid targetUser = listToMaybe <$> getUserProfiles luid [targetUser] -getLocalUserProfile :: Member UserSubsystem r => Local UserId -> Sem r (Maybe UserProfile) +getLocalUserProfile :: (Member UserSubsystem r) => Local UserId -> Sem r (Maybe UserProfile) getLocalUserProfile targetUser = listToMaybe <$> getLocalUserProfiles ((: []) <$> targetUser) -updateSupportedProtocols :: Member UserSubsystem r => Local UserId -> UpdateOriginType -> Set BaseProtocolTag -> Sem r () +updateSupportedProtocols :: (Member UserSubsystem r) => Local UserId -> UpdateOriginType -> Set BaseProtocolTag -> Sem r () updateSupportedProtocols uid mb prots = updateUserProfile uid Nothing mb (def {supportedProtocols = Just prots}) diff --git a/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs b/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs index 688818f6a99..31d0f8f36ad 100644 --- a/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs @@ -185,7 +185,8 @@ getUserProfilesLocalPart requestingUser luids = do EmailVisibleIfOnTeam -> pure EmailVisibleIfOnTeam EmailVisibleToSelf -> pure EmailVisibleToSelf EmailVisibleIfOnSameTeam () -> - EmailVisibleIfOnSameTeam . join @Maybe + EmailVisibleIfOnSameTeam + . join @Maybe <$> traverse getRequestingUserInfo requestingUser -- FUTUREWORK: (in the interpreters where it makes sense) pull paginated lists from the DB, -- not just single rows. @@ -251,11 +252,11 @@ getSelfProfileImpl self = do -- - comments in `testUpdateHandle` in `/integration`. -- -- FUTUREWORK: figure out a better way for clients to detect E2EId (V6?) - hackForBlockingHandleChangeForE2EIdTeams :: Member GalleyAPIAccess r => StoredUser -> Sem r StoredUser + hackForBlockingHandleChangeForE2EIdTeams :: (Member GalleyAPIAccess r) => StoredUser -> Sem r StoredUser hackForBlockingHandleChangeForE2EIdTeams user = do e2eid <- hasE2EId user - pure $ - if e2eid && isJust user.handle + pure + $ if e2eid && isJust user.handle then user {managedBy = Just ManagedByScim} else user @@ -266,8 +267,8 @@ deleteLocalIfExpired user = Nothing -> pure () Just (fromUTCTimeMillis -> e) -> do t <- Now.get - when (diffUTCTime e t < 0) $ - enqueueUserDeletion (qUnqualified user.userQualifiedId) + when (diffUTCTime e t < 0) + $ enqueueUserDeletion (qUnqualified user.userQualifiedId) getUserProfilesWithErrorsImpl :: forall r fedM. @@ -358,8 +359,8 @@ updateUserProfileImpl :: updateUserProfileImpl (tUnqualified -> uid) mconn updateOrigin update = do user <- getUser uid >>= note UserSubsystemProfileNotFound guardLockedFields user updateOrigin update - mapError (\StoredUserUpdateHandleExists -> UserSubsystemHandleExists) $ - updateUser uid (storedUserUpdate update) + mapError (\StoredUserUpdateHandleExists -> UserSubsystemHandleExists) + $ updateUser uid (storedUserUpdate update) generateUserEvent uid mconn (mkProfileUpdateEvent uid update) storedUserUpdate :: UserProfileUpdate -> StoredUserUpdate @@ -375,8 +376,8 @@ storedUserUpdate update = mkProfileUpdateEvent :: UserId -> UserProfileUpdate -> UserEvent mkProfileUpdateEvent uid update = - UserUpdated $ - (emptyUserUpdatedData uid) + UserUpdated + $ (emptyUserUpdatedData uid) { eupName = update.name, eupPict = update.pict, eupAccentId = update.accentId, @@ -405,21 +406,21 @@ updateHandleImpl :: Sem r () updateHandleImpl (tUnqualified -> uid) mconn updateOrigin uhandle = do newHandle :: Handle <- note UserSubsystemInvalidHandle $ Handle.parseHandle uhandle - when (isBlacklistedHandle newHandle) $ - throw UserSubsystemInvalidHandle + when (isBlacklistedHandle newHandle) + $ throw UserSubsystemInvalidHandle user <- getUser uid >>= note UserSubsystemNoIdentity guardLockedHandleField user updateOrigin newHandle - when (isNothing user.identity) $ - throw UserSubsystemNoIdentity - mapError (\StoredUserUpdateHandleExists -> UserSubsystemHandleExists) $ - US.updateUserHandle uid (MkStoredUserHandleUpdate user.handle newHandle) + when (isNothing user.identity) + $ throw UserSubsystemNoIdentity + mapError (\StoredUserUpdateHandleExists -> UserSubsystemHandleExists) + $ US.updateUserHandle uid (MkStoredUserHandleUpdate user.handle newHandle) generateUserEvent uid mconn (mkProfileUpdateHandleEvent uid newHandle) checkHandleImpl :: (Member (Error UserSubsystemError) r, Member UserStore r) => Text -> Sem r CheckHandleResp checkHandleImpl uhandle = do xhandle :: Handle <- Handle.parseHandle uhandle & maybe (throw UserSubsystemInvalidHandle) pure - when (isBlacklistedHandle xhandle) $ - throw UserSubsystemInvalidHandle + when (isBlacklistedHandle xhandle) + $ throw UserSubsystemInvalidHandle owner <- lookupHandle xhandle if isJust owner then -- Handle is taken (=> getHandleInfo will return 200) @@ -427,7 +428,7 @@ checkHandleImpl uhandle = do else -- Handle is free and can be taken pure CheckHandleNotFound -hasE2EId :: Member GalleyAPIAccess r => StoredUser -> Sem r Bool +hasE2EId :: (Member GalleyAPIAccess r) => StoredUser -> Sem r Bool hasE2EId user = wsStatus . afcMlsE2EId <$> getAllFeatureConfigsForUser (Just user.id) <&> \case FeatureStatusEnabled -> True @@ -438,7 +439,7 @@ hasE2EId user = -- | checks for handles @check@ to be available and returns -- at maximum @num@ of them -checkHandlesImpl :: _ => [Handle] -> Word -> Sem r [Handle] +checkHandlesImpl :: (_) => [Handle] -> Word -> Sem r [Handle] checkHandlesImpl check num = reverse <$> collectFree [] check num where collectFree free _ 0 = pure free diff --git a/libs/wire-subsystems/test/unit/Wire/NotificationSubsystem/InterpreterSpec.hs b/libs/wire-subsystems/test/unit/Wire/NotificationSubsystem/InterpreterSpec.hs index 38bebcabb28..d6d7382b9ca 100644 --- a/libs/wire-subsystems/test/unit/Wire/NotificationSubsystem/InterpreterSpec.hs +++ b/libs/wire-subsystems/test/unit/Wire/NotificationSubsystem/InterpreterSpec.hs @@ -190,9 +190,9 @@ spec = describe "NotificationSubsystem.Interpreter" do actualPushesRef <- newIORef [] delayControl <- newEmptyMVar slowPushThread <- - async $ - runMiniStackWithControlledDelay mockConfig delayControl actualPushesRef $ - pushSlowlyImpl pushes + async + $ runMiniStackWithControlledDelay mockConfig delayControl actualPushesRef + $ pushSlowlyImpl pushes putMVar delayControl (diffTimeToFullMicroseconds mockConfig.slowPushDelay) actualPushes1 <- timeout 100_000 $ (waitUntilPushes actualPushesRef 1) @@ -308,7 +308,7 @@ runMiniStackWithControlledDelay mockConfig delayControl actualPushesRef = do . runControlledDelay delayControl . runInputConst mockConfig -runGundeckAPIAccessFailure :: Member (Embed IO) r => IORef [[V2.Push]] -> Sem (GundeckAPIAccess : r) a -> Sem r a +runGundeckAPIAccessFailure :: (Member (Embed IO) r) => IORef [[V2.Push]] -> Sem (GundeckAPIAccess : r) a -> Sem r a runGundeckAPIAccessFailure pushesRef = interpret $ \action -> do case action of @@ -328,7 +328,7 @@ data TestException = TestException instance Exception TestException -runGundeckAPIAccessIORef :: Member (Embed IO) r => IORef [[V2.Push]] -> Sem (GundeckAPIAccess : r) a -> Sem r a +runGundeckAPIAccessIORef :: (Member (Embed IO) r) => IORef [[V2.Push]] -> Sem (GundeckAPIAccess : r) a -> Sem r a runGundeckAPIAccessIORef pushesRef = interpret \case PushV2 pushes -> modifyIORef pushesRef (<> [pushes]) diff --git a/libs/wire-subsystems/test/unit/Wire/UserSubsystem/InterpreterSpec.hs b/libs/wire-subsystems/test/unit/Wire/UserSubsystem/InterpreterSpec.hs index b43c9173a3d..9a05fddb855 100644 --- a/libs/wire-subsystems/test/unit/Wire/UserSubsystem/InterpreterSpec.hs +++ b/libs/wire-subsystems/test/unit/Wire/UserSubsystem/InterpreterSpec.hs @@ -37,8 +37,8 @@ spec :: Spec spec = describe "UserSubsystem.Interpreter" do describe "getUserProfiles" do describe "[with federation]" do - prop "gets all users on multiple federating backends" $ - \viewerTeam (localTargetUsersNotPending :: [NotPendingStoredUser]) targetUsers1 targetUsers2 visibility localDomain remoteDomain1 remoteDomain2 -> do + prop "gets all users on multiple federating backends" + $ \viewerTeam (localTargetUsersNotPending :: [NotPendingStoredUser]) targetUsers1 targetUsers2 visibility localDomain remoteDomain1 remoteDomain2 -> do let remoteBackend1 = def {users = targetUsers1} remoteBackend2 = def {users = targetUsers2} viewer = viewerTeam {teamId = Nothing} @@ -52,8 +52,8 @@ spec = describe "UserSubsystem.Interpreter" do target2 = mkUserIds remoteDomain2 targetUsers2 localBackend = def {users = [viewer] <> localTargetUsers} retrievedProfiles = - runFederationStack localBackend federation Nothing (UserSubsystemConfig visibility miniLocale) $ - getUserProfiles + runFederationStack localBackend federation Nothing (UserSubsystemConfig visibility miniLocale) + $ getUserProfiles (toLocalUnsafe localDomain viewer.id) (localTargets <> target1 <> target2) mkExpectedProfiles domain users = @@ -71,8 +71,8 @@ spec = describe "UserSubsystem.Interpreter" do sortOn (.profileQualifiedId) retrievedProfiles === sortOn (.profileQualifiedId) expectedProfiles - prop "fails when a backend is offline or returns an error" $ - \viewer onlineTargetUsers (offlineTargetUsers :: [StoredUser]) visibility localDomain onlineDomain (offlineDomain :: Domain) -> do + prop "fails when a backend is offline or returns an error" + $ \viewer onlineTargetUsers (offlineTargetUsers :: [StoredUser]) visibility localDomain onlineDomain (offlineDomain :: Domain) -> do let onlineRemoteBackend = def {users = onlineTargetUsers} online = [(onlineDomain, onlineRemoteBackend)] mkUserIds domain users = map (flip Qualified domain . (.id)) users @@ -96,23 +96,23 @@ spec = describe "UserSubsystem.Interpreter" do === Left (displayException (FederationUnexpectedError "RunFederatedEither")) describe "[without federation]" do - prop "returns nothing when none of the users exist" $ - \viewer targetUserIds visibility domain locale -> + prop "returns nothing when none of the users exist" + $ \viewer targetUserIds visibility domain locale -> let config = UserSubsystemConfig visibility locale retrievedProfiles = - runNoFederationStack def Nothing config $ - getUserProfiles (toLocalUnsafe domain viewer) (map (`Qualified` domain) targetUserIds) + runNoFederationStack def Nothing config + $ getUserProfiles (toLocalUnsafe domain viewer) (map (`Qualified` domain) targetUserIds) in retrievedProfiles === [] - prop "gets a local user profile when the user exists and both user and viewer have accepted their invitations" $ - \(NotPendingStoredUser viewer) (NotPendingStoredUser targetUserNoTeam) visibility domain locale sameTeam -> + prop "gets a local user profile when the user exists and both user and viewer have accepted their invitations" + $ \(NotPendingStoredUser viewer) (NotPendingStoredUser targetUserNoTeam) visibility domain locale sameTeam -> let teamMember = mkTeamMember viewer.id fullPermissions Nothing defUserLegalHoldStatus targetUser = if sameTeam then targetUserNoTeam {teamId = viewer.teamId} else targetUserNoTeam config = UserSubsystemConfig visibility locale localBackend = def {users = [targetUser, viewer]} retrievedProfiles = - runNoFederationStack localBackend (Just teamMember) config $ - getUserProfiles (toLocalUnsafe domain viewer.id) [Qualified targetUser.id domain] + runNoFederationStack localBackend (Just teamMember) config + $ getUserProfiles (toLocalUnsafe domain viewer.id) [Qualified targetUser.id domain] in retrievedProfiles === [ mkUserProfile (fmap (const $ (,) <$> viewer.teamId <*> Just teamMember) visibility) @@ -120,15 +120,15 @@ spec = describe "UserSubsystem.Interpreter" do defUserLegalHoldStatus ] - prop "gets a local user profile when the target user exists and has accepted their invitation but the viewer has not accepted their invitation" $ - \(PendingStoredUser viewer) (NotPendingStoredUser targetUserNoTeam) visibility domain locale sameTeam -> + prop "gets a local user profile when the target user exists and has accepted their invitation but the viewer has not accepted their invitation" + $ \(PendingStoredUser viewer) (NotPendingStoredUser targetUserNoTeam) visibility domain locale sameTeam -> let teamMember = mkTeamMember viewer.id fullPermissions Nothing defUserLegalHoldStatus targetUser = if sameTeam then targetUserNoTeam {teamId = viewer.teamId} else targetUserNoTeam config = UserSubsystemConfig visibility locale localBackend = def {users = [targetUser, viewer]} retrievedProfile = - runNoFederationStack localBackend (Just teamMember) config $ - getUserProfiles (toLocalUnsafe domain viewer.id) [Qualified targetUser.id domain] + runNoFederationStack localBackend (Just teamMember) config + $ getUserProfiles (toLocalUnsafe domain viewer.id) [Qualified targetUser.id domain] in retrievedProfile === [ mkUserProfile (fmap (const Nothing) visibility) @@ -136,31 +136,31 @@ spec = describe "UserSubsystem.Interpreter" do defUserLegalHoldStatus ] - prop "returns Nothing if the target user has not accepted their invitation yet" $ - \viewer (PendingStoredUser targetUser) visibility domain locale -> + prop "returns Nothing if the target user has not accepted their invitation yet" + $ \viewer (PendingStoredUser targetUser) visibility domain locale -> let teamMember = mkTeamMember viewer.id fullPermissions Nothing defUserLegalHoldStatus config = UserSubsystemConfig visibility locale localBackend = def {users = [targetUser, viewer]} retrievedProfile = - runNoFederationStack localBackend (Just teamMember) config $ - getLocalUserProfiles (toLocalUnsafe domain [targetUser.id]) + runNoFederationStack localBackend (Just teamMember) config + $ getLocalUserProfiles (toLocalUnsafe domain [targetUser.id]) in retrievedProfile === [] describe "getUserProfilesWithErrors" $ do - prop "If no errors, same behavior as getUserProfiles" $ - \viewer targetUsers visibility domain remoteDomain -> do + prop "If no errors, same behavior as getUserProfiles" + $ \viewer targetUsers visibility domain remoteDomain -> do let remoteBackend = def {users = targetUsers} federation = [(remoteDomain, remoteBackend)] config = UserSubsystemConfig visibility miniLocale localBackend = def {users = [viewer]} retrievedProfilesWithErrors :: ([(Qualified UserId, FederationError)], [UserProfile]) = - runFederationStack localBackend federation Nothing config $ - getUserProfilesWithErrors + runFederationStack localBackend federation Nothing config + $ getUserProfilesWithErrors (toLocalUnsafe domain viewer.id) (map (flip Qualified remoteDomain . (.id)) targetUsers) retrievedProfiles :: [UserProfile] = - runFederationStack localBackend federation Nothing config $ - getUserProfiles + runFederationStack localBackend federation Nothing config + $ getUserProfiles (toLocalUnsafe domain viewer.id) (map (flip Qualified remoteDomain . (.id)) targetUsers) remoteDomain /= domain ==> @@ -169,24 +169,24 @@ spec = describe "UserSubsystem.Interpreter" do .&&. snd retrievedProfilesWithErrors === retrievedProfiles .&&. length (snd retrievedProfilesWithErrors) === length targetUsers - prop "Remote users on offline backend always fail to return" $ - \viewer (targetUsers :: Set StoredUser) visibility domain remoteDomain -> do + prop "Remote users on offline backend always fail to return" + $ \viewer (targetUsers :: Set StoredUser) visibility domain remoteDomain -> do let online = mempty config = UserSubsystemConfig visibility miniLocale localBackend = def {users = [viewer]} retrievedProfilesWithErrors :: ([(Qualified UserId, FederationError)], [UserProfile]) = - runFederationStack localBackend online Nothing config $ - getUserProfilesWithErrors + runFederationStack localBackend online Nothing config + $ getUserProfilesWithErrors (toLocalUnsafe domain viewer.id) - ( map (flip Qualified remoteDomain . (.id)) $ - S.toList targetUsers + ( map (flip Qualified remoteDomain . (.id)) + $ S.toList targetUsers ) remoteDomain /= domain ==> length (fst retrievedProfilesWithErrors) === length targetUsers .&&. length (snd retrievedProfilesWithErrors) === 0 - prop "Remote users with one offline and one online backend return errors for offline backend but successed with online backend" $ - \viewer targetUsers visibility domain remoteDomainA remoteDomainB -> do + prop "Remote users with one offline and one online backend return errors for offline backend but successed with online backend" + $ \viewer targetUsers visibility domain remoteDomainA remoteDomainB -> do let remoteBackendA = def {users = targetUsers} online = [(remoteDomainA, remoteBackendA)] allDomains = [domain, remoteDomainA, remoteDomainB] @@ -195,8 +195,8 @@ spec = describe "UserSubsystem.Interpreter" do config = UserSubsystemConfig visibility miniLocale localBackend = def {users = [viewer]} retrievedProfilesWithErrors :: ([(Qualified UserId, FederationError)], [UserProfile]) = - runFederationStack localBackend online Nothing config $ - getUserProfilesWithErrors + runFederationStack localBackend online Nothing config + $ getUserProfilesWithErrors (toLocalUnsafe domain viewer.id) (remoteAUsers <> remoteBUsers) nub allDomains == allDomains ==> @@ -207,15 +207,15 @@ spec = describe "UserSubsystem.Interpreter" do prop "should retrieve a user which exists in the DB" \storedSelf otherStoredUsers domain config -> let localBackend = def {users = storedSelf : filter (\u -> u.id /= storedSelf.id) otherStoredUsers} retrievedProfile = - runNoFederationStack localBackend Nothing config $ - getSelfProfile (toLocalUnsafe domain storedSelf.id) + runNoFederationStack localBackend Nothing config + $ getSelfProfile (toLocalUnsafe domain storedSelf.id) in retrievedProfile === Just (SelfProfile $ mkUserFromStored domain config.defaultLocale storedSelf) prop "should fail when the user does not exist in the DB" \selfId otherStoredUsers domain config -> let localBackend = def {users = filter (\u -> u.id /= selfId) otherStoredUsers} retrievedProfile = - runNoFederationStack localBackend Nothing config $ - getSelfProfile (toLocalUnsafe domain selfId) + runNoFederationStack localBackend Nothing config + $ getSelfProfile (toLocalUnsafe domain selfId) in retrievedProfile === Nothing prop "should mark user as managed by scim if E2EId is enabled for the user and they have a handle" \storedSelf domain susbsystemConfig mlsE2EIdConfig -> @@ -232,8 +232,8 @@ spec = describe "UserSubsystem.Interpreter" do in retrievedUser.userManagedBy === expectedManagedBy describe "updateUserProfile" $ do - prop "Update user" $ - \(NotPendingStoredUser alice) localDomain update config -> do + prop "Update user" + $ \(NotPendingStoredUser alice) localDomain update config -> do let lusr = toLocalUnsafe localDomain alice.id localBackend = def {users = [alice {managedBy = Just ManagedByWire}]} userBeforeUpdate = mkUserFromStored localDomain config.defaultLocale alice @@ -247,8 +247,8 @@ spec = describe "UserSubsystem.Interpreter" do .&&. userAfterUpdate.userAccentId === fromMaybe userBeforeUpdate.userAccentId update.accentId .&&. userAfterUpdate.userLocale === fromMaybe userBeforeUpdate.userLocale update.locale - prop "Update user events" $ - \(NotPendingStoredUser alice) localDomain update config -> do + prop "Update user events" + $ \(NotPendingStoredUser alice) localDomain update config -> do let lusr = toLocalUnsafe localDomain alice.id localBackend = def {users = [alice {managedBy = Just ManagedByWire}]} events = runNoFederationStack localBackend Nothing config do @@ -257,8 +257,8 @@ spec = describe "UserSubsystem.Interpreter" do in events === [ MkMiniEvent alice.id - ( UserUpdated $ - (emptyUserUpdatedData alice.id) + ( UserUpdated + $ (emptyUserUpdatedData alice.id) { eupName = update.name, eupPict = update.pict, eupAccentId = update.accentId, @@ -270,8 +270,8 @@ spec = describe "UserSubsystem.Interpreter" do ] describe "user managed by scim doesn't allow certain update operations, but allows others" $ do - prop "happy" $ - \(NotPendingStoredUser alice) localDomain update config -> + prop "happy" + $ \(NotPendingStoredUser alice) localDomain update config -> let lusr = toLocalUnsafe localDomain alice.id localBackend = def {users = [alice {managedBy = Just ManagedByScim}]} profileErr :: Either UserSubsystemError (Maybe UserProfile) = @@ -283,8 +283,8 @@ spec = describe "UserSubsystem.Interpreter" do getUserProfile lusr (tUntagged lusr) in counterexample (show profileErr) $ isRight profileErr === True - prop "name" $ - \(NotPendingStoredUser alice) localDomain name config -> + prop "name" + $ \(NotPendingStoredUser alice) localDomain name config -> alice.name /= name ==> let lusr = toLocalUnsafe localDomain alice.id localBackend = def {users = [alice {managedBy = Just ManagedByScim}]} @@ -297,8 +297,8 @@ spec = describe "UserSubsystem.Interpreter" do getUserProfile lusr (tUntagged lusr) in profileErr === Left UserSubsystemDisplayNameManagedByScim - prop "locale" $ - \(NotPendingStoredUser alice) localDomain locale config -> + prop "locale" + $ \(NotPendingStoredUser alice) localDomain locale config -> alice.locale /= Just locale ==> let lusr = toLocalUnsafe localDomain alice.id localBackend = def {users = [alice {managedBy = Just ManagedByScim}]} @@ -433,7 +433,7 @@ spec = describe "UserSubsystem.Interpreter" do where dom = Domain "localdomain" - operation :: Monad m => Sem (GetUserProfileEffects `Append` AllErrors) a -> m a + operation :: (Monad m) => Sem (GetUserProfileEffects `Append` AllErrors) a -> m a operation op = result `seq` pure result where result = runNoFederationStack localBackend Nothing config op diff --git a/libs/zauth/main/Main.hs b/libs/zauth/main/Main.hs index 16aacc4b56f..17fcf464af1 100644 --- a/libs/zauth/main/Main.hs +++ b/libs/zauth/main/Main.hs @@ -77,22 +77,22 @@ go VerifyAccess o = check' (o ^. skey) (tkn (o ^. dat) fromByteString :: Token A go VerifyBot o = check' (o ^. skey) (tkn (o ^. dat) fromByteString :: Token Bot) go VerifyProvider o = check' (o ^. skey) (tkn (o ^. dat) fromByteString :: Token Provider) go CreateSession o = do - when (length (o ^. dat) /= 2) $ - error "invalid --data, must have 2 elements" + when (length (o ^. dat) /= 2) + $ error "invalid --data, must have 2 elements" let u = uuid . head $ o ^. dat case fromByteString ((o ^. dat) !! 1) of Nothing -> error "invalid random int" Just rn -> runCreate' o $ toByteString <$> sessionToken (o ^. dur) u Nothing rn go CreateUser o = do - when (length (o ^. dat) /= 2) $ - error "invalid --data, must have 2 elements" + when (length (o ^. dat) /= 2) + $ error "invalid --data, must have 2 elements" let u = uuid . head $ o ^. dat case fromByteString ((o ^. dat) !! 1) of Nothing -> error "invalid random int" Just rn -> runCreate' o $ toByteString <$> userToken (o ^. dur) u Nothing rn go CreateAccess o = do - when (null (o ^. dat)) $ - error "invalid --data, must have 1 or 2 elements" + when (null (o ^. dat)) + $ error "invalid --data, must have 1 or 2 elements" let u = uuid . head $ o ^. dat case length (o ^. dat) of 1 -> runCreate' o $ toByteString <$> accessToken1 (o ^. dur) u Nothing @@ -101,15 +101,15 @@ go CreateAccess o = do Just c -> runCreate' o $ toByteString <$> accessToken (o ^. dur) u Nothing c _ -> error "invalid --data, must have 1 or 2 elements" go CreateBot o = do - when (length (o ^. dat) /= 3) $ - error "invalid --data, must have 3 elements" + when (length (o ^. dat) /= 3) + $ error "invalid --data, must have 3 elements" let p = uuid $ head (o ^. dat) b = uuid $ (o ^. dat) !! 1 c = uuid $ (o ^. dat) !! 2 runCreate' o $ toByteString <$> botToken p b c go CreateProvider o = do - when (length (o ^. dat) /= 1) $ - error "missing --data" + when (length (o ^. dat) /= 1) + $ error "missing --data" let p = uuid $ head (o ^. dat) runCreate' o $ toByteString <$> providerToken (o ^. dur) p go GenKeyPair _ = do @@ -123,7 +123,7 @@ tkn xs f = fromMaybe (error "Failed to read token") . f $ headDef "missing token uuid :: ByteString -> UUID uuid s = fromMaybe (error $ "Invalid UUID: " ++ show s) $ fromASCIIBytes s -check' :: ToByteString a => ByteString -> Token a -> IO () +check' :: (ToByteString a) => ByteString -> Token a -> IO () check' k t = exceptT (\e -> putStrLn e >> exitFailure) (const $ pure ()) $ do p <- hoistEither $ PublicKey <$> decode k e <- liftIO $ runValidate (V.mkEnv p (replicate (t ^. header . key) p)) (check t) @@ -145,41 +145,46 @@ options = <*> optData where optDuration = - fmap read . strOption $ - long "duration" - <> short 'd' - <> metavar "STRING" - <> value "3600" - <> showDefault - <> help "token validity duration in seconds" + fmap read + . strOption + $ long "duration" + <> short 'd' + <> metavar "STRING" + <> value "3600" + <> showDefault + <> help "token validity duration in seconds" optKey = - fmap fromString . strOption $ - long "key" - <> short 'k' - <> value "" - <> metavar "STRING" - <> help "public or private key" + fmap fromString + . strOption + $ long "key" + <> short 'k' + <> value "" + <> metavar "STRING" + <> help "public or private key" optIdx = - fmap read . strOption $ - long "index" - <> short 'i' - <> metavar "INT" - <> help "key index" + fmap read + . strOption + $ long "index" + <> short 'i' + <> metavar "INT" + <> help "key index" optMode = - option toMode $ - long "mode" - <> short 'm' - <> metavar "STRING" - <> value CreateAccess - <> showDefaultWith (const "create-access") - <> help - "create-user | create-access | create-session | create-bot | create-provider \ - \ verify-user | verify-access | verify-bot | verify-provider | gen-keypair" + option toMode + $ long "mode" + <> short 'm' + <> metavar "STRING" + <> value CreateAccess + <> showDefaultWith (const "create-access") + <> help + "create-user | create-access | create-session | create-bot | create-provider \ + \ verify-user | verify-access | verify-bot | verify-provider | gen-keypair" optData = - many <$> fmap fromString . strOption $ - long "data" - <> metavar "STRING" - <> help "token data" + many + <$> fmap fromString + . strOption + $ long "data" + <> metavar "STRING" + <> help "token data" toMode = readerAsk >>= \case "create-user" -> pure CreateUser diff --git a/libs/zauth/src/Data/ZAuth/Creation.hs b/libs/zauth/src/Data/ZAuth/Creation.hs index 7a63a68e4a7..83e30dcbe06 100644 --- a/libs/zauth/src/Data/ZAuth/Creation.hs +++ b/libs/zauth/src/Data/ZAuth/Creation.hs @@ -86,15 +86,15 @@ mkEnv k kk = Env 1 (Vec.fromList $ map signature (k : kk)) <$> liftIO createSyst runCreate :: Env -> Int -> Create a -> IO a runCreate z k m = do - when (k < 1 || k > Vec.length (zSign z)) $ - error "runCreate: Key index out of range." + when (k < 1 || k > Vec.length (zSign z)) + $ error "runCreate: Key index out of range." runReaderT (zauth m) (z {keyIdx = k}) withIndex :: Int -> Create a -> Create a withIndex k m = Create $ do e <- ask - when (k < 1 || k > Vec.length (zSign e)) $ - error "withIndex: Key index out of range." + when (k < 1 || k > Vec.length (zSign e)) + $ error "withIndex: Key index out of range." local (const (e {keyIdx = k})) (zauth m) userToken :: Integer -> UUID -> Maybe Text -> Word32 -> Create (Token User) @@ -155,12 +155,12 @@ providerToken dur pid = do d <- expiry dur newToken d P Nothing (mkProvider pid) -renewToken :: ToByteString a => Integer -> Header -> a -> Create (Token a) +renewToken :: (ToByteString a) => Integer -> Header -> a -> Create (Token a) renewToken dur hdr bdy = do d <- expiry dur newToken d (hdr ^. typ) (hdr ^. tag) bdy -newToken :: ToByteString a => POSIXTime -> Type -> Maybe Tag -> a -> Create (Token a) +newToken :: (ToByteString a) => POSIXTime -> Type -> Maybe Tag -> a -> Create (Token a) newToken ti ty ta a = do k <- Create $ asks keyIdx let h = mkHeader tokenVersion k (floor ti) ty ta @@ -170,10 +170,10 @@ newToken ti ty ta a = do ----------------------------------------------------------------------------- -- Internal -signToken :: ToByteString a => Header -> a -> Create Signature +signToken :: (ToByteString a) => Header -> a -> Create Signature signToken h a = Create $ do f <- (! (h ^. key - 1)) <$> asks zSign liftIO . f . toStrict . toLazyByteString $ writeData h a -expiry :: MonadIO m => Integer -> m POSIXTime +expiry :: (MonadIO m) => Integer -> m POSIXTime expiry d = (fromInteger d +) <$> liftIO getPOSIXTime diff --git a/libs/zauth/src/Data/ZAuth/Token.hs b/libs/zauth/src/Data/ZAuth/Token.hs index 561878ce0bb..f87a314a6d0 100644 --- a/libs/zauth/src/Data/ZAuth/Token.hs +++ b/libs/zauth/src/Data/ZAuth/Token.hs @@ -233,7 +233,7 @@ instance FromByteString (Token LegalHoldUser) where Nothing -> fail "Invalid user token" Just t -> pure t -instance ToByteString a => ToByteString (Token a) where +instance (ToByteString a) => ToByteString (Token a) where builder = writeToken ----------------------------------------------------------------------------- @@ -331,13 +331,13 @@ readLegalHoldUserBody t = LegalHoldUser <$> readUserBody t ----------------------------------------------------------------------------- -- Writing -writeToken :: ToByteString a => Token a -> Builder +writeToken :: (ToByteString a) => Token a -> Builder writeToken t = byteString (encode (sigBytes (t ^. signature))) <> dot <> writeData (t ^. header) (t ^. body) -writeData :: ToByteString a => Header -> a -> Builder +writeData :: (ToByteString a) => Header -> a -> Builder writeData h a = writeHeader h <> dot <> builder a writeHeader :: Header -> Builder @@ -402,7 +402,7 @@ instance ToByteString Type where instance ToByteString Tag where builder S = char8 's' -field :: ToByteString a => LByteString -> a -> Builder +field :: (ToByteString a) => LByteString -> a -> Builder field k v = builder k <> eq <> builder v dot, eq :: Builder diff --git a/libs/zauth/src/Data/ZAuth/Validation.hs b/libs/zauth/src/Data/ZAuth/Validation.hs index f6289c4b67d..68e1a15eadb 100644 --- a/libs/zauth/src/Data/ZAuth/Validation.hs +++ b/libs/zauth/src/Data/ZAuth/Validation.hs @@ -73,7 +73,7 @@ newtype Validate a = Validate mkEnv :: PublicKey -> [PublicKey] -> Env mkEnv k kk = Env $ Vec.fromList (map verifyWith (k : kk)) -runValidate :: MonadIO m => Env -> Validate a -> m (Either Failure a) +runValidate :: (MonadIO m) => Env -> Validate a -> m (Either Failure a) runValidate v m = liftIO $ runReaderT (runExceptT (valid m)) v validateUser :: ByteString -> Validate (Token User) @@ -108,27 +108,27 @@ validate (Just c) (Just t) = do a <- maybe (throwError Invalid) pure (fromByteString t) void $ check u void $ check a - unless (u ^. body . user == a ^. body . userId) $ - throwError Invalid + unless (u ^. body . user == a ^. body . userId) + $ throwError Invalid pure a -check :: ToByteString a => Token a -> Validate (Token a) +check :: (ToByteString a) => Token a -> Validate (Token a) check t = do ff <- Validate $ lift $ asks verifyFns let dat = toByteString' $ writeData (t ^. header) (t ^. body) let k = t ^. header . key - when (k < 1 || k > Vec.length ff) $ - throwError Invalid + when (k < 1 || k > Vec.length ff) + $ throwError Invalid ok <- liftIO $ (ff ! (k - 1)) (t ^. signature) dat - unless ok $ - throwError Falsified + unless ok + $ throwError Falsified isExpired <- if t ^. header . time == -1 then pure False else (t ^. header . time <) <$> now - when isExpired $ - throwError Expired + when isExpired + $ throwError Expired pure t -now :: MonadIO m => m Integer +now :: (MonadIO m) => m Integer now = floor <$> liftIO getPOSIXTime diff --git a/libs/zauth/test/ZAuth.hs b/libs/zauth/test/ZAuth.hs index db94845d04c..76c86b8aa42 100644 --- a/libs/zauth/test/ZAuth.hs +++ b/libs/zauth/test/ZAuth.hs @@ -42,8 +42,8 @@ tests = do (p3, s3) <- newKeyPair z <- C.mkEnv s1 [s2, s3] let v = V.mkEnv p1 [p2, p3] - pure $ - testGroup + pure + $ testGroup "ZAuth" [ testGroup "Parsing" diff --git a/services/background-worker/src/Wire/BackendNotificationPusher.hs b/services/background-worker/src/Wire/BackendNotificationPusher.hs index 7dfad1390f1..fbd7e1b07f2 100644 --- a/services/background-worker/src/Wire/BackendNotificationPusher.hs +++ b/services/background-worker/src/Wire/BackendNotificationPusher.hs @@ -40,7 +40,7 @@ startPushingNotifications runningFlag chan domain = do lift $ ensureQueue chan domain._domainText QL.consumeMsgs chan (routingKey domain._domainText) Q.Ack (void . pushNotification runningFlag domain) -pushNotification :: RabbitMQEnvelope e => MVar () -> Domain -> (Q.Message, e) -> AppT IO (Async ()) +pushNotification :: (RabbitMQEnvelope e) => MVar () -> Domain -> (Q.Message, e) -> AppT IO (Async ()) pushNotification runningFlag targetDomain (msg, envelope) = do cfg <- asks (.backendNotificationsConfig) -- Jittered exponential backoff with 10ms as starting delay and 300s as max @@ -49,12 +49,12 @@ pushNotification runningFlag targetDomain (msg, envelope) = do -- FUTUREWORK: Pull these numbers into config.s let policy = capDelay cfg.pushBackoffMaxWait $ fullJitterBackoff cfg.pushBackoffMinWait logErrr willRetry (SomeException e) rs = do - Log.err $ - Log.msg (Log.val "Exception occurred while pushing notification") - . Log.field "error" (displayException e) - . Log.field "domain" (domainText targetDomain) - . Log.field "willRetry" willRetry - . Log.field "retryCount" rs.rsIterNumber + Log.err + $ Log.msg (Log.val "Exception occurred while pushing notification") + . Log.field "error" (displayException e) + . Log.field "domain" (domainText targetDomain) + . Log.field "willRetry" willRetry + . Log.field "retryCount" rs.rsIterNumber metrics <- asks backendNotificationMetrics withLabel metrics.errorCounter (domainText targetDomain) incCounter withLabel metrics.stuckQueuesGauge (domainText targetDomain) (flip setGauge 1) @@ -72,32 +72,33 @@ pushNotification runningFlag targetDomain (msg, envelope) = do -- can't cancel the consumer, and the calling code will block until the cancelation message -- can be processed. -- Luckily, we can async this loop and carry on as usual due to how we have the channel setup. - async $ - recovering policy handlers $ - const $ - -- Ensure that the mvars are reset correctly. - -- takeMVar also has the nice feature of being a second layer of protection - -- against lazy thread updates in `amqp`. If this somehow gets called while - -- we are trying to cleanup workers for a shutdown, this will call will block - -- and prevent the message from being sent out as we are tearing down resources. - -- This removes one way that a message might be delivered twice. - UnliftIO.bracket_ (takeMVar runningFlag) (putMVar runningFlag ()) go + async + $ recovering policy handlers + $ const + $ + -- Ensure that the mvars are reset correctly. + -- takeMVar also has the nice feature of being a second layer of protection + -- against lazy thread updates in `amqp`. If this somehow gets called while + -- we are trying to cleanup workers for a shutdown, this will call will block + -- and prevent the message from being sent out as we are tearing down resources. + -- This removes one way that a message might be delivered twice. + UnliftIO.bracket_ (takeMVar runningFlag) (putMVar runningFlag ()) go where go :: AppT IO () go = case A.eitherDecode @(PayloadBundle _) (Q.msgBody msg) of Left e -> do case A.eitherDecode @BackendNotification (Q.msgBody msg) of Left eBN -> do - Log.err $ - Log.msg + Log.err + $ Log.msg ( Log.val "Cannot parse a queued message as s notification " <> "nor as a bundle; the message will be ignored" ) - . Log.field "domain" (domainText targetDomain) - . Log.field "error-notification" eBN - . Log.field - "error-bundle" - e + . Log.field "domain" (domainText targetDomain) + . Log.field "error-notification" eBN + . Log.field + "error-bundle" + e -- FUTUREWORK: This rejects the message without any requeueing. This is -- dangerous as it could happen that a new type of notification is -- introduced and an old instance of this worker is running, in which case @@ -140,15 +141,15 @@ pushNotification runningFlag targetDomain (msg, envelope) = do -- use versioned client with no version set: since we are manually -- performing version negotiation, we don't want the client to -- negotiate a version for us - ( runVersionedFederatorClient @'Brig (unversionedEnv env) $ - fedClientIn @'Brig @"api-version" () + ( runVersionedFederatorClient @'Brig (unversionedEnv env) + $ fedClientIn @'Brig @"api-version" () ) >>= \case Left e -> do - Log.err $ - Log.msg (Log.val "Failed to get supported API versions") - . Log.field "domain" (domainText targetDomain) - . Log.field "error" (displayException e) + Log.err + $ Log.msg (Log.val "Failed to get supported API versions") + . Log.field "domain" (domainText targetDomain) + . Log.field "error" (displayException e) throwM e Right vi -> pure . Set.fromList . vinfoSupported $ vi @@ -156,9 +157,9 @@ pushNotification runningFlag targetDomain (msg, envelope) = do let bestVersion = bodyVersions >=> flip latestCommonVersion remoteVersions case pairedMaximumOn bestVersion (toList (notifications bundle)) of (_, Nothing) -> - Log.fatal $ - Log.msg (Log.val "No federation API version in common, the notification will be ignored") - . Log.field "domain" (domainText targetDomain) + Log.fatal + $ Log.msg (Log.val "No federation API version in common, the notification will be ignored") + . Log.field "domain" (domainText targetDomain) (notif, cveVersion) -> do ceFederator <- asks (.federatorInternal) ceHttp2Manager <- asks http2Manager @@ -182,16 +183,16 @@ sendNotificationIgnoringVersionMismatch :: sendNotificationIgnoringVersionMismatch env comp path body = liftIO (sendNotification env comp path body) >>= \case Left (FederatorClientVersionNegotiationError v) -> do - Log.fatal $ - Log.msg (Log.val "Federator version negotiation error") - . Log.field "domain" (domainText env.cveEnv.ceTargetDomain) - . Log.field "error" (show v) + Log.fatal + $ Log.msg (Log.val "Federator version negotiation error") + . Log.field "domain" (domainText env.cveEnv.ceTargetDomain) + . Log.field "error" (show v) pure () Left e -> throwM e Right () -> pure () -- | Find the pair that maximises b. -pairedMaximumOn :: Ord b => (a -> b) -> [a] -> (a, b) +pairedMaximumOn :: (Ord b) => (a -> b) -> [a] -> (a, b) pairedMaximumOn f = maximumBy (compare `on` snd) . map (id &&& f) -- FUTUREWORK: Recosider using 1 channel for many consumers. It shouldn't matter @@ -242,7 +243,8 @@ cancelConsumer consumers chan domain = do -- The ' version of atomicModifyIORef is strict in the function update and is useful -- for not leaking memory. atomicModifyIORef' consumers (\c -> (Map.delete domain c, Map.lookup domain c)) - >>= liftIO . traverse_ (Q.cancelConsumer chan . fst) + >>= liftIO + . traverse_ (Q.cancelConsumer chan . fst) ensureConsumer :: IORef (Map Domain (Q.ConsumerTag, MVar ())) -> Q.Channel -> Domain -> AppT IO () ensureConsumer consumers chan domain = do @@ -267,11 +269,11 @@ getRemoteDomains = do -- FUTUREWORK: Pull these numbers into config let policy = limitRetriesByCumulativeDelay 60_000_000 $ fullJitterBackoff 10000 logErrr willRetry (SomeException e) rs = - Log.err $ - Log.msg (Log.val "Exception occurred while refreshig domains") - . Log.field "error" (displayException e) - . Log.field "willRetry" willRetry - . Log.field "retryCount" rs.rsIterNumber + Log.err + $ Log.msg (Log.val "Exception occurred while refreshig domains") + . Log.field "error" (displayException e) + . Log.field "willRetry" willRetry + . Log.field "retryCount" rs.rsIterNumber handlers = skipAsyncExceptions <> [logRetries (const $ pure True) logErrr] @@ -285,10 +287,10 @@ getRemoteDomains = do let notifQueuesSuffixes = mapMaybe (\q -> Text.stripPrefix "backend-notifications." q.name) queues catMaybes <$> traverse (\d -> either (\e -> logInvalidDomain d e >> pure Nothing) (pure . Just) $ mkDomain d) notifQueuesSuffixes logInvalidDomain d e = - Log.warn $ - Log.msg (Log.val "Found invalid domain in a backend notifications queue name") - . Log.field "queue" ("backend-notifications." <> d) - . Log.field "error" e + Log.warn + $ Log.msg (Log.val "Found invalid domain in a backend notifications queue name") + . Log.field "queue" ("backend-notifications." <> d) + . Log.field "error" e startWorker :: RabbitMqAdminOpts -> AppT IO (IORef (Maybe Q.Channel), IORef (Map Domain (Q.ConsumerTag, MVar ()))) startWorker rabbitmqOpts = do @@ -305,21 +307,21 @@ startWorker rabbitmqOpts = do atomicWriteIORef chanRef Nothing atomicWriteIORef consumersRef mempty -- We can fire and forget this thread because it keeps respawning itself using the 'onConnectionClosedHandler'. - void $ - async $ - liftIO $ - openConnectionWithRetries env.logger (demoteOpts rabbitmqOpts) $ - RabbitMqHooks - { -- The exception handling in `openConnectionWithRetries` won't open a new - -- connection on an explicit close call. - onNewChannel = \chan -> do - atomicWriteIORef chanRef $ pure chan - runAppT env $ startPusher consumersRef chan, - onChannelException = \_ -> do - clearRefs - runAppT env $ markAsNotWorking BackendNotificationPusher, - onConnectionClose = do - clearRefs - runAppT env $ markAsNotWorking BackendNotificationPusher - } + void + $ async + $ liftIO + $ openConnectionWithRetries env.logger (demoteOpts rabbitmqOpts) + $ RabbitMqHooks + { -- The exception handling in `openConnectionWithRetries` won't open a new + -- connection on an explicit close call. + onNewChannel = \chan -> do + atomicWriteIORef chanRef $ pure chan + runAppT env $ startPusher consumersRef chan, + onChannelException = \_ -> do + clearRefs + runAppT env $ markAsNotWorking BackendNotificationPusher, + onConnectionClose = do + clearRefs + runAppT env $ markAsNotWorking BackendNotificationPusher + } pure (chanRef, consumersRef) diff --git a/services/background-worker/src/Wire/BackgroundWorker.hs b/services/background-worker/src/Wire/BackgroundWorker.hs index 3a9bc8e298a..8095949f14d 100644 --- a/services/background-worker/src/Wire/BackgroundWorker.hs +++ b/services/background-worker/src/Wire/BackgroundWorker.hs @@ -55,6 +55,6 @@ run opts = do servantApp :: Env -> Application servantApp env = - Metrics.servantPrometheusMiddleware (Proxy @(ToServant Health.HealthAPI AsApi)) $ - genericServe $ - Health.api env + Metrics.servantPrometheusMiddleware (Proxy @(ToServant Health.HealthAPI AsApi)) + $ genericServe + $ Health.api env diff --git a/services/background-worker/src/Wire/BackgroundWorker/Env.hs b/services/background-worker/src/Wire/BackgroundWorker/Env.hs index 9d1265fd131..eb4cdd4286e 100644 --- a/services/background-worker/src/Wire/BackgroundWorker/Env.hs +++ b/services/background-worker/src/Wire/BackgroundWorker/Env.hs @@ -69,8 +69,8 @@ mkEnv opts = do rabbitmqVHost = opts.rabbitmq.vHost rabbitmqAdminClient <- mkRabbitMqAdminClientEnv opts.rabbitmq statuses <- - newIORef $ - Map.fromList + newIORef + $ Map.fromList [ (BackendNotificationPusher, False) ] backendNotificationMetrics <- mkBackendNotificationMetrics @@ -84,8 +84,8 @@ initHttp2Manager = do SSL.contextAddOption ctx SSL_OP_NO_SSLv3 SSL.contextAddOption ctx SSL_OP_NO_TLSv1 SSL.contextSetCiphers ctx "HIGH" - SSL.contextSetVerificationMode ctx $ - SSL.VerifyPeer True True Nothing + SSL.contextSetVerificationMode ctx + $ SSL.VerifyPeer True True Nothing SSL.contextSetDefaultVerifyPaths ctx http2ManagerWithSSLCtx ctx @@ -108,7 +108,7 @@ deriving newtype instance (MonadBase b m) => MonadBase b (AppT m) deriving newtype instance (MonadBaseControl b m) => MonadBaseControl b (AppT m) -- Coppied from Federator. -instance MonadUnliftIO m => MonadUnliftIO (AppT m) where +instance (MonadUnliftIO m) => MonadUnliftIO (AppT m) where withRunInIO inner = AppT . ReaderT $ \r -> withRunInIO $ \runner -> diff --git a/services/background-worker/test/Test/Wire/BackendNotificationPusherSpec.hs b/services/background-worker/test/Test/Wire/BackendNotificationPusherSpec.hs index 6b53ed6e9e3..8010ef39046 100644 --- a/services/background-worker/test/Test/Wire/BackendNotificationPusherSpec.hs +++ b/services/background-worker/test/Test/Wire/BackendNotificationPusherSpec.hs @@ -102,8 +102,11 @@ spec = do -- slow. Make me wonder if notification pusher should even try to parse the -- actual content, seems like wasted compute power. notifContent <- - generate $ - ClientRemovedRequest <$> arbitrary <*> arbitrary <*> arbitrary + generate + $ ClientRemovedRequest + <$> arbitrary + <*> arbitrary + <*> arbitrary let bundle = toBundle @'OnClientRemovedTag (RequestId "N/A") origDomain notifContent envelope <- newMockEnvelope let msg = @@ -201,8 +204,8 @@ spec = do let mockRemote _ = do isRemoteBroken <- readIORef isRemoteBrokenRef atomicModifyIORef fedCalls $ \c -> (c + 1, ()) - pure $ - if isRemoteBroken + pure + $ if isRemoteBroken then ("text/html", "down for maintenance") else ("application/json", Aeson.encode EmptyResponse) origDomain = Domain "origin.example.com" diff --git a/services/brig/src/Brig/API/Auth.hs b/services/brig/src/Brig/API/Auth.hs index 66e65b4354d..4e85f12d47f 100644 --- a/services/brig/src/Brig/API/Auth.hs +++ b/services/brig/src/Brig/API/Auth.hs @@ -89,7 +89,8 @@ access :: Handler r SomeAccess access mcid t mt = traverse mkUserTokenCookie - =<< Auth.renewAccess (List1 t) mt mcid !>> zauthError + =<< Auth.renewAccess (List1 t) mt mcid + !>> zauthError sendLoginCode :: (Member TinyLog r) => SendLoginCode -> Handler r LoginCodeTimeout sendLoginCode (SendLoginCode phone call force) = do @@ -124,12 +125,12 @@ logoutH uts' mat' = do partitionTokens uts mat >>= either (uncurry logout) (uncurry logout) -logout :: TokenPair u a => NonEmpty (Token u) -> Maybe (Token a) -> Handler r () +logout :: (TokenPair u a) => NonEmpty (Token u) -> Maybe (Token a) -> Handler r () logout _ Nothing = throwStd authMissingToken logout uts (Just at) = Auth.logout (List1 uts) at !>> zauthError changeSelfEmailH :: - Member BlacklistStore r => + (Member BlacklistStore r) => [Either Text SomeUserToken] -> Maybe (Either Text SomeAccessToken) -> EmailUpdate -> @@ -143,7 +144,7 @@ changeSelfEmailH uts' mat' up = do changeSelfEmail usr email UpdateOriginWireClient validateCredentials :: - TokenPair u a => + (TokenPair u a) => NonEmpty (Token u) -> Maybe (Token a) -> Handler r UserId @@ -197,7 +198,7 @@ getLoginCode phone = do code <- lift $ Auth.lookupLoginCode phone maybe (throwStd loginCodeNotFound) pure code -reauthenticate :: Member GalleyAPIAccess r => UserId -> ReAuthUser -> Handler r () +reauthenticate :: (Member GalleyAPIAccess r) => UserId -> ReAuthUser -> Handler r () reauthenticate uid body = do wrapClientE (User.reauthenticate uid (reAuthPassword body)) !>> reauthError case reAuthCodeAction body of diff --git a/services/brig/src/Brig/API/Client.hs b/services/brig/src/Brig/API/Client.hs index 3176421f984..87d80e26c90 100644 --- a/services/brig/src/Brig/API/Client.hs +++ b/services/brig/src/Brig/API/Client.hs @@ -152,9 +152,9 @@ lookupPubClientsBulk qualifiedUids = do (\(d, ids) -> mapLeft (const d) . fmap (d,) <$> runExceptT (getUserClients d (GetUserClients ids))) (Map.toList uids) forM_ (lefts results) $ \d -> - Log.warn $ - field "remote_domain" (domainText d) - ~~ msg (val "Failed to fetch clients for domain") + Log.warn + $ field "remote_domain" (domainText d) + ~~ msg (val "Failed to fetch clients for domain") pure $ Map.fromList (rights results) lookupLocalPubClientsBulk :: [UserId] -> ExceptT ClientError (AppT r) (UserMap (Set PubClient)) @@ -217,10 +217,10 @@ addClientWithReAuthPolicy policy u con new = do liftSem $ GalleyAPIAccess.newClient u (clientId clt) liftSem $ Intra.onClientEvent u con (ClientAdded clt) when (clientType clt == LegalHoldClientType) $ liftSem $ Intra.onUserEvent u con (UserLegalHoldEnabled u) - when (count > 1) $ - for_ (userEmail usr) $ - \email -> - sendNewClientEmail (userDisplayName usr) email clt (userLocale usr) + when (count > 1) + $ for_ (userEmail usr) + $ \email -> + sendNewClientEmail (userDisplayName usr) email clt (userLocale usr) pure clt where clientId' = clientIdFromPrekey (unpackLastPrekey $ newClientLastKey new) @@ -237,7 +237,7 @@ addClientWithReAuthPolicy policy u con new = do VerificationCodeNoPendingCode -> throwE ClientCodeAuthenticationFailed VerificationCodeNoEmail -> throwE ClientCodeAuthenticationFailed -updateClient :: MonadClient m => UserId -> ClientId -> UpdateClient -> ExceptT ClientError m () +updateClient :: (MonadClient m) => UserId -> ClientId -> UpdateClient -> ExceptT ClientError m () updateClient u c r = do client <- lift (Data.lookupClient u c) >>= maybe (throwE ClientNotFound) pure for_ (updateClientLabel r) $ lift . Data.updateClientLabel u c . Just @@ -253,7 +253,7 @@ updateClient u c r = do -- nb. We must ensure that the set of clients known to brig is always -- a superset of the clients known to galley. rmClient :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> ConnId -> ClientId -> @@ -273,7 +273,7 @@ rmClient u con clt pw = lift $ execDelete u (Just con) client claimPrekey :: - Member DeleteQueue r => + (Member DeleteQueue r) => LegalholdProtectee -> UserId -> Domain -> @@ -286,7 +286,7 @@ claimPrekey protectee u d c = do else wrapClientE $ claimRemotePrekey (Qualified u d) c claimLocalPrekey :: - Member DeleteQueue r => + (Member DeleteQueue r) => LegalholdProtectee -> UserId -> ClientId -> @@ -354,7 +354,8 @@ claimMultiPrekeyBundlesInternal protectee quc = do Local UserClients -> ExceptT ClientError (AppT r) (Qualified UserClientPrekeyMap) claimLocal luc = - tUntagged . qualifyAs luc + tUntagged + . qualifyAs luc <$> claimLocalMultiPrekeyBundles protectee (tUnqualified luc) claimMultiPrekeyBundlesV3 :: @@ -367,11 +368,11 @@ claimMultiPrekeyBundlesV3 :: claimMultiPrekeyBundlesV3 protectee quc = do (localPrekeys, remotes) <- claimMultiPrekeyBundlesInternal protectee quc remotePrekeys <- - mapExceptT wrapHttpClient $ - traverseConcurrentlyWithErrors + mapExceptT wrapHttpClient + $ traverseConcurrentlyWithErrors claimRemote remotes - !>> ClientFederationError + !>> ClientFederationError pure . qualifiedUserClientPrekeyMapFromList $ localPrekeys <> remotePrekeys where claimRemote :: @@ -382,7 +383,8 @@ claimMultiPrekeyBundlesV3 protectee quc = do Remote UserClients -> ExceptT FederationError m (Qualified UserClientPrekeyMap) claimRemote ruc = - tUntagged . qualifyAs ruc + tUntagged + . qualifyAs ruc <$> Federation.claimMultiPrekeyBundle (tDomain ruc) (tUnqualified ruc) -- Similar to claimMultiPrekeyBundles except for the following changes @@ -403,21 +405,23 @@ claimMultiPrekeyBundles protectee quc = do (localPrekeys, remotes) <- claimMultiPrekeyBundlesInternal protectee quc remotePrekeys <- mapExceptT wrapHttpClient $ lift $ traverseConcurrentlySem claimRemote remotes let prekeys = - getQualifiedUserClientPrekeyMap $ - qualifiedUserClientPrekeyMapFromList $ - localPrekeys <> rights remotePrekeys + getQualifiedUserClientPrekeyMap + $ qualifiedUserClientPrekeyMapFromList + $ localPrekeys + <> rights remotePrekeys failed = lefts remotePrekeys >>= toQualifiedUser . fst - pure $ - QualifiedUserClientPrekeyMapV4 prekeys $ - if null failed - then Nothing - else pure failed + pure + $ QualifiedUserClientPrekeyMapV4 prekeys + $ if null failed + then Nothing + else pure failed where toQualifiedUser :: Remote UserClients -> [Qualified UserId] toQualifiedUser r = fmap (\u -> Qualified u $ tDomain r) . Map.keys . userClients . qUnqualified $ tUntagged r claimRemote :: Remote UserClients -> ExceptT FederationError HttpClientIO (Qualified UserClientPrekeyMap) claimRemote ruc = - tUntagged . qualifyAs ruc + tUntagged + . qualifyAs ruc <$> Federation.claimMultiPrekeyBundle (tDomain ruc) (tUnqualified ruc) claimLocalMultiPrekeyBundles :: @@ -441,13 +445,13 @@ claimLocalMultiPrekeyBundles protectee userClients = do getChunk :: Map UserId (Set ClientId) -> AppT r (Map UserId (Map ClientId (Maybe Prekey))) getChunk m = do e <- ask - AppT $ - lift $ - Map.fromListWith (<>) - <$> unsafePooledMapConcurrentlyN - 16 - (\(u, cids) -> (u,) <$> lowerAppT e (getUserKeys u cids)) - (Map.toList m) + AppT + $ lift + $ Map.fromListWith (<>) + <$> unsafePooledMapConcurrentlyN + 16 + (\(u, cids) -> (u,) <$> lowerAppT e (getUserKeys u cids)) + (Map.toList m) getUserKeys :: UserId -> Set ClientId -> @@ -467,7 +471,7 @@ claimLocalMultiPrekeyBundles protectee userClients = do -- | Enqueue an orderly deletion of an existing client. execDelete :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> Maybe ConnId -> Client -> @@ -483,7 +487,7 @@ execDelete u con c = do -- thus repairing any inconsistencies related to distributed -- (and possibly duplicated) client data. noPrekeys :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> ClientId -> (AppT r) () @@ -491,15 +495,15 @@ noPrekeys u c = do mclient <- wrapClient $ Data.lookupClient u c case mclient of Nothing -> do - Log.warn $ - field "user" (toByteString u) - ~~ field "client" (toByteString c) - ~~ msg (val "No prekey found. Client is missing, so doing nothing.") + Log.warn + $ field "user" (toByteString u) + ~~ field "client" (toByteString c) + ~~ msg (val "No prekey found. Client is missing, so doing nothing.") Just client -> do - Log.warn $ - field "user" (toByteString u) - ~~ field "client" (toByteString c) - ~~ msg (val "No prekey found. Deleting client.") + Log.warn + $ field "user" (toByteString u) + ~~ field "client" (toByteString c) + ~~ msg (val "No prekey found. Deleting client.") execDelete u Nothing client pubClient :: Client -> PubClient @@ -562,24 +566,27 @@ createAccessToken luid cid method link proof = do let uid = tUnqualified luid (tid, handle, displayName) <- do mUser <- lift $ wrapClient (Data.lookupUser NoPendingInvitations uid) - except $ - (,,) - <$> note NotATeamUser (userTeam =<< mUser) - <*> note MissingHandle (userHandle =<< mUser) - <*> note MissingName (userDisplayName <$> mUser) + except + $ (,,) + <$> note NotATeamUser (userTeam =<< mUser) + <*> note MissingHandle (userHandle =<< mUser) + <*> note MissingName (userDisplayName <$> mUser) nonce <- - ExceptT $ - note NonceNotFound - <$> wrapClient - ( Nonce.lookupAndDeleteNonce - uid - (T.decodeUtf8With lenientDecode . toStrict $ toByteString cid) - ) + ExceptT + $ note NonceNotFound + <$> wrapClient + ( Nonce.lookupAndDeleteNonce + uid + (T.decodeUtf8With lenientDecode . toStrict $ toByteString cid) + ) httpsUrl <- - except $ - note MisconfiguredRequestUrl $ - fromByteString $ - "https://" <> toByteString' domain <> "/" <> T.encodeUtf8 (toUrlPiece link) + except + $ note MisconfiguredRequestUrl + $ fromByteString + $ "https://" + <> toByteString' domain + <> "/" + <> T.encodeUtf8 (toUrlPiece link) maxSkewSeconds <- Opt.setDpopMaxSkewSecs <$> view settings expiresIn <- Opt.setDpopTokenExpirationTimeSecs <$> view settings now <- fromUTCTime <$> lift (liftSem Now.get) @@ -588,19 +595,19 @@ createAccessToken luid cid method link proof = do pathToKeys <- ExceptT $ note KeyBundleError . Opt.setPublicKeyBundle <$> view settings ExceptT $ note KeyBundleError <$> liftSem (PublicKeyBundle.get pathToKeys) token <- - ExceptT $ - liftSem $ - JwtTools.generateDPoPAccessToken - proof - (ClientIdentity domain uid cid) - handle - displayName - tid - nonce - httpsUrl - method - maxSkewSeconds - expiresAt - now - pubKeyBundle + ExceptT + $ liftSem + $ JwtTools.generateDPoPAccessToken + proof + (ClientIdentity domain uid cid) + handle + displayName + tid + nonce + httpsUrl + method + maxSkewSeconds + expiresAt + now + pubKeyBundle pure $ (DPoPAccessTokenResponse token DPoP expiresIn, NoStore) diff --git a/services/brig/src/Brig/API/Connection.hs b/services/brig/src/Brig/API/Connection.hs index 45445657f23..4b99cf9739d 100644 --- a/services/brig/src/Brig/API/Connection.hs +++ b/services/brig/src/Brig/API/Connection.hs @@ -72,12 +72,12 @@ import Wire.GalleyAPIAccess import Wire.GalleyAPIAccess qualified as GalleyAPIAccess import Wire.NotificationSubsystem -ensureNotSameTeam :: Member GalleyAPIAccess r => Local UserId -> Local UserId -> (ConnectionM r) () +ensureNotSameTeam :: (Member GalleyAPIAccess r) => Local UserId -> Local UserId -> (ConnectionM r) () ensureNotSameTeam self target = do selfTeam <- lift $ liftSem $ GalleyAPIAccess.getTeamId (tUnqualified self) targetTeam <- lift $ liftSem $ GalleyAPIAccess.getTeamId (tUnqualified target) - when (isJust selfTeam && selfTeam == targetTeam) $ - throwE ConnectSameBindingTeamUsers + when (isJust selfTeam && selfTeam == targetTeam) + $ throwE ConnectSameBindingTeamUsers createConnection :: ( Member FederationConfigStore r, @@ -111,8 +111,8 @@ createConnectionToLocalUser :: ConnectionM r (ResponseForExistedCreated UserConnection) createConnectionToLocalUser self conn target = do ensureNotSameAndActivated self (tUntagged target) - noteT (InvalidUser (tUntagged target)) $ - ensureIsActivated target + noteT (InvalidUser (tUntagged target)) + $ ensureIsActivated target checkLegalholdPolicyConflict (tUnqualified self) (tUnqualified target) ensureNotSameTeam self target s2o <- lift . wrapClient $ Data.lookupConnection self (tUntagged target) @@ -126,9 +126,9 @@ createConnectionToLocalUser self conn target = do where insert :: ExceptT ConnectionError (AppT r) UserConnection insert = lift $ do - Log.info $ - logConnection (tUnqualified self) (tUntagged target) - . msg (val "Creating connection") + Log.info + $ logConnection (tUnqualified self) (tUntagged target) + . msg (val "Creating connection") qcnv <- Intra.createConnectConv (tUntagged self) (tUntagged target) Nothing (Just conn) s2o' <- wrapClient $ Data.insertConnection self (tUntagged target) SentWithHistory qcnv o2s' <- wrapClient $ Data.insertConnection target (tUntagged self) PendingWithHistory qcnv @@ -155,32 +155,37 @@ createConnectionToLocalUser self conn target = do accept :: UserConnection -> UserConnection -> ExceptT ConnectionError (AppT r) (ResponseForExistedCreated UserConnection) accept s2o o2s = do - unless (ucStatus s2o `elem` [Sent, Accepted]) $ - checkLimit self - lift . Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Accepting connection") + unless (ucStatus s2o `elem` [Sent, Accepted]) + $ checkLimit self + lift + . Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Accepting connection") cnv <- lift $ for (ucConvId s2o) $ Intra.acceptConnectConv self (Just conn) s2o' <- lift . wrapClient $ Data.updateConnection s2o AcceptedWithHistory o2s' <- - lift . wrapClient $ - if (cnvType <$> cnv) == Just ConnectConv + lift + . wrapClient + $ if (cnvType <$> cnv) == Just ConnectConv then Data.updateConnection o2s BlockedWithHistory else Data.updateConnection o2s AcceptedWithHistory e2o <- - lift . wrapClient $ - ConnectionUpdated o2s' <$> Data.lookupName (tUnqualified self) + lift + . wrapClient + $ ConnectionUpdated o2s' + <$> Data.lookupName (tUnqualified self) let e2s = ConnectionUpdated s2o' Nothing lift $ liftSem $ mapM_ (Intra.onConnectionEvent (tUnqualified self) (Just conn)) [e2o, e2s] pure $ Existed s2o' resend :: UserConnection -> ExceptT ConnectionError (AppT r) (ResponseForExistedCreated UserConnection) resend s2o = do - unless (ucStatus s2o `elem` [Sent, Accepted]) $ - checkLimit self - lift . Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Resending connection request") + unless (ucStatus s2o `elem` [Sent, Accepted]) + $ checkLimit self + lift + . Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Resending connection request") Existed <$> insert change :: UserConnection -> RelationWithHistory -> ExceptT ConnectionError (AppT r) (ResponseForExistedCreated UserConnection) @@ -191,7 +196,7 @@ createConnectionToLocalUser self conn target = do -- FUTUREWORK: we may want to move this to the LH application logic, so we can recycle it for -- group conv creation and possibly other situations. checkLegalholdPolicyConflict :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => UserId -> UserId -> ExceptT ConnectionError (AppT r) () @@ -310,9 +315,10 @@ updateConnectionToLocalUser self other newStatus conn = do accept :: UserConnection -> UserConnection -> ExceptT ConnectionError (AppT r) (Maybe UserConnection) accept s2o o2s = do checkLimit self - lift . Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Accepting connection") + lift + . Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Accepting connection") cnv <- lift $ traverse (Intra.acceptConnectConv self conn) (ucConvId s2o) -- Note: The check for @Pending@ accounts for situations in which both -- sides are pending, which can occur due to rare race conditions @@ -320,8 +326,8 @@ updateConnectionToLocalUser self other newStatus conn = do -- crashes. when (ucStatus o2s `elem` [Sent, Pending]) . lift $ do o2s' <- - wrapClient $ - if (cnvType <$> cnv) /= Just ConnectConv + wrapClient + $ if (cnvType <$> cnv) /= Just ConnectConv then Data.updateConnection o2s AcceptedWithHistory else Data.updateConnection o2s BlockedWithHistory e2o <- @@ -332,9 +338,9 @@ updateConnectionToLocalUser self other newStatus conn = do block :: UserConnection -> ExceptT ConnectionError (AppT r) (Maybe UserConnection) block s2o = lift $ do - Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Blocking connection") + Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Blocking connection") traverse_ (liftSem . Intra.blockConv self) (ucConvId s2o) mlsEnabled <- view (settings . enableMLS) liftSem $ when (fromMaybe False mlsEnabled) $ do @@ -346,37 +352,40 @@ updateConnectionToLocalUser self other newStatus conn = do unblock :: UserConnection -> UserConnection -> Relation -> ExceptT ConnectionError (AppT r) (Maybe UserConnection) unblock s2o o2s new = do -- FUTUREWORK: new is always in [Sent, Accepted]. Refactor to total function. - when (new `elem` [Sent, Accepted]) $ - checkLimit self - lift . Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Unblocking connection") + when (new `elem` [Sent, Accepted]) + $ checkLimit self + lift + . Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Unblocking connection") cnv <- lift . liftSem $ traverse (unblockConversation self conn) (ucConvId s2o) mlsEnabled <- view (settings . enableMLS) lift . liftSem $ when (fromMaybe False mlsEnabled) $ do let mlsConvId = one2OneConvId BaseProtocolMLSTag (tUntagged self) (tUntagged other) isEstablished <- isMLSOne2OneEstablished self (tUntagged other) - when (isEstablished == NotAMember || isEstablished == Established) . void $ - unblockConversation self conn mlsConvId + when (isEstablished == NotAMember || isEstablished == Established) + . void + $ unblockConversation self conn mlsConvId when (ucStatus o2s == Sent && new == Accepted) . lift $ do o2s' <- - wrapClient $ - if (cnvType <$> cnv) /= Just ConnectConv + wrapClient + $ if (cnvType <$> cnv) /= Just ConnectConv then Data.updateConnection o2s AcceptedWithHistory else Data.updateConnection o2s BlockedWithHistory e2o :: ConnectionEvent <- - wrapClient $ - ConnectionUpdated o2s' - <$> Data.lookupName (tUnqualified self) + wrapClient + $ ConnectionUpdated o2s' + <$> Data.lookupName (tUnqualified self) -- TODO: is this correct? shouldnt o2s be sent to other? liftSem $ Intra.onConnectionEvent (tUnqualified self) conn e2o lift . wrapClient $ Just <$> Data.updateConnection s2o (mkRelationWithHistory (error "impossible") new) cancel :: UserConnection -> UserConnection -> ExceptT ConnectionError (AppT r) (Maybe UserConnection) cancel s2o o2s = do - lift . Log.info $ - logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) - . msg (val "Cancelling connection") + lift + . Log.info + $ logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o)) + . msg (val "Cancelling connection") lfrom <- qualifyLocal (ucFrom s2o) lift $ traverse_ (liftSem . Intra.blockConv lfrom) (ucConvId s2o) o2s' <- lift . wrapClient $ Data.updateConnection o2s CancelledWithHistory @@ -397,7 +406,7 @@ localConnection la lb = do lift (wrapClient $ Data.lookupConnection la (tUntagged lb)) >>= tryJust (NotConnected (tUnqualified la) (tUntagged lb)) -mkRelationWithHistory :: HasCallStack => Relation -> Relation -> RelationWithHistory +mkRelationWithHistory :: (HasCallStack) => Relation -> Relation -> RelationWithHistory mkRelationWithHistory oldRel = \case Accepted -> AcceptedWithHistory Blocked -> BlockedWithHistory @@ -431,8 +440,8 @@ updateConnectionInternal = \case RemoveLHBlocksInvolving uid -> removeLHBlocksInvolving =<< qualifyLocal uid CreateConnectionForTest usr other -> do lusr <- qualifyLocal usr - lift $ - foldQualified + lift + $ foldQualified lusr (createLocalConnectionUnchecked lusr) (createRemoteConnectionUnchecked lusr) @@ -442,9 +451,10 @@ updateConnectionInternal = \case blockForMissingLegalholdConsent :: Local UserId -> [UserId] -> ExceptT ConnectionError (AppT r) () blockForMissingLegalholdConsent self others = do for_ others $ \(qualifyAs self -> other) -> do - lift . Log.info $ - logConnection (tUnqualified self) (tUntagged other) - . msg (val "Blocking connection (legalhold device present, but missing consent)") + lift + . Log.info + $ logConnection (tUnqualified self) (tUntagged other) + . msg (val "Blocking connection (legalhold device present, but missing consent)") s2o <- localConnection self other o2s <- localConnection other self @@ -464,9 +474,10 @@ updateConnectionInternal = \case -- Here we are using the fact that s2o is a local connection other <- qualifyLocal (qUnqualified (ucTo s2o)) o2s <- localConnection other self - lift . Log.info $ - logConnection (ucFrom s2o) (ucTo s2o) - . msg (val "Unblocking connection (legalhold device removed or consent given)") + lift + . Log.info + $ logConnection (ucFrom s2o) (ucTo s2o) + . msg (val "Unblocking connection (legalhold device removed or consent given)") unblockDirected s2o o2s unblockDirected o2s s2o where diff --git a/services/brig/src/Brig/API/Connection/Remote.hs b/services/brig/src/Brig/API/Connection/Remote.hs index d9de83ccef5..4bd830064a6 100644 --- a/services/brig/src/Brig/API/Connection/Remote.hs +++ b/services/brig/src/Brig/API/Connection/Remote.hs @@ -175,8 +175,8 @@ transitionTo self mzcon other Nothing (Just rel) actor = lift $ do -- create connection connection <- - wrapClient $ - Data.insertConnection + wrapClient + $ Data.insertConnection self (tUntagged other) (relationWithHistory rel) @@ -200,7 +200,8 @@ transitionTo self mzcon other (Just connection) (Just rel) actor = do isEstablished <- lift . liftSem $ isMLSOne2OneEstablished self (tUntagged other) lift . when - ( isEstablished == Established + ( isEstablished + == Established || (isEstablished == NotAMember && ucStatus connection == Blocked && rel == Accepted) ) $ updateOne2OneConv self Nothing other mlsConvId desiredMem actor @@ -248,8 +249,9 @@ performLocalAction self mzcon other mconnection action = do NewConnectionResponseOk reaction -> pure reaction NewConnectionResponseNotFederating -> throwE ConnectTeamFederationError NewConnectionResponseUserNotActivated -> throwE (InvalidUser (tUntagged other)) - pure $ - fromMaybe rel1 $ do + pure + $ fromMaybe rel1 + $ do reactionAction <- (mreaction :: Maybe RemoteConnectionAction) transition (RCA reactionAction) rel1 transitionTo self mzcon other mconnection mrel2 LocalActor @@ -341,19 +343,19 @@ updateConnectionToRemoteUser self other rel1 zcon = do checkLimitForLocalAction :: Local UserId -> Relation -> LocalConnectionAction -> (ConnectionM r) () checkLimitForLocalAction u oldRel action = - when (oldRel `notElem` [Accepted, Sent] && (action == LocalConnect)) $ - checkLimit u + when (oldRel `notElem` [Accepted, Sent] && (action == LocalConnect)) + $ checkLimit u -- | Check if the local backend federates with the remote user's team. Throw an -- exception if it does not federate. ensureFederatesWith :: - Member FederationConfigStore r => + (Member FederationConfigStore r) => Remote UserId -> ConnectionM r () ensureFederatesWith remote = do profiles <- - withExceptT ConnectFederationError $ - getUsersByIds (tDomain remote) [tUnqualified remote] + withExceptT ConnectFederationError + $ getUsersByIds (tDomain remote) [tUnqualified remote] let rTeam = qualifyAs remote $ profileTeam =<< listToMaybe profiles - unlessM (lift . liftSem . backendFederatesWith $ rTeam) $ - throwE ConnectTeamFederationError + unlessM (lift . liftSem . backendFederatesWith $ rTeam) + $ throwE ConnectTeamFederationError diff --git a/services/brig/src/Brig/API/Connection/Util.hs b/services/brig/src/Brig/API/Connection/Util.hs index 6b3cf894483..e63885bc899 100644 --- a/services/brig/src/Brig/API/Connection/Util.hs +++ b/services/brig/src/Brig/API/Connection/Util.hs @@ -48,10 +48,10 @@ checkLimit u = noteT (TooManyConnections (tUnqualified u)) $ do ensureNotSameAndActivated :: Local UserId -> Qualified UserId -> ConnectionM r () ensureNotSameAndActivated self target = do - when (tUntagged self == target) $ - throwE (InvalidUser target) - noteT ConnectNoIdentity $ - ensureIsActivated self + when (tUntagged self == target) + $ throwE (InvalidUser target) + noteT ConnectNoIdentity + $ ensureIsActivated self ensureIsActivated :: Local UserId -> MaybeT (AppT r) () ensureIsActivated lusr = do diff --git a/services/brig/src/Brig/API/Federation.hs b/services/brig/src/Brig/API/Federation.hs index 8d4ec27088c..a20f335329a 100644 --- a/services/brig/src/Brig/API/Federation.hs +++ b/services/brig/src/Brig/API/Federation.hs @@ -198,8 +198,10 @@ fedClaimKeyPackages domain ckpr = suite <- getCipherSuite (Just ckpr.cipherSuite) ltarget <- qualifyLocal ckpr.target let rusr = toRemoteUnsafe domain ckpr.claimant - lift . fmap hush . runExceptT $ - claimLocalKeyPackages (tUntagged rusr) Nothing suite ltarget + lift + . fmap hush + . runExceptT + $ claimLocalKeyPackages (tUntagged rusr) Nothing suite ltarget False -> pure Nothing -- | Searching for federated users on a remote backend @@ -284,8 +286,9 @@ onUserDeleted origDomain udcn = lift $ do map csv2From . filter (\x -> csv2Status x == Accepted) <$> wrapClient (Data.lookupRemoteConnectionStatuses (fromRange connections) (fmap pure deletedUser)) - liftSem $ - unsafePooledForConcurrentlyN_ 16 (nonEmpty acceptedLocals) $ \recipients -> + liftSem + $ unsafePooledForConcurrentlyN_ 16 (nonEmpty acceptedLocals) + $ \recipients -> notify event (tUnqualified deletedUser) Push.RouteDirect Nothing (pure recipients) wrapClient $ Data.deleteRemoteConnections deletedUser connections pure EmptyResponse @@ -301,10 +304,11 @@ lookupSearchPolicy domain = do -- if no team is provided, and restriction is set by team, fall back to `NoSearch` lookupSearchPolicyWithTeam :: (Member FederationConfigStore r) => Domain -> Maybe TeamId -> (Handler r) FederatedUserSearchPolicy lookupSearchPolicyWithTeam domain mSearcherTeamId = - lift $ - liftSem $ - E.getFederationConfig domain <&> \case - Nothing -> NoSearch - Just (FederationDomainConfig _ sp FederationRestrictionAllowAll) -> sp - Just (FederationDomainConfig _ sp (FederationRestrictionByTeam teams)) -> - maybe NoSearch (\tid -> if tid `elem` teams then sp else NoSearch) $ mSearcherTeamId + lift + $ liftSem + $ E.getFederationConfig domain + <&> \case + Nothing -> NoSearch + Just (FederationDomainConfig _ sp FederationRestrictionAllowAll) -> sp + Just (FederationDomainConfig _ sp (FederationRestrictionByTeam teams)) -> + maybe NoSearch (\tid -> if tid `elem` teams then sp else NoSearch) $ mSearcherTeamId diff --git a/services/brig/src/Brig/API/Handler.hs b/services/brig/src/Brig/API/Handler.hs index 4c6e92e341a..b8d7e72f77a 100644 --- a/services/brig/src/Brig/API/Handler.hs +++ b/services/brig/src/Brig/API/Handler.hs @@ -71,9 +71,9 @@ toServantHandler env action = do let logger = view applog env reqId = unRequestId $ view requestId env a <- - liftIO $ - runBrigToIO env (runExceptT action) - `catches` brigErrorHandlers logger reqId + liftIO + $ runBrigToIO env (runExceptT action) + `catches` brigErrorHandlers logger reqId case a of Left werr -> handleWaiErrors logger reqId werr Right x -> pure x @@ -87,11 +87,12 @@ toServantHandler env action = do -- into a response and log accordingly StdError werr -> liftIO $ throwIO werr RichError werr body headers -> do - when (statusCode (WaiError.code werr) < 500) $ + when (statusCode (WaiError.code werr) < 500) + $ -- 5xx are logged by the middleware, so we only log errors < 500 to avoid duplicated entries Server.logError' logger (Just reqId) werr - Servant.throwError $ - Servant.ServerError (mkCode werr) (mkPhrase (WaiError.code werr)) (Aeson.encode body) headers + Servant.throwError + $ Servant.ServerError (mkCode werr) (mkPhrase (WaiError.code werr)) (Aeson.encode body) headers newtype UserNotAllowedToJoinTeam = UserNotAllowedToJoinTeam WaiError.Error deriving (Show) @@ -110,10 +111,10 @@ brigErrorHandlers logger reqId = _ -> throwM ex, Catch.Handler $ \(UserNotAllowedToJoinTeam e) -> pure (Left $ StdError e), Catch.Handler $ \(e :: SomeException) -> do - Log.err logger $ - Log.msg ("IO Exception occurred" :: ByteString) - . Log.field "message" (displayException e) - . Log.field "request" reqId + Log.err logger + $ Log.msg ("IO Exception occurred" :: ByteString) + . Log.field "message" (displayException e) + . Log.field "request" reqId throwIO e ] diff --git a/services/brig/src/Brig/API/Internal.hs b/services/brig/src/Brig/API/Internal.hs index af81a62a56c..28c9c47aac3 100644 --- a/services/brig/src/Brig/API/Internal.hs +++ b/services/brig/src/Brig/API/Internal.hs @@ -245,7 +245,7 @@ teamsAPI = :<|> Named @"team-size" Team.teamSize :<|> Named @"create-invitations-via-scim" Team.createInvitationViaScim -userAPI :: Member UserSubsystem r => ServerT BrigIRoutes.UserAPI (Handler r) +userAPI :: (Member UserSubsystem r) => ServerT BrigIRoutes.UserAPI (Handler r) userAPI = updateLocale :<|> deleteLocale @@ -292,12 +292,16 @@ addFederationRemoteTeam domain rt = lift (liftSem $ E.addFederationRemoteTeam domain rt.teamId) >>= \case AddFederationRemoteTeamSuccess -> pure () AddFederationRemoteTeamDomainNotFound -> - throwError . fedError . FederationUnexpectedError $ - "Federation domain does not exist. Please add it first." + throwError + . fedError + . FederationUnexpectedError + $ "Federation domain does not exist. Please add it first." AddFederationRemoteTeamRestrictionAllowAll -> - throwError . fedError . FederationUnexpectedError $ - "Federation is not configured to be restricted by teams. Therefore adding a team to a \ - \remote domain is not allowed." + throwError + . fedError + . FederationUnexpectedError + $ "Federation is not configured to be restricted by teams. Therefore adding a team to a \ + \remote domain is not allowed." getFederationRemotes :: (Member FederationConfigStore r) => (Handler r) FederationDomainConfigs getFederationRemotes = lift $ liftSem $ E.getFederationConfigs @@ -307,37 +311,54 @@ addFederationRemote fedDomConf = do lift (liftSem $ E.addFederationConfig fedDomConf) >>= \case AddFederationRemoteSuccess -> pure () AddFederationRemoteMaxRemotesReached -> - throwError . fedError . FederationUnexpectedError $ - "Maximum number of remote backends reached. If you need to create more connections, \ - \please contact wire.com." + throwError + . fedError + . FederationUnexpectedError + $ "Maximum number of remote backends reached. If you need to create more connections, \ + \please contact wire.com." AddFederationRemoteDivergingConfig cfg -> - throwError . fedError . FederationUnexpectedError $ - "keeping track of remote domains in the brig config file is deprecated, but as long as we \ - \do that, adding a domain with different settings than in the config file is not allowed. want " - <> ( "Just " - <> T.pack (show fedDomConf) - <> "or Nothing, " - ) - <> ( "got " - <> T.pack (show (Map.lookup (domain fedDomConf) cfg)) - ) + throwError + . fedError + . FederationUnexpectedError + $ "keeping track of remote domains in the brig config file is deprecated, but as long as we \ + \do that, adding a domain with different settings than in the config file is not allowed. want " + <> ( "Just " + <> T.pack (show fedDomConf) + <> "or Nothing, " + ) + <> ( "got " + <> T.pack (show (Map.lookup (domain fedDomConf) cfg)) + ) updateFederationRemote :: (Member FederationConfigStore r) => Domain -> FederationDomainConfig -> (Handler r) () updateFederationRemote dom fedcfg = do if (dom /= fedcfg.domain) then - throwError . fedError . FederationUnexpectedError . T.pack $ - "federation domain of a given peer cannot be changed from " <> show (domain fedcfg) <> " to " <> show dom <> "." + throwError + . fedError + . FederationUnexpectedError + . T.pack + $ "federation domain of a given peer cannot be changed from " + <> show (domain fedcfg) + <> " to " + <> show dom + <> "." else lift (liftSem (E.updateFederationConfig fedcfg)) >>= \case UpdateFederationSuccess -> pure () UpdateFederationRemoteNotFound -> - throwError . fedError . FederationUnexpectedError . T.pack $ - "federation domain does not exist and cannot be updated: " <> show (dom, fedcfg) + throwError + . fedError + . FederationUnexpectedError + . T.pack + $ "federation domain does not exist and cannot be updated: " + <> show (dom, fedcfg) UpdateFederationRemoteDivergingConfig -> - throwError . fedError . FederationUnexpectedError $ - "keeping track of remote domains in the brig config file is deprecated, but as long as we \ - \do that, removing or updating items listed in the config file is not allowed." + throwError + . fedError + . FederationUnexpectedError + $ "keeping track of remote domains in the brig config file is deprecated, but as long as we \ + \do that, removing or updating items listed in the config file is not allowed." -- | Responds with 'Nothing' if field is NULL in existing user or user does not exist. getAccountConferenceCallingConfig :: UserId -> (Handler r) (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig) @@ -367,7 +388,8 @@ getMLSClients usr suite = do | otherwise = getResult rs getValidity lusr cid suiteTag = - (cid,) . (> 0) + (cid,) + . (> 0) <$> Data.countKeyPackages lusr cid suiteTag getVerificationCode :: UserId -> VerificationAction -> Handler r (Maybe Code.Value) @@ -442,7 +464,8 @@ removeLegalHoldClientH uid = do internalListClientsH :: UserSet -> (Handler r) UserClients internalListClientsH (UserSet usrs) = lift $ do - UserClients . Map.fromList + UserClients + . Map.fromList <$> wrapClient (API.lookupUsersClientIds (Set.toList usrs)) internalListFullClientsH :: UserSet -> (Handler r) UserClientsFull @@ -575,10 +598,10 @@ listActivatedAccounts elh includePendingInvitations = do us <- liftSem $ mapM API.lookupHandle hs byIds (catMaybes us) where - byIds :: Member DeleteQueue r => [UserId] -> (AppT r) [UserAccount] + byIds :: (Member DeleteQueue r) => [UserId] -> (AppT r) [UserAccount] byIds uids = wrapClient (API.lookupAccounts uids) >>= filterM accountValid - accountValid :: Member DeleteQueue r => UserAccount -> (AppT r) Bool + accountValid :: (Member DeleteQueue r) => UserAccount -> (AppT r) Bool accountValid account = case userIdentity . accountUser $ account of Nothing -> pure False Just ident -> @@ -717,7 +740,7 @@ updateConnectionInternalH updateConn = do API.updateConnectionInternal updateConn !>> connError pure NoContent -checkBlacklistH :: Member BlacklistStore r => Maybe Email -> Maybe Phone -> (Handler r) CheckBlacklistResponse +checkBlacklistH :: (Member BlacklistStore r) => Maybe Email -> Maybe Phone -> (Handler r) CheckBlacklistResponse checkBlacklistH (Just email) Nothing = checkBlacklist (Left email) checkBlacklistH Nothing (Just phone) = checkBlacklist (Right phone) checkBlacklistH bade badp = @@ -726,10 +749,10 @@ checkBlacklistH bade badp = ("need exactly one of email, phone: " <> LT.pack (show (bade, badp))) ) -checkBlacklist :: Member BlacklistStore r => Either Email Phone -> (Handler r) CheckBlacklistResponse +checkBlacklist :: (Member BlacklistStore r) => Either Email Phone -> (Handler r) CheckBlacklistResponse checkBlacklist emailOrPhone = lift $ bool NotBlacklisted YesBlacklisted <$> API.isBlacklisted emailOrPhone -deleteFromBlacklistH :: Member BlacklistStore r => Maybe Email -> Maybe Phone -> (Handler r) NoContent +deleteFromBlacklistH :: (Member BlacklistStore r) => Maybe Email -> Maybe Phone -> (Handler r) NoContent deleteFromBlacklistH (Just email) Nothing = deleteFromBlacklist (Left email) deleteFromBlacklistH Nothing (Just phone) = deleteFromBlacklist (Right phone) deleteFromBlacklistH bade badp = @@ -738,10 +761,10 @@ deleteFromBlacklistH bade badp = ("need exactly one of email, phone: " <> LT.pack (show (bade, badp))) ) -deleteFromBlacklist :: Member BlacklistStore r => Either Email Phone -> (Handler r) NoContent +deleteFromBlacklist :: (Member BlacklistStore r) => Either Email Phone -> (Handler r) NoContent deleteFromBlacklist emailOrPhone = lift $ NoContent <$ API.blacklistDelete emailOrPhone -addBlacklistH :: Member BlacklistStore r => Maybe Email -> Maybe Phone -> (Handler r) NoContent +addBlacklistH :: (Member BlacklistStore r) => Maybe Email -> Maybe Phone -> (Handler r) NoContent addBlacklistH (Just email) Nothing = addBlacklist (Left email) addBlacklistH Nothing (Just phone) = addBlacklist (Right phone) addBlacklistH bade badp = @@ -750,12 +773,12 @@ addBlacklistH bade badp = ("need exactly one of email, phone: " <> LT.pack (show (bade, badp))) ) -addBlacklist :: Member BlacklistStore r => Either Email Phone -> (Handler r) NoContent +addBlacklist :: (Member BlacklistStore r) => Either Email Phone -> (Handler r) NoContent addBlacklist emailOrPhone = lift $ NoContent <$ API.blacklistInsert emailOrPhone -- | Get any matching prefixes. Also try for shorter prefix matches, -- i.e. checking for +123456 also checks for +12345, +1234, ... -getPhonePrefixesH :: Member BlacklistPhonePrefixStore r => PhonePrefix -> (Handler r) GetPhonePrefixResponse +getPhonePrefixesH :: (Member BlacklistPhonePrefixStore r) => PhonePrefix -> (Handler r) GetPhonePrefixResponse getPhonePrefixesH prefix = lift $ do results <- API.phonePrefixGet prefix pure $ case results of @@ -763,10 +786,10 @@ getPhonePrefixesH prefix = lift $ do (_ : _) -> PhonePrefixesFound results -- | Delete a phone prefix entry (must be an exact match) -deleteFromPhonePrefixH :: Member BlacklistPhonePrefixStore r => PhonePrefix -> (Handler r) NoContent +deleteFromPhonePrefixH :: (Member BlacklistPhonePrefixStore r) => PhonePrefix -> (Handler r) NoContent deleteFromPhonePrefixH prefix = lift $ NoContent <$ API.phonePrefixDelete prefix -addPhonePrefixH :: Member BlacklistPhonePrefixStore r => ExcludedPrefix -> (Handler r) NoContent +addPhonePrefixH :: (Member BlacklistPhonePrefixStore r) => ExcludedPrefix -> (Handler r) NoContent addPhonePrefixH prefix = lift $ NoContent <$ API.phonePrefixInsert prefix updateSSOIdH :: @@ -820,13 +843,13 @@ updateRichInfoH uid rup = -- Intra.onUserEvent uid (Just conn) (richInfoUpdate uid ri) lift $ wrapClient $ Data.updateRichInfo uid (mkRichInfoAssocList richInfo) -updateLocale :: Member UserSubsystem r => UserId -> LocaleUpdate -> (Handler r) LocaleUpdate +updateLocale :: (Member UserSubsystem r) => UserId -> LocaleUpdate -> (Handler r) LocaleUpdate updateLocale uid upd@(LocaleUpdate locale) = do qUid <- qualifyLocal uid lift . liftSem $ updateUserProfile qUid Nothing UpdateOriginScim def {locale = Just locale} pure upd -deleteLocale :: Member UserSubsystem r => UserId -> (Handler r) NoContent +deleteLocale :: (Member UserSubsystem r) => UserId -> (Handler r) NoContent deleteLocale uid = do defLoc <- setDefaultUserLocale <$> view settings qUid <- qualifyLocal uid @@ -844,8 +867,8 @@ updateClientLastActive u c = do -- round up to the next multiple of a week let week = 604800 let now = - systemToUTCTime $ - sysTime + systemToUTCTime + $ sysTime { systemSeconds = systemSeconds sysTime + (week - systemSeconds sysTime `mod` week), systemNanoseconds = 0 } @@ -859,7 +882,7 @@ getRichInfoMultiH (maybe [] fromCommaSeparatedList -> uids) = lift $ wrapClient $ API.lookupRichInfoMultiUsers uids updateHandleH :: - Member UserSubsystem r => + (Member UserSubsystem r) => UserId -> HandleUpdate -> Handler r NoContent @@ -869,7 +892,7 @@ updateHandleH uid (HandleUpdate handleUpd) = lift . liftSem $ UserSubsystem.updateHandle quid Nothing UpdateOriginScim handleUpd updateUserNameH :: - Member UserSubsystem r => + (Member UserSubsystem r) => UserId -> NameUpdate -> (Handler r) NoContent @@ -881,7 +904,7 @@ updateUserNameH uid (NameUpdate nameUpd) = Just _ -> lift . liftSem $ updateUserProfile luid Nothing UpdateOriginScim (def {name = Just name}) Nothing -> throwStd (errorToWai @'E.InvalidUser) -checkHandleInternalH :: Member UserSubsystem r => Handle -> Handler r CheckHandleResponse +checkHandleInternalH :: (Member UserSubsystem r) => Handle -> Handler r CheckHandleResponse checkHandleInternalH h = lift $ liftSem do API.checkHandle (fromHandle h) <&> \case API.CheckHandleFound -> CheckHandleResponseFound diff --git a/services/brig/src/Brig/API/MLS/KeyPackages.hs b/services/brig/src/Brig/API/MLS/KeyPackages.hs index 35d1edba025..3597d01265b 100644 --- a/services/brig/src/Brig/API/MLS/KeyPackages.hs +++ b/services/brig/src/Brig/API/MLS/KeyPackages.hs @@ -93,8 +93,11 @@ claimLocalKeyPackages qusr skipOwn suite target = do ) (\_ -> pure ()) qusr - lift $ - KeyPackageBundle . Set.fromList . catMaybes <$> traverse (mkEntry own) clients + lift + $ KeyPackageBundle + . Set.fromList + . catMaybes + <$> traverse (mkEntry own) clients where mkEntry :: Maybe ClientId -> ClientId -> AppT r (Maybe KeyPackageBundleEntry) mkEntry own c = @@ -138,16 +141,17 @@ claimRemoteKeyPackages lusr suite target = do pure bundle where - handleFailure :: Monad m => Maybe x -> ExceptT ClientError m x + handleFailure :: (Monad m) => Maybe x -> ExceptT ClientError m x handleFailure = maybe (throwE (ClientUserNotFound (tUnqualified target))) pure countKeyPackages :: Local UserId -> ClientId -> Maybe CipherSuite -> Handler r KeyPackageCount countKeyPackages lusr c mSuite = do assertMLSEnabled suite <- getCipherSuite mSuite - lift $ - KeyPackageCount . fromIntegral - <$> wrapClient (Data.countKeyPackages lusr c suite) + lift + $ KeyPackageCount + . fromIntegral + <$> wrapClient (Data.countKeyPackages lusr c suite) deleteKeyPackages :: Local UserId -> diff --git a/services/brig/src/Brig/API/MLS/KeyPackages/Validation.hs b/services/brig/src/Brig/API/MLS/KeyPackages/Validation.hs index 16707b15ff4..b73b3fde076 100644 --- a/services/brig/src/Brig/API/MLS/KeyPackages/Validation.hs +++ b/services/brig/src/Brig/API/MLS/KeyPackages/Validation.hs @@ -60,8 +60,9 @@ validateUploadedKeyPackage identity kp = do loc ( \_ -> do mkey :: Maybe LByteString <- - lift . wrapClient $ - Data.lookupMLSPublicKey + lift + . wrapClient + $ Data.lookupMLSPublicKey (ciUser identity) (ciClient identity) (csSignatureScheme cs) @@ -70,8 +71,8 @@ validateUploadedKeyPackage identity kp = do (mlsProtocolError "No key associated to the given identity and signature scheme") pure mkey - when (key /= LBS.fromStrict kp.value.leafNode.signatureKey) $ - mlsProtocolError "Unrecognised signature key" + when (key /= LBS.fromStrict kp.value.leafNode.signatureKey) + $ mlsProtocolError "Unrecognised signature key" ) (\_ -> pure ()) (cidQualifiedClient identity) @@ -83,22 +84,23 @@ validateLifetime :: Lifetime -> Handler r () validateLifetime lt = do now <- liftIO getPOSIXTime mMaxLifetime <- setKeyPackageMaximumLifetime <$> view settings - either mlsProtocolError pure $ - validateLifetime' now mMaxLifetime lt + either mlsProtocolError pure + $ validateLifetime' now mMaxLifetime lt validateLifetime' :: POSIXTime -> Maybe NominalDiffTime -> Lifetime -> Either Text () validateLifetime' now mMaxLifetime lt = do - when (tsPOSIX (ltNotBefore lt) > now) $ - Left "Key package not_before date is in the future" - when (tsPOSIX (ltNotAfter lt) <= now) $ - Left "Key package is expired" + when (tsPOSIX (ltNotBefore lt) > now) + $ Left "Key package not_before date is in the future" + when (tsPOSIX (ltNotAfter lt) <= now) + $ Left "Key package is expired" for_ mMaxLifetime $ \maxLifetime -> - when (tsPOSIX (ltNotAfter lt) > now + maxLifetime) $ - Left "Key package expiration time is too far in the future" + when (tsPOSIX (ltNotAfter lt) > now + maxLifetime) + $ Left "Key package expiration time is too far in the future" mlsProtocolError :: Text -> Handler r a mlsProtocolError msg = - throwStd . dynErrorToWai $ - (dynError @(MapError 'MLSProtocolError)) + throwStd + . dynErrorToWai + $ (dynError @(MapError 'MLSProtocolError)) { eMessage = msg } diff --git a/services/brig/src/Brig/API/MLS/Util.hs b/services/brig/src/Brig/API/MLS/Util.hs index e36f83babe1..b42b343eb05 100644 --- a/services/brig/src/Brig/API/MLS/Util.hs +++ b/services/brig/src/Brig/API/MLS/Util.hs @@ -31,5 +31,5 @@ isMLSEnabled = fromMaybe False . setEnableMLS <$> view settings assertMLSEnabled :: Handler r () assertMLSEnabled = - unlessM isMLSEnabled $ - throwE (clientDataError MLSNotEnabled) + unlessM isMLSEnabled + $ throwE (clientDataError MLSNotEnabled) diff --git a/services/brig/src/Brig/API/OAuth.hs b/services/brig/src/Brig/API/OAuth.hs index 8643e8eff6d..9c08dc26ef0 100644 --- a/services/brig/src/Brig/API/OAuth.hs +++ b/services/brig/src/Brig/API/OAuth.hs @@ -89,13 +89,13 @@ registerOAuthClient (OAuthClientConfig name uri) = do lift $ wrapClient $ insertOAuthClient cid name uri safeSecret pure credentials where - createSecret :: MonadIO m => m OAuthClientPlainTextSecret + createSecret :: (MonadIO m) => m OAuthClientPlainTextSecret createSecret = OAuthClientPlainTextSecret <$> rand32Bytes - hashClientSecret :: MonadIO m => OAuthClientPlainTextSecret -> m Password + hashClientSecret :: (MonadIO m) => OAuthClientPlainTextSecret -> m Password hashClientSecret = mkSafePassword . plainTextPassword8Unsafe . toText . unOAuthClientPlainTextSecret -rand32Bytes :: MonadIO m => m AsciiBase16 +rand32Bytes :: (MonadIO m) => m AsciiBase16 rand32Bytes = liftIO . fmap encodeBase16 $ randBytes 32 getOAuthClientById :: OAuthClientId -> (Handler r) OAuthClient @@ -126,40 +126,40 @@ createNewOAuthAuthorizationCode :: UserId -> CreateOAuthAuthorizationCodeRequest createNewOAuthAuthorizationCode uid code = do runExceptT (validateAndCreateAuthorizationCode uid code) >>= \case Right oauthCode -> - pure $ - CreateOAuthCodeSuccess $ - code.redirectUri - & addParams - [ ("code", toByteString' oauthCode), - ("state", T.encodeUtf8 code.state) - ] + pure + $ CreateOAuthCodeSuccess + $ code.redirectUri + & addParams + [ ("code", toByteString' oauthCode), + ("state", T.encodeUtf8 code.state) + ] Left CreateNewOAuthCodeErrorFeatureDisabled -> - pure $ - CreateOAuthCodeFeatureDisabled $ - code.redirectUri - & addParams - [ ("error", "access_denied"), - ("error_description", "OAuth is not enabled"), - ("state", T.encodeUtf8 code.state) - ] + pure + $ CreateOAuthCodeFeatureDisabled + $ code.redirectUri + & addParams + [ ("error", "access_denied"), + ("error_description", "OAuth is not enabled"), + ("state", T.encodeUtf8 code.state) + ] Left CreateNewOAuthCodeErrorClientNotFound -> - pure $ - CreateOAuthCodeClientNotFound $ - code.redirectUri - & addParams - [ ("error", "access_denied"), - ("error_description", "The client ID was not found"), - ("state", T.encodeUtf8 code.state) - ] + pure + $ CreateOAuthCodeClientNotFound + $ code.redirectUri + & addParams + [ ("error", "access_denied"), + ("error_description", "The client ID was not found"), + ("state", T.encodeUtf8 code.state) + ] Left CreateNewOAuthCodeErrorUnsupportedResponseType -> - pure $ - CreateOAuthCodeUnsupportedResponseType $ - code.redirectUri - & addParams - [ ("error", "access_denied"), - ("error_description", "The client ID was not found"), - ("state", T.encodeUtf8 code.state) - ] + pure + $ CreateOAuthCodeUnsupportedResponseType + $ code.redirectUri + & addParams + [ ("error", "access_denied"), + ("error_description", "The client ID was not found"), + ("state", T.encodeUtf8 code.state) + ] Left CreateNewOAuthCodeErrorRedirectUrlMissMatch -> pure CreateOAuthCodeRedirectUrlMissMatch @@ -205,7 +205,9 @@ createAccessTokenWithRefreshToken req = do lookupVerifyAndDeleteToken :: JWK -> OAuthRefreshToken -> (Handler r) OAuthRefreshTokenInfo lookupVerifyAndDeleteToken key = verifyRefreshToken key - >=> lift . wrapClient . lookupAndDeleteOAuthRefreshToken + >=> lift + . wrapClient + . lookupAndDeleteOAuthRefreshToken >=> maybe (throwStd $ errorToWai @'OAuthInvalidRefreshToken) pure verifyRefreshToken :: JWK -> OAuthRefreshToken -> (Handler r) OAuthRefreshTokenId @@ -230,7 +232,7 @@ createAccessTokenWithAuthorizationCode req = do key <- signingKey createAccessToken key uid cid scope -signingKey :: Member Jwk r => (Handler r) JWK +signingKey :: (Member Jwk r) => (Handler r) JWK signingKey = do fp <- view settings >>= maybe (throwStd $ errorToWai @'OAuthJwtError) pure . Opt.setOAuthJwkKeyPair lift (liftSem $ Jwk.get fp) >>= maybe (throwStd $ errorToWai @'OAuthJwtError) pure @@ -254,14 +256,14 @@ createAccessToken key uid cid scope = do let claims = emptyClaimsSet & claimSub ?~ sub (rid,) . OAuthToken <$> signRefreshToken claims - mkAccessToken :: Member Now r => (Handler r) OAuthAccessToken + mkAccessToken :: (Member Now r) => (Handler r) OAuthAccessToken mkAccessToken = do domain <- Opt.setFederationDomain <$> view settings exp <- fromIntegral . Opt.setOAuthAccessTokenExpirationTimeSecs <$> view settings claims <- mkAccessTokenClaims uid domain scope exp OAuthToken <$> signAccessToken claims - mkAccessTokenClaims :: Member Now r => UserId -> Domain -> OAuthScopes -> NominalDiffTime -> (Handler r) OAuthClaimsSet + mkAccessTokenClaims :: (Member Now r) => UserId -> Domain -> OAuthScopes -> NominalDiffTime -> (Handler r) OAuthClaimsSet mkAccessTokenClaims u domain scopes ttl = do iat <- lift (liftSem Now.get) uri <- maybe (throwStd $ errorToWai @'OAuthJwtError) pure $ domainText domain ^? stringOrUri @@ -269,11 +271,16 @@ createAccessToken key uid cid scope = do let exp = addUTCTime ttl iat let claimSet = emptyClaimsSet - & claimIss ?~ uri - & claimAud ?~ Audience [uri] - & claimIat ?~ NumericDate iat - & claimSub ?~ sub - & claimExp ?~ NumericDate exp + & claimIss + ?~ uri + & claimAud + ?~ Audience [uri] + & claimIat + ?~ NumericDate iat + & claimSub + ?~ sub + & claimExp + ?~ NumericDate exp pure $ OAuthClaimsSet claimSet scopes signAccessToken :: OAuthClaimsSet -> (Handler r) SignedJWT @@ -298,7 +305,7 @@ createAccessToken key uid cid scope = do -------------------------------------------------------------------------------- -revokeRefreshToken :: Member Jwk r => OAuthRevokeRefreshTokenRequest -> (Handler r) () +revokeRefreshToken :: (Member Jwk r) => OAuthRevokeRefreshTokenRequest -> (Handler r) () revokeRefreshToken req = do key <- signingKey info <- lookupAndVerifyToken key req.refreshToken @@ -308,7 +315,9 @@ revokeRefreshToken req = do lookupAndVerifyToken :: JWK -> OAuthRefreshToken -> (Handler r) OAuthRefreshTokenInfo lookupAndVerifyToken key = verifyRefreshToken key - >=> lift . wrapClient . lookupOAuthRefreshTokenInfo + >=> lift + . wrapClient + . lookupOAuthRefreshTokenInfo >=> maybe (throwStd $ errorToWai @'OAuthInvalidRefreshToken) pure -------------------------------------------------------------------------------- diff --git a/services/brig/src/Brig/API/Public.hs b/services/brig/src/Brig/API/Public.hs index 3636589b6bd..85b99dbfe96 100644 --- a/services/brig/src/Brig/API/Public.hs +++ b/services/brig/src/Brig/API/Public.hs @@ -197,20 +197,25 @@ internalEndpointsSwaggerDocsAPIs = -- Dual to `internalEndpointsSwaggerDocsAPI`. versionedSwaggerDocsAPI :: Servant.Server VersionedSwaggerDocsAPI versionedSwaggerDocsAPI (Just (VersionNumber V6)) = - swaggerSchemaUIServer $ - ( serviceSwagger @VersionAPITag @'V6 - <> serviceSwagger @BrigAPITag @'V6 - <> serviceSwagger @GalleyAPITag @'V6 - <> serviceSwagger @SparAPITag @'V6 - <> serviceSwagger @CargoholdAPITag @'V6 - <> serviceSwagger @CannonAPITag @'V6 - <> serviceSwagger @GundeckAPITag @'V6 - <> serviceSwagger @ProxyAPITag @'V6 - <> serviceSwagger @OAuthAPITag @'V6 - ) - & S.info . S.title .~ "Wire-Server API" - & S.info . S.description ?~ $(embedText =<< makeRelativeToProject "docs/swagger.md") - & S.servers .~ [S.Server ("/" <> toUrlPiece V6) Nothing mempty] + swaggerSchemaUIServer + $ ( serviceSwagger @VersionAPITag @'V6 + <> serviceSwagger @BrigAPITag @'V6 + <> serviceSwagger @GalleyAPITag @'V6 + <> serviceSwagger @SparAPITag @'V6 + <> serviceSwagger @CargoholdAPITag @'V6 + <> serviceSwagger @CannonAPITag @'V6 + <> serviceSwagger @GundeckAPITag @'V6 + <> serviceSwagger @ProxyAPITag @'V6 + <> serviceSwagger @OAuthAPITag @'V6 + ) + & S.info + . S.title + .~ "Wire-Server API" + & S.info + . S.description + ?~ $(embedText =<< makeRelativeToProject "docs/swagger.md") + & S.servers + .~ [S.Server ("/" <> toUrlPiece V6) Nothing mempty] & cleanupSwagger versionedSwaggerDocsAPI (Just (VersionNumber V5)) = swaggerPregenUIServer $(pregenSwagger V5) versionedSwaggerDocsAPI (Just (VersionNumber V4)) = swaggerPregenUIServer $(pregenSwagger V4) @@ -260,15 +265,15 @@ internalEndpointsSwaggerDocsAPI :: S.OpenApi -> Servant.Server (VersionedSwaggerDocsAPIBase service) internalEndpointsSwaggerDocsAPI service examplePort swagger (Just (VersionNumber V6)) = - swaggerSchemaUIServer $ - swagger - & adjustSwaggerForInternalEndpoint service examplePort - & cleanupSwagger + swaggerSchemaUIServer + $ swagger + & adjustSwaggerForInternalEndpoint service examplePort + & cleanupSwagger internalEndpointsSwaggerDocsAPI service examplePort swagger (Just (VersionNumber V5)) = - swaggerSchemaUIServer $ - swagger - & adjustSwaggerForInternalEndpoint service examplePort - & cleanupSwagger + swaggerSchemaUIServer + $ swagger + & adjustSwaggerForInternalEndpoint service examplePort + & cleanupSwagger internalEndpointsSwaggerDocsAPI _ _ _ (Just (VersionNumber V4)) = emptySwagger internalEndpointsSwaggerDocsAPI _ _ _ (Just (VersionNumber V3)) = emptySwagger internalEndpointsSwaggerDocsAPI _ _ _ (Just (VersionNumber V2)) = emptySwagger @@ -480,8 +485,8 @@ checkPropertyKey :: Public.PropertyKey -> Handler r () checkPropertyKey k = do maxKeyLen <- fromMaybe defMaxKeyLen <$> view (settings . propertyMaxKeyLen) let keyText = Ascii.toText (Public.propertyKeyName k) - when (Text.compareLength keyText (fromIntegral maxKeyLen) == GT) $ - throwStd propertyKeyTooLarge + when (Text.compareLength keyText (fromIntegral maxKeyLen) == GT) + $ throwStd propertyKeyTooLarge -- | Parse a 'PropertyValue' from a bytestring. This is different from 'FromJSON' in that -- checks the byte size of the input, and fails *without consuming all of it* if that size @@ -490,8 +495,8 @@ safeParsePropertyValue :: Public.RawPropertyValue -> Handler r Public.PropertyVa safeParsePropertyValue raw = do maxValueLen <- fromMaybe defMaxValueLen <$> view (settings . propertyMaxValueLen) let lbs = Lazy.take (maxValueLen + 1) (Public.rawPropertyBytes raw) - unless (Lazy.length lbs <= maxValueLen) $ - throwStd propertyValueTooLarge + unless (Lazy.length lbs <= maxValueLen) + $ throwStd propertyValueTooLarge hoistEither $ first (StdError . badRequest . pack) (propertyValueFromRaw raw) propertyValueFromRaw :: Public.RawPropertyValue -> Either String Public.PropertyValue @@ -503,10 +508,10 @@ parseStoredPropertyValue :: Public.RawPropertyValue -> Handler r Public.Property parseStoredPropertyValue raw = case propertyValueFromRaw raw of Right value -> pure value Left e -> do - Log.err $ - Log.msg (Log.val "Failed to parse a stored property value") - . Log.field "raw_value" (Public.rawPropertyBytes raw) - . Log.field "parse_error" e + Log.err + $ Log.msg (Log.val "Failed to parse a stored property value") + . Log.field "raw_value" (Public.rawPropertyBytes raw) + . Log.field "parse_error" e throwStd internalServerError deleteProperty :: (Member NotificationSubsystem r) => UserId -> ConnId -> Public.PropertyKey -> Handler r () @@ -527,7 +532,7 @@ listPropertyKeysAndValues u = do Public.PropertyKeysAndValues <$> traverse parseStoredPropertyValue keysAndVals getPrekeyUnqualifiedH :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> UserId -> ClientId -> @@ -537,7 +542,7 @@ getPrekeyUnqualifiedH zusr user client = do getPrekeyH zusr (Qualified user domain) client getPrekeyH :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> Qualified UserId -> ClientId -> @@ -564,8 +569,8 @@ getMultiUserPrekeyBundleUnqualifiedH :: Handler r Public.UserClientPrekeyMap getMultiUserPrekeyBundleUnqualifiedH zusr userClients = do maxSize <- fromIntegral . setMaxConvSize <$> view settings - when (Map.size (Public.userClients userClients) > maxSize) $ - throwStd (errorToWai @'E.TooManyClients) + when (Map.size (Public.userClients userClients) > maxSize) + $ throwStd (errorToWai @'E.TooManyClients) API.claimLocalMultiPrekeyBundles (ProtectedUser zusr) userClients !>> clientError getMultiUserPrekeyBundleHInternal :: @@ -578,8 +583,8 @@ getMultiUserPrekeyBundleHInternal qualUserClients = do Map.foldMapWithKey (\_ v -> Sum . Map.size $ v) (Public.qualifiedUserClients qualUserClients) - when (size > maxSize) $ - throwStd (errorToWai @'E.TooManyClients) + when (size > maxSize) + $ throwStd (errorToWai @'E.TooManyClients) getMultiUserPrekeyBundleHV3 :: ( Member (Concurrency 'Unsafe) r, @@ -619,13 +624,13 @@ addClient :: Handler r Public.Client addClient usr con new = do -- Users can't add legal hold clients - when (Public.newClientType new == Public.LegalHoldClientType) $ - throwE (clientError ClientLegalHoldCannotBeAdded) + when (Public.newClientType new == Public.LegalHoldClientType) + $ throwE (clientError ClientLegalHoldCannotBeAdded) API.addClient usr (Just con) new !>> clientError deleteClient :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> ConnId -> ClientId -> @@ -785,11 +790,13 @@ createUser (Public.NewUserPublic new) = lift . runExceptT $ do cok <- Auth.toWebCookie =<< case acc of UserAccount _ Public.Ephemeral -> - lift . wrapHttpClient $ - Auth.newCookie @ZAuth.User userId Nothing Public.SessionCookie newUserLabel + lift + . wrapHttpClient + $ Auth.newCookie @ZAuth.User userId Nothing Public.SessionCookie newUserLabel UserAccount _ _ -> - lift . wrapHttpClient $ - Auth.newCookie @ZAuth.User userId Nothing Public.PersistentCookie newUserLabel + lift + . wrapHttpClient + $ Auth.newCookie @ZAuth.User userId Nothing Public.PersistentCookie newUserLabel -- pure $ CreateUserResponse cok userId (Public.SelfProfile usr) pure $ Public.RegisterSuccess cok (Public.SelfProfile usr) where @@ -812,7 +819,7 @@ createUser (Public.NewUserPublic new) = lift . runExceptT $ do Public.NewTeamMemberSSO _ -> Team.sendMemberWelcomeMail e t n l -getSelf :: Member UserSubsystem r => Local UserId -> Handler r Public.SelfProfile +getSelf :: (Member UserSubsystem r) => Local UserId -> Handler r Public.SelfProfile getSelf self = lift (liftSem (getSelfProfile self)) >>= ifNothing (errorToWai @'E.UserNotFound) @@ -856,7 +863,7 @@ listUsersByUnqualifiedIdsOrHandles self mUids mHandles = do (Nothing, Nothing) -> throwStd $ badRequest "at least one ids or handles must be provided" listUsersByIdsOrHandlesGetIds :: - Member UserStore r => + (Member UserStore r) => [Handle] -> Handler r [Qualified UserId] listUsersByIdsOrHandlesGetIds localHandles = do @@ -865,7 +872,7 @@ listUsersByIdsOrHandlesGetIds localHandles = do pure $ map (`Qualified` domain) localUsers listUsersByIdsOrHandlesGetUsers :: - Member UserStore r => + (Member UserStore r) => Local x -> Range n m [Qualified Handle] -> Handler r [Qualified UserId] @@ -927,7 +934,7 @@ instance ToJSON GetActivationCodeResp where toJSON (GetActivationCodeResp (k, c)) = object ["key" .= k, "code" .= c] updateUser :: - Member UserSubsystem r => + (Member UserSubsystem r) => Local UserId -> ConnId -> Public.UserUpdate -> @@ -940,8 +947,9 @@ updateUser uid conn uu = do assets = uu.uupAssets, accentId = uu.uupAccentId } - lift . liftSem $ - updateUserProfile uid (Just conn) UpdateOriginWireClient update + lift + . liftSem + $ updateUserProfile uid (Just conn) UpdateOriginWireClient update changePhone :: ( Member BlacklistStore r, @@ -994,14 +1002,15 @@ changePassword :: UserId -> Public.PasswordChange -> (Handler r) (Maybe Public.C changePassword u cp = lift . exceptTToMaybe $ API.changePassword u cp changeLocale :: - Member UserSubsystem r => + (Member UserSubsystem r) => Local UserId -> ConnId -> Public.LocaleUpdate -> (Handler r) () changeLocale lusr conn l = - lift . liftSem $ - updateUserProfile + lift + . liftSem + $ updateUserProfile lusr (Just conn) UserSubsystem.UpdateOriginWireClient @@ -1020,7 +1029,7 @@ changeSupportedProtocols u conn (Public.SupportedProtocolUpdate prots) = -- | (zusr is ignored by this handler, ie. checking handles is allowed as long as you have -- *any* account.) -checkHandle :: Member UserSubsystem r => UserId -> Text -> Handler r () +checkHandle :: (Member UserSubsystem r) => UserId -> Text -> Handler r () checkHandle _uid hndl = lift (liftSem $ UserSubsystem.checkHandle hndl) >>= \case API.CheckHandleFound -> pure () @@ -1028,7 +1037,7 @@ checkHandle _uid hndl = -- | (zusr is ignored by this handler, ie. checking handles is allowed as long as you have -- *any* account.) -checkHandles :: Member UserSubsystem r => UserId -> Public.CheckHandles -> Handler r [Handle] +checkHandles :: (Member UserSubsystem r) => UserId -> Public.CheckHandles -> Handler r [Handle] checkHandles _ (Public.CheckHandles hs num) = do let handles = mapMaybe Handle.parseHandle (fromRange hs) lift $ liftSem $ API.checkHandles handles (fromRange num) @@ -1046,7 +1055,8 @@ getHandleInfoUnqualifiedH :: (Handler r) (Maybe Public.UserHandleInfo) getHandleInfoUnqualifiedH self handle = do domain <- viewFederationDomain - Public.UserHandleInfo . Public.profileQualifiedId + Public.UserHandleInfo + . Public.profileQualifiedId <$$> Handle.getHandleInfo self (Qualified handle domain) changeHandle :: (Member UserSubsystem r) => Local UserId -> ConnId -> Public.HandleUpdate -> Handler r () @@ -1101,9 +1111,9 @@ customerExtensionCheckBlockedDomains email = do Left _ -> pure () -- if it doesn't fit the syntax of blocked domains, it is not blocked Right domain -> - when (domain `elem` blockedDomains) $ - throwM $ - customerExtensionBlockedDomain domain + when (domain `elem` blockedDomains) + $ throwM + $ customerExtensionBlockedDomain domain createConnectionUnqualified :: ( Member GalleyAPIAccess r, @@ -1150,7 +1160,8 @@ updateLocalConnection self conn other (Public.cuStatus -> newStatus) = do lself <- qualifyLocal self lother <- qualifyLocal other mkUpdateResult - <$> API.updateConnectionToLocalUser lself lother newStatus (Just conn) !>> connError + <$> API.updateConnectionToLocalUser lself lother newStatus (Just conn) + !>> connError updateConnection :: ( Member FederationConfigStore r, @@ -1167,7 +1178,8 @@ updateConnection :: updateConnection self conn other (Public.cuStatus -> newStatus) = do lself <- qualifyLocal self mkUpdateResult - <$> API.updateConnection lself other newStatus (Just conn) !>> connError + <$> API.updateConnection lself other newStatus (Just conn) + !>> connError listLocalConnections :: UserId -> Maybe UserId -> Maybe (Range 1 500 Int32) -> (Handler r) Public.UserConnectionList listLocalConnections uid start msize = do @@ -1214,8 +1226,10 @@ listConnections uid Public.GetMultiTablePageRequest {..} = do remotesOnly :: Local UserId -> Maybe C.PagingState -> Int32 -> (Handler r) Public.ConnectionsPage remotesOnly self pagingState size = - lift . wrapClient $ - pageToConnectionsPage Public.PagingRemotes <$> Data.lookupRemoteConnectionsPage self pagingState size + lift + . wrapClient + $ pageToConnectionsPage Public.PagingRemotes + <$> Data.lookupRemoteConnectionsPage self pagingState size getLocalConnection :: UserId -> UserId -> (Handler r) (Maybe Public.UserConnection) getLocalConnection self other = do @@ -1330,7 +1344,7 @@ activateKey (Public.Activate tgt code dryrun) sendVerificationCode :: forall r. - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => Public.SendVerificationCode -> (Handler r) () sendVerificationCode req = do @@ -1373,9 +1387,9 @@ sendVerificationCode req = do getSystemSettings :: (Handler r) SystemSettingsPublic getSystemSettings = do optSettings <- view settings - pure $ - SystemSettingsPublic $ - fromMaybe False (setRestrictUserCreation optSettings) + pure + $ SystemSettingsPublic + $ fromMaybe False (setRestrictUserCreation optSettings) getSystemSettingsInternal :: UserId -> (Handler r) SystemSettings getSystemSettingsInternal _ = do diff --git a/services/brig/src/Brig/API/Public/Swagger.hs b/services/brig/src/Brig/API/Public/Swagger.hs index bce174ab17f..e1671b0ac5e 100644 --- a/services/brig/src/Brig/API/Public/Swagger.hs +++ b/services/brig/src/Brig/API/Public/Swagger.hs @@ -98,20 +98,21 @@ adjustSwaggerForInternalEndpoint service examplePort swagger = renderedDescription :: Text renderedDescription = - T.pack . Imports.unlines $ - [ "To have access to this *internal* endpoint, create a port forwarding to `" - ++ service - ++ "` into the Kubernetes cluster. E.g.:", - "```", - "kubectl port-forward -n wire service/" - ++ service - ++ " " - ++ show examplePort - ++ ":8080", - "```", - "**N.B.:** Execution via this UI won't work due to CORS issues." - ++ " But, the proposed `curl` commands will." - ] + T.pack + . Imports.unlines + $ [ "To have access to this *internal* endpoint, create a port forwarding to `" + ++ service + ++ "` into the Kubernetes cluster. E.g.:", + "```", + "kubectl port-forward -n wire service/" + ++ service + ++ " " + ++ show examplePort + ++ ":8080", + "```", + "**N.B.:** Execution via this UI won't work due to CORS issues." + ++ " But, the proposed `curl` commands will." + ] adjustSwaggerForFederationEndpoints :: String -> S.OpenApi -> S.OpenApi adjustSwaggerForFederationEndpoints service swagger = @@ -124,10 +125,10 @@ adjustSwaggerForFederationEndpoints service swagger = emptySwagger :: Servant.Server (ServiceSwaggerDocsAPIBase a) emptySwagger = - swaggerSchemaUIServer $ - mempty @S.OpenApi - & S.info . S.description - ?~ "There is no Swagger documentation for this version. Please refer to v5 or later." + swaggerSchemaUIServer + $ mempty @S.OpenApi + & S.info . S.description + ?~ "There is no Swagger documentation for this version. Please refer to v5 or later." {- FUTUREWORK(fisx): there are a few things that need to be fixed before this schema collection is of any practical use! @@ -164,7 +165,7 @@ eventNotificationSchemas = fst . (`S.runDeclare` mempty) <$> renderAll render @Wire.API.Event.Team.Event "Wire.API.Event.Team.Event" ] - render :: forall a. S.ToSchema a => Text -> S.Declare (S.Definitions S.Schema) () + render :: forall a. (S.ToSchema a) => Text -> S.Declare (S.Definitions S.Schema) () render eventTypeName = do eventSchema <- S.declareNamedSchema (Proxy @a) <&> view S.schema S.declare (HM.singleton eventTypeName eventSchema) diff --git a/services/brig/src/Brig/API/User.hs b/services/brig/src/Brig/API/User.hs index fba40e66135..fffed413cb4 100644 --- a/services/brig/src/Brig/API/User.hs +++ b/services/brig/src/Brig/API/User.hs @@ -199,17 +199,17 @@ identityErrorToBrigError = \case IdentityErrorBlacklistedPhone -> Error.StdError $ errorToWai @'E.BlacklistedPhone IdentityErrorUserKeyExists -> Error.StdError $ errorToWai @'E.UserKeyExists -verifyUniquenessAndCheckBlacklist :: Member BlacklistStore r => UserKey -> ExceptT IdentityError (AppT r) () +verifyUniquenessAndCheckBlacklist :: (Member BlacklistStore r) => UserKey -> ExceptT IdentityError (AppT r) () verifyUniquenessAndCheckBlacklist uk = do wrapClientE $ checkKey Nothing uk blacklisted <- lift $ liftSem $ BlacklistStore.exists uk - when blacklisted $ - throwE (foldKey (const IdentityErrorBlacklistedEmail) (const IdentityErrorBlacklistedPhone) uk) + when blacklisted + $ throwE (foldKey (const IdentityErrorBlacklistedEmail) (const IdentityErrorBlacklistedPhone) uk) where checkKey u k = do av <- lift $ Data.keyAvailable k u - unless av $ - throwE IdentityErrorUserKeyExists + unless av + $ throwE IdentityErrorUserKeyExists createUserSpar :: forall r. @@ -267,16 +267,16 @@ createUserSpar new = do addUserToTeamSSO account tid ident role = do let uid = userId (accountUser account) added <- lift $ liftSem $ GalleyAPIAccess.addTeamMember uid tid (Nothing, role) - unless added $ - throwE RegisterErrorTooManyTeamMembers + unless added + $ throwE RegisterErrorTooManyTeamMembers lift $ do wrapClient $ activateUser uid ident void $ onActivated (AccountActivated account) - liftSem $ - Log.info $ - field "user" (toByteString uid) - . field "team" (toByteString tid) - . msg (val "Added via SSO") + liftSem + $ Log.info + $ field "user" (toByteString uid) + . field "team" (toByteString tid) + . msg (val "Added via SSO") Team.TeamName nm <- lift $ liftSem $ GalleyAPIAccess.getTeamName tid pure $ CreateUserTeam tid nm @@ -362,8 +362,8 @@ createUser new = do liftSem $ GalleyAPIAccess.createTeam uid (bnuTeam newTeamUser) tid' let activating = isJust (newUserEmailCode new) BindingNewTeam newTeam = newTeamUser.bnuTeam - pure $ - if activating + pure + $ if activating then Just $ CreateUserTeam tid' (fromRange (newTeam ^. newTeamName)) else Nothing _ -> pure Nothing @@ -434,8 +434,8 @@ createUser new = do ensureMemberCanJoin tid = do maxSize <- fromIntegral . setMaxTeamSize <$> view settings (TeamSize teamSize) <- TeamSize.teamSize tid - when (teamSize >= maxSize) $ - throwE RegisterErrorTooManyTeamMembers + when (teamSize >= maxSize) + $ throwE RegisterErrorTooManyTeamMembers -- FUTUREWORK: The above can easily be done/tested in the intra call. -- Remove after the next release. canAdd <- lift $ liftSem $ GalleyAPIAccess.checkUserCanJoinTeam tid @@ -453,21 +453,21 @@ createUser new = do acceptTeamInvitation account inv ii uk ident = do let uid = userId (accountUser account) ok <- lift . wrapClient $ Data.claimKey uk uid - unless ok $ - throwE RegisterErrorUserKeyExists + unless ok + $ throwE RegisterErrorUserKeyExists let minvmeta :: (Maybe (UserId, UTCTimeMillis), Role) minvmeta = ((,inCreatedAt inv) <$> inCreatedBy inv, Team.inRole inv) added <- lift $ liftSem $ GalleyAPIAccess.addTeamMember uid (Team.iiTeam ii) minvmeta - unless added $ - throwE RegisterErrorTooManyTeamMembers + unless added + $ throwE RegisterErrorTooManyTeamMembers lift $ do wrapClient $ activateUser uid ident -- ('insertAccount' sets column activated to False; here it is set to True.) void $ onActivated (AccountActivated account) - liftSem $ - Log.info $ - field "user" (toByteString uid) - . field "team" (toByteString $ Team.iiTeam ii) - . msg (val "Accepting invitation") + liftSem + $ Log.info + $ field "user" (toByteString uid) + . field "team" (toByteString $ Team.iiTeam ii) + . msg (val "Accepting invitation") liftSem $ UserPendingActivationStore.remove uid wrapClient $ do Team.deleteInvitation (Team.inTeam inv) (Team.inInvitation inv) @@ -476,16 +476,16 @@ createUser new = do addUserToTeamSSO account tid ident = do let uid = userId (accountUser account) added <- lift $ liftSem $ GalleyAPIAccess.addTeamMember uid tid (Nothing, defaultRole) - unless added $ - throwE RegisterErrorTooManyTeamMembers + unless added + $ throwE RegisterErrorTooManyTeamMembers lift $ do wrapClient $ activateUser uid ident void $ onActivated (AccountActivated account) - liftSem $ - Log.info $ - field "user" (toByteString uid) - . field "team" (toByteString tid) - . msg (val "Added via SSO") + liftSem + $ Log.info + $ field "user" (toByteString uid) + . field "team" (toByteString tid) + . msg (val "Added via SSO") Team.TeamName nm <- lift $ liftSem $ GalleyAPIAccess.getTeamName tid pure $ CreateUserTeam tid nm @@ -496,16 +496,18 @@ createUser new = do Nothing -> do timeout <- setActivationTimeout <$> view settings edata <- lift . wrapClient $ Data.newActivation ek timeout (Just uid) - lift . liftSem . Log.info $ - field "user" (toByteString uid) - . field "activation.key" (toByteString $ activationKey edata) - . msg (val "Created email activation key/code pair") + lift + . liftSem + . Log.info + $ field "user" (toByteString uid) + . field "activation.key" (toByteString $ activationKey edata) + . msg (val "Created email activation key/code pair") pure $ Just edata Just c -> do ak <- liftIO $ Data.mkActivationKey ek - void $ - activateWithCurrency (ActivateKey ak) c (Just uid) (bnuCurrency =<< newTeam) - !>> activationErrorToRegisterError + void + $ activateWithCurrency (ActivateKey ak) c (Just uid) (bnuCurrency =<< newTeam) + !>> activationErrorToRegisterError pure Nothing -- Handle phone activation (deprecated, see #RefRegistrationNoPreverification in /docs/reference/user/registration.md) @@ -515,10 +517,12 @@ createUser new = do Nothing -> do timeout <- setActivationTimeout <$> view settings pdata <- lift . wrapClient $ Data.newActivation pk timeout (Just uid) - lift . liftSem . Log.info $ - field "user" (toByteString uid) - . field "activation.key" (toByteString $ activationKey pdata) - . msg (val "Created phone activation key/code pair") + lift + . liftSem + . Log.info + $ field "user" (toByteString uid) + . field "activation.key" (toByteString $ activationKey pdata) + . msg (val "Created phone activation key/code pair") pure $ Just pdata Just c -> do ak <- liftIO $ Data.mkActivationKey pk @@ -598,7 +602,7 @@ changeManagedBy uid conn (ManagedByUpdate mb) = do -- | Call 'changeEmail' and process result: if email changes to itself, succeed, if not, send -- validation email. -changeSelfEmail :: Member BlacklistStore r => UserId -> Email -> UpdateOriginType -> ExceptT Error.Error (AppT r) ChangeEmailResponse +changeSelfEmail :: (Member BlacklistStore r) => UserId -> Email -> UpdateOriginType -> ExceptT Error.Error (AppT r) ChangeEmailResponse changeSelfEmail u email allowScim = do changeEmail u email allowScim !>> Error.changeEmailError >>= \case ChangeEmailIdempotent -> @@ -618,7 +622,7 @@ changeSelfEmail u email allowScim = do (userIdentity usr) -- | Prepare changing the email (checking a number of invariants). -changeEmail :: Member BlacklistStore r => UserId -> Email -> UpdateOriginType -> ExceptT ChangeEmailError (AppT r) ChangeEmailResult +changeEmail :: (Member BlacklistStore r) => UserId -> Email -> UpdateOriginType -> ExceptT ChangeEmailError (AppT r) ChangeEmailResult changeEmail u email updateOrigin = do em <- either @@ -627,19 +631,19 @@ changeEmail u email updateOrigin = do (validateEmail email) let ek = userEmailKey em blacklisted <- lift . liftSem $ BlacklistStore.exists ek - when blacklisted $ - throwE (ChangeBlacklistedEmail email) + when blacklisted + $ throwE (ChangeBlacklistedEmail email) available <- lift . wrapClient $ Data.keyAvailable ek (Just u) - unless available $ - throwE $ - EmailExists email + unless available + $ throwE + $ EmailExists email usr <- maybe (throwM $ UserProfileNotFound u) pure =<< lift (wrapClient $ Data.lookupUser WithPendingInvitations u) case emailIdentity =<< userIdentity usr of -- The user already has an email address and the new one is exactly the same Just current | current == em -> pure ChangeEmailIdempotent _ -> do - unless (userManagedBy usr /= ManagedByScim || updateOrigin == UpdateOriginScim) $ - throwE EmailManagedByScim + unless (userManagedBy usr /= ManagedByScim || updateOrigin == UpdateOriginScim) + $ throwE EmailManagedByScim timeout <- setActivationTimeout <$> view settings act <- lift . wrapClient $ Data.newActivation ek timeout (Just u) pure $ ChangeEmailNeedsActivation (usr, act, em) @@ -662,16 +666,16 @@ changePhone u phone = do =<< lift (wrapClient $ validatePhone phone) let pk = userPhoneKey canonical available <- lift . wrapClient $ Data.keyAvailable pk (Just u) - unless available $ - throwE PhoneExists + unless available + $ throwE PhoneExists timeout <- setActivationTimeout <$> view settings blacklisted <- lift . liftSem $ BlacklistStore.exists pk - when blacklisted $ - throwE BlacklistedNewPhone + when blacklisted + $ throwE BlacklistedNewPhone -- check if any prefixes of this phone number are blocked prefixExcluded <- lift . liftSem $ BlacklistPhonePrefixStore.existsAny canonical - when prefixExcluded $ - throwE BlacklistedNewPhone + when prefixExcluded + $ throwE BlacklistedNewPhone act <- lift . wrapClient $ Data.newActivation pk timeout (Just u) pure (act, canonical) @@ -720,8 +724,8 @@ removePhone uid conn = do case ident of Just (FullIdentity _ p) -> do pw <- lift . wrapClient $ Data.lookupPassword uid - unless (isJust pw) $ - throwE NoPassword + unless (isJust pw) + $ throwE NoPassword lift $ do wrapClient . deleteKey $ userPhoneKey p wrapClient $ Data.deletePhone uid @@ -763,17 +767,17 @@ revokeIdentity key = do revokeKey :: UserId -> UserKey -> AppT r () revokeKey u uk = do wrapClient $ deleteKey uk - wrapClient $ - foldKey + wrapClient + $ foldKey (\(_ :: Email) -> Data.deleteEmail u) (\(_ :: Phone) -> Data.deletePhone u) uk - liftSem $ - Intra.onUserEvent u Nothing $ - foldKey - (emailRemoved u) - (phoneRemoved u) - uk + liftSem + $ Intra.onUserEvent u Nothing + $ foldKey + (emailRemoved u) + (phoneRemoved u) + uk ------------------------------------------------------------------------------- -- Change Account Status @@ -870,18 +874,20 @@ activateWithCurrency :: ExceptT ActivationError (AppT r) ActivationResult activateWithCurrency tgt code usr cur = do key <- wrapClientE $ mkActivationKey tgt - lift . liftSem . Log.info $ - field "activation.key" (toByteString key) - . field "activation.code" (toByteString code) - . msg (val "Activating") + lift + . liftSem + . Log.info + $ field "activation.key" (toByteString key) + . field "activation.code" (toByteString code) + . msg (val "Activating") event <- wrapClientE $ Data.activateKey key code usr case event of Nothing -> pure ActivationPass Just e -> do (uid, ident, first) <- lift $ onActivated e - when first $ - lift $ - activateTeam uid + when first + $ lift + $ activateTeam uid pure $ ActivationSuccess ident first where activateTeam uid = do @@ -941,12 +947,12 @@ sendActivationCode emailOrPhone loc call = case emailOrPhone of (pure . userEmailKey) (validateEmail email) exists <- lift $ isJust <$> wrapClient (Data.lookupKey ek) - when exists $ - throwE $ - UserKeyInUse ek + when exists + $ throwE + $ UserKeyInUse ek blacklisted <- lift . liftSem $ BlacklistStore.exists ek - when blacklisted $ - throwE (ActivationBlacklistedUserKey ek) + when blacklisted + $ throwE (ActivationBlacklistedUserKey ek) uc <- lift . wrapClient $ Data.lookupActivationCode ek case uc of Nothing -> sendVerificationEmail ek Nothing -- Fresh code request, no user @@ -961,16 +967,16 @@ sendActivationCode emailOrPhone loc call = case emailOrPhone of =<< lift (wrapClient $ validatePhone phone) let pk = userPhoneKey canonical exists <- lift $ isJust <$> wrapClient (Data.lookupKey pk) - when exists $ - throwE $ - UserKeyInUse pk + when exists + $ throwE + $ UserKeyInUse pk blacklisted <- lift . liftSem $ BlacklistStore.exists pk - when blacklisted $ - throwE (ActivationBlacklistedUserKey pk) + when blacklisted + $ throwE (ActivationBlacklistedUserKey pk) -- check if any prefixes of this phone number are blocked prefixExcluded <- lift . liftSem $ BlacklistPhonePrefixStore.existsAny canonical - when prefixExcluded $ - throwE (ActivationBlacklistedUserKey pk) + when prefixExcluded + $ throwE (ActivationBlacklistedUserKey pk) c <- lift . wrapClient $ fmap snd <$> Data.lookupActivationCode pk p <- wrapClientE $ mkPair pk c Nothing void . lift . wrapHttp $ forPhoneKey pk $ \ph -> @@ -989,8 +995,8 @@ sendActivationCode emailOrPhone loc call = case emailOrPhone of sendVerificationEmail ek uc = do p <- wrapClientE $ mkPair ek uc Nothing void . forEmailKey ek $ \em -> - lift $ - sendVerificationMail em p loc + lift + $ sendVerificationMail em p loc sendActivationEmail ek uc uid = do -- FUTUREWORK(fisx): we allow for 'PendingInvitations' here, but I'm not sure this -- top-level function isn't another piece of a deprecated onboarding flow? @@ -1036,8 +1042,8 @@ mkActivationKey (ActivatePhone p) = do changePassword :: UserId -> PasswordChange -> ExceptT ChangePasswordError (AppT r) () changePassword uid cp = do activated <- lift . wrapClient $ Data.isActivated uid - unless activated $ - throwE ChangePasswordNoIdentity + unless activated + $ throwE ChangePasswordNoIdentity currpw <- lift . wrapClient $ Data.lookupPassword uid let newpw = cpNewPassword cp case (currpw, cpOldPassword cp) of @@ -1045,10 +1051,10 @@ changePassword uid cp = do (Just _, Nothing) -> throwE InvalidCurrentPassword (Just pw, Just pw') -> do -- We are updating the pwd here anyway, so we don't care about the pwd status - unless (verifyPassword pw' pw) $ - throwE InvalidCurrentPassword - when (verifyPassword newpw pw) $ - throwE ChangePasswordMustDiffer + unless (verifyPassword pw' pw) + $ throwE InvalidCurrentPassword + when (verifyPassword newpw pw) + $ throwE ChangePasswordMustDiffer lift $ wrapClient (Data.updatePassword uid newpw) >> wrapClient (revokeAllCookies uid) beginPasswordReset :: @@ -1062,11 +1068,11 @@ beginPasswordReset target = do user <- lift (wrapClient $ Data.lookupKey key) >>= maybe (throwE InvalidPasswordResetKey) pure lift . liftSem . Log.debug $ field "user" (toByteString user) . field "action" (val "User.beginPasswordReset") status <- lift . wrapClient $ Data.lookupStatus user - unless (status == Just Active) $ - throwE InvalidPasswordResetKey + unless (status == Just Active) + $ throwE InvalidPasswordResetKey code <- lift . liftSem $ E.lookupPasswordResetCode user - when (isJust code) $ - throwE (PasswordResetInProgress Nothing) + when (isJust code) + $ throwE (PasswordResetInProgress Nothing) (user,) <$> lift (liftSem $ E.createPasswordResetCode user target) completePasswordReset :: @@ -1102,17 +1108,21 @@ checkNewIsDifferent uid pw = do _ -> pure () mkPasswordResetKey :: - Member CodeStore r => + (Member CodeStore r) => PasswordResetIdentity -> ExceptT PasswordResetError (AppT r) PasswordResetKey mkPasswordResetKey ident = case ident of PasswordResetIdentityKey k -> pure k PasswordResetEmailIdentity e -> wrapClientE (user (userEmailKey e)) - >>= lift . liftSem . E.mkPasswordResetKey + >>= lift + . liftSem + . E.mkPasswordResetKey PasswordResetPhoneIdentity p -> wrapClientE (user (userPhoneKey p)) - >>= lift . liftSem . E.mkPasswordResetKey + >>= lift + . liftSem + . E.mkPasswordResetKey where user uk = lift (Data.lookupKey uk) >>= maybe (throwE InvalidPasswordResetKey) pure @@ -1176,16 +1186,18 @@ deleteSelfUser uid pwd = do Just _ -> throwE DeleteUserMissingPassword Nothing -> lift . liftSem $ deleteAccount a >> pure Nothing byPassword a pw = do - lift . liftSem . Log.info $ - field "user" (toByteString uid) - . msg (val "Attempting account deletion with a password") + lift + . liftSem + . Log.info + $ field "user" (toByteString uid) + . msg (val "Attempting account deletion with a password") actual <- lift . wrapClient $ Data.lookupPassword uid case actual of Nothing -> throwE DeleteUserInvalidPassword Just p -> do -- We're deleting a user, no sense in updating their pwd, so we ignore pwd status - unless (verifyPassword pw p) $ - throwE DeleteUserInvalidPassword + unless (verifyPassword pw p) + $ throwE DeleteUserInvalidPassword lift . liftSem $ deleteAccount a >> pure Nothing sendCode a target = do gen <- Code.mkGen (either Code.ForEmail Code.ForPhone target) @@ -1193,9 +1205,11 @@ deleteSelfUser uid pwd = do case pending of Just c -> throwE $! DeleteUserPendingCode (Code.codeTTL c) Nothing -> do - lift . liftSem . Log.info $ - field "user" (toByteString uid) - . msg (val "Sending verification code for account deletion") + lift + . liftSem + . Log.info + $ field "user" (toByteString uid) + . msg (val "Sending verification code for account deletion") c <- Code.generate gen @@ -1273,7 +1287,8 @@ ensureAccountDeleted uid = do if notNull probs || not accIsDeleted || notNull clients - || conCount > 0 + || conCount + > 0 || notNull cookies then do liftSem $ deleteAccount acc @@ -1330,7 +1345,7 @@ deleteAccount (accountUser -> user) = do -- Lookups lookupActivationCode :: - MonadClient m => + (MonadClient m) => Either Email Phone -> m (Maybe ActivationPair) lookupActivationCode emailOrPhone = do @@ -1356,7 +1371,7 @@ lookupPasswordResetCode emailOrPhone = do pure $ (k,) <$> c deleteUserNoVerify :: - Member DeleteQueue r => + (Member DeleteQueue r) => UserId -> Sem r () deleteUserNoVerify uid = do @@ -1374,8 +1389,8 @@ deleteUsersNoVerify uids = do {-# NOINLINE enqueueMultiDeleteCounter #-} enqueueMultiDeleteCounter :: Prom.Counter enqueueMultiDeleteCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.enqueue_multi_delete_total", Prom.metricHelp = "Number of users enqueued to be deleted" @@ -1384,8 +1399,8 @@ enqueueMultiDeleteCounter = {-# NOINLINE enqueueMultiDeleteCallsCounter #-} enqueueMultiDeleteCallsCounter :: Prom.Counter enqueueMultiDeleteCallsCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.enqueue_multi_delete_calls_total", Prom.metricHelp = "Number of users enqueued to be deleted" @@ -1402,13 +1417,13 @@ lookupProfilesV3 :: lookupProfilesV3 self others = getUserProfilesWithErrors self others getLegalHoldStatus :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => UserId -> AppT r (Maybe UserLegalHoldStatus) getLegalHoldStatus uid = traverse (liftSem . getLegalHoldStatus' . accountUser) =<< wrapHttpClient (lookupAccount uid) getLegalHoldStatus' :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => User -> Sem r UserLegalHoldStatus getLegalHoldStatus' user = @@ -1430,26 +1445,26 @@ lookupAccountsByIdentity emailOrPhone includePendingInvitations = do then pure result else pure $ filter ((/= PendingInvitation) . accountStatus) result -isBlacklisted :: Member BlacklistStore r => Either Email Phone -> AppT r Bool +isBlacklisted :: (Member BlacklistStore r) => Either Email Phone -> AppT r Bool isBlacklisted emailOrPhone = do let uk = either userEmailKey userPhoneKey emailOrPhone liftSem $ BlacklistStore.exists uk -blacklistInsert :: Member BlacklistStore r => Either Email Phone -> AppT r () +blacklistInsert :: (Member BlacklistStore r) => Either Email Phone -> AppT r () blacklistInsert emailOrPhone = do let uk = either userEmailKey userPhoneKey emailOrPhone liftSem $ BlacklistStore.insert uk -blacklistDelete :: Member BlacklistStore r => Either Email Phone -> AppT r () +blacklistDelete :: (Member BlacklistStore r) => Either Email Phone -> AppT r () blacklistDelete emailOrPhone = do let uk = either userEmailKey userPhoneKey emailOrPhone liftSem $ BlacklistStore.delete uk -phonePrefixGet :: Member BlacklistPhonePrefixStore r => PhonePrefix -> (AppT r) [ExcludedPrefix] +phonePrefixGet :: (Member BlacklistPhonePrefixStore r) => PhonePrefix -> (AppT r) [ExcludedPrefix] phonePrefixGet = liftSem . BlacklistPhonePrefixStore.getAll -phonePrefixDelete :: Member BlacklistPhonePrefixStore r => PhonePrefix -> (AppT r) () +phonePrefixDelete :: (Member BlacklistPhonePrefixStore r) => PhonePrefix -> (AppT r) () phonePrefixDelete = liftSem . BlacklistPhonePrefixStore.delete -phonePrefixInsert :: Member BlacklistPhonePrefixStore r => ExcludedPrefix -> (AppT r) () +phonePrefixInsert :: (Member BlacklistPhonePrefixStore r) => ExcludedPrefix -> (AppT r) () phonePrefixInsert = liftSem . BlacklistPhonePrefixStore.insert diff --git a/services/brig/src/Brig/API/Util.hs b/services/brig/src/Brig/API/Util.hs index 947f761a511..d55993db6e4 100644 --- a/services/brig/src/Brig/API/Util.hs +++ b/services/brig/src/Brig/API/Util.hs @@ -69,7 +69,7 @@ lookupProfilesMaybeFilterSameTeamOnly self us = do Just team -> filter (\x -> profileTeam x == Just team) us Nothing -> us -fetchUserIdentity :: Member UserSubsystem r => UserId -> AppT r (Maybe UserIdentity) +fetchUserIdentity :: (Member UserSubsystem r) => UserId -> AppT r (Maybe UserIdentity) fetchUserIdentity uid = do luid <- qualifyLocal uid liftSem (getSelfProfile luid) @@ -95,12 +95,12 @@ traverseConcurrentlyAppT :: AppT r [Either (a, e) b] traverseConcurrentlyAppT f t = do env <- temporaryGetEnv - AppT $ - lift $ - C.unsafePooledMapConcurrentlyN - 8 - (\a -> first (a,) <$> lowerAppT env (runExceptT $ f a)) - t + AppT + $ lift + $ C.unsafePooledMapConcurrentlyN + 8 + (\a -> first (a,) <$> lowerAppT env (runExceptT $ f a)) + t -- | Traverse concurrently and fail on first error. traverseConcurrentlyWithErrors :: @@ -145,15 +145,15 @@ traverseConcurrentlyWithErrorsAppT :: ExceptT e (AppT r) [b] traverseConcurrentlyWithErrorsAppT f t = do env <- lift temporaryGetEnv - ExceptT $ - AppT $ - lift $ - runExceptT $ - traverseConcurrentlyWithErrorsSem - (mapExceptT (lowerAppT env) . f) - t + ExceptT + $ AppT + $ lift + $ runExceptT + $ traverseConcurrentlyWithErrorsSem + (mapExceptT (lowerAppT env) . f) + t -exceptTToMaybe :: Monad m => ExceptT e m () -> m (Maybe e) +exceptTToMaybe :: (Monad m) => ExceptT e m () -> m (Maybe e) exceptTToMaybe = (pure . either Just (const Nothing)) <=< runExceptT tryInsertVerificationCode :: Code.Code -> (RetryAfter -> e) -> ExceptT e (AppT r) () diff --git a/services/brig/src/Brig/AWS.hs b/services/brig/src/Brig/AWS.hs index 54a93e85c5b..4bea17d6338 100644 --- a/services/brig/src/Brig/AWS.hs +++ b/services/brig/src/Brig/AWS.hs @@ -124,8 +124,8 @@ mkEnv lgr opts emailOpts mgr = do baseEnv <- AWS.newEnv AWS.discover <&> AWS.configureService sqs . maybe id AWS.configureService dyn . maybe id AWS.configureService ses - pure $ - baseEnv + pure + $ baseEnv { AWS.logger = awsLogger g, AWS.manager = mgr } @@ -151,7 +151,7 @@ getQueueUrl :: m Text getQueueUrl e q = view SQS.getQueueUrlResponse_queueUrl <$> exec e (SQS.newGetQueueUrl q) -execute :: MonadIO m => Env -> Amazon a -> m a +execute :: (MonadIO m) => Env -> Amazon a -> m a execute e m = liftIO $ runResourceT (runReaderT (unAmazon m) e) data Error where @@ -171,8 +171,8 @@ listen :: (FromJSON a, Show a) => Int -> Text -> (a -> IO ()) -> Amazon () listen throttleMillis url callback = forever . handleAny unexpectedError $ do msgs <- fromMaybe [] . view SQS.receiveMessageResponse_messages <$> send receive void $ mapConcurrently onMessage msgs - when (null msgs) $ - threadDelay (1000 * throttleMillis) + when (null msgs) + $ threadDelay (1000 * throttleMillis) where receive = SQS.newReceiveMessage url @@ -226,8 +226,8 @@ sendMail m = do AWS.ServiceError se | se ^. AWS.serviceError_status - == status400 - && "Invalid domain name" + == status400 + && "Invalid domain name" `Text.isPrefixOf` AWS.toText (se ^. AWS.serviceError_code) -> throwM SESInvalidDomain _ -> throwM (GeneralError x) @@ -260,9 +260,9 @@ execCatch :: a -> m (Either AWS.Error (AWSResponse a)) execCatch e cmd = - runResourceT $ - AWS.trying AWS._Error $ - AWS.send e cmd + runResourceT + $ AWS.trying AWS._Error + $ AWS.send e cmd exec :: ( AWSRequest a, @@ -276,7 +276,7 @@ exec :: m (AWSResponse a) exec e cmd = liftIO (execCatch e cmd) >>= either (throwM . GeneralError) pure -canRetry :: MonadIO m => Either AWS.Error a -> m Bool +canRetry :: (MonadIO m) => Either AWS.Error a -> m Bool canRetry (Right _) = pure False canRetry (Left e) = case e of AWS.TransportError (HttpExceptionRequest _ ResponseTimeout) -> pure True diff --git a/services/brig/src/Brig/AWS/SesNotification.hs b/services/brig/src/Brig/AWS/SesNotification.hs index 97f75c55f8a..63b1f5c07ca 100644 --- a/services/brig/src/Brig/AWS/SesNotification.hs +++ b/services/brig/src/Brig/AWS/SesNotification.hs @@ -31,13 +31,13 @@ import System.Logger.Class (field, msg, (~~)) import System.Logger.Class qualified as Log import Wire.API.User.Identity -onEvent :: Member BlacklistStore r => SESNotification -> AppT r () +onEvent :: (Member BlacklistStore r) => SESNotification -> AppT r () onEvent (MailBounce BouncePermanent es) = onPermanentBounce es onEvent (MailBounce BounceTransient es) = onTransientBounce es onEvent (MailBounce BounceUndetermined es) = onUndeterminedBounce es onEvent (MailComplaint es) = onComplaint es -onPermanentBounce :: Member BlacklistStore r => [Email] -> AppT r () +onPermanentBounce :: (Member BlacklistStore r) => [Email] -> AppT r () onPermanentBounce = mapM_ $ \e -> do logEmailEvent "Permanent bounce" e liftSem $ BlacklistStore.insert (userEmailKey e) @@ -48,7 +48,7 @@ onTransientBounce = mapM_ (logEmailEvent "Transient bounce") onUndeterminedBounce :: [Email] -> AppT r () onUndeterminedBounce = mapM_ (logEmailEvent "Undetermined bounce") -onComplaint :: Member BlacklistStore r => [Email] -> AppT r () +onComplaint :: (Member BlacklistStore r) => [Email] -> AppT r () onComplaint = mapM_ $ \e -> do logEmailEvent "Complaint" e liftSem $ BlacklistStore.insert (userEmailKey e) diff --git a/services/brig/src/Brig/App.hs b/services/brig/src/Brig/App.hs index d647ab88957..61c7b47516a 100644 --- a/services/brig/src/Brig/App.hs +++ b/services/brig/src/Brig/App.hs @@ -229,8 +229,8 @@ newEnv o = do zau <- initZAuth o clock <- mkAutoUpdate defaultUpdateSettings {updateAction = getCurrentTime} w <- - FS.startManagerConf $ - FS.defaultConfig {FS.confWatchMode = FS.WatchModeOS} + FS.startManagerConf + $ FS.defaultConfig {FS.confWatchMode = FS.WatchModeOS} let turnOpts = Opt.turn o turnSecret <- Text.encodeUtf8 . Text.strip <$> Text.readFile (Opt.secret turnOpts) turn <- Calling.mkTurnEnv (Opt.serversSource turnOpts) (Opt.tokenTTL turnOpts) (Opt.configTTL turnOpts) turnSecret sha512 @@ -260,8 +260,8 @@ newEnv o = do rabbitChan <- traverse (Q.mkRabbitMqChannelMVar lgr) o.rabbitmq let allDisabledVersions = foldMap expandVersionExp (Opt.setDisabledAPIVersions sett) idxEnv <- mkIndexEnv o.elasticsearch lgr (Opt.galley o) mgr - pure $! - Env + pure + $! Env { _cargohold = mkEndpoint $ Opt.cargohold o, _galley = mkEndpoint $ Opt.galley o, _galleyEndpoint = Opt.galley o, @@ -324,10 +324,10 @@ mkIndexEnv esOpts logger galleyEp rpcHttpManager = do esLogger = Log.clone (Just "index.brig") logger bhEnv <- mkBhEnv esOpts.insecureSkipVerifyTls esOpts.caCert mEsCreds esOpts.url additionalBhEnv <- - for esOpts.additionalWriteIndexUrl $ - mkBhEnv esOpts.additionalInsecureSkipVerifyTls esOpts.additionalCaCert mEsAddCreds - pure $ - IndexEnv + for esOpts.additionalWriteIndexUrl + $ mkBhEnv esOpts.additionalInsecureSkipVerifyTls esOpts.additionalCaCert mEsAddCreds + pure + $ IndexEnv { idxLogger = esLogger, idxElastic = bhEnv, idxRequest = Nothing, @@ -365,8 +365,8 @@ initHttpManagerWithTLSConfig skipTlsVerify mCustomCa = do if skipTlsVerify then SSL.contextSetVerificationMode ctx SSL.VerifyNone else - SSL.contextSetVerificationMode ctx $ - SSL.VerifyPeer True True Nothing + SSL.contextSetVerificationMode ctx + $ SSL.VerifyPeer True True Nothing case mCustomCa of Nothing -> SSL.contextSetDefaultVerifyPaths ctx Just customCa -> do @@ -389,8 +389,8 @@ initHttp2Manager = do SSL.contextAddOption ctx SSL_OP_NO_SSLv3 SSL.contextAddOption ctx SSL_OP_NO_TLSv1 SSL.contextSetCiphers ctx "HIGH" - SSL.contextSetVerificationMode ctx $ - SSL.VerifyPeer True True Nothing + SSL.contextSetVerificationMode ctx + $ SSL.VerifyPeer True True Nothing SSL.contextSetDefaultVerifyPaths ctx http2ManagerWithSSLCtx ctx @@ -501,8 +501,9 @@ instance (Member (Final IO) r) => MonadCatch (Sem r) where pure $ m' `catch` \e -> handler' $ e <$ st instance MonadCatch (AppT r) where - catch (AppT m) handler = AppT $ - ReaderT $ \env -> + catch (AppT m) handler = AppT + $ ReaderT + $ \env -> catch (runReaderT m env) (\x -> runReaderT (unAppT $ handler x) env) instance MonadReader Env (AppT r) where @@ -522,11 +523,12 @@ instance MonadLogger (AppT r) where log l m = do g <- view applog r <- view requestId - AppT $ - lift $ - embedFinal @IO $ - Log.log g l $ - field "request" (unRequestId r) ~~ m + AppT + $ lift + $ embedFinal @IO + $ Log.log g l + $ field "request" (unRequestId r) + ~~ m instance MonadLogger (ExceptT err (AppT r)) where log l m = lift (LC.log l m) @@ -582,7 +584,7 @@ newtype HttpClientIO a = HttpClientIO MonadIndexIO ) -runHttpClientIO :: MonadIO m => Env -> HttpClientIO a -> m a +runHttpClientIO :: (MonadIO m) => Env -> HttpClientIO a -> m a runHttpClientIO env = runClient (env ^. casClient) . runHttpT (env ^. httpManager) @@ -636,7 +638,7 @@ qualifyLocal :: (MonadReader Env m) => a -> m (Local a) qualifyLocal a = toLocalUnsafe <$> viewFederationDomain <*> pure a -- FUTUREWORK: rename to 'qualifyLocalPoly' -qualifyLocal' :: (Member (Input (Local ()))) r => a -> Sem r (Local a) +qualifyLocal' :: ((Member (Input (Local ()))) r) => a -> Sem r (Local a) qualifyLocal' a = flip toLocalUnsafe a . tDomain <$> input -- | Convert a qualified value into a local one. Throw if the value is not actually local. diff --git a/services/brig/src/Brig/Budget.hs b/services/brig/src/Brig/Budget.hs index cf952a3ed76..35bb1b2348d 100644 --- a/services/brig/src/Brig/Budget.hs +++ b/services/brig/src/Brig/Budget.hs @@ -58,7 +58,7 @@ newtype BudgetKey = BudgetKey Text -- -- FUTUREWORK: exceptions are not handled very nicely, but it's not clear what it would mean -- to improve this. -withBudget :: MonadClient m => BudgetKey -> Budget -> m a -> m (Budgeted a) +withBudget :: (MonadClient m) => BudgetKey -> Budget -> m a -> m (Budgeted a) withBudget k b ma = do Budget ttl val <- fromMaybe b <$> lookupBudget k let remaining = val - 1 @@ -70,21 +70,21 @@ withBudget k b ma = do pure (BudgetedValue a remaining) -- | Like 'withBudget', but does not decrease budget, only takes a look. -checkBudget :: MonadClient m => BudgetKey -> Budget -> m (Budgeted ()) +checkBudget :: (MonadClient m) => BudgetKey -> Budget -> m (Budgeted ()) checkBudget k b = do Budget ttl val <- fromMaybe b <$> lookupBudget k let remaining = val - 1 - pure $ - if remaining < 0 + pure + $ if remaining < 0 then BudgetExhausted ttl else BudgetedValue () remaining -lookupBudget :: MonadClient m => BudgetKey -> m (Maybe Budget) +lookupBudget :: (MonadClient m) => BudgetKey -> m (Maybe Budget) lookupBudget k = fmap mk <$> query1 budgetSelect (params One (Identity k)) where mk (val, ttl) = Budget (fromIntegral ttl) val -insertBudget :: MonadClient m => BudgetKey -> Budget -> m () +insertBudget :: (MonadClient m) => BudgetKey -> Budget -> m () insertBudget k (Budget ttl val) = retry x5 $ write budgetInsert (params One (k, val, round ttl)) diff --git a/services/brig/src/Brig/Calling.hs b/services/brig/src/Brig/Calling.hs index c9501b3fcad..5f9bb4e280b 100644 --- a/services/brig/src/Brig/Calling.hs +++ b/services/brig/src/Brig/Calling.hs @@ -163,21 +163,21 @@ discoverSRVRecords domain = lookupSRV domain >>= \case SrvAvailable es -> pure $ Just es SrvNotAvailable -> do - warn $ - Log.msg (Log.val "SRV Records not available") - . Log.field "domain" domain + warn + $ Log.msg (Log.val "SRV Records not available") + . Log.field "domain" domain pure Nothing -- It is not an error if the record doesn't exist SrvResponseError DNS.NameError -> do - warn $ - Log.msg (Log.val "SRV Records not available") - . Log.field "domain" domain + warn + $ Log.msg (Log.val "SRV Records not available") + . Log.field "domain" domain pure Nothing SrvResponseError e -> do - err $ - Log.msg (Log.val "SRV Lookup failed") - . Log.field "Error" (show e) - . Log.field "domain" domain + err + $ Log.msg (Log.val "SRV Lookup failed") + . Log.field "Error" (show e) + . Log.field "domain" domain pure Nothing srvDiscoveryLoop :: (Members [DNSLookup, TinyLog, Delay] r) => DNS.Domain -> Int -> (NonEmpty SrvEntry -> Sem r ()) -> Sem r () @@ -198,8 +198,10 @@ mkSFTDomain SFTOptions {..} = DNS.normalize $ maybe defSftServiceName ("_" <>) s sftDiscoveryLoop :: (Members [DNSLookup, TinyLog, Delay, Embed IO] r) => SFTEnv -> Sem r () sftDiscoveryLoop SFTEnv {..} = - srvDiscoveryLoop sftDomain sftDiscoveryInterval $ - atomicWriteIORef sftServers . Discovered . SFTServers + srvDiscoveryLoop sftDomain sftDiscoveryInterval + $ atomicWriteIORef sftServers + . Discovered + . SFTServers mkSFTEnv :: Digest -> SFTOptions -> IO SFTEnv mkSFTEnv digest opts = @@ -304,8 +306,8 @@ startDNSBasedTurnDiscovery logger opts deprecatedUdpRef udpRef tcpRef tlsRef = d . runDelay . srvDiscoveryLoop domain interval . withNonZeroWeightRecords - udpLoop <- runLoopAsync udpDomain $ - \records -> do + udpLoop <- runLoopAsync udpDomain + $ \records -> do ipsAndPorts <- fetchIpsAndPorts records case ipsAndPorts of [] -> pure () @@ -314,12 +316,16 @@ startDNSBasedTurnDiscovery logger opts deprecatedUdpRef udpRef tcpRef tlsRef = d atomicWriteIORef udpRef . Discovered $ turnURIFromSRV SchemeTurn (Just TransportUDP) <$> records tcpLoop <- - runLoopAsync tcpDomain $ - atomicWriteIORef tcpRef . Discovered . fmap (turnURIFromSRV SchemeTurn (Just TransportTCP)) + runLoopAsync tcpDomain + $ atomicWriteIORef tcpRef + . Discovered + . fmap (turnURIFromSRV SchemeTurn (Just TransportTCP)) tlsLoop <- - runLoopAsync tlsDomain $ - atomicWriteIORef tlsRef . Discovered . fmap (turnURIFromSRV SchemeTurns (Just TransportTCP)) + runLoopAsync tlsDomain + $ atomicWriteIORef tlsRef + . Discovered + . fmap (turnURIFromSRV SchemeTurns (Just TransportTCP)) pure [udpLoop, tcpLoop, tlsLoop] where withNonZeroWeightRecords :: (Monad m) => (NonEmpty SrvEntry -> m ()) -> NonEmpty SrvEntry -> m () @@ -372,18 +378,19 @@ startFileBasedTurnDiscovery l w files v1ServersRef v2ServersRef = do atomicWriteIORef v2ServersRef . maybe NotDiscoveredYet Discovered =<< readTurnList v2FileCanonicalPath - Log.info l $ - Log.msg (Log.val "Waiting for TURN files") - . Log.field "v1File" v1FileCanonicalPath - . Log.field "v2File" v2FileCanonicalPath + Log.info l + $ Log.msg (Log.val "Waiting for TURN files") + . Log.field "v1File" v1FileCanonicalPath + . Log.field "v2File" v2FileCanonicalPath startWatching w v1FileCanonicalPath (replaceTurnServers l v1ServersRef) startWatching w v2FileCanonicalPath (replaceTurnServers l v2ServersRef) replaceTurnServers :: Log.Logger -> IORef (Discovery (NonEmpty TurnURI)) -> FS.Event -> IO () replaceTurnServers g ref e = do let logErr x = Log.err g (Log.msg $ Log.val "Error loading turn servers: " Log.+++ show x) - handleAny logErr $ - readTurnList (FS.eventPath e) >>= \case + handleAny logErr + $ readTurnList (FS.eventPath e) + >>= \case Just servers -> do atomicWriteIORef ref (Discovered servers) Log.info g (Log.msg $ Log.val "New turn servers loaded.") diff --git a/services/brig/src/Brig/Calling/API.hs b/services/brig/src/Brig/Calling/API.hs index 998b92ee874..4413368721b 100644 --- a/services/brig/src/Brig/Calling/API.hs +++ b/services/brig/src/Brig/Calling/API.hs @@ -149,7 +149,8 @@ newConfig :: newConfig env discoveredServers sftStaticUrl mSftEnv limit listAllServers version = do -- randomize list of servers (before limiting the list, to ensure not always the same servers are chosen if limit is set) randomizedUris <- - liftIO . randomize + liftIO + . randomize =<< Polysemy.note NoTurnServers (discoveryToMaybe discoveredServers) let limitedUris = case limit of Nothing -> randomizedUris @@ -162,11 +163,15 @@ newConfig env discoveredServers sftStaticUrl mSftEnv limit listAllServers versio let staticSft = pure . Public.sftServer <$> sftStaticUrl allSrvEntries <- - fmap join $ - for mSftEnv $ - (unSFTServers <$$>) . fmap discoveryToMaybe . readIORef . sftServers - srvEntries <- fmap join $ - for mSftEnv $ \actualSftEnv -> liftIO $ do + fmap join + $ for mSftEnv + $ (unSFTServers <$$>) + . fmap discoveryToMaybe + . readIORef + . sftServers + srvEntries <- fmap join + $ for mSftEnv + $ \actualSftEnv -> liftIO $ do let subsetLength = Calling.sftListLength actualSftEnv mapM (getRandomElements subsetLength) allSrvEntries @@ -203,10 +208,10 @@ newConfig env discoveredServers sftStaticUrl mSftEnv limit listAllServers versio genTurnUsername = (fmap (uncurry Public.turnUsername) .) . genUsername genSFTUsername :: Word32 -> MWC.GenIO -> IO Public.SFTUsername genSFTUsername = (fmap (uncurry Public.mkSFTUsername) .) . genUsername - computeCred :: ToByteString a => Digest -> ByteString -> a -> AsciiBase64 + computeCred :: (ToByteString a) => Digest -> ByteString -> a -> AsciiBase64 computeCred dig secret = encodeBase64 . hmacBS dig secret . toByteString' authenticate :: - Member (Embed IO) r => + (Member (Embed IO) r) => Public.SFTServer -> Sem r Public.AuthSFTServer authenticate = diff --git a/services/brig/src/Brig/CanonicalInterpreter.hs b/services/brig/src/Brig/CanonicalInterpreter.hs index e4d1da5f636..a7dbd00267f 100644 --- a/services/brig/src/Brig/CanonicalInterpreter.hs +++ b/services/brig/src/Brig/CanonicalInterpreter.hs @@ -161,7 +161,7 @@ runBrigToIO e (AppT ma) = do ) $ runReaderT ma e -rethrowWaiErrorIO :: Member (Final IO) r => InterpreterFor (Error Wai.Error) r +rethrowWaiErrorIO :: (Member (Final IO) r) => InterpreterFor (Error Wai.Error) r rethrowWaiErrorIO act = do eithError <- errorToIOFinal act case eithError of diff --git a/services/brig/src/Brig/Code.hs b/services/brig/src/Brig/Code.hs index 2ea506aa5e7..7e4aefff3c6 100644 --- a/services/brig/src/Brig/Code.hs +++ b/services/brig/src/Brig/Code.hs @@ -170,7 +170,7 @@ data Gen = Gen genValue :: IO Value } -mkKey :: MonadIO m => CodeFor -> m Key +mkKey :: (MonadIO m) => CodeFor -> m Key mkKey cfor = liftIO $ do Just sha256 <- getDigestByName "SHA256" let uniqueK = case cfor of @@ -179,7 +179,7 @@ mkKey cfor = liftIO $ do pure $ mkKey' sha256 (Text.encodeUtf8 uniqueK) -- | Initialise a 'Code' 'Gen'erator for a given natural key. This generates a link for emails and a 6-digit code for phone. See also: `mk6DigitGen`. -mkGen :: MonadIO m => CodeFor -> m Gen +mkGen :: (MonadIO m) => CodeFor -> m Gen mkGen cfor = liftIO $ do Just sha256 <- getDigestByName "SHA256" pure (initGen sha256 cfor) @@ -188,7 +188,7 @@ mkGen cfor = liftIO $ do initGen d _ = mk6DigitGen' cfor d -- | Initialise a 'Code' 'Gen'erator for a given natural key. This generates a 6-digit code, matter whether it is sent to a phone or to an email address. See also: `mkGen`. -mk6DigitGen :: MonadIO m => CodeFor -> m Gen +mk6DigitGen :: (MonadIO m) => CodeFor -> m Gen mk6DigitGen cfor = liftIO $ do Just sha256 <- getDigestByName "SHA256" pure $ mk6DigitGen' cfor sha256 @@ -213,7 +213,7 @@ mkKey' d = Key . unsafeRange . Ascii.encodeBase64Url . BS.take 15 . digestBS d -- | Generate a new 'Code'. generate :: - MonadIO m => + (MonadIO m) => -- | The 'Gen'erator to use. Gen -> -- | The scope of the generated code. @@ -272,7 +272,7 @@ generate gen scope retries ttl account = do -------------------------------------------------------------------------------- -- Storage -insert :: MonadClient m => Code -> Int -> m (Maybe RetryAfter) +insert :: (MonadClient m) => Code -> Int -> m (Maybe RetryAfter) insert code ttl = do mRetryAfter <- lookupThrottle (codeKey code) (codeScope code) case mRetryAfter of @@ -282,7 +282,7 @@ insert code ttl = do insertInternal code pure Nothing where - insertThrottle :: MonadClient m => Code -> Int -> m () + insertThrottle :: (MonadClient m) => Code -> Int -> m () insertThrottle c t = do let k = codeKey c let s = codeScope c @@ -293,7 +293,7 @@ insert code ttl = do "INSERT INTO vcodes_throttle (key, scope, initial_delay) \ \VALUES (?, ?, ?) USING TTL ?" -insertInternal :: MonadClient m => Code -> m () +insertInternal :: (MonadClient m) => Code -> m () insertInternal c = do let k = codeKey c let s = codeScope c @@ -311,7 +311,7 @@ insertInternal c = do \VALUES (?, ?, ?, ?, ?, ?, ?) USING TTL ?" -- | Check if code generation should be throttled. -lookupThrottle :: MonadClient m => Key -> Scope -> m (Maybe RetryAfter) +lookupThrottle :: (MonadClient m) => Key -> Scope -> m (Maybe RetryAfter) lookupThrottle k s = do fmap (RetryAfter . fromIntegral . runIdentity) <$> retry x1 (query1 cql (params LocalQuorum (k, s))) where @@ -321,7 +321,7 @@ lookupThrottle k s = do \FROM vcodes_throttle WHERE key = ? AND scope = ?" -- | Lookup a pending code. -lookup :: MonadClient m => Key -> Scope -> m (Maybe Code) +lookup :: (MonadClient m) => Key -> Scope -> m (Maybe Code) lookup k s = fmap (toCode k s) <$> retry x1 (query1 cql (params LocalQuorum (k, s))) where cql :: PrepQuery R (Key, Scope) (Value, Int32, Retries, Maybe Email, Maybe Phone, Maybe UUID) @@ -331,7 +331,7 @@ lookup k s = fmap (toCode k s) <$> retry x1 (query1 cql (params LocalQuorum (k, -- | Lookup and verify the code for the given key and scope -- against the given value. -verify :: MonadClient m => Key -> Scope -> Value -> m (Maybe Code) +verify :: (MonadClient m) => Key -> Scope -> Value -> m (Maybe Code) verify k s v = lookup k s >>= maybe (pure Nothing) continue where continue c @@ -342,7 +342,7 @@ verify k s v = lookup k s >>= maybe (pure Nothing) continue | otherwise = pure Nothing -- | Delete a code associated with the given key and scope. -delete :: MonadClient m => Key -> Scope -> m () +delete :: (MonadClient m) => Key -> Scope -> m () delete k s = retry x5 $ write cql (params LocalQuorum (k, s)) where cql :: PrepQuery W (Key, Scope) () diff --git a/services/brig/src/Brig/Data/Activation.hs b/services/brig/src/Brig/Data/Activation.hs index 2afb23725fd..6a5220724c9 100644 --- a/services/brig/src/Brig/Data/Activation.hs +++ b/services/brig/src/Brig/Data/Activation.hs @@ -97,8 +97,8 @@ activateKey k c u = verifyCode k c >>= pickUser >>= activate pickUser (uk, u') = maybe (throwE invalidUser) (pure . (uk,)) (u <|> u') activate (key, uid) = do a <- lift (lookupAccount uid) >>= maybe (throwE invalidUser) pure - unless (accountStatus a == Active) $ -- this is never 'PendingActivation' in the flow this function is used in. - throwE invalidCode + unless (accountStatus a == Active) + $ throwE invalidCode -- this is never 'PendingActivation' in the flow this function is used in. case userIdentity (accountUser a) of Nothing -> do claim key uid @@ -135,13 +135,15 @@ activateKey k c u = verifyCode k c >>= pickUser >>= activate updateEmail u' email <* deleteEmailUnvalidated u' claim key uid = do ok <- lift $ claimKey key uid - unless ok $ - throwE . UserKeyExists . LT.fromStrict $ - foldKey fromEmail fromPhone key + unless ok + $ throwE + . UserKeyExists + . LT.fromStrict + $ foldKey fromEmail fromPhone key -- | Create a new pending activation for a given 'UserKey'. newActivation :: - MonadClient m => + (MonadClient m) => UserKey -> -- | The timeout for the activation code. Timeout -> @@ -150,8 +152,8 @@ newActivation :: m Activation newActivation uk timeout u = do (typ, key, code) <- - liftIO $ - foldKey + liftIO + $ foldKey (\e -> ("email",fromEmail e,) <$> genCode) (\p -> ("phone",fromPhone p,) <$> genCode) uk @@ -162,18 +164,24 @@ newActivation uk timeout u = do retry x5 . write keyInsert $ params LocalQuorum (key, t, k, c, u, maxAttempts, round timeout) pure $ Activation key c genCode = - ActivationCode . Ascii.unsafeFromText . pack . printf "%06d" + ActivationCode + . Ascii.unsafeFromText + . pack + . printf "%06d" <$> randIntegerZeroToNMinusOne 1000000 -- | Lookup an activation code and it's associated owner (if any) for a 'UserKey'. -lookupActivationCode :: MonadClient m => UserKey -> m (Maybe (Maybe UserId, ActivationCode)) +lookupActivationCode :: (MonadClient m) => UserKey -> m (Maybe (Maybe UserId, ActivationCode)) lookupActivationCode k = liftIO (mkActivationKey k) - >>= retry x1 . query1 codeSelect . params LocalQuorum . Identity + >>= retry x1 + . query1 codeSelect + . params LocalQuorum + . Identity -- | Verify an activation code. verifyCode :: - MonadClient m => + (MonadClient m) => ActivationKey -> ActivationCode -> ExceptT ActivationError m (UserKey, Maybe UserId) @@ -182,9 +190,9 @@ verifyCode key code = do case s of Just (ttl, Ascii t, k, c, u, r) -> if - | c == code -> mkScope t k u - | r >= 1 -> countdown (key, t, k, c, u, r - 1, ttl) >> throwE invalidCode - | otherwise -> revoke >> throwE invalidCode + | c == code -> mkScope t k u + | r >= 1 -> countdown (key, t, k, c, u, r - 1, ttl) >> throwE invalidCode + | otherwise -> revoke >> throwE invalidCode Nothing -> throwE invalidCode where mkScope "email" k u = case parseEmail k of @@ -204,7 +212,7 @@ mkActivationKey k = do let bs = digestBS d' (T.encodeUtf8 $ keyText k) pure . ActivationKey $ Ascii.encodeBase64Url bs -deleteActivationPair :: MonadClient m => ActivationKey -> m () +deleteActivationPair :: (MonadClient m) => ActivationKey -> m () deleteActivationPair = write keyDelete . params LocalQuorum . Identity invalidUser :: ActivationError diff --git a/services/brig/src/Brig/Data/Client.hs b/services/brig/src/Brig/Data/Client.hs index b214ef7ab06..3bfd2f77656 100644 --- a/services/brig/src/Brig/Data/Client.hs +++ b/services/brig/src/Brig/Data/Client.hs @@ -140,12 +140,12 @@ addClientWithReAuthPolicy reAuthPolicy u newId c maxPermClients cps = do let typed = filter ((== newClientType c) . clientType) clients let count = length typed let upsert = any exists typed - when (reAuthPolicy count upsert) $ - fmapLT ClientReAuthError $ - User.reauthenticate u (newClientPassword c) + when (reAuthPolicy count upsert) + $ fmapLT ClientReAuthError + $ User.reauthenticate u (newClientPassword c) let capacity = fmap (+ (-count)) limit - unless (maybe True (> 0) capacity || upsert) $ - throwE TooManyClients + unless (maybe True (> 0) capacity || upsert) + $ throwE TooManyClients new <- insert let !total = fromIntegral (length clients + if upsert then 0 else 1) let old = maybe (filter (not . exists) typed) (const []) limit @@ -170,8 +170,8 @@ addClientWithReAuthPolicy reAuthPolicy u newId c maxPermClients cps = do prm = (u, newId, now, newClientType c, newClientLabel c, newClientClass c, newClientCookie c, mdl, C.Set . Set.toList <$> cps) retry x5 $ write insertClient (params LocalQuorum prm) addMLSPublicKeys u newId (Map.assocs (newClientMLSPublicKeys c)) - pure $! - Client + pure + $! Client { clientId = newId, clientType = newClientType c, clientTime = now, @@ -184,7 +184,7 @@ addClientWithReAuthPolicy reAuthPolicy u newId c maxPermClients cps = do clientLastActive = Nothing } -lookupClient :: MonadClient m => UserId -> ClientId -> m (Maybe Client) +lookupClient :: (MonadClient m) => UserId -> ClientId -> m (Maybe Client) lookupClient u c = do keys <- retry x1 (query selectMLSPublicKeys (params LocalQuorum (u, c))) fmap (toClient keys) @@ -195,7 +195,7 @@ lookupClientsBulk uids = liftClient $ do userClientTuples <- pooledMapConcurrentlyN 50 getClientSetWithUser uids pure $ Map.fromList userClientTuples where - getClientSetWithUser :: MonadClient m => UserId -> m (UserId, Imports.Set Client) + getClientSetWithUser :: (MonadClient m) => UserId -> m (UserId, Imports.Set Client) getClientSetWithUser u = fmap ((u,) . Set.fromList) . lookupClients $ u lookupPubClientsBulk :: (MonadClient m) => [UserId] -> m (UserMap (Imports.Set PubClient)) @@ -203,13 +203,13 @@ lookupPubClientsBulk uids = liftClient $ do userClientTuples <- pooledMapConcurrentlyN 50 getClientSetWithUser uids pure $ UserMap $ Map.fromList userClientTuples where - getClientSetWithUser :: MonadClient m => UserId -> m (UserId, Imports.Set PubClient) + getClientSetWithUser :: (MonadClient m) => UserId -> m (UserId, Imports.Set PubClient) getClientSetWithUser u = (u,) . Set.fromList . map toPubClient <$> executeQuery u - executeQuery :: MonadClient m => UserId -> m [(ClientId, Maybe ClientClass)] + executeQuery :: (MonadClient m) => UserId -> m [(ClientId, Maybe ClientClass)] executeQuery u = retry x1 (query selectPubClients (params LocalQuorum (Identity u))) -lookupClients :: MonadClient m => UserId -> m [Client] +lookupClients :: (MonadClient m) => UserId -> m [Client] lookupClients u = do keys <- (\(cid, ss, Blob b) -> (cid, [(ss, LBS.toStrict b)])) @@ -220,26 +220,27 @@ lookupClients u = do { clientMLSPublicKeys = Map.fromList $ Map.findWithDefault [] (clientId c) keyMap } - updateKeys . toClient [] + updateKeys + . toClient [] <$$> retry x1 (query selectClients (params LocalQuorum (Identity u))) -lookupClientIds :: MonadClient m => UserId -> m [ClientId] +lookupClientIds :: (MonadClient m) => UserId -> m [ClientId] lookupClientIds u = map runIdentity <$> retry x1 (query selectClientIds (params LocalQuorum (Identity u))) -lookupUsersClientIds :: MonadClient m => [UserId] -> m [(UserId, Set.Set ClientId)] +lookupUsersClientIds :: (MonadClient m) => [UserId] -> m [(UserId, Set.Set ClientId)] lookupUsersClientIds us = liftClient $ pooledMapConcurrentlyN 16 getClientIds us where getClientIds u = (u,) <$> fmap Set.fromList (lookupClientIds u) -lookupPrekeyIds :: MonadClient m => UserId -> ClientId -> m [PrekeyId] +lookupPrekeyIds :: (MonadClient m) => UserId -> ClientId -> m [PrekeyId] lookupPrekeyIds u c = map runIdentity <$> retry x1 (query selectPrekeyIds (params LocalQuorum (u, c))) -hasClient :: MonadClient m => UserId -> ClientId -> m Bool +hasClient :: (MonadClient m) => UserId -> ClientId -> m Bool hasClient u d = isJust <$> retry x1 (query1 checkClient (params LocalQuorum (u, d))) rmClient :: @@ -255,26 +256,27 @@ rmClient u c = do retry x5 $ write removeClientKeys (params LocalQuorum (u, c)) unlessM (isJust <$> view randomPrekeyLocalLock) $ deleteOptLock u c -updateClientLabel :: MonadClient m => UserId -> ClientId -> Maybe Text -> m () +updateClientLabel :: (MonadClient m) => UserId -> ClientId -> Maybe Text -> m () updateClientLabel u c l = retry x5 $ write updateClientLabelQuery (params LocalQuorum (l, u, c)) -updateClientCapabilities :: MonadClient m => UserId -> ClientId -> Maybe (Imports.Set ClientCapability) -> m () +updateClientCapabilities :: (MonadClient m) => UserId -> ClientId -> Maybe (Imports.Set ClientCapability) -> m () updateClientCapabilities u c fs = retry x5 $ write updateClientCapabilitiesQuery (params LocalQuorum (C.Set . Set.toList <$> fs, u, c)) -- | If the update fails, which can happen if device does not exist, then ignore the error silently. -updateClientLastActive :: MonadClient m => UserId -> ClientId -> UTCTime -> m () +updateClientLastActive :: (MonadClient m) => UserId -> ClientId -> UTCTime -> m () updateClientLastActive u c t = - void . retry x5 $ - trans + void + . retry x5 + $ trans updateClientLastActiveQuery (params LocalQuorum (t, u, c)) -updatePrekeys :: MonadClient m => UserId -> ClientId -> [Prekey] -> ExceptT ClientDataError m () +updatePrekeys :: (MonadClient m) => UserId -> ClientId -> [Prekey] -> ExceptT ClientDataError m () updatePrekeys u c pks = do plain <- mapM (hoistEither . fmapL (const MalformedPrekeys) . B64.decode . toByteString' . prekeyKey) pks binary <- liftIO $ zipWithM check pks plain - unless (and binary) $ - throwE MalformedPrekeys + unless (and binary) + $ throwE MalformedPrekeys for_ pks $ \k -> do let args = (u, c, prekeyId k, prekeyKey k) retry x5 $ write insertClientKey (params LocalQuorum args) @@ -312,14 +314,14 @@ claimPrekey u c = if i /= lastPrekeyId then retry x1 $ write removePrekey (params LocalQuorum (u, c, i)) else - Log.debug $ - field "user" (toByteString u) - . field "client" (toByteString c) - . msg (val "last resort prekey used") + Log.debug + $ field "user" (toByteString u) + . field "client" (toByteString c) + . msg (val "last resort prekey used") pure $ Just (ClientPrekey c (Prekey i k)) removeAndReturnPreKey Nothing = pure Nothing - pickRandomPrekey :: MonadIO f => [(PrekeyId, Text)] -> f (Maybe (PrekeyId, Text)) + pickRandomPrekey :: (MonadIO f) => [(PrekeyId, Text)] -> f (Maybe (PrekeyId, Text)) pickRandomPrekey [] = pure Nothing -- unless we only have one key left pickRandomPrekey [pk] = pure $ Just pk @@ -330,7 +332,7 @@ claimPrekey u c = pure $ atMay pks' ind lookupMLSPublicKey :: - MonadClient m => + (MonadClient m) => UserId -> ClientId -> SignatureSchemeTag -> @@ -339,7 +341,7 @@ lookupMLSPublicKey u c ss = (fromBlob . runIdentity) <$$> retry x1 (query1 selectMLSPublicKey (params LocalQuorum (u, c, ss))) addMLSPublicKeys :: - MonadClient m => + (MonadClient m) => UserId -> ClientId -> [(SignatureSchemeTag, ByteString)] -> @@ -347,7 +349,7 @@ addMLSPublicKeys :: addMLSPublicKeys u c = traverse_ (uncurry (addMLSPublicKey u c)) addMLSPublicKey :: - MonadClient m => + (MonadClient m) => UserId -> ClientId -> SignatureSchemeTag -> @@ -536,24 +538,24 @@ withOptLock u c ma = go (10 :: Int) check :: Maybe Word32 -> HashMap Text AWS.ExpectedAttributeValue check Nothing = HashMap.singleton ddbVersion $ AWS.newExpectedAttributeValue & AWS.expectedAttributeValue_comparisonOperator ?~ AWS.ComparisonOperator_NULL check (Just v) = - HashMap.singleton ddbVersion $ - AWS.newExpectedAttributeValue - & AWS.expectedAttributeValue_comparisonOperator ?~ AWS.ComparisonOperator_EQ - & AWS.expectedAttributeValue_attributeValueList ?~ [toAttributeValue v] + HashMap.singleton ddbVersion + $ AWS.newExpectedAttributeValue + & AWS.expectedAttributeValue_comparisonOperator ?~ AWS.ComparisonOperator_EQ + & AWS.expectedAttributeValue_attributeValueList ?~ [toAttributeValue v] item :: Maybe Word32 -> HashMap Text AWS.AttributeValue item v = - HashMap.insert ddbVersion (toAttributeValue (maybe (1 :: Word32) (+ 1) v)) $ - key u c + HashMap.insert ddbVersion (toAttributeValue (maybe (1 :: Word32) (+ 1) v)) + $ key u c toAttributeValue :: Word32 -> AWS.AttributeValue toAttributeValue w = AWS.N $ AWS.toText (fromIntegral w :: Int) reportAttemptFailure :: m () reportAttemptFailure = Prom.incCounter optimisticLockGrabAttemptFailedCounter reportFailureAndLogError :: m () reportFailureAndLogError = do - Log.err $ - Log.field "user" (toByteString' u) - . Log.field "client" (toByteString' c) - . msg (val "PreKeys: Optimistic lock failed") + Log.err + $ Log.field "user" (toByteString' u) + . Log.field "client" (toByteString' c) + . msg (val "PreKeys: Optimistic lock failed") Prom.incCounter optimisticLockFailedCounter execDyn :: forall r x. @@ -590,8 +592,8 @@ withLocalLock l ma = do {-# NOINLINE optimisticLockGrabAttemptFailedCounter #-} optimisticLockGrabAttemptFailedCounter :: Prom.Counter optimisticLockGrabAttemptFailedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "client.opt_lock.optimistic_lock_grab_attempt_failed", Prom.metricHelp = "Number of times grab attempts for optimisitic lock on prekeys failed" @@ -600,8 +602,8 @@ optimisticLockGrabAttemptFailedCounter = {-# NOINLINE optimisticLockFailedCounter #-} optimisticLockFailedCounter :: Prom.Counter optimisticLockFailedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "client.opt_lock.optimistic_lock_failed", Prom.metricHelp = "Number of time optimisitic lock on prekeys failed" @@ -610,8 +612,8 @@ optimisticLockFailedCounter = {-# NOINLINE dynProvisionedThroughputExceededCounter #-} dynProvisionedThroughputExceededCounter :: Prom.Counter dynProvisionedThroughputExceededCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "client.opt_lock.provisioned_throughput_exceeded", Prom.metricHelp = "Number of times provisioned throughput on DynamoDB was exceeded" diff --git a/services/brig/src/Brig/Data/Connection.hs b/services/brig/src/Brig/Data/Connection.hs index ec46f3fe406..f98e8763fb8 100644 --- a/services/brig/src/Brig/Data/Connection.hs +++ b/services/brig/src/Brig/Data/Connection.hs @@ -79,14 +79,14 @@ insertConnection :: insertConnection self target rel qcnv@(Qualified cnv cdomain) = do now <- toUTCTimeMillis <$> liftIO getCurrentTime let local (tUnqualified -> ltarget) = - write connectionInsert $ - params LocalQuorum (tUnqualified self, ltarget, rel, now, cnv) + write connectionInsert + $ params LocalQuorum (tUnqualified self, ltarget, rel, now, cnv) let remote (tUntagged -> Qualified rtarget domain) = - write remoteConnectionInsert $ - params LocalQuorum (tUnqualified self, domain, rtarget, rel, now, cdomain, cnv) + write remoteConnectionInsert + $ params LocalQuorum (tUnqualified self, domain, rtarget, rel, now, cdomain, cnv) retry x5 $ foldQualified self local remote target - pure $ - UserConnection + pure + $ UserConnection { ucFrom = tUnqualified self, ucTo = target, ucStatus = relationDropHistory rel, @@ -98,8 +98,8 @@ updateConnection :: (MonadClient m, MonadReader Env m) => UserConnection -> Rela updateConnection c status = do self <- qualifyLocal (ucFrom c) now <- updateConnectionStatus self (ucTo c) status - pure $ - c + pure + $ c { ucStatus = relationDropHistory status, ucLastUpdate = now } @@ -108,11 +108,11 @@ updateConnectionStatus :: (MonadClient m) => Local UserId -> Qualified UserId -> updateConnectionStatus self target status = do now <- toUTCTimeMillis <$> liftIO getCurrentTime let local (tUnqualified -> ltarget) = - write connectionUpdate $ - params LocalQuorum (status, now, tUnqualified self, ltarget) + write connectionUpdate + $ params LocalQuorum (status, now, tUnqualified self, ltarget) let remote (tUntagged -> Qualified rtarget domain) = - write remoteConnectionUpdate $ - params LocalQuorum (status, now, tUnqualified self, domain, rtarget) + write remoteConnectionUpdate + $ params LocalQuorum (status, now, tUnqualified self, domain, rtarget) retry x5 $ foldQualified self local remote target pure now @@ -121,17 +121,19 @@ lookupConnection :: (MonadClient m) => Local UserId -> Qualified UserId -> m (Ma lookupConnection self target = runMaybeT $ do let local (tUnqualified -> ltarget) = do (_, _, rel, time, mcnv) <- - MaybeT . query1 connectionSelect $ - params LocalQuorum (tUnqualified self, ltarget) + MaybeT + . query1 connectionSelect + $ params LocalQuorum (tUnqualified self, ltarget) pure (rel, time, fmap (tUntagged . qualifyAs self) mcnv) let remote (tUntagged -> Qualified rtarget domain) = do (rel, time, cdomain, cnv) <- - MaybeT . query1 remoteConnectionSelectFrom $ - params LocalQuorum (tUnqualified self, domain, rtarget) + MaybeT + . query1 remoteConnectionSelectFrom + $ params LocalQuorum (tUnqualified self, domain, rtarget) pure (rel, time, Just (Qualified cnv cdomain)) (rel, time, mqcnv) <- hoist (retry x1) $ foldQualified self local remote target - pure $ - UserConnection + pure + $ UserConnection { ucFrom = tUnqualified self, ucTo = target, ucStatus = relationDropHistory rel, @@ -170,11 +172,11 @@ lookupLocalConnections :: lookupLocalConnections lfrom start (fromRange -> size) = toResult <$> case start of Just u -> - retry x1 $ - paginate connectionsSelectFrom (paramsP LocalQuorum (tUnqualified lfrom, u) (size + 1)) + retry x1 + $ paginate connectionsSelectFrom (paramsP LocalQuorum (tUnqualified lfrom, u) (size + 1)) Nothing -> - retry x1 $ - paginate connectionsSelect (paramsP LocalQuorum (Identity (tUnqualified lfrom)) (size + 1)) + retry x1 + $ paginate connectionsSelect (paramsP LocalQuorum (Identity (tUnqualified lfrom)) (size + 1)) where toResult = cassandraResultPage . fmap (toLocalUserConnection lfrom) . trim trim p = p {result = take (fromIntegral size) (result p)} @@ -272,7 +274,7 @@ lookupRemoteConnectedUsersC u maxResults = paginateC remoteConnectionSelect (paramsP LocalQuorum (Identity (tUnqualified u)) maxResults) x1 .| C.map (\xs -> map (\x@(d, _, _, _, _, _) -> toRemoteUnsafe d (toRemoteUserConnection u x)) xs) -lookupRemoteConnectedUsersPaginated :: MonadClient m => Local UserId -> Int32 -> m (Page (Remote UserConnection)) +lookupRemoteConnectedUsersPaginated :: (MonadClient m) => Local UserId -> Int32 -> m (Page (Remote UserConnection)) lookupRemoteConnectedUsersPaginated u maxResults = do (\x@(d, _, _, _, _, _) -> toRemoteUnsafe d (toRemoteUserConnection u x)) <$$> retry x1 (paginate remoteConnectionSelect (paramsP LocalQuorum (Identity (tUnqualified u)) maxResults)) @@ -308,10 +310,10 @@ countConnections u r = do deleteConnections :: (MonadClient m, MonadUnliftIO m) => UserId -> m () deleteConnections u = do - runConduit $ - paginateC contactsSelect (paramsP LocalQuorum (Identity u) 100) x1 - .| C.mapM_ - (pooledMapConcurrentlyN_ 16 delete) + runConduit + $ paginateC contactsSelect (paramsP LocalQuorum (Identity u) 100) x1 + .| C.mapM_ + (pooledMapConcurrentlyN_ 16 delete) do retry x1 . write connectionClear $ params LocalQuorum (Identity u) retry x1 . write remoteConnectionClear $ params LocalQuorum (Identity u) @@ -332,10 +334,10 @@ deleteRemoteConnections (tUntagged -> Qualified remoteUser remoteDomain) (fromRa deleteRemoteConnectionsDomain :: (MonadClient m, MonadUnliftIO m) => Domain -> m () deleteRemoteConnectionsDomain dom = do -- Select all triples for the given domain, and then delete them - runConduit $ - paginateC remoteConnectionSelectFromDomain (paramsP LocalQuorum (pure dom) 100) x1 - .| C.mapM_ - (pooledMapConcurrentlyN_ 16 $ write remoteConnectionDelete . params LocalQuorum) + runConduit + $ paginateC remoteConnectionSelectFromDomain (paramsP LocalQuorum (pure dom) 100) x1 + .| C.mapM_ + (pooledMapConcurrentlyN_ 16 $ write remoteConnectionDelete . params LocalQuorum) -- Queries diff --git a/services/brig/src/Brig/Data/LoginCode.hs b/services/brig/src/Brig/Data/LoginCode.hs index 1f58dba7cc7..2bb0a86febf 100644 --- a/services/brig/src/Brig/Data/LoginCode.hs +++ b/services/brig/src/Brig/Data/LoginCode.hs @@ -76,10 +76,10 @@ lookupLoginCode u = do pending c now t = PendingLoginCode c (timeout now t) timeout now t = Timeout (t `diffUTCTime` now) -deleteLoginCode :: MonadClient m => UserId -> m () +deleteLoginCode :: (MonadClient m) => UserId -> m () deleteLoginCode u = retry x5 . write codeDelete $ params LocalQuorum (Identity u) -insertLoginCode :: MonadClient m => UserId -> LoginCode -> Int32 -> UTCTime -> m () +insertLoginCode :: (MonadClient m) => UserId -> LoginCode -> Int32 -> UTCTime -> m () insertLoginCode u c n t = retry x5 . write codeInsert $ params LocalQuorum (u, c, n, t, round ttl) -- Queries diff --git a/services/brig/src/Brig/Data/MLS/KeyPackage.hs b/services/brig/src/Brig/Data/MLS/KeyPackage.hs index 7aaccc4d16c..c9c09acfc8f 100644 --- a/services/brig/src/Brig/Data/MLS/KeyPackage.hs +++ b/services/brig/src/Brig/Data/MLS/KeyPackage.hs @@ -45,7 +45,7 @@ import Wire.API.MLS.LeafNode import Wire.API.MLS.Serialisation insertKeyPackages :: - MonadClient m => + (MonadClient m) => UserId -> ClientId -> [(KeyPackageRef, CipherSuiteTag, KeyPackageData)] -> @@ -134,10 +134,10 @@ countKeyPackages :: m Int64 countKeyPackages u c suite = fromIntegral . length <$> getNonClaimedKeyPackages u c suite -deleteKeyPackages :: MonadClient m => UserId -> ClientId -> CipherSuiteTag -> [KeyPackageRef] -> m () +deleteKeyPackages :: (MonadClient m) => UserId -> ClientId -> CipherSuiteTag -> [KeyPackageRef] -> m () deleteKeyPackages u c suite refs = - retry x5 $ - write + retry x5 + $ write deleteQuery (params LocalQuorum (u, c, suite, refs)) where @@ -152,8 +152,8 @@ deleteAllKeyPackages :: m () deleteAllKeyPackages u c suites = pooledForConcurrentlyN_ 16 suites $ \suite -> - retry x5 $ - write + retry x5 + $ write deleteQuery (params LocalQuorum (u, c, suite)) where diff --git a/services/brig/src/Brig/Data/Nonce.hs b/services/brig/src/Brig/Data/Nonce.hs index 8ca18fd1a53..00fda3fbcd5 100644 --- a/services/brig/src/Brig/Data/Nonce.hs +++ b/services/brig/src/Brig/Data/Nonce.hs @@ -28,7 +28,7 @@ import Data.Nonce (Nonce, NonceTtlSecs) import Imports insertNonce :: - MonadClient m => + (MonadClient m) => NonceTtlSecs -> UserId -> Text -> @@ -40,14 +40,14 @@ insertNonce ttl uid key nonce = retry x5 . write insert $ params LocalQuorum (ui insert = "INSERT INTO nonce (user, key, nonce) VALUES (?, ?, ?) USING TTL ?" lookupAndDeleteNonce :: - MonadClient m => + (MonadClient m) => UserId -> Text -> m (Maybe Nonce) lookupAndDeleteNonce uid key = lookupNonce uid key <* deleteNonce uid key lookupNonce :: - MonadClient m => + (MonadClient m) => UserId -> Text -> m (Maybe Nonce) @@ -57,7 +57,7 @@ lookupNonce uid key = (runIdentity <$$>) . retry x5 . query1 get $ params LocalQ get = "SELECT nonce FROM nonce WHERE user = ? AND key = ?" deleteNonce :: - MonadClient m => + (MonadClient m) => UserId -> Text -> m () diff --git a/services/brig/src/Brig/Data/Properties.hs b/services/brig/src/Brig/Data/Properties.hs index b073394584f..daad2063a38 100644 --- a/services/brig/src/Brig/Data/Properties.hs +++ b/services/brig/src/Brig/Data/Properties.hs @@ -39,34 +39,34 @@ data PropertiesDataError = TooManyProperties insertProperty :: - MonadClient m => + (MonadClient m) => UserId -> PropertyKey -> RawPropertyValue -> ExceptT PropertiesDataError m () insertProperty u k v = do n <- lift . fmap (maybe 0 runIdentity) . retry x1 $ query1 propertyCount (params LocalQuorum (Identity u)) - unless (n < maxProperties) $ - throwE TooManyProperties + unless (n < maxProperties) + $ throwE TooManyProperties lift . retry x5 $ write propertyInsert (params LocalQuorum (u, k, v)) -deleteProperty :: MonadClient m => UserId -> PropertyKey -> m () +deleteProperty :: (MonadClient m) => UserId -> PropertyKey -> m () deleteProperty u k = retry x5 $ write propertyDelete (params LocalQuorum (u, k)) -clearProperties :: MonadClient m => UserId -> m () +clearProperties :: (MonadClient m) => UserId -> m () clearProperties u = retry x5 $ write propertyReset (params LocalQuorum (Identity u)) -lookupProperty :: MonadClient m => UserId -> PropertyKey -> m (Maybe RawPropertyValue) +lookupProperty :: (MonadClient m) => UserId -> PropertyKey -> m (Maybe RawPropertyValue) lookupProperty u k = fmap runIdentity <$> retry x1 (query1 propertySelect (params LocalQuorum (u, k))) -lookupPropertyKeys :: MonadClient m => UserId -> m [PropertyKey] +lookupPropertyKeys :: (MonadClient m) => UserId -> m [PropertyKey] lookupPropertyKeys u = map runIdentity <$> retry x1 (query propertyKeysSelect (params LocalQuorum (Identity u))) -lookupPropertyKeysAndValues :: MonadClient m => UserId -> m [(PropertyKey, RawPropertyValue)] +lookupPropertyKeysAndValues :: (MonadClient m) => UserId -> m [(PropertyKey, RawPropertyValue)] lookupPropertyKeysAndValues u = retry x1 (query propertyKeysValuesSelect (params LocalQuorum (Identity u))) diff --git a/services/brig/src/Brig/Data/User.hs b/services/brig/src/Brig/Data/User.hs index f4b495e1c99..59d3e0b67ee 100644 --- a/services/brig/src/Brig/Data/User.hs +++ b/services/brig/src/Brig/Data/User.hs @@ -155,7 +155,7 @@ newAccount u inv tid mbHandle = do prots = fromMaybe defSupportedProtocols (newUserSupportedProtocols u) user uid domain l e = User (Qualified uid domain) ident name pict assets colour False l Nothing mbHandle e tid managedBy prots -newAccountInviteViaScim :: MonadReader Env m => UserId -> TeamId -> Maybe Locale -> Name -> Email -> m UserAccount +newAccountInviteViaScim :: (MonadReader Env m) => UserId -> TeamId -> Maybe Locale -> Name -> Email -> m UserAccount newAccountInviteViaScim uid tid locale name email = do defLoc <- setDefaultUserLocale <$> view settings let loc = fromMaybe defLoc locale @@ -180,7 +180,7 @@ newAccountInviteViaScim uid tid locale name email = do defSupportedProtocols -- | Mandatory password authentication. -authenticate :: MonadClient m => UserId -> PlainTextPassword6 -> ExceptT AuthError m () +authenticate :: (MonadClient m) => UserId -> PlainTextPassword6 -> ExceptT AuthError m () authenticate u pw = lift (lookupAuth u) >>= \case Nothing -> throwE AuthInvalidUser @@ -215,8 +215,8 @@ reauthenticate u pw = maybeReAuth pw' = case pw of Nothing -> unlessM (isSamlUser u) $ throwE ReAuthMissingPassword Just p -> - unless (verifyPassword p pw') $ - throwE (ReAuthError AuthInvalidCredentials) + unless (verifyPassword p pw') + $ throwE (ReAuthError AuthInvalidCredentials) isSamlUser :: (MonadClient m, MonadReader Env m) => UserId -> m Bool isSamlUser uid = do @@ -226,7 +226,7 @@ isSamlUser uid = do _ -> pure False insertAccount :: - MonadClient m => + (MonadClient m) => UserAccount -> -- | If a bot: conversation and team -- (if a team conversation) @@ -278,16 +278,16 @@ insertAccount (UserAccount u status) mbConv password activated = retry x5 . batc "INSERT INTO service_team (provider, service, user, conv, team) \ \VALUES (?, ?, ?, ?, ?)" -updateEmail :: MonadClient m => UserId -> Email -> m () +updateEmail :: (MonadClient m) => UserId -> Email -> m () updateEmail u e = retry x5 $ write userEmailUpdate (params LocalQuorum (e, u)) -updateEmailUnvalidated :: MonadClient m => UserId -> Email -> m () +updateEmailUnvalidated :: (MonadClient m) => UserId -> Email -> m () updateEmailUnvalidated u e = retry x5 $ write userEmailUnvalidatedUpdate (params LocalQuorum (e, u)) -updatePhone :: MonadClient m => UserId -> Phone -> m () +updatePhone :: (MonadClient m) => UserId -> Phone -> m () updatePhone u p = retry x5 $ write userPhoneUpdate (params LocalQuorum (p, u)) -updateSSOId :: MonadClient m => UserId -> Maybe UserSSOId -> m Bool +updateSSOId :: (MonadClient m) => UserId -> Maybe UserSSOId -> m Bool updateSSOId u ssoid = do mteamid <- lookupUserTeam u case mteamid of @@ -296,18 +296,18 @@ updateSSOId u ssoid = do pure True Nothing -> pure False -updateManagedBy :: MonadClient m => UserId -> ManagedBy -> m () +updateManagedBy :: (MonadClient m) => UserId -> ManagedBy -> m () updateManagedBy u h = retry x5 $ write userManagedByUpdate (params LocalQuorum (h, u)) -updatePassword :: MonadClient m => UserId -> PlainTextPassword8 -> m () +updatePassword :: (MonadClient m) => UserId -> PlainTextPassword8 -> m () updatePassword u t = do p <- liftIO $ mkSafePassword t retry x5 $ write userPasswordUpdate (params LocalQuorum (p, u)) -updateRichInfo :: MonadClient m => UserId -> RichInfoAssocList -> m () +updateRichInfo :: (MonadClient m) => UserId -> RichInfoAssocList -> m () updateRichInfo u ri = retry x5 $ write userRichInfoUpdate (params LocalQuorum (ri, u)) -updateFeatureConferenceCalling :: MonadClient m => UserId -> Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig) -> m (Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig)) +updateFeatureConferenceCalling :: (MonadClient m) => UserId -> Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig) -> m (Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig)) updateFeatureConferenceCalling uid mbStatus = do let flag = ApiFt.wssStatus <$> mbStatus retry x5 $ write update (params LocalQuorum (flag, uid)) @@ -316,16 +316,16 @@ updateFeatureConferenceCalling uid mbStatus = do update :: PrepQuery W (Maybe ApiFt.FeatureStatus, UserId) () update = fromString "update user set feature_conference_calling = ? where id = ?" -deleteEmail :: MonadClient m => UserId -> m () +deleteEmail :: (MonadClient m) => UserId -> m () deleteEmail u = retry x5 $ write userEmailDelete (params LocalQuorum (Identity u)) -deleteEmailUnvalidated :: MonadClient m => UserId -> m () +deleteEmailUnvalidated :: (MonadClient m) => UserId -> m () deleteEmailUnvalidated u = retry x5 $ write userEmailUnvalidatedDelete (params LocalQuorum (Identity u)) -deletePhone :: MonadClient m => UserId -> m () +deletePhone :: (MonadClient m) => UserId -> m () deletePhone u = retry x5 $ write userPhoneDelete (params LocalQuorum (Identity u)) -deleteServiceUser :: MonadClient m => ProviderId -> ServiceId -> BotId -> m () +deleteServiceUser :: (MonadClient m) => ProviderId -> ServiceId -> BotId -> m () deleteServiceUser pid sid bid = do lookupServiceUser pid sid bid >>= \case Nothing -> pure () @@ -345,23 +345,24 @@ deleteServiceUser pid sid bid = do "DELETE FROM service_team \ \WHERE provider = ? AND service = ? AND team = ? AND user = ?" -updateStatus :: MonadClient m => UserId -> AccountStatus -> m () +updateStatus :: (MonadClient m) => UserId -> AccountStatus -> m () updateStatus u s = retry x5 $ write userStatusUpdate (params LocalQuorum (s, u)) -userExists :: MonadClient m => UserId -> m Bool +userExists :: (MonadClient m) => UserId -> m Bool userExists uid = isJust <$> retry x1 (query1 idSelect (params LocalQuorum (Identity uid))) -- | Whether the account has been activated by verifying -- an email address or phone number. -isActivated :: MonadClient m => UserId -> m Bool +isActivated :: (MonadClient m) => UserId -> m Bool isActivated u = (== Just (Identity True)) <$> retry x1 (query1 activatedSelect (params LocalQuorum (Identity u))) -filterActive :: MonadClient m => [UserId] -> m [UserId] +filterActive :: (MonadClient m) => [UserId] -> m [UserId] filterActive us = - map (view _1) . filter isActiveUser + map (view _1) + . filter isActiveUser <$> retry x1 (query accountStateSelectAll (params LocalQuorum (Identity us))) where isActiveUser :: (UserId, Bool, Maybe AccountStatus) -> Bool @@ -371,13 +372,13 @@ filterActive us = lookupUser :: (MonadClient m, MonadReader Env m) => HavePendingInvitations -> UserId -> m (Maybe User) lookupUser hpi u = listToMaybe <$> lookupUsers hpi [u] -activateUser :: MonadClient m => UserId -> UserIdentity -> m () +activateUser :: (MonadClient m) => UserId -> UserIdentity -> m () activateUser u ident = do let email = emailIdentity ident let phone = phoneIdentity ident retry x5 $ write userActivatedUpdate (params LocalQuorum (email, phone, u)) -deactivateUser :: MonadClient m => UserId -> m () +deactivateUser :: (MonadClient m) => UserId -> m () deactivateUser u = retry x5 $ write userDeactivatedUpdate (params LocalQuorum (Identity u)) @@ -386,28 +387,28 @@ lookupLocale u = do defLoc <- setDefaultUserLocale <$> view settings fmap (toLocale defLoc) <$> retry x1 (query1 localeSelect (params LocalQuorum (Identity u))) -lookupName :: MonadClient m => UserId -> m (Maybe Name) +lookupName :: (MonadClient m) => UserId -> m (Maybe Name) lookupName u = fmap runIdentity <$> retry x1 (query1 nameSelect (params LocalQuorum (Identity u))) -lookupPassword :: MonadClient m => UserId -> m (Maybe Password) +lookupPassword :: (MonadClient m) => UserId -> m (Maybe Password) lookupPassword u = (runIdentity =<<) <$> retry x1 (query1 passwordSelect (params LocalQuorum (Identity u))) -lookupStatus :: MonadClient m => UserId -> m (Maybe AccountStatus) +lookupStatus :: (MonadClient m) => UserId -> m (Maybe AccountStatus) lookupStatus u = (runIdentity =<<) <$> retry x1 (query1 statusSelect (params LocalQuorum (Identity u))) -lookupRichInfo :: MonadClient m => UserId -> m (Maybe RichInfoAssocList) +lookupRichInfo :: (MonadClient m) => UserId -> m (Maybe RichInfoAssocList) lookupRichInfo u = fmap runIdentity <$> retry x1 (query1 richInfoSelect (params LocalQuorum (Identity u))) -- | Returned rich infos are in the same order as users -lookupRichInfoMultiUsers :: MonadClient m => [UserId] -> m [(UserId, RichInfo)] +lookupRichInfoMultiUsers :: (MonadClient m) => [UserId] -> m [(UserId, RichInfo)] lookupRichInfoMultiUsers users = do mapMaybe (\(uid, mbRi) -> (uid,) . RichInfo <$> mbRi) <$> retry x1 (query richInfoSelectMulti (params LocalQuorum (Identity users))) @@ -415,12 +416,12 @@ lookupRichInfoMultiUsers users = do -- | Lookup user (no matter what status) and return 'TeamId'. Safe to use for authorization: -- suspended / deleted / ... users can't login, so no harm done if we authorize them *after* -- successful login. -lookupUserTeam :: MonadClient m => UserId -> m (Maybe TeamId) +lookupUserTeam :: (MonadClient m) => UserId -> m (Maybe TeamId) lookupUserTeam u = (runIdentity =<<) <$> retry x1 (query1 teamSelect (params LocalQuorum (Identity u))) -lookupAuth :: MonadClient m => UserId -> m (Maybe (Maybe Password, AccountStatus)) +lookupAuth :: (MonadClient m) => UserId -> m (Maybe (Maybe Password, AccountStatus)) lookupAuth u = fmap f <$> retry x1 (query1 authSelect (params LocalQuorum (Identity u))) where f (pw, st) = (pw, fromMaybe Active st) @@ -443,7 +444,7 @@ lookupAccounts usrs = do domain <- viewFederationDomain fmap (toUserAccount domain loc) <$> retry x1 (query accountsSelect (params LocalQuorum (Identity usrs))) -lookupServiceUser :: MonadClient m => ProviderId -> ServiceId -> BotId -> m (Maybe (ConvId, Maybe TeamId)) +lookupServiceUser :: (MonadClient m) => ProviderId -> ServiceId -> BotId -> m (Maybe (ConvId, Maybe TeamId)) lookupServiceUser pid sid bid = retry x1 (query1 cql (params LocalQuorum (pid, sid, bid))) where cql :: PrepQuery R (ProviderId, ServiceId, BotId) (ConvId, Maybe TeamId) @@ -453,7 +454,7 @@ lookupServiceUser pid sid bid = retry x1 (query1 cql (params LocalQuorum (pid, s -- | NB: might return a lot of users, and therefore we do streaming here (page-by-page). lookupServiceUsers :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> ConduitM () [(BotId, ConvId, Maybe TeamId)] m () @@ -466,7 +467,7 @@ lookupServiceUsers pid sid = \WHERE provider = ? AND service = ?" lookupServiceUsersForTeam :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> TeamId -> @@ -479,7 +480,7 @@ lookupServiceUsersForTeam pid sid tid = "SELECT user, conv FROM service_team \ \WHERE provider = ? AND service = ? AND team = ?" -lookupFeatureConferenceCalling :: MonadClient m => UserId -> m (Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig)) +lookupFeatureConferenceCalling :: (MonadClient m) => UserId -> m (Maybe (ApiFt.WithStatusNoLock ApiFt.ConferenceCallingConfig)) lookupFeatureConferenceCalling uid = do let q = query1 select (params LocalQuorum (Identity uid)) mStatusValue <- (>>= runIdentity) <$> retry x1 q diff --git a/services/brig/src/Brig/Data/UserKey.hs b/services/brig/src/Brig/Data/UserKey.hs index a1769c68421..15323d0f98d 100644 --- a/services/brig/src/Brig/Data/UserKey.hs +++ b/services/brig/src/Brig/Data/UserKey.hs @@ -58,10 +58,10 @@ foldKey f g k = case k of UserEmailKey ek -> f (emailKeyOrig ek) UserPhoneKey pk -> g (phoneKeyOrig pk) -forEmailKey :: Applicative f => UserKey -> (Email -> f a) -> f (Maybe a) +forEmailKey :: (Applicative f) => UserKey -> (Email -> f a) -> f (Maybe a) forEmailKey k f = foldKey (fmap Just . f) (const (pure Nothing)) k -forPhoneKey :: Applicative f => UserKey -> (Phone -> f a) -> f (Maybe a) +forPhoneKey :: (Applicative f) => UserKey -> (Phone -> f a) -> f (Maybe a) forPhoneKey k f = foldKey (const (pure Nothing)) (fmap Just . f) k -- | Get the normalised text of a 'UserKey'. @@ -77,7 +77,7 @@ keyTextOriginal (UserPhoneKey k) = fromPhone (phoneKeyOrig k) -- | Claim a 'UserKey' for a user. claimKey :: - MonadClient m => + (MonadClient m) => -- | The key to claim. UserKey -> -- | The user claiming the key. @@ -92,7 +92,7 @@ claimKey k u = do -- A key is available if it is not already actived for another user or -- if the other user and the user looking to claim the key are the same. keyAvailable :: - MonadClient m => + (MonadClient m) => -- | The key to check. UserKey -> -- | The user looking to claim the key, if any. @@ -105,16 +105,16 @@ keyAvailable k u = do (Just x, Just y) | x == y -> pure True (Just x, _) -> not <$> User.isActivated x -lookupKey :: MonadClient m => UserKey -> m (Maybe UserId) +lookupKey :: (MonadClient m) => UserKey -> m (Maybe UserId) lookupKey k = fmap runIdentity <$> retry x1 (query1 keySelect (params LocalQuorum (Identity $ keyText k))) -insertKey :: MonadClient m => UserId -> UserKey -> m () +insertKey :: (MonadClient m) => UserId -> UserKey -> m () insertKey u k = do retry x5 $ write keyInsert (params LocalQuorum (keyText k, u)) -deleteKey :: MonadClient m => UserKey -> m () +deleteKey :: (MonadClient m) => UserKey -> m () deleteKey k = do retry x5 $ write keyDelete (params LocalQuorum (Identity $ keyText k)) @@ -126,7 +126,7 @@ deleteKey k = do -- executed several times due to cassandra not supporting transactions) -- `deleteKeyForUser` does not fail for missing keys or keys that belong to -- another user: It always returns `()` as result. -deleteKeyForUser :: MonadClient m => UserId -> UserKey -> m () +deleteKeyForUser :: (MonadClient m) => UserId -> UserKey -> m () deleteKeyForUser uid k = do mbKeyUid <- lookupKey k case mbKeyUid of diff --git a/services/brig/src/Brig/DeleteQueue/Interpreter.hs b/services/brig/src/Brig/DeleteQueue/Interpreter.hs index e55b7453ef5..48247e9b615 100644 --- a/services/brig/src/Brig/DeleteQueue/Interpreter.hs +++ b/services/brig/src/Brig/DeleteQueue/Interpreter.hs @@ -49,7 +49,7 @@ enqueue :: Member (Logger (Log.Msg -> Log.Msg)) r, Member (Error ErrorCall) r ) => - ToJSON a => + (ToJSON a) => QueueEnv -> a -> Sem r () @@ -61,11 +61,11 @@ enqueue (SqsQueueEnv awsEnv _ queue) message = do let bodyMD5 = fmap (flip digest body) md5 resp <- embed @IO $ AWS.execute awsEnv (AWS.enqueueStandard queue body) unless (resp ^. sendMessageResponse_mD5OfMessageBody == bodyMD5) $ do - err $ - Log.msg (Log.val "Returned hash (MD5) doesn't match message hash") - . Log.field "SqsQueue" (show queue) - . Log.field "returned_hash" (show (resp ^. sendMessageResponse_mD5OfMessageBody)) - . Log.field "message_hash" (show (Just bodyMD5)) + err + $ Log.msg (Log.val "Returned hash (MD5) doesn't match message hash") + . Log.field "SqsQueue" (show queue) + . Log.field "returned_hash" (show (resp ^. sendMessageResponse_mD5OfMessageBody)) + . Log.field "message_hash" (show (Just bodyMD5)) throw (ErrorCall "The server couldn't access a queue") where digest :: Digest -> BL.ByteString -> Text diff --git a/services/brig/src/Brig/Effects/BlacklistPhonePrefixStore/Cassandra.hs b/services/brig/src/Brig/Effects/BlacklistPhonePrefixStore/Cassandra.hs index e8c1713f91b..7b7b4bded47 100644 --- a/services/brig/src/Brig/Effects/BlacklistPhonePrefixStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/BlacklistPhonePrefixStore/Cassandra.hs @@ -16,8 +16,9 @@ interpretBlacklistPhonePrefixStoreToCassandra :: Sem (BlacklistPhonePrefixStore ': r) a -> Sem r a interpretBlacklistPhonePrefixStoreToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Insert ep -> insertPrefix ep Delete pp -> deletePrefix pp ExistsAny uk -> existsAnyPrefix uk @@ -26,29 +27,29 @@ interpretBlacklistPhonePrefixStoreToCassandra = -------------------------------------------------------------------------------- -- Excluded phone prefixes -insertPrefix :: MonadClient m => ExcludedPrefix -> m () +insertPrefix :: (MonadClient m) => ExcludedPrefix -> m () insertPrefix prefix = retry x5 $ write ins (params LocalQuorum (phonePrefix prefix, comment prefix)) where ins :: PrepQuery W (PhonePrefix, Text) () ins = "INSERT INTO excluded_phones (prefix, comment) VALUES (?, ?)" -deletePrefix :: MonadClient m => PhonePrefix -> m () +deletePrefix :: (MonadClient m) => PhonePrefix -> m () deletePrefix prefix = retry x5 $ write del (params LocalQuorum (Identity prefix)) where del :: PrepQuery W (Identity PhonePrefix) () del = "DELETE FROM excluded_phones WHERE prefix = ?" -getAllPrefixes :: MonadClient m => PhonePrefix -> m [ExcludedPrefix] +getAllPrefixes :: (MonadClient m) => PhonePrefix -> m [ExcludedPrefix] getAllPrefixes prefix = do let prefixes = fromPhonePrefix <$> allPrefixes (fromPhonePrefix prefix) selectPrefixes prefixes -existsAnyPrefix :: MonadClient m => Phone -> m Bool +existsAnyPrefix :: (MonadClient m) => Phone -> m Bool existsAnyPrefix phone = do let prefixes = fromPhonePrefix <$> allPrefixes (fromPhone phone) not . null <$> selectPrefixes prefixes -selectPrefixes :: MonadClient m => [Text] -> m [ExcludedPrefix] +selectPrefixes :: (MonadClient m) => [Text] -> m [ExcludedPrefix] selectPrefixes prefixes = do results <- retry x1 (query sel (params LocalQuorum (Identity $ prefixes))) pure $ uncurry ExcludedPrefix <$> results diff --git a/services/brig/src/Brig/Effects/BlacklistStore/Cassandra.hs b/services/brig/src/Brig/Effects/BlacklistStore/Cassandra.hs index 995926b7040..bf7cebc238d 100644 --- a/services/brig/src/Brig/Effects/BlacklistStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/BlacklistStore/Cassandra.hs @@ -15,8 +15,9 @@ interpretBlacklistStoreToCassandra :: Sem (BlacklistStore ': r) a -> Sem r a interpretBlacklistStoreToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Insert uk -> insert uk Exists uk -> exists uk Delete uk -> delete uk @@ -24,15 +25,16 @@ interpretBlacklistStoreToCassandra = -------------------------------------------------------------------------------- -- UserKey blacklisting -insert :: MonadClient m => UserKey -> m () +insert :: (MonadClient m) => UserKey -> m () insert uk = retry x5 $ write keyInsert (params LocalQuorum (Identity $ keyText uk)) -exists :: MonadClient m => UserKey -> m Bool +exists :: (MonadClient m) => UserKey -> m Bool exists uk = - (pure . isJust) . fmap runIdentity + (pure . isJust) + . fmap runIdentity =<< retry x1 (query1 keySelect (params LocalQuorum (Identity $ keyText uk))) -delete :: MonadClient m => UserKey -> m () +delete :: (MonadClient m) => UserKey -> m () delete uk = retry x5 $ write keyDelete (params LocalQuorum (Identity $ keyText uk)) keyInsert :: PrepQuery W (Identity Text) () diff --git a/services/brig/src/Brig/Effects/CodeStore/Cassandra.hs b/services/brig/src/Brig/Effects/CodeStore/Cassandra.hs index 26d4d2c7f32..faaf363725a 100644 --- a/services/brig/src/Brig/Effects/CodeStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/CodeStore/Cassandra.hs @@ -43,30 +43,30 @@ codeStoreToCassandra :: Sem (CodeStore ': r) a -> Sem r a codeStoreToCassandra = - interpret $ - embed @m - . \case - MkPasswordResetKey uid -> mkPwdResetKey uid - GenerateEmailCode -> genEmailCode - GeneratePhoneCode -> genPhoneCode - CodeSelect prk -> - (fmap . fmap) toRecord - . retry x1 - . query1 codeSelectQuery - . params LocalQuorum - . Identity - $ prk - CodeInsert prk (PRQueryData prc uid n ut) ttl -> - retry x5 - . write codeInsertQuery - . params LocalQuorum - $ (prk, prc, uid, runIdentity n, runIdentity ut, ttl) - CodeDelete prk -> - retry x5 - . write codeDeleteQuery - . params LocalQuorum - . Identity - $ prk + interpret + $ embed @m + . \case + MkPasswordResetKey uid -> mkPwdResetKey uid + GenerateEmailCode -> genEmailCode + GeneratePhoneCode -> genPhoneCode + CodeSelect prk -> + (fmap . fmap) toRecord + . retry x1 + . query1 codeSelectQuery + . params LocalQuorum + . Identity + $ prk + CodeInsert prk (PRQueryData prc uid n ut) ttl -> + retry x5 + . write codeInsertQuery + . params LocalQuorum + $ (prk, prc, uid, runIdentity n, runIdentity ut, ttl) + CodeDelete prk -> + retry x5 + . write codeDeleteQuery + . params LocalQuorum + . Identity + $ prk where toRecord :: (PasswordResetCode, UserId, Maybe Int32, Maybe UTCTime) -> @@ -74,21 +74,24 @@ codeStoreToCassandra = toRecord (prqdCode, prqdUser, prqdRetries, prqdTimeout) = PRQueryData {..} -genEmailCode :: MonadIO m => m PasswordResetCode +genEmailCode :: (MonadIO m) => m PasswordResetCode genEmailCode = PasswordResetCode . encodeBase64Url <$> liftIO (randBytes 24) -genPhoneCode :: MonadIO m => m PasswordResetCode +genPhoneCode :: (MonadIO m) => m PasswordResetCode genPhoneCode = - PasswordResetCode . unsafeFromText . pack . printf "%06d" + PasswordResetCode + . unsafeFromText + . pack + . printf "%06d" <$> liftIO (randIntegerZeroToNMinusOne 1000000) -mkPwdResetKey :: MonadIO m => UserId -> m PasswordResetKey +mkPwdResetKey :: (MonadIO m) => UserId -> m PasswordResetKey mkPwdResetKey u = do d <- liftIO $ getDigestByName "SHA256" >>= maybe (error "SHA256 not found") pure pure . PasswordResetKey . encodeBase64Url . digestBS d $ toByteString' u interpretClientToIO :: - Member (Final IO) r => + (Member (Final IO) r) => ClientState -> Sem (Embed Cassandra.Client ': r) a -> Sem r a diff --git a/services/brig/src/Brig/Effects/ConnectionStore/Cassandra.hs b/services/brig/src/Brig/Effects/ConnectionStore/Cassandra.hs index 35f2444ab88..e1d9a6a835e 100644 --- a/services/brig/src/Brig/Effects/ConnectionStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/ConnectionStore/Cassandra.hs @@ -34,8 +34,10 @@ connectionStoreToCassandra :: Sem (ConnectionStore InternalPaging ': r) a -> Sem r a connectionStoreToCassandra = - interpretH $ - liftT . embed @Client . \case + interpretH + $ liftT + . embed @Client + . \case RemoteConnectedUsersPaginated uid mps bounds -> case mps of Nothing -> flip mkInternalPage pure =<< lookupRemoteConnectedUsersPaginated uid (fromRange bounds) Just ps -> ipNext ps diff --git a/services/brig/src/Brig/Effects/FederationConfigStore/Cassandra.hs b/services/brig/src/Brig/Effects/FederationConfigStore/Cassandra.hs index bc9fcd8f7b6..a883a2907c1 100644 --- a/services/brig/src/Brig/Effects/FederationConfigStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/FederationConfigStore/Cassandra.hs @@ -54,8 +54,9 @@ interpretFederationDomainConfig :: Sem (FederationConfigStore ': r) a -> Sem r a interpretFederationDomainConfig mFedStrategy fedCfgs = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case GetFederationConfig d -> getFederationConfig' fedCfgs d GetFederationConfigs -> getFederationConfigs' mFedStrategy fedCfgs AddFederationConfig cnf -> addFederationConfig' fedCfgs cnf @@ -103,7 +104,7 @@ getFederationConfigs' mFedStrategy cfgs = do maxKnownNodes :: Int maxKnownNodes = 10000 -getFederationConfig' :: MonadClient m => Map Domain FederationDomainConfig -> Domain -> m (Maybe FederationDomainConfig) +getFederationConfig' :: (MonadClient m) => Map Domain FederationDomainConfig -> Domain -> m (Maybe FederationDomainConfig) getFederationConfig' cfgs rDomain = case find ((== rDomain) . domain) cfgs of Just cfg -> pure . Just $ cfg -- the configuration from the file has precedence (if exists there should not be a db entry at all) Nothing -> do @@ -115,7 +116,7 @@ getFederationConfig' cfgs rDomain = case find ((== rDomain) . domain) cfgs of q :: PrepQuery R (Identity Domain) (FederatedUserSearchPolicy, Maybe Int32) q = "SELECT search_policy, restriction FROM federation_remotes WHERE domain = ?" -getFederationRemotesFromDb :: forall m. MonadClient m => m [FederationDomainConfig] +getFederationRemotesFromDb :: forall m. (MonadClient m) => m [FederationDomainConfig] getFederationRemotesFromDb = (\(d, p, r) -> FederationDomainConfig d p r) <$$> qry where qry :: m [(Domain, FederatedUserSearchPolicy, FederationRestriction)] @@ -127,7 +128,7 @@ getFederationRemotesFromDb = (\(d, p, r) -> FederationDomainConfig d p r) <$$> q get :: PrepQuery R () (Domain, FederatedUserSearchPolicy, Maybe Int32) get = fromString $ "SELECT domain, search_policy, restriction FROM federation_remotes LIMIT " <> show maxKnownNodes -addFederationConfig' :: MonadClient m => Map Domain FederationDomainConfig -> FederationDomainConfig -> m AddFederationRemoteResult +addFederationConfig' :: (MonadClient m) => Map Domain FederationDomainConfig -> FederationDomainConfig -> m AddFederationRemoteResult addFederationConfig' cfg (FederationDomainConfig rDomain searchPolicy restriction) = do -- if a domain already exists in a config, we do not allow to add it to the database conflict <- domainExistsInConfig (FederationDomainConfig rDomain searchPolicy restriction) @@ -159,7 +160,7 @@ addFederationConfig' cfg (FederationDomainConfig rDomain searchPolicy restrictio addTeams :: PrepQuery W (Domain, TeamId) () addTeams = "INSERT INTO federation_remote_teams (domain, team) VALUES (?, ?)" -updateFederationConfig' :: MonadClient m => Map Domain FederationDomainConfig -> FederationDomainConfig -> m UpdateFederationResult +updateFederationConfig' :: (MonadClient m) => Map Domain FederationDomainConfig -> FederationDomainConfig -> m UpdateFederationResult updateFederationConfig' cfgs (FederationDomainConfig rDomain searchPolicy restriction) = do -- if a domain already exists in a config, we do not allow update it if rDomain `elem` (domain <$> cfgs) @@ -182,7 +183,7 @@ updateFederationConfig' cfgs (FederationDomainConfig rDomain searchPolicy restri updateConfig :: PrepQuery W (FederatedUserSearchPolicy, Int32, Domain) x updateConfig = "UPDATE federation_remotes SET search_policy = ?, restriction = ? WHERE domain = ? IF EXISTS" - updateTeams :: MonadClient m => m () + updateTeams :: (MonadClient m) => m () updateTeams = retry x5 $ do write dropTeams (params LocalQuorum (Identity rDomain)) case restriction of @@ -196,7 +197,7 @@ updateFederationConfig' cfgs (FederationDomainConfig rDomain searchPolicy restri insertTeam :: PrepQuery W (Domain, TeamId) () insertTeam = "INSERT INTO federation_remote_teams (domain, team) VALUES (?, ?)" -addFederationRemoteTeam' :: MonadClient m => Map Domain FederationDomainConfig -> Domain -> TeamId -> m AddFederationRemoteTeamResult +addFederationRemoteTeam' :: (MonadClient m) => Map Domain FederationDomainConfig -> Domain -> TeamId -> m AddFederationRemoteTeamResult addFederationRemoteTeam' cfgs rDomain tid = do mDom <- getFederationConfig' cfgs rDomain case mDom of @@ -211,14 +212,14 @@ addFederationRemoteTeam' cfgs rDomain tid = do add :: PrepQuery W (Domain, TeamId) () add = "INSERT INTO federation_remote_teams (domain, team) VALUES (?, ?)" -getFederationRemoteTeams' :: MonadClient m => Domain -> m [FederationRemoteTeam] +getFederationRemoteTeams' :: (MonadClient m) => Domain -> m [FederationRemoteTeam] getFederationRemoteTeams' rDomain = do fmap (FederationRemoteTeam . runIdentity) <$> retry x1 (query get (params LocalQuorum (Identity rDomain))) where get :: PrepQuery R (Identity Domain) (Identity TeamId) get = "SELECT team FROM federation_remote_teams WHERE domain = ?" -removeFederationRemoteTeam' :: MonadClient m => Domain -> TeamId -> m () +removeFederationRemoteTeam' :: (MonadClient m) => Domain -> TeamId -> m () removeFederationRemoteTeam' rDomain rteam = retry x1 $ write delete (params LocalQuorum (rDomain, rteam)) where @@ -226,7 +227,7 @@ removeFederationRemoteTeam' rDomain rteam = delete = "DELETE FROM federation_remote_teams WHERE domain = ? AND team = ?" backendFederatesWithImpl :: - MonadClient m => + (MonadClient m) => Remote (Maybe TeamId) -> Map Domain FederationDomainConfig -> Maybe FederationStrategy -> @@ -258,11 +259,12 @@ instance Show RestrictionException where instance Exception RestrictionException -toRestriction :: MonadClient m => Domain -> Int32 -> m FederationRestriction +toRestriction :: (MonadClient m) => Domain -> Int32 -> m FederationRestriction toRestriction _ 0 = pure FederationRestrictionAllowAll toRestriction dom 1 = - fmap FederationRestrictionByTeam $ - runIdentity <$$> retry x1 (query getTeams (params LocalQuorum (Identity dom))) + fmap FederationRestrictionByTeam + $ runIdentity + <$$> retry x1 (query getTeams (params LocalQuorum (Identity dom))) where getTeams :: PrepQuery R (Identity Domain) (Identity TeamId) getTeams = fromString $ "SELECT team FROM federation_remote_teams WHERE domain = ?" diff --git a/services/brig/src/Brig/Effects/JwtTools.hs b/services/brig/src/Brig/Effects/JwtTools.hs index 1b9a1773413..a344f5b7ae4 100644 --- a/services/brig/src/Brig/Effects/JwtTools.hs +++ b/services/brig/src/Brig/Effects/JwtTools.hs @@ -55,7 +55,7 @@ data JwtTools m a where makeSem ''JwtTools -interpretJwtTools :: Member (Embed IO) r => Sem (JwtTools ': r) a -> Sem r a +interpretJwtTools :: (Member (Embed IO) r) => Sem (JwtTools ': r) a -> Sem r a interpretJwtTools = interpret $ \case GenerateDPoPAccessToken proof cid handle displayName tid nonce uri method skew ex now pem -> mapLeft RustError diff --git a/services/brig/src/Brig/Effects/PublicKeyBundle.hs b/services/brig/src/Brig/Effects/PublicKeyBundle.hs index bd7c680d994..3178d57380f 100644 --- a/services/brig/src/Brig/Effects/PublicKeyBundle.hs +++ b/services/brig/src/Brig/Effects/PublicKeyBundle.hs @@ -14,7 +14,7 @@ data PublicKeyBundle m a where makeSem ''PublicKeyBundle -interpretPublicKeyBundle :: Member (Embed IO) r => Sem (PublicKeyBundle ': r) a -> Sem r a +interpretPublicKeyBundle :: (Member (Embed IO) r) => Sem (PublicKeyBundle ': r) a -> Sem r a interpretPublicKeyBundle = interpret $ \(Get fp) -> do contents :: Either IOException ByteString <- liftIO $ try $ BS.readFile fp pure $ either (const Nothing) fromByteString contents diff --git a/services/brig/src/Brig/Effects/SFT.hs b/services/brig/src/Brig/Effects/SFT.hs index d1cdd9d2cde..e6dbfcaaf1b 100644 --- a/services/brig/src/Brig/Effects/SFT.hs +++ b/services/brig/src/Brig/Effects/SFT.hs @@ -52,10 +52,10 @@ newtype SFTGetResponse = SFTGetResponse data SFT m a where SFTGetAllServers :: HttpsUrl -> SFT m SFTGetResponse -sftGetAllServers :: Member SFT r => HttpsUrl -> Sem r SFTGetResponse +sftGetAllServers :: (Member SFT r) => HttpsUrl -> Sem r SFTGetResponse sftGetAllServers = send . SFTGetAllServers -interpretSFT :: Members [Embed IO, TinyLog] r => Manager -> Sem (SFT ': r) a -> Sem r a +interpretSFT :: (Members [Embed IO, TinyLog] r) => Manager -> Sem (SFT ': r) a -> Sem r a interpretSFT httpManager = interpret $ \(SFTGetAllServers url) -> do let urlWithPath = ensureHttpsUrl $ (httpsUrl url) {uriPath = "/sft_servers_all.json"} fmap SFTGetResponse . runSftError urlWithPath $ do @@ -66,26 +66,27 @@ interpretSFT httpManager = interpret $ \(SFTGetAllServers url) -> do debug $ Log.field "URLs" (show res) . Log.msg ("Fetched the following server URLs" :: ByteString) pure res -runSftError :: Member TinyLog r => HttpsUrl -> Sem (Error SFTError : r) a -> Sem r (Either SFTError a) +runSftError :: (Member TinyLog r) => HttpsUrl -> Sem (Error SFTError : r) a -> Sem r (Either SFTError a) runSftError urlWithPath act = - runError $ - act - `catch` ( \(e :: SFTError) -> do - err $ Log.field "sft_err" (show e) . Log.msg ("Error for URL: " <> toByteString' urlWithPath) - throw e - ) + runError + $ act + `catch` ( \(e :: SFTError) -> do + err $ Log.field "sft_err" (show e) . Log.msg ("Error for URL: " <> toByteString' urlWithPath) + throw e + ) newtype AllURLs = AllURLs {unAllURLs :: [HttpsUrl]} deriving (Aeson.FromJSON) via Schema AllURLs instance ToSchema AllURLs where schema = - object "AllURLs" $ - AllURLs - <$> unAllURLs .= field "sft_servers_all" (array schema) + object "AllURLs" + $ AllURLs + <$> unAllURLs + .= field "sft_servers_all" (array schema) interpretSFTInMemory :: - Member TinyLog r => + (Member TinyLog r) => Map HttpsUrl SFTGetResponse -> Sem (SFT ': r) a -> Sem r a diff --git a/services/brig/src/Brig/Effects/UserPendingActivationStore.hs b/services/brig/src/Brig/Effects/UserPendingActivationStore.hs index 69a1db7397d..eb7cd15479a 100644 --- a/services/brig/src/Brig/Effects/UserPendingActivationStore.hs +++ b/services/brig/src/Brig/Effects/UserPendingActivationStore.hs @@ -23,5 +23,5 @@ data UserPendingActivationStore p m a where makeSem ''UserPendingActivationStore -remove :: forall p r. Member (UserPendingActivationStore p) r => UserId -> Sem r () +remove :: forall p r. (Member (UserPendingActivationStore p) r) => UserId -> Sem r () remove uid = removeMultiple [uid] diff --git a/services/brig/src/Brig/Effects/UserPendingActivationStore/Cassandra.hs b/services/brig/src/Brig/Effects/UserPendingActivationStore/Cassandra.hs index 44e6431e8e2..521a5ee2ffa 100644 --- a/services/brig/src/Brig/Effects/UserPendingActivationStore/Cassandra.hs +++ b/services/brig/src/Brig/Effects/UserPendingActivationStore/Cassandra.hs @@ -20,21 +20,23 @@ userPendingActivationStoreToCassandra :: Sem (UserPendingActivationStore PC.InternalPaging ': r) a -> Sem r a userPendingActivationStoreToCassandra = - interpretH $ - liftT . embed @Client . \case + interpretH + $ liftT + . embed @Client + . \case Add upa -> usersPendingActivationAdd upa List Nothing -> flip PC.mkInternalPage pure =<< usersPendingActivationList List (Just ps) -> PC.ipNext ps RemoveMultiple uids -> usersPendingActivationRemoveMultiple uids -usersPendingActivationAdd :: MonadClient m => UserPendingActivation -> m () +usersPendingActivationAdd :: (MonadClient m) => UserPendingActivation -> m () usersPendingActivationAdd (UserPendingActivation uid expiresAt) = do retry x5 . write insertExpiration . params LocalQuorum $ (uid, expiresAt) where insertExpiration :: PrepQuery W (UserId, UTCTime) () insertExpiration = "INSERT INTO users_pending_activation (user, expires_at) VALUES (?, ?)" -usersPendingActivationList :: MonadClient m => m (Page UserPendingActivation) +usersPendingActivationList :: (MonadClient m) => m (Page UserPendingActivation) usersPendingActivationList = do uncurry UserPendingActivation <$$> retry x1 (paginate selectExpired (params LocalQuorum ())) where @@ -42,7 +44,7 @@ usersPendingActivationList = do selectExpired = "SELECT user, expires_at FROM users_pending_activation" -usersPendingActivationRemoveMultiple :: MonadClient m => [UserId] -> m () +usersPendingActivationRemoveMultiple :: (MonadClient m) => [UserId] -> m () usersPendingActivationRemoveMultiple uids = retry x5 . write deleteExpired . params LocalQuorum $ Identity uids where diff --git a/services/brig/src/Brig/Federation/Client.hs b/services/brig/src/Brig/Federation/Client.hs index d86f706169f..2a11beb5b3c 100644 --- a/services/brig/src/Brig/Federation/Client.hs +++ b/services/brig/src/Brig/Federation/Client.hs @@ -156,14 +156,14 @@ notifyUserDeleted self remotes = do remoteDomain = tDomain remotes view rabbitmqChannel >>= \case Just chanVar -> do - enqueueNotification (tDomain self) remoteDomain Q.Persistent chanVar $ - fedQueueClient @'OnUserDeletedConnectionsTag notif + enqueueNotification (tDomain self) remoteDomain Q.Persistent chanVar + $ fedQueueClient @'OnUserDeletedConnectionsTag notif Nothing -> - Log.err $ - Log.msg ("Federation error while notifying remote backends of a user deletion." :: ByteString) - . Log.field "user_id" (show self) - . Log.field "domain" (domainText remoteDomain) - . Log.field "error" (show FederationNotConfigured) + Log.err + $ Log.msg ("Federation error while notifying remote backends of a user deletion." :: ByteString) + . Log.field "user_id" (show self) + . Log.field "domain" (domainText remoteDomain) + . Log.field "error" (show FederationNotConfigured) -- | Enqueues notifications in RabbitMQ. Retries 3 times with a delay of 1s. enqueueNotification :: (MonadIO m, MonadMask m, Log.MonadLogger m, MonadReader Env m) => Domain -> Domain -> Q.DeliveryMode -> MVar Q.Channel -> FedQueueClient c () -> m () @@ -173,12 +173,12 @@ enqueueNotification ownDomain remoteDomain deliveryMode chanVar action = do where logError willRetry (SomeException e) status = do rid <- view Brig.requestId - Log.err $ - Log.msg @Text "failed to enqueue notification in RabbitMQ" - . Log.field "error" (displayException e) - . Log.field "willRetry" willRetry - . Log.field "retryCount" status.rsIterNumber - . Log.field "request" rid + Log.err + $ Log.msg @Text "failed to enqueue notification in RabbitMQ" + . Log.field "error" (displayException e) + . Log.field "willRetry" willRetry + . Log.field "retryCount" status.rsIterNumber + . Log.field "request" rid go = do rid <- view Brig.requestId mChan <- timeout (1 :: Second) (readMVar chanVar) diff --git a/services/brig/src/Brig/IO/Intra.hs b/services/brig/src/Brig/IO/Intra.hs index b550a667ab9..7393466687a 100644 --- a/services/brig/src/Brig/IO/Intra.hs +++ b/services/brig/src/Brig/IO/Intra.hs @@ -187,12 +187,14 @@ onClientEvent orig conn e = do let rcps = Recipient orig V2.RecipientClientsAll :| [] pushNotifications [ newPush1 (Just orig) (toJSONObject event) rcps - & pushConn .~ conn - & pushApsData .~ toApsData event + & pushConn + .~ conn + & pushApsData + .~ toApsData event ] updateSearchIndex :: - Member (Embed HttpClientIO) r => + (Member (Embed HttpClientIO) r) => UserId -> UserEvent -> Sem r () @@ -328,8 +330,8 @@ notifyUserDeletionLocals deleted conn event = do [] -> pure () xs -> do handler xs - when (Data.resultHasMore page) $ - connectionPages (Just (maximum (qUnqualified . ucTo <$> xs))) user pageSize + when (Data.resultHasMore page) + $ connectionPages (Just (maximum (qUnqualified . ucTo <$> xs))) user pageSize notifyUserDeletionRemotes :: forall r. @@ -366,9 +368,9 @@ notifyUserDeletionRemotes deleted = do embed (runExceptT (sendConnectionAction luidDeleted Nothing (qUnqualified . ucTo <$> ruc) RemoteRescind)) >>= \case -- should we abort the whole process if we fail to send the event to a remote backend? Left e -> - Log.err $ - field "error" (show e) - . msg (val "An error occurred while sending a connection cancelled event to a remote backend.") + Log.err + $ field "error" (show e) + . msg (val "An error occurred while sending a connection cancelled event to a remote backend.") Right _ -> pure () -- | (Asynchronously) notifies other users of events. @@ -388,9 +390,12 @@ notify (toList -> events) orig route conn recipients = do rs <- (\u -> Recipient u RecipientClientsAll) <$$> recipients let pushes = flip map events $ \event -> newPush1 (Just orig) (toJSONObject event) rs - & pushConn .~ conn - & pushRoute .~ route - & pushApsData .~ toApsData event + & pushConn + .~ conn + & pushRoute + .~ route + & pushApsData + .~ toApsData event void $ pushNotificationsAsync pushes notifySelf :: @@ -421,8 +426,9 @@ notifyContacts :: Maybe ConnId -> Sem r () notifyContacts events orig route conn = do - notify events orig route conn $ - (:|) orig <$> liftA2 (++) contacts teamContacts + notify events orig route conn + $ (:|) orig + <$> liftA2 (++) contacts teamContacts where contacts :: Sem r [UserId] contacts = embed $ lookupContactList orig @@ -450,10 +456,12 @@ toApsData (ConnectionEvent (ConnectionUpdated uc name)) = where apsConnRequest n = V2.apsData (V2.ApsLocKey "push.notification.connection.request") [fromName n] - & V2.apsSound ?~ V2.ApsSound "new_message_apns.caf" + & V2.apsSound + ?~ V2.ApsSound "new_message_apns.caf" apsConnAccept n = V2.apsData (V2.ApsLocKey "push.notification.connection.accepted") [fromName n] - & V2.apsSound ?~ V2.ApsSound "new_message_apns.caf" + & V2.apsSound + ?~ V2.ApsSound "new_message_apns.caf" toApsData _ = Nothing ------------------------------------------------------------------------------- @@ -470,10 +478,10 @@ createLocalConnectConv :: Maybe ConnId -> Sem r ConvId createLocalConnectConv from to cname conn = do - Log.debug $ - logConnection (tUnqualified from) (tUntagged to) - . remote "galley" - . msg (val "Creating connect conversation") + Log.debug + $ logConnection (tUnqualified from) (tUntagged to) + . remote "galley" + . msg (val "Creating connect conversation") let req = path "/i/conversations/connect" . zUser (tUnqualified from) @@ -482,9 +490,9 @@ createLocalConnectConv from to cname conn = do . lbytes (encode $ Connect (tUntagged to) Nothing cname Nothing) . expect2xx r <- embed $ galleyRequest POST req - maybe (error "invalid conv id") pure $ - fromByteString $ - getHeader' "Location" r + maybe (error "invalid conv id") pure + $ fromByteString + $ getHeader' "Location" r createConnectConv :: ( Member (Embed HttpClientIO) r, @@ -498,7 +506,8 @@ createConnectConv :: createConnectConv from to cname conn = do lfrom <- ensureLocal from lto <- ensureLocal to - tUntagged . qualifyAs lfrom + tUntagged + . qualifyAs lfrom <$> liftSem (createLocalConnectConv lfrom lto cname conn) -- | Calls 'Galley.API.acceptConvH'. @@ -509,10 +518,10 @@ acceptLocalConnectConv :: ConvId -> Sem r Conversation acceptLocalConnectConv from conn cnv = do - Log.debug $ - remote "galley" - . field "conv" (toByteString cnv) - . msg (val "Accepting connect conversation") + Log.debug + $ remote "galley" + . field "conv" (toByteString cnv) + . msg (val "Accepting connect conversation") embed $ galleyRequest PUT req >>= decodeBody "galley" where req = @@ -543,11 +552,11 @@ blockConv :: Qualified ConvId -> Sem r () blockConv lusr qcnv = do - Log.debug $ - remote "galley" - . field "conv" (toByteString . qUnqualified $ qcnv) - . field "domain" (toByteString . qDomain $ qcnv) - . msg (val "Blocking conversation") + Log.debug + $ remote "galley" + . field "conv" (toByteString . qUnqualified $ qcnv) + . field "domain" (toByteString . qDomain $ qcnv) + . msg (val "Blocking conversation") embed . void $ galleyRequest PUT req where req = @@ -595,20 +604,20 @@ rmUser :: [Asset] -> Sem r () rmUser usr asts = do - Log.debug $ - remote "gundeck" - . field "user" (toByteString usr) - . msg (val "remove user") + Log.debug + $ remote "gundeck" + . field "user" (toByteString usr) + . msg (val "remove user") cleanupUser usr - Log.debug $ - remote "galley" - . field "user" (toByteString usr) - . msg (val "remove user") + Log.debug + $ remote "galley" + . field "user" (toByteString usr) + . msg (val "remove user") embed $ void $ galleyRequest DELETE (path "/i/user" . zUser usr . expect2xx) - Log.debug $ - remote "cargohold" - . field "user" (toByteString usr) - . msg (val "remove profile assets") + Log.debug + $ remote "cargohold" + . field "user" (toByteString usr) + . msg (val "remove profile assets") -- Note that we _may_ not get a 2xx response code from cargohold (e.g., client has -- deleted the asset "directly" with cargohold; on our side, we just do our best to -- delete it in case it is still there @@ -629,19 +638,19 @@ rmClient :: Sem r () rmClient u c = do let cid = toByteString' c - Log.debug $ - remote "galley" - . field "user" (toByteString u) - . field "client" (BL.fromStrict cid) - . msg (val "remove client") + Log.debug + $ remote "galley" + . field "user" (toByteString u) + . field "client" (BL.fromStrict cid) + . msg (val "remove client") let p = paths ["i", "clients", cid] embed $ void $ galleyRequest DELETE (p . zUser u . expect expected) -- for_ clabel rmClientCookie - Log.debug $ - remote "gundeck" - . field "user" (toByteString u) - . field "client" (BL.fromStrict cid) - . msg (val "unregister push client") + Log.debug + $ remote "gundeck" + . field "user" (toByteString u) + . field "client" (BL.fromStrict cid) + . msg (val "unregister push client") unregisterPushClient u c where expected = [status200, status204, status404] diff --git a/services/brig/src/Brig/IO/Logging.hs b/services/brig/src/Brig/IO/Logging.hs index ec733caa119..fcea253cea5 100644 --- a/services/brig/src/Brig/IO/Logging.hs +++ b/services/brig/src/Brig/IO/Logging.hs @@ -24,11 +24,16 @@ import System.Logger logConnection :: UserId -> Qualified UserId -> Msg -> Msg logConnection from (Qualified toUser toDomain) = - "connection.from" .= toByteString from - ~~ "connection.to" .= toByteString toUser - ~~ "connection.to_domain" .= toByteString toDomain + "connection.from" + .= toByteString from + ~~ "connection.to" + .= toByteString toUser + ~~ "connection.to_domain" + .= toByteString toDomain logLocalConnection :: UserId -> UserId -> Msg -> Msg logLocalConnection from to = - "connection.from" .= toByteString from - ~~ "connection.to" .= toByteString to + "connection.from" + .= toByteString from + ~~ "connection.to" + .= toByteString to diff --git a/services/brig/src/Brig/Index/Eval.hs b/services/brig/src/Brig/Index/Eval.hs index c19d000c5d9..99132778f84 100644 --- a/services/brig/src/Brig/Index/Eval.hs +++ b/services/brig/src/Brig/Index/Eval.hs @@ -128,10 +128,10 @@ waitForTaskToComplete timeoutSeconds taskNodeId = do unless (ES.taskResponseCompleted task) $ do throwM $ ReindexFromAnotherIndexError $ "Timed out waiting for task: " <> show taskNodeId when (isJust $ ES.taskResponseError task) $ do - throwM $ - ReindexFromAnotherIndexError $ - "Task failed with error: " - <> UTF8.toString (Aeson.encode $ ES.taskResponseError task) + throwM + $ ReindexFromAnotherIndexError + $ "Task failed with error: " + <> UTF8.toString (Aeson.encode $ ES.taskResponseError task) where isTaskComplete :: Either ES.EsError (ES.TaskResponse a) -> m Bool isTaskComplete (Left e) = throwM $ ReindexFromAnotherIndexError $ "Error response while getting task: " <> show e diff --git a/services/brig/src/Brig/Index/Migrations.hs b/services/brig/src/Brig/Index/Migrations.hs index 2fbb8ce5455..028ea0bcc82 100644 --- a/services/brig/src/Brig/Index/Migrations.hs +++ b/services/brig/src/Brig/Index/Migrations.hs @@ -52,9 +52,10 @@ migrate l es cas galleyEndpoint = do logAndThrowAgain :: forall a. SomeException -> IO a logAndThrowAgain e = do - runWithLogger l $ - Log.err $ - Log.msg (Log.val "Migration failed with exception") . Log.field "exception" (show e) + runWithLogger l + $ Log.err + $ Log.msg (Log.val "Migration failed with exception") + . Log.field "exception" (show e) throwM e -- | Increase this number any time you want to force reindexing. @@ -99,17 +100,17 @@ createMigrationsIndexIfNotPresent :: (MonadThrow m, ES.MonadBH m, Log.MonadLogge createMigrationsIndexIfNotPresent = do unlessM (ES.indexExists indexName) $ do - Log.info $ - Log.msg (Log.val "Creating migrations index, used for tracking which migrations have run") + Log.info + $ Log.msg (Log.val "Creating migrations index, used for tracking which migrations have run") ES.createIndexWith [] 1 indexName >>= throwIfNotCreated CreateMigrationIndexFailed ES.putMapping indexName indexMappingName indexMapping >>= throwIfNotCreated PutMappingFailed where throwIfNotCreated err response = - unless (ES.isSuccess response) $ - throwM $ - err (show response) + unless (ES.isSuccess response) + $ throwM + $ err (show response) failIfIndexAbsent :: (MonadThrow m, ES.MonadBH m) => ES.IndexName -> m () failIfIndexAbsent targetIndex = @@ -123,17 +124,17 @@ runMigration expectedVersion = do foundVersion <- latestMigrationVersion if expectedVersion > foundVersion then do - Log.info $ - Log.msg (Log.val "Migration necessary.") - . Log.field "expectedVersion" expectedVersion - . Log.field "foundVersion" foundVersion + Log.info + $ Log.msg (Log.val "Migration necessary.") + . Log.field "expectedVersion" expectedVersion + . Log.field "foundVersion" foundVersion Search.reindexAllIfSameOrNewer persistVersion expectedVersion else do - Log.info $ - Log.msg (Log.val "No migration necessary.") - . Log.field "expectedVersion" expectedVersion - . Log.field "foundVersion" foundVersion + Log.info + $ Log.msg (Log.val "No migration necessary.") + . Log.field "expectedVersion" expectedVersion + . Log.field "foundVersion" foundVersion persistVersion :: (MonadThrow m, MonadIO m) => MigrationVersion -> MigrationActionT m () persistVersion v = @@ -142,9 +143,9 @@ persistVersion v = persistResponse <- ES.indexDocument indexName indexMappingName ES.defaultIndexDocumentSettings v docId if ES.isCreated persistResponse then do - Log.info $ - Log.msg (Log.val "Migration success recorded") - . Log.field "migrationVersion" v + Log.info + $ Log.msg (Log.val "Migration success recorded") + . Log.field "migrationVersion" v else throwM $ PersistVersionFailed v $ show persistResponse -- | Which version is the table space currently running on? diff --git a/services/brig/src/Brig/Index/Migrations/Types.hs b/services/brig/src/Brig/Index/Migrations/Types.hs index 389868c06eb..7854ce67aae 100644 --- a/services/brig/src/Brig/Index/Migrations/Types.hs +++ b/services/brig/src/Brig/Index/Migrations/Types.hs @@ -62,18 +62,18 @@ instance (MonadIO m, MonadThrow m) => C.MonadClient (MigrationActionT m) where liftClient = liftCassandra localState f = local (\env -> env {cassandraClientState = f $ cassandraClientState env}) -instance MonadIO m => MonadLogger (MigrationActionT m) where +instance (MonadIO m) => MonadLogger (MigrationActionT m) where log level f = do env <- ask Logger.log (logger env) level f -instance MonadIO m => Search.MonadIndexIO (MigrationActionT m) where +instance (MonadIO m) => Search.MonadIndexIO (MigrationActionT m) where liftIndexIO m = do Env {..} <- ask let indexEnv = Search.IndexEnv logger bhEnv Nothing searchIndex Nothing Nothing galleyEndpoint httpManager searchIndexCredentials Search.runIndexIO indexEnv m -instance MonadIO m => ES.MonadBH (MigrationActionT m) where +instance (MonadIO m) => ES.MonadBH (MigrationActionT m) where getBHEnv = bhEnv <$> ask data Env = Env @@ -90,11 +90,11 @@ runMigrationAction :: Env -> MigrationActionT m a -> m a runMigrationAction env action = runReaderT (unMigrationAction action) env -liftCassandra :: MonadIO m => C.Client a -> MigrationActionT m a +liftCassandra :: (MonadIO m) => C.Client a -> MigrationActionT m a liftCassandra m = do env <- ask lift $ C.runClient (cassandraClientState env) m -cleanup :: MonadIO m => Env -> m () +cleanup :: (MonadIO m) => Env -> m () cleanup env = do C.shutdown (cassandraClientState env) diff --git a/services/brig/src/Brig/Index/Options.hs b/services/brig/src/Brig/Index/Options.hs index c0fe469f0ff..0965036e56b 100644 --- a/services/brig/src/Brig/Index/Options.hs +++ b/services/brig/src/Brig/Index/Options.hs @@ -183,8 +183,8 @@ restrictedElasticSettingsParser = do mCreds <- credentialsPathParser mCaCert <- caCertParser verifyCa <- verifyCaParser - pure $ - localElasticSettings + pure + $ localElasticSettings { _esConnection = localElasticSettings._esConnection { esServer = server, @@ -197,7 +197,8 @@ restrictedElasticSettingsParser = do indexNameParser :: Parser ES.IndexName indexNameParser = - ES.IndexName . view packed + ES.IndexName + . view packed <$> strOption ( long "elasticsearch-index" <> metavar "STRING" @@ -312,7 +313,8 @@ cassandraSettingsParser = <> value (_cPort localCassandraSettings) <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long "cassandra-keyspace" <> metavar "STRING" @@ -332,7 +334,8 @@ reindexToAnotherIndexSettingsParser :: Parser ReindexFromAnotherIndexSettings reindexToAnotherIndexSettingsParser = ReindexFromAnotherIndexSettings <$> connectionSettingsParser - <*> ( ES.IndexName . view packed + <*> ( ES.IndexName + . view packed <$> strOption ( long "destination-index" <> metavar "STRING" diff --git a/services/brig/src/Brig/InternalEvent/Process.hs b/services/brig/src/Brig/InternalEvent/Process.hs index 484e4026e11..408ef7f9a95 100644 --- a/services/brig/src/Brig/InternalEvent/Process.hs +++ b/services/brig/src/Brig/InternalEvent/Process.hs @@ -64,9 +64,9 @@ onEvent n = handleTimeout $ case n of rmClient uid clientId Intra.onClientEvent uid mcon (ClientRemoved clientId) DeleteUser uid -> do - Log.info $ - msg (val "Processing user delete event") - ~~ field "user" (toByteString uid) + Log.info + $ msg (val "Processing user delete event") + ~~ field "user" (toByteString uid) embed (API.lookupAccount uid) >>= mapM_ API.deleteAccount -- As user deletions are expensive resource-wise in the context of -- bulk user deletions (e.g. during team deletions), @@ -74,10 +74,10 @@ onEvent n = handleTimeout $ case n of deleteThrottleMillis <- embed $ fromMaybe defDeleteThrottleMillis . setDeleteThrottleMillis <$> view settings delay (1000 * deleteThrottleMillis) DeleteService pid sid -> do - Log.info $ - msg (val "Processing service delete event") - ~~ field "provider" (toByteString pid) - ~~ field "service" (toByteString sid) + Log.info + $ msg (val "Processing service delete event") + ~~ field "provider" (toByteString pid) + ~~ field "service" (toByteString sid) embed $ API.finishDeleteService pid sid where handleTimeout act = diff --git a/services/brig/src/Brig/Options.hs b/services/brig/src/Brig/Options.hs index d837fb7a2f4..7afadc53b8f 100644 --- a/services/brig/src/Brig/Options.hs +++ b/services/brig/src/Brig/Options.hs @@ -376,8 +376,8 @@ data ListAllSFTServers instance ToSchema ListAllSFTServers where schema = - enum @Text "ListSFTServers" $ - mconcat + enum @Text "ListSFTServers" + $ mconcat [ element "enabled" ListAllSFTServers, element "disabled" HideAllSFTServers ] @@ -619,8 +619,9 @@ instance FromJSON ImplicitNoFederationRestriction where ( \obj -> do domain <- obj Aeson..: "domain" searchPolicy <- obj Aeson..: "search_policy" - pure . ImplicitNoFederationRestriction $ - FederationDomainConfig domain searchPolicy FederationRestrictionAllowAll + pure + . ImplicitNoFederationRestriction + $ FederationDomainConfig domain searchPolicy FederationRestrictionAllowAll ) defaultTemplateLocale :: Locale @@ -873,10 +874,10 @@ instance FromJSON Timeout where parseJSON (Y.Number n) = let defaultV = 3600 bounded = toBoundedInteger n :: Maybe Int64 - in pure $ - Timeout $ - fromIntegral @Int $ - maybe defaultV fromIntegral bounded + in pure + $ Timeout + $ fromIntegral @Int + $ maybe defaultV fromIntegral bounded parseJSON v = typeMismatch "activationTimeout" v instance FromJSON Settings where diff --git a/services/brig/src/Brig/Phone.hs b/services/brig/src/Brig/Phone.hs index e87a46ea739..92814aa0d4f 100644 --- a/services/brig/src/Brig/Phone.hs +++ b/services/brig/src/Brig/Phone.hs @@ -83,9 +83,11 @@ sendCall call = unless (isTestPhone $ Nexmo.callTo call) $ do cred <- view nexmoCreds withCallBudget (Nexmo.callTo call) $ do r <- - liftIO . try @_ @Nexmo.CallErrorResponse . recovering x3 nexmoHandlers $ - const $ - Nexmo.sendCall cred m call + liftIO + . try @_ @Nexmo.CallErrorResponse + . recovering x3 nexmoHandlers + $ const + $ Nexmo.sendCall cred m call case r of Left ex -> case Nexmo.caStatus ex of Nexmo.CallDestinationNotPermitted -> unreachable ex @@ -106,10 +108,10 @@ sendCall call = unless (isTestPhone $ Nexmo.callTo call) $ do unreachable ex = warn (toException ex) >> throwM PhoneNumberUnreachable barred ex = warn (toException ex) >> throwM PhoneNumberBarred warn ex = - Log.warn $ - msg (val "Voice call failed.") - ~~ field "error" (show ex) - ~~ field "phone" (Nexmo.callTo call) + Log.warn + $ msg (val "Voice call failed.") + ~~ field "error" (show ex) + ~~ field "phone" (Nexmo.callTo call) sendSms :: ( MonadClient m, @@ -146,10 +148,12 @@ sendSms loc SMSMessage {..} = unless (isTestPhone smsTo) $ do sendNexmoSms :: (MonadIO f, MonadReader Env f) => Manager -> f () sendNexmoSms mgr = do crd <- view nexmoCreds - void . liftIO . recovering x3 nexmoHandlers $ - const $ - Nexmo.sendMessage crd mgr $ - Nexmo.Message "Wire" smsTo smsText (toNexmoCharset loc) + void + . liftIO + . recovering x3 nexmoHandlers + $ const + $ Nexmo.sendMessage crd mgr + $ Nexmo.Message "Wire" smsTo smsText (toNexmoCharset loc) toNexmoCharset :: Locale -> Nexmo.Charset toNexmoCharset l = case fromLanguage (lLanguage l) of RU -> Nexmo.UCS2 @@ -163,9 +167,11 @@ sendSms loc SMSMessage {..} = unless (isTestPhone smsTo) $ do sendTwilioSms :: (MonadIO f, MonadReader Env f) => Manager -> f () sendTwilioSms mgr = do crd <- view twilioCreds - void . liftIO . recovering x3 twilioHandlers $ - const $ - Twilio.sendMessage crd mgr (Twilio.Message smsFrom smsTo smsText) + void + . liftIO + . recovering x3 twilioHandlers + $ const + $ Twilio.sendMessage crd mgr (Twilio.Message smsFrom smsTo smsText) nexmoFailed = [ Handler $ \(ex :: HttpException) -> pure (Just (SomeException ex)), @@ -193,10 +199,10 @@ sendSms loc SMSMessage {..} = unless (isTestPhone smsTo) $ do unreachable ex = warn (toException ex) >> throwM PhoneNumberUnreachable barred ex = warn (toException ex) >> throwM PhoneNumberBarred warn ex = - Log.warn $ - msg (val "SMS failed.") - ~~ field "error" (show ex) - ~~ field "phone" smsTo + Log.warn + $ msg (val "SMS failed.") + ~~ field "error" (show ex) + ~~ field "phone" smsTo ------------------------------------------------------------------------------- -- Phone Number Validation @@ -210,10 +216,11 @@ validatePhone (Phone p) c <- view twilioCreds m <- view httpManager r <- - liftIO . try @_ @Twilio.ErrorResponse $ - recovering x3 httpHandlers $ - const $ - Twilio.lookupPhone c m p LookupNoDetail Nothing + liftIO + . try @_ @Twilio.ErrorResponse + $ recovering x3 httpHandlers + $ const + $ Twilio.lookupPhone c m p LookupNoDetail Nothing case r of Right x -> pure (Just (Phone (Twilio.lookupE164 x))) Left e | Twilio.errStatus e == 404 -> pure Nothing @@ -245,16 +252,16 @@ withSmsBudget phone go = do r <- withBudget k smsBudget go case r of BudgetExhausted t -> do - Log.info $ - msg (val "SMS budget exhausted.") - ~~ field "phone" phone + Log.info + $ msg (val "SMS budget exhausted.") + ~~ field "phone" phone Prom.incCounter smsBudgetExhaustedCounter throwM (PhoneBudgetExhausted t) BudgetedValue a b -> do - Log.debug $ - msg (val "SMS budget deducted.") - ~~ field "budget" b - ~~ field "phone" phone + Log.debug + $ msg (val "SMS budget deducted.") + ~~ field "budget" b + ~~ field "phone" phone pure a -------------------------------------------------------------------------------- @@ -280,16 +287,16 @@ withCallBudget phone go = do r <- withBudget k callBudget go case r of BudgetExhausted t -> do - Log.info $ - msg (val "Voice call budget exhausted.") - ~~ field "phone" phone + Log.info + $ msg (val "Voice call budget exhausted.") + ~~ field "phone" phone Prom.incCounter callBudgetExhaustedCounter throwM (PhoneBudgetExhausted t) BudgetedValue a b -> do - Log.debug $ - msg (val "Voice call budget deducted.") - ~~ field "budget" b - ~~ field "phone" phone + Log.debug + $ msg (val "Voice call budget deducted.") + ~~ field "budget" b + ~~ field "phone" phone pure a -------------------------------------------------------------------------------- @@ -325,8 +332,8 @@ x3 = limitRetries 3 <> exponentialBackoff 100000 {-# NOINLINE callBudgetExhaustedCounter #-} callBudgetExhaustedCounter :: Prom.Counter callBudgetExhaustedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "budget.call.exhausted", Prom.metricHelp = "Number of times budget for calls got exhausted" @@ -335,8 +342,8 @@ callBudgetExhaustedCounter = {-# NOINLINE smsBudgetExhaustedCounter #-} smsBudgetExhaustedCounter :: Prom.Counter smsBudgetExhaustedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "budget.sms.exhausted", Prom.metricHelp = "Number of times budget for sending SMS got exhausted" diff --git a/services/brig/src/Brig/Provider/API.hs b/services/brig/src/Brig/Provider/API.hs index 56587b0d68f..5226d740c71 100644 --- a/services/brig/src/Brig/Provider/API.hs +++ b/services/brig/src/Brig/Provider/API.hs @@ -160,7 +160,7 @@ servicesAPI = :<|> Named @"get-whitelisted-services-by-team-id" searchTeamServiceProfiles :<|> Named @"post-team-whitelist-by-team-id" updateServiceWhitelist -providerAPI :: Member GalleyAPIAccess r => ServerT ProviderAPI (Handler r) +providerAPI :: (Member GalleyAPIAccess r) => ServerT ProviderAPI (Handler r) providerAPI = Named @"provider-register" newAccount :<|> Named @"provider-activate" activateAccountKey @@ -174,13 +174,13 @@ providerAPI = :<|> Named @"provider-get-account" getAccount :<|> Named @"provider-get-profile" getProviderProfile -internalProviderAPI :: Member GalleyAPIAccess r => ServerT BrigIRoutes.ProviderAPI (Handler r) +internalProviderAPI :: (Member GalleyAPIAccess r) => ServerT BrigIRoutes.ProviderAPI (Handler r) internalProviderAPI = Named @"get-provider-activation-code" getActivationCodeH -------------------------------------------------------------------------------- -- Public API (Unauthenticated) -newAccount :: Member GalleyAPIAccess r => Public.NewProvider -> (Handler r) Public.NewProviderResponse +newAccount :: (Member GalleyAPIAccess r) => Public.NewProvider -> (Handler r) Public.NewProviderResponse newAccount new = do guardSecondFactorDisabled Nothing email <- case validateEmail (Public.newProviderEmail new) of @@ -213,7 +213,7 @@ newAccount new = do lift $ sendActivationMail name email key val False pure $ Public.NewProviderResponse pid newPass -activateAccountKey :: Member GalleyAPIAccess r => Code.Key -> Code.Value -> (Handler r) (Maybe Public.ProviderActivationResponse) +activateAccountKey :: (Member GalleyAPIAccess r) => Code.Key -> Code.Value -> (Handler r) (Maybe Public.ProviderActivationResponse) activateAccountKey key val = do guardSecondFactorDisabled Nothing c <- wrapClientE (Code.verify key Code.IdentityVerification val) >>= maybeInvalidCode @@ -236,7 +236,7 @@ activateAccountKey key val = do lift $ sendApprovalConfirmMail name email pure . Just $ Public.ProviderActivationResponse email -getActivationCodeH :: Member GalleyAPIAccess r => Public.Email -> (Handler r) Code.KeyValuePair +getActivationCodeH :: (Member GalleyAPIAccess r) => Public.Email -> (Handler r) Code.KeyValuePair getActivationCodeH e = do guardSecondFactorDisabled Nothing email <- case validateEmail e of @@ -246,18 +246,18 @@ getActivationCodeH e = do code <- wrapClientE $ Code.lookup (Code.genKey gen) Code.IdentityVerification maybe (throwStd activationKeyNotFound) (pure . Code.codeToKeyValuePair) code -login :: Member GalleyAPIAccess r => ProviderLogin -> Handler r ProviderTokenCookie +login :: (Member GalleyAPIAccess r) => ProviderLogin -> Handler r ProviderTokenCookie login l = do guardSecondFactorDisabled Nothing pid <- wrapClientE (DB.lookupKey (mkEmailKey (providerLoginEmail l))) >>= maybeBadCredentials pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials - unless (verifyPassword (providerLoginPassword l) pass) $ - throwStd (errorToWai @'E.BadCredentials) + unless (verifyPassword (providerLoginPassword l) pass) + $ throwStd (errorToWai @'E.BadCredentials) token <- ZAuth.newProviderToken pid s <- view settings pure $ ProviderTokenCookie (ProviderToken token) (not (setCookieInsecure s)) -beginPasswordReset :: Member GalleyAPIAccess r => Public.PasswordReset -> (Handler r) () +beginPasswordReset :: (Member GalleyAPIAccess r) => Public.PasswordReset -> (Handler r) () beginPasswordReset (Public.PasswordReset target) = do guardSecondFactorDisabled Nothing pid <- wrapClientE (DB.lookupKey (mkEmailKey target)) >>= maybeBadCredentials @@ -275,7 +275,7 @@ beginPasswordReset (Public.PasswordReset target) = do tryInsertVerificationCode code $ verificationCodeThrottledError . VerificationCodeThrottled lift $ sendPasswordResetMail target (Code.codeKey code) (Code.codeValue code) -completePasswordReset :: Member GalleyAPIAccess r => Public.CompletePasswordReset -> (Handler r) () +completePasswordReset :: (Member GalleyAPIAccess r) => Public.CompletePasswordReset -> (Handler r) () completePasswordReset (Public.CompletePasswordReset key val newpwd) = do guardSecondFactorDisabled Nothing code <- wrapClientE (Code.verify key Code.PasswordReset val) >>= maybeInvalidCode @@ -292,23 +292,23 @@ completePasswordReset (Public.CompletePasswordReset key val newpwd) = do -------------------------------------------------------------------------------- -- Provider API -getAccount :: Member GalleyAPIAccess r => ProviderId -> (Handler r) (Maybe Public.Provider) +getAccount :: (Member GalleyAPIAccess r) => ProviderId -> (Handler r) (Maybe Public.Provider) getAccount pid = do guardSecondFactorDisabled Nothing wrapClientE $ DB.lookupAccount pid -updateAccountProfile :: Member GalleyAPIAccess r => ProviderId -> Public.UpdateProvider -> (Handler r) () +updateAccountProfile :: (Member GalleyAPIAccess r) => ProviderId -> Public.UpdateProvider -> (Handler r) () updateAccountProfile pid upd = do guardSecondFactorDisabled Nothing _ <- wrapClientE (DB.lookupAccount pid) >>= maybeInvalidProvider - wrapClientE $ - DB.updateAccountProfile + wrapClientE + $ DB.updateAccountProfile pid (updateProviderName upd) (updateProviderUrl upd) (updateProviderDescr upd) -updateAccountEmail :: Member GalleyAPIAccess r => ProviderId -> Public.EmailUpdate -> (Handler r) () +updateAccountEmail :: (Member GalleyAPIAccess r) => ProviderId -> Public.EmailUpdate -> (Handler r) () updateAccountEmail pid (Public.EmailUpdate new) = do guardSecondFactorDisabled Nothing email <- case validateEmail new of @@ -327,18 +327,18 @@ updateAccountEmail pid (Public.EmailUpdate new) = do tryInsertVerificationCode code $ verificationCodeThrottledError . VerificationCodeThrottled lift $ sendActivationMail (Name "name") email (Code.codeKey code) (Code.codeValue code) True -updateAccountPassword :: Member GalleyAPIAccess r => ProviderId -> Public.PasswordChange -> (Handler r) () +updateAccountPassword :: (Member GalleyAPIAccess r) => ProviderId -> Public.PasswordChange -> (Handler r) () updateAccountPassword pid upd = do guardSecondFactorDisabled Nothing pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials - unless (verifyPassword (oldPassword upd) pass) $ - throwStd (errorToWai @'E.BadCredentials) - when (verifyPassword (newPassword upd) pass) $ - throwStd (errorToWai @'E.ResetPasswordMustDiffer) + unless (verifyPassword (oldPassword upd) pass) + $ throwStd (errorToWai @'E.BadCredentials) + when (verifyPassword (newPassword upd) pass) + $ throwStd (errorToWai @'E.ResetPasswordMustDiffer) wrapClientE $ DB.updateAccountPassword pid (newPassword upd) addService :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => ProviderId -> Public.NewService -> (Handler r) Public.NewServiceResponse @@ -358,13 +358,13 @@ addService pid new = do let rstoken = maybe (Just token) (const Nothing) (newServiceToken new) pure $ Public.NewServiceResponse sid rstoken -listServices :: Member GalleyAPIAccess r => ProviderId -> (Handler r) [Public.Service] +listServices :: (Member GalleyAPIAccess r) => ProviderId -> (Handler r) [Public.Service] listServices pid = do guardSecondFactorDisabled Nothing wrapClientE $ DB.listServices pid getService :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => ProviderId -> ServiceId -> (Handler r) Public.Service @@ -373,7 +373,7 @@ getService pid sid = do wrapClientE (DB.lookupService pid sid) >>= maybeServiceNotFound updateService :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => ProviderId -> ServiceId -> Public.UpdateService -> @@ -393,8 +393,8 @@ updateService pid sid upd = do let newDescr = fromRange <$> updateServiceDescr upd let newAssets = updateServiceAssets upd -- Update service, tags/prefix index if the service is enabled - wrapClientE $ - DB.updateService + wrapClientE + $ DB.updateService pid sid name @@ -407,7 +407,7 @@ updateService pid sid upd = do (serviceEnabled svc) updateServiceConn :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => ProviderId -> ServiceId -> Public.UpdateServiceConn -> @@ -415,8 +415,8 @@ updateServiceConn :: updateServiceConn pid sid upd = do guardSecondFactorDisabled Nothing pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials - unless (verifyPassword (updateServiceConnPassword upd) pass) $ - throwStd (errorToWai @'E.BadCredentials) + unless (verifyPassword (updateServiceConnPassword upd) pass) + $ throwStd (errorToWai @'E.BadCredentials) scon <- wrapClientE (DB.lookupServiceConn pid sid) >>= maybeServiceNotFound svc <- wrapClientE (DB.lookupServiceProfile pid sid) >>= maybeServiceNotFound let newBaseUrl = updateServiceConnUrl upd @@ -441,8 +441,8 @@ updateServiceConn pid sid upd = do let name = serviceProfileName svc let tags = unsafeRange (serviceProfileTags svc) -- Update index, make it visible over search - wrapClientE $ - if sconEnabled scon + wrapClientE + $ if sconEnabled scon then DB.deleteServiceIndexes pid sid name tags else DB.insertServiceIndexes pid sid name tags @@ -465,8 +465,8 @@ deleteService pid sid del = do guardSecondFactorDisabled Nothing pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials -- We don't care about pwd status when deleting things - unless (verifyPassword (deleteServicePassword del) pass) $ - throwStd (errorToWai @'E.BadCredentials) + unless (verifyPassword (deleteServicePassword del) pass) + $ throwStd (errorToWai @'E.BadCredentials) _ <- wrapClientE (DB.lookupService pid sid) >>= maybeServiceNotFound -- Disable the service wrapClientE $ DB.updateServiceConn pid sid Nothing Nothing Nothing (Just False) @@ -490,9 +490,9 @@ finishDeleteService pid sid = do for_ mbSvc $ \svc -> do let tags = unsafeRange (serviceTags svc) name = serviceName svc - runConduit $ - User.lookupServiceUsers pid sid - .| C.mapM_ (pooledMapConcurrentlyN_ 16 kick) + runConduit + $ User.lookupServiceUsers pid sid + .| C.mapM_ (pooledMapConcurrentlyN_ 16 kick) RPC.removeServiceConn pid sid DB.deleteService pid sid name tags where @@ -509,8 +509,8 @@ deleteAccount pid del = do prov <- wrapClientE (DB.lookupAccount pid) >>= maybeInvalidProvider pass <- wrapClientE (DB.lookupPassword pid) >>= maybeBadCredentials -- We don't care about pwd status when deleting things - unless (verifyPassword (deleteProviderPassword del) pass) $ - throwStd (errorToWai @'E.BadCredentials) + unless (verifyPassword (deleteProviderPassword del) pass) + $ throwStd (errorToWai @'E.BadCredentials) svcs <- wrapClientE $ DB.listServices pid forM_ svcs $ \svc -> do let sid = serviceId svc @@ -524,17 +524,17 @@ deleteAccount pid del = do -------------------------------------------------------------------------------- -- User API -getProviderProfile :: Member GalleyAPIAccess r => UserId -> ProviderId -> (Handler r) (Maybe Public.ProviderProfile) +getProviderProfile :: (Member GalleyAPIAccess r) => UserId -> ProviderId -> (Handler r) (Maybe Public.ProviderProfile) getProviderProfile _ pid = do guardSecondFactorDisabled Nothing wrapClientE (DB.lookupAccountProfile pid) -listServiceProfiles :: Member GalleyAPIAccess r => UserId -> ProviderId -> (Handler r) [Public.ServiceProfile] +listServiceProfiles :: (Member GalleyAPIAccess r) => UserId -> ProviderId -> (Handler r) [Public.ServiceProfile] listServiceProfiles _ pid = do guardSecondFactorDisabled Nothing wrapClientE $ DB.listServiceProfiles pid -getServiceProfile :: Member GalleyAPIAccess r => UserId -> ProviderId -> ServiceId -> (Handler r) Public.ServiceProfile +getServiceProfile :: (Member GalleyAPIAccess r) => UserId -> ProviderId -> ServiceId -> (Handler r) Public.ServiceProfile getServiceProfile _ pid sid = do guardSecondFactorDisabled Nothing wrapClientE (DB.lookupServiceProfile pid sid) >>= maybeServiceNotFound @@ -543,7 +543,7 @@ getServiceProfile _ pid sid = do -- pagination here, we need both 'start' and 'prefix'. -- -- Also see Note [buggy pagination]. -searchServiceProfiles :: Member GalleyAPIAccess r => UserId -> Maybe (Public.QueryAnyTags 1 3) -> Maybe Text -> Maybe (Range 10 100 Int32) -> (Handler r) Public.ServiceProfilePage +searchServiceProfiles :: (Member GalleyAPIAccess r) => UserId -> Maybe (Public.QueryAnyTags 1 3) -> Maybe Text -> Maybe (Range 10 100 Int32) -> (Handler r) Public.ServiceProfilePage searchServiceProfiles _ Nothing (Just start) mSize = do guardSecondFactorDisabled Nothing prefix :: Range 1 128 Text <- rangeChecked start @@ -572,19 +572,19 @@ searchTeamServiceProfiles uid tid prefix mFilterDisabled mSize = do let filterDisabled = fromMaybe True mFilterDisabled let size = fromMaybe (unsafeRange 20) mSize teamId <- lift $ wrapClient $ User.lookupUserTeam uid - unless (Just tid == teamId) $ - throwStd insufficientTeamPermissions + unless (Just tid == teamId) + $ throwStd insufficientTeamPermissions -- Get search results wrapClientE $ DB.paginateServiceWhitelist tid prefix filterDisabled (fromRange size) -getServiceTagList :: Member GalleyAPIAccess r => UserId -> (Handler r) Public.ServiceTagList +getServiceTagList :: (Member GalleyAPIAccess r) => UserId -> (Handler r) Public.ServiceTagList getServiceTagList _ = do guardSecondFactorDisabled Nothing pure (Public.ServiceTagList allTags) where allTags = [(minBound :: Public.ServiceTag) ..] -updateServiceWhitelist :: Member GalleyAPIAccess r => UserId -> ConnId -> TeamId -> Public.UpdateServiceWhitelist -> (Handler r) UpdateServiceWhitelistResp +updateServiceWhitelist :: (Member GalleyAPIAccess r) => UserId -> ConnId -> TeamId -> Public.UpdateServiceWhitelist -> (Handler r) UpdateServiceWhitelistResp updateServiceWhitelist uid con tid upd = do guardSecondFactorDisabled (Just uid) let pid = updateServiceWhitelistProvider upd @@ -609,19 +609,19 @@ updateServiceWhitelist uid con tid upd = do wrapHttpClient runConduit $ User.lookupServiceUsersForTeam pid sid tid - .| C.mapM_ - ( pooledMapConcurrentlyN_ - 16 - ( uncurry (deleteBot uid (Just con)) - ) - ) + .| C.mapM_ + ( pooledMapConcurrentlyN_ + 16 + ( uncurry (deleteBot uid (Just con)) + ) + ) wrapClientE $ DB.deleteServiceWhitelist (Just tid) pid sid pure UpdateServiceWhitelistRespChanged -------------------------------------------------------------------------------- -- Bot API -addBot :: Member GalleyAPIAccess r => UserId -> ConnId -> ConvId -> Public.AddBot -> (Handler r) Public.AddBotResponse +addBot :: (Member GalleyAPIAccess r) => UserId -> ConnId -> ConvId -> Public.AddBot -> (Handler r) Public.AddBotResponse addBot zuid zcon cid add = do guardSecondFactorDisabled (Just zuid) zusr <- lift (wrapClient $ User.lookupUser NoPendingInvitations zuid) >>= maybeInvalidUser @@ -639,24 +639,24 @@ addBot zuid zcon cid add = do -- Also see `removeBot` for a similar check. guardConvAdmin cnv let mems = cnvMembers cnv - unless (cnvType cnv == RegularConv) $ - throwStd (errorToWai @'E.InvalidConversation) + unless (cnvType cnv == RegularConv) + $ throwStd (errorToWai @'E.InvalidConversation) maxSize <- fromIntegral . setMaxConvSize <$> view settings - unless (length (cmOthers mems) < maxSize - 1) $ - throwStd (errorToWai @'E.TooManyConversationMembers) + unless (length (cmOthers mems) < maxSize - 1) + $ throwStd (errorToWai @'E.TooManyConversationMembers) -- For team conversations: bots are not allowed in -- team-only conversations - unless (Set.member ServiceAccessRole (cnvAccessRoles cnv)) $ - throwStd (errorToWai @'E.InvalidConversation) + unless (Set.member ServiceAccessRole (cnvAccessRoles cnv)) + $ throwStd (errorToWai @'E.InvalidConversation) -- Lookup the relevant service data scon <- wrapClientE (DB.lookupServiceConn pid sid) >>= maybeServiceNotFound - unless (sconEnabled scon) $ - throwStd (errorToWai @'E.ServiceDisabled) + unless (sconEnabled scon) + $ throwStd (errorToWai @'E.ServiceDisabled) svp <- wrapClientE (DB.lookupServiceProfile pid sid) >>= maybeServiceNotFound for_ (cnvTeam cnv) $ \tid -> do whitelisted <- wrapClientE $ DB.getServiceWhitelistStatus tid pid sid - unless whitelisted $ - throwStd serviceNotWhitelisted + unless whitelisted + $ throwStd serviceNotWhitelisted -- Prepare a user ID, client ID and token for the bot. bid <- BotId <$> randomId domain <- viewFederationDomain @@ -695,8 +695,8 @@ addBot zuid zcon cid add = do -- Add the bot to the conversation ev <- lift $ RPC.addBotMember zuid zcon cid bid (clientId clt) pid sid - pure $ - Public.AddBotResponse + pure + $ Public.AddBotResponse { Public.rsAddBotId = bid, Public.rsAddBotClient = bcl, Public.rsAddBotName = name, @@ -705,7 +705,7 @@ addBot zuid zcon cid add = do Public.rsAddBotEvent = ev } -removeBot :: Member GalleyAPIAccess r => UserId -> ConnId -> ConvId -> BotId -> (Handler r) (Maybe Public.RemoveBotResponse) +removeBot :: (Member GalleyAPIAccess r) => UserId -> ConnId -> ConvId -> BotId -> (Handler r) (Maybe Public.RemoveBotResponse) removeBot zusr zcon cid bid = do guardSecondFactorDisabled (Just zusr) -- Get the conversation and check preconditions @@ -718,8 +718,8 @@ removeBot zusr zcon cid bid = do -- Also see `addBot` for a similar check. guardConvAdmin cnv let mems = cnvMembers cnv - unless (cnvType cnv == RegularConv) $ - (throwStd (errorToWai @'E.InvalidConversation)) + unless (cnvType cnv == RegularConv) + $ (throwStd (errorToWai @'E.InvalidConversation)) -- Find the bot in the member list and delete it let busr = botUserId bid let bot = List.find ((== busr) . qUnqualified . omQualifiedId) (cmOthers mems) @@ -738,12 +738,12 @@ botGetSelf bot = do p <- lift $ wrapClient $ User.lookupUser NoPendingInvitations (botUserId bot) maybe (throwStd (errorToWai @'E.UserNotFound)) (\u -> pure $ Public.mkUserProfile EmailVisibleToSelf u UserLegalHoldNoConsent) p -botGetClient :: Member GalleyAPIAccess r => BotId -> (Handler r) (Maybe Public.Client) +botGetClient :: (Member GalleyAPIAccess r) => BotId -> (Handler r) (Maybe Public.Client) botGetClient bot = do guardSecondFactorDisabled (Just (botUserId bot)) lift $ listToMaybe <$> wrapClient (User.lookupClients (botUserId bot)) -botListPrekeys :: Member GalleyAPIAccess r => BotId -> (Handler r) [Public.PrekeyId] +botListPrekeys :: (Member GalleyAPIAccess r) => BotId -> (Handler r) [Public.PrekeyId] botListPrekeys bot = do guardSecondFactorDisabled (Just (botUserId bot)) clt <- lift $ listToMaybe <$> wrapClient (User.lookupClients (botUserId bot)) @@ -751,7 +751,7 @@ botListPrekeys bot = do Nothing -> pure [] Just ci -> lift (wrapClient $ User.lookupPrekeyIds (botUserId bot) ci) -botUpdatePrekeys :: Member GalleyAPIAccess r => BotId -> Public.UpdateBotPrekeys -> (Handler r) () +botUpdatePrekeys :: (Member GalleyAPIAccess r) => BotId -> Public.UpdateBotPrekeys -> (Handler r) () botUpdatePrekeys bot upd = do guardSecondFactorDisabled (Just (botUserId bot)) clt <- lift $ listToMaybe <$> wrapClient (User.lookupClients (botUserId bot)) @@ -772,24 +772,24 @@ botClaimUsersPrekeys :: botClaimUsersPrekeys _ body = do guardSecondFactorDisabled Nothing maxSize <- fromIntegral . setMaxConvSize <$> view settings - when (Map.size (Public.userClients body) > maxSize) $ - throwStd (errorToWai @'E.TooManyClients) + when (Map.size (Public.userClients body) > maxSize) + $ throwStd (errorToWai @'E.TooManyClients) Client.claimLocalMultiPrekeyBundles UnprotectedBot body !>> clientError -botListUserProfiles :: Member GalleyAPIAccess r => BotId -> (CommaSeparatedList UserId) -> (Handler r) [Public.BotUserView] +botListUserProfiles :: (Member GalleyAPIAccess r) => BotId -> (CommaSeparatedList UserId) -> (Handler r) [Public.BotUserView] botListUserProfiles _ uids = do guardSecondFactorDisabled Nothing -- should we check all user ids? us <- lift . wrapClient $ User.lookupUsers NoPendingInvitations (fromCommaSeparatedList uids) pure (map mkBotUserView us) -botGetUserClients :: Member GalleyAPIAccess r => BotId -> UserId -> (Handler r) [Public.PubClient] +botGetUserClients :: (Member GalleyAPIAccess r) => BotId -> UserId -> (Handler r) [Public.PubClient] botGetUserClients _ uid = do guardSecondFactorDisabled (Just uid) lift $ pubClient <$$> wrapClient (User.lookupClients uid) where pubClient c = Public.PubClient (clientId c) (clientClass c) -botDeleteSelf :: Member GalleyAPIAccess r => BotId -> ConvId -> (Handler r) () +botDeleteSelf :: (Member GalleyAPIAccess r) => BotId -> ConvId -> (Handler r) () botDeleteSelf bid cid = do guardSecondFactorDisabled (Just (botUserId bid)) bot <- lift . wrapClient $ User.lookupUser NoPendingInvitations (botUserId bid) @@ -803,7 +803,7 @@ botDeleteSelf bid cid = do -- | If second factor auth is enabled, make sure that end-points that don't support it, but should, are blocked completely. -- (This is a workaround until we have 2FA for those end-points as well.) guardSecondFactorDisabled :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => Maybe UserId -> ExceptT Error (AppT r) () guardSecondFactorDisabled mbUserId = do @@ -817,8 +817,8 @@ activate :: ProviderId -> Maybe Public.Email -> Public.Email -> (Handler r) () activate pid old new = do let emailKey = mkEmailKey new taken <- maybe False (/= pid) <$> wrapClientE (DB.lookupKey emailKey) - when taken $ - throwStd emailExists + when taken + $ throwStd emailExists wrapClientE $ DB.insertKey pid (mkEmailKey <$> old) emailKey deleteBot :: @@ -850,10 +850,11 @@ deleteBot zusr zcon bid cid = do void $ runExceptT $ User.updateStatus buid Deleted pure ev -validateServiceKey :: MonadIO m => Public.ServiceKeyPEM -> m (Maybe (Public.ServiceKey, Fingerprint Rsa)) +validateServiceKey :: (MonadIO m) => Public.ServiceKeyPEM -> m (Maybe (Public.ServiceKey, Fingerprint Rsa)) validateServiceKey pem = - liftIO $ - readPublicKey >>= \pk -> + liftIO + $ readPublicKey + >>= \pk -> case SSL.toPublicKey =<< pk of Nothing -> pure Nothing Just pk' -> do @@ -882,25 +883,25 @@ mkBotUserView u = Ext.botUserViewTeam = userTeam u } -maybeInvalidProvider :: Monad m => Maybe a -> (ExceptT Error m) a +maybeInvalidProvider :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeInvalidProvider = maybe (throwStd (errorToWai @'E.ProviderNotFound)) pure -maybeInvalidCode :: Monad m => Maybe a -> (ExceptT Error m) a +maybeInvalidCode :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeInvalidCode = maybe (throwStd (errorToWai @'E.InvalidCode)) pure -maybeServiceNotFound :: Monad m => Maybe a -> (ExceptT Error m) a +maybeServiceNotFound :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeServiceNotFound = maybe (throwStd (errorToWai @'E.ServiceNotFound)) pure -maybeConvNotFound :: Monad m => Maybe a -> (ExceptT Error m) a +maybeConvNotFound :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeConvNotFound = maybe (throwStd (notFound "Conversation not found")) pure -maybeBadCredentials :: Monad m => Maybe a -> (ExceptT Error m) a +maybeBadCredentials :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeBadCredentials = maybe (throwStd (errorToWai @'E.BadCredentials)) pure -maybeInvalidServiceKey :: Monad m => Maybe a -> (ExceptT Error m) a +maybeInvalidServiceKey :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeInvalidServiceKey = maybe (throwStd (errorToWai @'E.InvalidServiceKey)) pure -maybeInvalidUser :: Monad m => Maybe a -> (ExceptT Error m) a +maybeInvalidUser :: (Monad m) => Maybe a -> (ExceptT Error m) a maybeInvalidUser = maybe (throwStd (errorToWai @'E.InvalidUser)) pure rangeChecked :: (KnownNat n, KnownNat m, Within a n m, Monad monad) => a -> (ExceptT Error monad) (Range n m a) @@ -919,5 +920,5 @@ serviceError :: RPC.ServiceError -> Wai.Error serviceError (RPC.ServiceUnavailableWith str) = badGatewayWith str serviceError RPC.ServiceBotConflict = tooManyBots -randServiceToken :: MonadIO m => m Public.ServiceToken +randServiceToken :: (MonadIO m) => m Public.ServiceToken randServiceToken = ServiceToken . Ascii.encodeBase64Url <$> liftIO (randBytes 18) diff --git a/services/brig/src/Brig/Provider/DB.hs b/services/brig/src/Brig/Provider/DB.hs index 77aefc29ea5..df0877beac3 100644 --- a/services/brig/src/Brig/Provider/DB.hs +++ b/services/brig/src/Brig/Provider/DB.hs @@ -42,7 +42,7 @@ type RangedServiceTags = Range 0 3 (Set.Set ServiceTag) -- Providers insertAccount :: - MonadClient m => + (MonadClient m) => Name -> Password -> HttpsUrl -> @@ -57,7 +57,7 @@ insertAccount name pass url descr = do cql = "INSERT INTO provider (id, name, password, url, descr) VALUES (?, ?, ?, ?, ?)" updateAccountProfile :: - MonadClient m => + (MonadClient m) => ProviderId -> Maybe Name -> Maybe HttpsUrl -> @@ -79,7 +79,7 @@ updateAccountProfile p name url descr = retry x5 . batch $ do -- | Lookup the raw account data of a (possibly unverified) provider. lookupAccountData :: - MonadClient m => + (MonadClient m) => ProviderId -> m (Maybe (Name, Maybe Email, HttpsUrl, Text)) lookupAccountData p = retry x1 $ query1 cql $ params LocalQuorum (Identity p) @@ -88,7 +88,7 @@ lookupAccountData p = retry x1 $ query1 cql $ params LocalQuorum (Identity p) cql = "SELECT name, email, url, descr FROM provider WHERE id = ?" lookupAccount :: - MonadClient m => + (MonadClient m) => ProviderId -> m (Maybe Provider) lookupAccount p = (>>= mk) <$> lookupAccountData p @@ -98,26 +98,26 @@ lookupAccount p = (>>= mk) <$> lookupAccountData p mk (n, Just e, u, d) = Just $! Provider p n e u d lookupAccountProfile :: - MonadClient m => + (MonadClient m) => ProviderId -> m (Maybe ProviderProfile) lookupAccountProfile p = fmap ProviderProfile <$> lookupAccount p lookupPassword :: - MonadClient m => + (MonadClient m) => ProviderId -> m (Maybe Password) lookupPassword p = - fmap (fmap runIdentity) $ - retry x1 $ - query1 cql $ - params LocalQuorum (Identity p) + fmap (fmap runIdentity) + $ retry x1 + $ query1 cql + $ params LocalQuorum (Identity p) where cql :: PrepQuery R (Identity ProviderId) (Identity Password) cql = "SELECT password FROM provider WHERE id = ?" deleteAccount :: - MonadClient m => + (MonadClient m) => ProviderId -> m () deleteAccount pid = retry x5 $ write cql $ params LocalQuorum (Identity pid) @@ -126,7 +126,7 @@ deleteAccount pid = retry x5 $ write cql $ params LocalQuorum (Identity pid) cql = "DELETE FROM provider WHERE id = ?" updateAccountPassword :: - MonadClient m => + (MonadClient m) => ProviderId -> PlainTextPassword6 -> m () @@ -141,7 +141,7 @@ updateAccountPassword pid pwd = do -- Unique (Natural) Keys insertKey :: - MonadClient m => + (MonadClient m) => ProviderId -> Maybe EmailKey -> EmailKey -> @@ -163,19 +163,19 @@ insertKey p old new = retry x5 . batch $ do cqlEmail = {- `IF EXISTS`, but that requires benchmarking -} "UPDATE provider SET email = ? WHERE id = ?" lookupKey :: - MonadClient m => + (MonadClient m) => EmailKey -> m (Maybe ProviderId) lookupKey k = - fmap (fmap runIdentity) $ - retry x1 $ - query1 cql $ - params LocalQuorum (Identity (emailKeyUniq k)) + fmap (fmap runIdentity) + $ retry x1 + $ query1 cql + $ params LocalQuorum (Identity (emailKeyUniq k)) where cql :: PrepQuery R (Identity Text) (Identity ProviderId) cql = "SELECT provider FROM provider_keys WHERE key = ?" -deleteKey :: MonadClient m => EmailKey -> m () +deleteKey :: (MonadClient m) => EmailKey -> m () deleteKey k = retry x5 $ write cql $ params LocalQuorum (Identity (emailKeyUniq k)) where cql :: PrepQuery W (Identity Text) () @@ -185,7 +185,7 @@ deleteKey k = retry x5 $ write cql $ params LocalQuorum (Identity (emailKeyUniq -- Services insertService :: - MonadClient m => + (MonadClient m) => ProviderId -> Name -> Text -> @@ -200,11 +200,11 @@ insertService :: insertService pid name summary descr url token key fprint assets tags = do sid <- randomId let tagSet = C.Set (Set.toList tags) - retry x5 $ - write cql $ - params - LocalQuorum - (pid, sid, name, summary, descr, url, [token], [key], [fprint], assets, tagSet, False) + retry x5 + $ write cql + $ params + LocalQuorum + (pid, sid, name, summary, descr, url, [token], [key], [fprint], assets, tagSet, False) pure sid where cql :: @@ -230,15 +230,15 @@ insertService pid name summary descr url token key fprint assets tags = do \VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" lookupService :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> m (Maybe Service) lookupService pid sid = - fmap (fmap mk) $ - retry x1 $ - query1 cql $ - params LocalQuorum (pid, sid) + fmap (fmap mk) + $ retry x1 + $ query1 cql + $ params LocalQuorum (pid, sid) where cql :: PrepQuery @@ -252,14 +252,14 @@ lookupService pid sid = Service sid name (fromMaybe mempty summary) descr url toks keys assets (Set.fromList (fromSet tags)) enabled listServices :: - MonadClient m => + (MonadClient m) => ProviderId -> m [Service] listServices p = - fmap (map mk) $ - retry x1 $ - query cql $ - params LocalQuorum (Identity p) + fmap (map mk) + $ retry x1 + $ query cql + $ params LocalQuorum (Identity p) where cql :: PrepQuery @@ -274,7 +274,7 @@ listServices p = in Service sid name (fromMaybe mempty summary) descr url toks keys assets tags' enabled updateService :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> Name -> @@ -319,7 +319,7 @@ updateService pid sid svcName svcTags nameChange summary descr assets tagsChange -- NB: can take a significant amount of time if many teams were using the service deleteService :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> Name -> @@ -346,15 +346,15 @@ deleteService pid sid name tags = do -- | Note: Consistency = One lookupServiceProfile :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> m (Maybe ServiceProfile) lookupServiceProfile p s = - fmap (fmap mk) $ - retry x1 $ - query1 cql $ - params One (p, s) + fmap (fmap mk) + $ retry x1 + $ query1 cql + $ params One (p, s) where cql :: PrepQuery R (ProviderId, ServiceId) (Name, Maybe Text, Text, [Asset], C.Set ServiceTag, Bool) cql = @@ -366,14 +366,14 @@ lookupServiceProfile p s = -- | Note: Consistency = One listServiceProfiles :: - MonadClient m => + (MonadClient m) => ProviderId -> m [ServiceProfile] listServiceProfiles p = - fmap (map mk) $ - retry x1 $ - query cql $ - params One (Identity p) + fmap (map mk) + $ retry x1 + $ query cql + $ params One (Identity p) where cql :: PrepQuery @@ -401,15 +401,15 @@ data ServiceConn = ServiceConn -- | Lookup the connection information of a service. lookupServiceConn :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> m (Maybe ServiceConn) lookupServiceConn pid sid = - fmap (fmap mk) $ - retry x1 $ - query1 cql $ - params LocalQuorum (pid, sid) + fmap (fmap mk) + $ retry x1 + $ query1 cql + $ params LocalQuorum (pid, sid) where cql :: PrepQuery R (ProviderId, ServiceId) (HttpsUrl, List1 ServiceToken, List1 (Fingerprint Rsa), Bool) cql = @@ -419,7 +419,7 @@ lookupServiceConn pid sid = -- | Update connection information of a service. updateServiceConn :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> Maybe HttpsUrl -> @@ -453,7 +453,7 @@ updateServiceConn pid sid url tokens keys enabled = retry x5 . batch $ do -- Service "Indexes" (tag and prefix); contain only enabled services insertServiceIndexes :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> Name -> @@ -467,7 +467,7 @@ insertServiceIndexes pid sid name tags = insertServiceTags pid sid name tags deleteServiceIndexes :: - MonadClient m => + (MonadClient m) => ProviderId -> ServiceId -> Name -> @@ -572,7 +572,7 @@ type IndexRow = (Name, ProviderId, ServiceId) -- | Note: Consistency = One paginateServiceTags :: - MonadClient m => + (MonadClient m) => QueryAnyTags 1 3 -> Maybe Text -> Int32 -> @@ -657,7 +657,7 @@ updateServicePrefix pid sid oldName newName = do insertServicePrefix pid sid newName paginateServiceNames :: - MonadClient m => + (MonadClient m) => Maybe (Range 1 128 Text) -> Int32 -> Maybe ProviderId -> @@ -688,9 +688,9 @@ paginateServiceNames mbPrefix size providerFilter = liftClient $ do \FROM service_prefix \ \WHERE prefix = ? AND name >= ?" p <- - retry x1 $ - paginate cql $ - paramsP One (mkPrefixIndex (Name prefix), prefix) len + retry x1 + $ paginate cql + $ paramsP One (mkPrefixIndex (Name prefix), prefix) len pure $! p {result = trim size (result p)} -- Pagination utilities @@ -713,13 +713,13 @@ filterPrefix prefix p = do more = allValid && hasMore p in p {hasMore = more, result = prefixed} -resolveRow :: MonadClient m => IndexRow -> m (Maybe ServiceProfile) +resolveRow :: (MonadClient m) => IndexRow -> m (Maybe ServiceProfile) resolveRow (_, pid, sid) = lookupServiceProfile pid sid -------------------------------------------------------------------------------- -- Service whitelist -insertServiceWhitelist :: MonadClient m => TeamId -> ProviderId -> ServiceId -> m () +insertServiceWhitelist :: (MonadClient m) => TeamId -> ProviderId -> ServiceId -> m () insertServiceWhitelist tid pid sid = retry x5 . batch $ do addPrepQuery insert1 (tid, pid, sid) @@ -739,7 +739,7 @@ insertServiceWhitelist tid pid sid = -- -- NB: Can take a significant amount of time if many teams were using the service -deleteServiceWhitelist :: MonadClient m => Maybe TeamId -> ProviderId -> ServiceId -> m () +deleteServiceWhitelist :: (MonadClient m) => Maybe TeamId -> ProviderId -> ServiceId -> m () deleteServiceWhitelist mbTid pid sid = case mbTid of Nothing -> do teams <- retry x5 $ query lookupRev $ params LocalQuorum (pid, sid) @@ -775,7 +775,7 @@ deleteServiceWhitelist mbTid pid sid = case mbTid of -- paginateServiceWhitelist :: - MonadClient m => + (MonadClient m) => -- | Team for which to list the services TeamId -> -- | Prefix @@ -797,8 +797,8 @@ paginateServiceWhitelist tid mbPrefix filterDisabled size = liftClient $ do . maybeFilterDisabled . catMaybes <$> mapConcurrently (uncurry lookupServiceProfile) p - pure $! - ServiceProfilePage + pure + $! ServiceProfilePage (length r > fromIntegral size) (trim size r) where @@ -817,7 +817,7 @@ paginateServiceWhitelist tid mbPrefix filterDisabled size = liftClient $ do | otherwise = id getServiceWhitelistStatus :: - MonadClient m => + (MonadClient m) => TeamId -> ProviderId -> ServiceId -> diff --git a/services/brig/src/Brig/Provider/RPC.hs b/services/brig/src/Brig/Provider/RPC.hs index a95873c5ccd..8f5f07f9bc3 100644 --- a/services/brig/src/Brig/Provider/RPC.hs +++ b/services/brig/src/Brig/Provider/RPC.hs @@ -76,14 +76,14 @@ createBot scon new = do let fprs = toList (sconFingerprints scon) (man, verifyFingerprints) <- view extGetManager extHandleAll onExc $ do - rs <- lift $ - wrapHttp $ - recovering x3 httpHandlers $ - const $ - liftIO $ - withVerifiedSslConnection (verifyFingerprints fprs) man reqBuilder $ - \req -> - Http.httpLbs req man + rs <- lift + $ wrapHttp + $ recovering x3 httpHandlers + $ const + $ liftIO + $ withVerifiedSslConnection (verifyFingerprints fprs) man reqBuilder + $ \req -> + Http.httpLbs req man case Bilge.statusCode rs of 201 -> decodeBytes "External" (responseBody rs) 409 -> throwE ServiceBotConflict @@ -111,7 +111,7 @@ extReq scon ps = url = httpsUrl (sconBaseUrl scon) tok = List1.head (sconAuthTokens scon) -extHandleAll :: MonadCatch m => (SomeException -> m a) -> m a -> m a +extHandleAll :: (MonadCatch m) => (SomeException -> m a) -> m a -> m a extHandleAll f ma = catches ma @@ -124,11 +124,11 @@ extHandleAll f ma = -- other important errors. extLogError :: (MonadLogger m, Show e) => ServiceConn -> e -> m () extLogError scon e = - Log.info $ - field "provider" (toByteString pid) - ~~ field "service" (toByteString sid) - ~~ field "error" (show e) - ~~ msg (val "External service error") + Log.info + $ field "provider" (toByteString pid) + ~~ field "service" (toByteString sid) + ~~ field "error" (show e) + ~~ msg (val "External service error") where pid = sconProvider scon sid = sconService scon @@ -139,11 +139,11 @@ extLogError scon e = -- | Set service connection information in galley. setServiceConn :: ServiceConn -> AppT r () setServiceConn scon = do - Log.debug $ - remote "galley" - . field "provider" (toByteString pid) - . field "service" (toByteString sid) - . msg (val "Setting service connection") + Log.debug + $ remote "galley" + . field "provider" (toByteString pid) + . field "service" (toByteString sid) + . msg (val "Setting service connection") void $ wrapHttp $ galleyRequest POST req where pid = sconProvider scon @@ -174,11 +174,11 @@ removeServiceConn :: ServiceId -> m () removeServiceConn pid sid = do - Log.debug $ - remote "galley" - . field "provider" (toByteString pid) - . field "service" (toByteString sid) - . msg (val "Removing service connection") + Log.debug + $ remote "galley" + . field "provider" (toByteString pid) + . field "service" (toByteString sid) + . msg (val "Removing service connection") void $ galleyRequest DELETE req where req = @@ -198,14 +198,14 @@ addBotMember :: ServiceId -> (AppT r) Conv.Event addBotMember zusr zcon conv bot clt pid sid = do - Log.debug $ - remote "galley" - . field "provider" (toByteString pid) - . field "service" (toByteString sid) - . field "conv" (toByteString conv) - . field "user" (toByteString zusr) - . field "bot" (toByteString bot) - . msg (val "Adding bot member") + Log.debug + $ remote "galley" + . field "provider" (toByteString pid) + . field "service" (toByteString sid) + . field "conv" (toByteString conv) + . field "user" (toByteString zusr) + . field "bot" (toByteString bot) + . msg (val "Adding bot member") decodeBody "galley" =<< wrapHttp (galleyRequest POST req) where req = @@ -231,12 +231,12 @@ removeBotMember :: BotId -> m (Maybe Conv.Event) removeBotMember zusr zcon conv bot = do - Log.debug $ - remote "galley" - . field "user" (toByteString zusr) - . field "conv" (toByteString conv) - . field "bot" (toByteString bot) - . msg (val "Removing bot member") + Log.debug + $ remote "galley" + . field "user" (toByteString zusr) + . field "conv" (toByteString conv) + . field "bot" (toByteString bot) + . msg (val "Removing bot member") rs <- galleyRequest DELETE req if isJust (responseBody rs) && Bilge.statusCode rs == 200 then Just <$> decodeBody "galley" rs diff --git a/services/brig/src/Brig/Queue.hs b/services/brig/src/Brig/Queue.hs index a5e7d4d275b..f77d81aa856 100644 --- a/services/brig/src/Brig/Queue.hs +++ b/services/brig/src/Brig/Queue.hs @@ -70,11 +70,11 @@ enqueue (SqsQueueEnv env _ queue) message = do bodyMD5 <- digest <$> view digestMD5 <*> pure body resp <- AWS.execute env (AWS.enqueueStandard queue body) unless (resp ^. sendMessageResponse_mD5OfMessageBody == Just bodyMD5) $ do - Log.err $ - msg (val "Returned hash (MD5) doesn't match message hash") - . field "SqsQueue" (show queue) - . field "returned_hash" (show (resp ^. sendMessageResponse_mD5OfMessageBody)) - . field "message_hash" (show (Just bodyMD5)) + Log.err + $ msg (val "Returned hash (MD5) doesn't match message hash") + . field "SqsQueue" (show queue) + . field "returned_hash" (show (resp ^. sendMessageResponse_mD5OfMessageBody)) + . field "message_hash" (show (Just bodyMD5)) throwM (ErrorCall "The server couldn't access a queue") where digest :: Digest -> BL.ByteString -> Text diff --git a/services/brig/src/Brig/Queue/Stomp.hs b/services/brig/src/Brig/Queue/Stomp.hs index 0ec44a75f24..d6d8c3abfca 100644 --- a/services/brig/src/Brig/Queue/Stomp.hs +++ b/services/brig/src/Brig/Queue/Stomp.hs @@ -180,7 +180,7 @@ listen b q callback = ------------------------------------------------------------------------------- -- Utilities -iconv :: FromJSON a => Text -> InBound a +iconv :: (FromJSON a) => Text -> InBound a iconv queue _ _ _ bs = case Aeson.eitherDecode (BL.fromStrict bs) of Right x -> pure x @@ -188,7 +188,7 @@ iconv queue _ _ _ bs = convertError $ "Error when parsing message from STOMP queue " <> unpack queue <> ": " <> e -oconv :: ToJSON a => OutBound a +oconv :: (ToJSON a) => OutBound a oconv = pure . BL.toStrict . Aeson.encode jsonType :: MIME.Type diff --git a/services/brig/src/Brig/RPC.hs b/services/brig/src/Brig/RPC.hs index c421ad468d2..b68d5961984 100644 --- a/services/brig/src/Brig/RPC.hs +++ b/services/brig/src/Brig/RPC.hs @@ -73,6 +73,6 @@ serviceRequestImpl :: (Request -> Request) -> m (Response (Maybe BL.ByteString)) serviceRequestImpl nm service m r = do - recovering x3 rpcHandlers $ - const $ - rpc' nm service (method m . r) + recovering x3 rpcHandlers + $ const + $ rpc' nm service (method m . r) diff --git a/services/brig/src/Brig/Run.hs b/services/brig/src/Brig/Run.hs index 7e31ac802b1..1a37b596e62 100644 --- a/services/brig/src/Brig/Run.hs +++ b/services/brig/src/Brig/Run.hs @@ -83,16 +83,19 @@ run o = do (app, e) <- mkApp o s <- Server.newSettings (server e) internalEventListener <- - Async.async $ - runBrigToIO e $ - wrapHttpClient $ - Queue.listen (e ^. internalEvents) $ - liftIO . runBrigToIO e . liftSem . Internal.onEvent + Async.async + $ runBrigToIO e + $ wrapHttpClient + $ Queue.listen (e ^. internalEvents) + $ liftIO + . runBrigToIO e + . liftSem + . Internal.onEvent let throttleMillis = fromMaybe defSqsThrottleMillis $ setSqsThrottleMillis (optSettings o) emailListener <- for (e ^. awsEnv . sesQueue) $ \q -> - Async.async $ - AWS.execute (e ^. awsEnv) $ - AWS.listen throttleMillis q (runBrigToIO e . SesNotification.onEvent) + Async.async + $ AWS.execute (e ^. awsEnv) + $ AWS.listen throttleMillis q (runBrigToIO e . SesNotification.onEvent) sftDiscovery <- forM (e ^. sftEnv) $ Async.async . Calling.startSFTServiceDiscovery (e ^. applog) turnDiscovery <- Calling.startTurnDiscovery (e ^. applog) (e ^. fsWatcher) (e ^. turnEnv) authMetrics <- Async.async (runBrigToIO e collectAuthMetrics) @@ -164,8 +167,8 @@ bodyParserErrorFormatter _ _ errMsg = { Servant.errHTTPCode = HTTP.statusCode HTTP.status400, Servant.errReasonPhrase = UTF8.toString $ HTTP.statusMessage HTTP.status400, Servant.errBody = - Aeson.encode $ - Aeson.object + Aeson.encode + $ Aeson.object [ "code" Aeson..= Aeson.Number 400, "message" Aeson..= errMsg, "label" Aeson..= ("bad-request" :: Text) @@ -196,15 +199,16 @@ pendingActivationCleanup = do uid ) - API.deleteUsersNoVerify $ - mapMaybe + API.deleteUsersNoVerify + $ mapMaybe ( \(isExpired, isPendingInvitation, uid) -> if isExpired && isPendingInvitation then Just uid else Nothing ) uids - liftSem . UsersPendingActivationStore.removeMultiple $ - mapMaybe + liftSem + . UsersPendingActivationStore.removeMultiple + $ mapMaybe ( \(isExpired, _isPendingInvitation, uid) -> if isExpired then Just uid else Nothing ) @@ -214,8 +218,9 @@ pendingActivationCleanup = do where safeForever :: (MonadIO m, MonadLogger m, MonadCatch m) => String -> m () -> m () safeForever funName action = - forever $ - action `catchAny` \exc -> do + forever + $ action + `catchAny` \exc -> do err $ "error" .= show exc ~~ msg (val $ UTF8.fromString funName <> " failed") -- pause to keep worst-case noise in logs manageable threadDelay 60_000_000 @@ -243,8 +248,9 @@ pendingActivationCleanup = do collectAuthMetrics :: forall r. AppT r () collectAuthMetrics = do env <- view (awsEnv . amazonkaEnv) - liftIO $ - forever $ do + liftIO + $ forever + $ do mbRemaining <- readAuthExpiration env gaugeTokenRemaing mbRemaining threadDelay 1_000_000 diff --git a/services/brig/src/Brig/SMTP.hs b/services/brig/src/Brig/SMTP.hs index 75694ee3c11..bffcdebca25 100644 --- a/services/brig/src/Brig/SMTP.hs +++ b/services/brig/src/Brig/SMTP.hs @@ -116,8 +116,8 @@ initSMTP' timeoutDuration lg host port credentials connType = do error $ "Failed to establish test connection with SMTP server: " ++ show e ) catch - ( logExceptionOrResult lg "Closing test connection on startup" $ - ensureSMTPConnectionTimeout timeoutDuration (SMTP.gracefullyCloseSMTP con) + ( logExceptionOrResult lg "Closing test connection on startup" + $ ensureSMTPConnectionTimeout timeoutDuration (SMTP.gracefullyCloseSMTP con) ) ( \(e :: SomeException) -> do -- Ensure that the logs are written: In case of failure, the error thrown @@ -137,16 +137,16 @@ initSMTP' timeoutDuration lg host port credentials connType = do (Plain, Just p) -> SMTP.connectSMTPPort (unpack host) p (TLS, Nothing) -> SMTP.connectSMTPSTARTTLS (unpack host) (TLS, Just p) -> - SMTP.connectSMTPSTARTTLSWithSettings (unpack host) $ - SMTP.defaultSettingsSMTPSTARTTLS {SMTP.sslPort = p} + SMTP.connectSMTPSTARTTLSWithSettings (unpack host) + $ SMTP.defaultSettingsSMTPSTARTTLS {SMTP.sslPort = p} (SSL, Nothing) -> SMTP.connectSMTPSSL (unpack host) (SSL, Just p) -> - SMTP.connectSMTPSSLWithSettings (unpack host) $ - SMTP.defaultSettingsSMTPSSL {SMTP.sslPort = p} + SMTP.connectSMTPSSLWithSettings (unpack host) + $ SMTP.defaultSettingsSMTPSSL {SMTP.sslPort = p} ok <- case credentials of (Just (Username u, Password p)) -> - ensureTimeout $ - SMTP.authenticate SMTP.LOGIN (unpack u) (unpack p) conn + ensureTimeout + $ SMTP.authenticate SMTP.LOGIN (unpack u) (unpack p) conn _ -> pure True if ok then pure conn @@ -167,8 +167,8 @@ initSMTP' timeoutDuration lg host port credentials connType = do withAsyncWithUnmask do \unmask -> do - logExceptionOrResult lg ("Closing pooled SMTP connection to " ++ unpack host) $ - unmask do + logExceptionOrResult lg ("Closing pooled SMTP connection to " ++ unpack host) + $ unmask do ensureTimeout $ SMTP.gracefullyCloseSMTP c do wait @@ -233,5 +233,5 @@ sendMail' timeoutDuration lg s m = liftIO $ withResource (s ^. pool) sendMail'' where sendMail'' :: SMTP.SMTPConnection -> IO () sendMail'' c = - logExceptionOrResult lg "Sending mail via SMTP" $ - ensureSMTPConnectionTimeout timeoutDuration (SMTP.sendMail m c) + logExceptionOrResult lg "Sending mail via SMTP" + $ ensureSMTPConnectionTimeout timeoutDuration (SMTP.sendMail m c) diff --git a/services/brig/src/Brig/Schema/V43.hs b/services/brig/src/Brig/Schema/V43.hs index 42038f4d0a0..e5a0ee4c856 100644 --- a/services/brig/src/Brig/Schema/V43.hs +++ b/services/brig/src/Brig/Schema/V43.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 43 "Initial brig schema at time of open-sourcing wire-server in 2017" $ do - void $ - schema' + void + $ schema' [r| create columnfamily if not exists user ( id uuid @@ -45,8 +45,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (id) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| -- verified, 'unique' user attributes create columnfamily if not exists user_keys @@ -55,8 +55,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (key) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| -- (temporary) activation keys create columnfamily if not exists activation_keys @@ -70,8 +70,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (key) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| -- (temporary) password reset codes create columnfamily if not exists password_reset @@ -81,8 +81,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (key) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| create columnfamily if not exists connection ( left uuid -- user id "from" in the relation @@ -94,13 +94,13 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (left, right) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| create index if not exists conn_status on connection (status); |] - void $ - schema' + void + $ schema' [r| create columnfamily if not exists invitee_info ( invitee uuid -- user id generated with the invitation @@ -111,8 +111,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv |] -- Add prekeys - void $ - schema' + void + $ schema' [r| create columnfamily if not exists clients ( user uuid @@ -123,8 +123,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (user, client) ); |] - void $ - schema' + void + $ schema' [r| create columnfamily if not exists prekeys ( user uuid @@ -136,8 +136,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv |] -- Add properties - void $ - schema' + void + $ schema' [r| create columnfamily if not exists properties ( user uuid @@ -148,8 +148,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv |] -- Add login_codes - void $ - schema' + void + $ schema' [r| create columnfamily if not exists login_codes ( user uuid @@ -161,13 +161,13 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv |] -- Add password_reset.retries and timeout - void $ - schema' + void + $ schema' [r| alter columnfamily password_reset add retries int; |] - void $ - schema' + void + $ schema' [r| alter columnfamily password_reset add timeout timestamp; |] @@ -177,8 +177,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv schema' [r| alter columnfamily clients add cookie text; |] -- Create new invitations tables - void $ - schema' + void + $ schema' [r| create columnfamily if not exists invitation ( inviter uuid -- user id that created the invitation @@ -191,8 +191,8 @@ migration = Migration 43 "Initial brig schema at time of open-sourcing wire-serv , primary key (inviter, id) ); |] - void $ - schema' + void + $ schema' [r| create columnfamily if not exists invitation_info ( code ascii -- code of the invitation (known only by invitee) diff --git a/services/brig/src/Brig/Schema/V44.hs b/services/brig/src/Brig/Schema/V44.hs index b1222e53ff1..76d0d2ca8b6 100644 --- a/services/brig/src/Brig/Schema/V44.hs +++ b/services/brig/src/Brig/Schema/V44.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 44 "Use LeveledCompactionStrategy on clients" $ - schema' + Migration 44 "Use LeveledCompactionStrategy on clients" + $ schema' [r| ALTER TABLE clients WITH compaction = {'class': 'LeveledCompactionStrategy'}; diff --git a/services/brig/src/Brig/Schema/V45.hs b/services/brig/src/Brig/Schema/V45.hs index 070801bd535..0861bfa0b48 100644 --- a/services/brig/src/Brig/Schema/V45.hs +++ b/services/brig/src/Brig/Schema/V45.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 45 "Use LeveledCompactionStrategy on prekeys" $ - schema' + Migration 45 "Use LeveledCompactionStrategy on prekeys" + $ schema' [r| ALTER TABLE prekeys WITH compaction = {'class': 'LeveledCompactionStrategy'}; diff --git a/services/brig/src/Brig/Schema/V46.hs b/services/brig/src/Brig/Schema/V46.hs index c4d223582cf..c6cd069d617 100644 --- a/services/brig/src/Brig/Schema/V46.hs +++ b/services/brig/src/Brig/Schema/V46.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 46 "Add summary field to service table" $ - schema' + Migration 46 "Add summary field to service table" + $ schema' [r| alter table service add summary text |] diff --git a/services/brig/src/Brig/Schema/V47.hs b/services/brig/src/Brig/Schema/V47.hs index e6f94b5e3b3..315e824e0de 100644 --- a/services/brig/src/Brig/Schema/V47.hs +++ b/services/brig/src/Brig/Schema/V47.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 47 "Create and populate prefix table" $ - schema' + Migration 47 "Create and populate prefix table" + $ schema' [r| create table if not exists service_prefix ( prefix text diff --git a/services/brig/src/Brig/Schema/V48.hs b/services/brig/src/Brig/Schema/V48.hs index 44927c581eb..6201ff99ac5 100644 --- a/services/brig/src/Brig/Schema/V48.hs +++ b/services/brig/src/Brig/Schema/V48.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 48 "Add expiration to user table" $ - schema' [r| ALTER TABLE user ADD expires timestamp; |] + Migration 48 "Add expiration to user table" + $ schema' [r| ALTER TABLE user ADD expires timestamp; |] diff --git a/services/brig/src/Brig/Schema/V49.hs b/services/brig/src/Brig/Schema/V49.hs index b319ce45295..58fd2098093 100644 --- a/services/brig/src/Brig/Schema/V49.hs +++ b/services/brig/src/Brig/Schema/V49.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 49 "Add binding team to user table" $ - schema' [r| ALTER TABLE user ADD team uuid; |] + Migration 49 "Add binding team to user table" + $ schema' [r| ALTER TABLE user ADD team uuid; |] diff --git a/services/brig/src/Brig/Schema/V50.hs b/services/brig/src/Brig/Schema/V50.hs index ccfda0525e7..0086b4757b6 100644 --- a/services/brig/src/Brig/Schema/V50.hs +++ b/services/brig/src/Brig/Schema/V50.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 50 "Add UserSSOId to user table" $ - schema' [r| ALTER TABLE user ADD sso_id text; |] + Migration 50 "Add UserSSOId to user table" + $ schema' [r| ALTER TABLE user ADD sso_id text; |] diff --git a/services/brig/src/Brig/Schema/V51.hs b/services/brig/src/Brig/Schema/V51.hs index e0e2b3b7489..833a7c27521 100644 --- a/services/brig/src/Brig/Schema/V51.hs +++ b/services/brig/src/Brig/Schema/V51.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 51 "Add blacklist table" $ - schema' + Migration 51 "Add blacklist table" + $ schema' [r| create table if not exists blacklist ( key text -- blacklisted email/phone diff --git a/services/brig/src/Brig/Schema/V52.hs b/services/brig/src/Brig/Schema/V52.hs index e102ffceac4..bd4147f29ba 100644 --- a/services/brig/src/Brig/Schema/V52.hs +++ b/services/brig/src/Brig/Schema/V52.hs @@ -28,8 +28,8 @@ migration :: Migration migration = Migration 52 "Add service whitelist table" $ do -- NB. It's expected that for every team there'll only be a few -- whitelisted services (tens? maybe less). - void $ - schema' + void + $ schema' [r| create table if not exists service_whitelist ( team uuid @@ -42,8 +42,8 @@ migration = Migration 52 "Add service whitelist table" $ do -- Since 'service_whitelist' has 'team' as the partition key, Cassandra -- won't allow a naive "delete ... where service = X" query. Hence, we -- will create and maintain a reverse index for the whitelist. - void $ - schema' + void + $ schema' [r| create table if not exists service_whitelist_rev ( team uuid diff --git a/services/brig/src/Brig/Schema/V53.hs b/services/brig/src/Brig/Schema/V53.hs index 475eb68c6f5..e7f64653eae 100644 --- a/services/brig/src/Brig/Schema/V53.hs +++ b/services/brig/src/Brig/Schema/V53.hs @@ -33,8 +33,8 @@ migration = Migration 53 "Add tables for tracking users spawned by services" $ d -- Operations we need to support: -- * Delete a user knowing (provider, service, user) -- * Select all users for (provider, service) - void $ - schema' + void + $ schema' [r| create table if not exists service_user ( provider uuid @@ -52,8 +52,8 @@ migration = Migration 53 "Add tables for tracking users spawned by services" $ d -- * Delete a user knowing (provider, service, user): -- can be done by consulting the previous table -- * Select all users for (provider, service, team) - void $ - schema' + void + $ schema' [r| create table if not exists service_team ( provider uuid diff --git a/services/brig/src/Brig/Schema/V56.hs b/services/brig/src/Brig/Schema/V56.hs index 052d86089ee..2c99cf2b690 100644 --- a/services/brig/src/Brig/Schema/V56.hs +++ b/services/brig/src/Brig/Schema/V56.hs @@ -36,8 +36,8 @@ migration = Migration 56 "Add table to exclude phone number prefixes" $ do -- * Add a new prefix of arbitrary length -- * Remove a prefix -- * Given a phone number, check whether it matches any existing prefix - void $ - schema' + void + $ schema' [r| create table if not exists excluded_phones ( prefix text diff --git a/services/brig/src/Brig/Schema/V58.hs b/services/brig/src/Brig/Schema/V58.hs index a5e074efe80..ed5c44332e9 100644 --- a/services/brig/src/Brig/Schema/V58.hs +++ b/services/brig/src/Brig/Schema/V58.hs @@ -29,8 +29,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 58 "Add table for storing rich info" $ do - void $ - schema' + void + $ schema' [r| create table if not exists rich_info ( user uuid diff --git a/services/brig/src/Brig/Schema/V61_team_invitation_email.hs b/services/brig/src/Brig/Schema/V61_team_invitation_email.hs index 1f1a863942b..1507feefe21 100644 --- a/services/brig/src/Brig/Schema/V61_team_invitation_email.hs +++ b/services/brig/src/Brig/Schema/V61_team_invitation_email.hs @@ -31,8 +31,8 @@ migration :: Migration migration = -- This table adds a lookup-by-email possibility, -- see also the team_invitation table - Migration 61 "Add team_invitation_email table" $ - schema' + Migration 61 "Add team_invitation_email table" + $ schema' [r| CREATE TABLE team_invitation_email ( email text diff --git a/services/brig/src/Brig/Schema/V63_AddUsersPendingActivation.hs b/services/brig/src/Brig/Schema/V63_AddUsersPendingActivation.hs index 540d6603ca6..994329ed8af 100644 --- a/services/brig/src/Brig/Schema/V63_AddUsersPendingActivation.hs +++ b/services/brig/src/Brig/Schema/V63_AddUsersPendingActivation.hs @@ -23,7 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 63 "Add users_pending_activation" $ + Migration 63 "Add users_pending_activation" + $ -- This table keeps track of users that were invited via SCIM. -- When their invitation expires this table is used -- to clean any data of these expired users. diff --git a/services/brig/src/Brig/Schema/V67_MLSKeyPackages.hs b/services/brig/src/Brig/Schema/V67_MLSKeyPackages.hs index 21d14d97338..fff4c3404e2 100644 --- a/services/brig/src/Brig/Schema/V67_MLSKeyPackages.hs +++ b/services/brig/src/Brig/Schema/V67_MLSKeyPackages.hs @@ -28,8 +28,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 67 "Add table for MLS key packages" $ - schema' + Migration 67 "Add table for MLS key packages" + $ schema' [r| CREATE TABLE mls_key_packages ( user uuid diff --git a/services/brig/src/Brig/Schema/V69_MLSKeyPackageRefMapping.hs b/services/brig/src/Brig/Schema/V69_MLSKeyPackageRefMapping.hs index a1a5933b107..f197c6b676e 100644 --- a/services/brig/src/Brig/Schema/V69_MLSKeyPackageRefMapping.hs +++ b/services/brig/src/Brig/Schema/V69_MLSKeyPackageRefMapping.hs @@ -29,8 +29,8 @@ import Text.RawString.QQ -- FUTUREWORK: remove this table migration :: Migration migration = - Migration 69 "Add key package ref mapping" $ - schema' + Migration 69 "Add key package ref mapping" + $ schema' [r| CREATE TABLE mls_key_package_refs ( ref blob diff --git a/services/brig/src/Brig/Schema/V70_UserEmailUnvalidated.hs b/services/brig/src/Brig/Schema/V70_UserEmailUnvalidated.hs index 8373d8931fc..efa183deaab 100644 --- a/services/brig/src/Brig/Schema/V70_UserEmailUnvalidated.hs +++ b/services/brig/src/Brig/Schema/V70_UserEmailUnvalidated.hs @@ -28,8 +28,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 70 "Add email_unvalidated to user table" $ - schema' + Migration 70 "Add email_unvalidated to user table" + $ schema' [r| ALTER TABLE user ADD ( email_unvalidated text ) diff --git a/services/brig/src/Brig/Schema/V75_AddOAuthCodeChallenge.hs b/services/brig/src/Brig/Schema/V75_AddOAuthCodeChallenge.hs index 62cb91e5dbe..80cc1348994 100644 --- a/services/brig/src/Brig/Schema/V75_AddOAuthCodeChallenge.hs +++ b/services/brig/src/Brig/Schema/V75_AddOAuthCodeChallenge.hs @@ -28,8 +28,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 75 "Add PKCE code_challenge to oauth_auth_code table" $ - schema' + Migration 75 "Add PKCE code_challenge to oauth_auth_code table" + $ schema' [r| ALTER TABLE oauth_auth_code ADD ( code_challenge blob ) diff --git a/services/brig/src/Brig/Schema/V76_AddSupportedProtocols.hs b/services/brig/src/Brig/Schema/V76_AddSupportedProtocols.hs index ddf5baa6361..5939bd6936f 100644 --- a/services/brig/src/Brig/Schema/V76_AddSupportedProtocols.hs +++ b/services/brig/src/Brig/Schema/V76_AddSupportedProtocols.hs @@ -25,8 +25,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 76 "Add supported_protocols to user table" $ - schema' + Migration 76 "Add supported_protocols to user table" + $ schema' [r| ALTER TABLE user ADD ( supported_protocols int ) diff --git a/services/brig/src/Brig/Schema/V77_FederationRemotes.hs b/services/brig/src/Brig/Schema/V77_FederationRemotes.hs index 1ab4ca90c6b..83336b7c759 100644 --- a/services/brig/src/Brig/Schema/V77_FederationRemotes.hs +++ b/services/brig/src/Brig/Schema/V77_FederationRemotes.hs @@ -28,8 +28,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 77 "Table for keeping track of instances we federate with" $ - schema' + Migration 77 "Table for keeping track of instances we federate with" + $ schema' [r| CREATE TABLE federation_remotes ( domain text PRIMARY KEY, search_policy int diff --git a/services/brig/src/Brig/Schema/V78_ClientLastActive.hs b/services/brig/src/Brig/Schema/V78_ClientLastActive.hs index 2c80519700b..2dbf8be5071 100644 --- a/services/brig/src/Brig/Schema/V78_ClientLastActive.hs +++ b/services/brig/src/Brig/Schema/V78_ClientLastActive.hs @@ -28,8 +28,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 78 "Add last_active field to clients table" $ - schema' + Migration 78 "Add last_active field to clients table" + $ schema' [r| ALTER TABLE clients ADD ( last_active timestamp ) diff --git a/services/brig/src/Brig/Team/API.hs b/services/brig/src/Brig/Team/API.hs index c488e657111..ecd0712c521 100644 --- a/services/brig/src/Brig/Team/API.hs +++ b/services/brig/src/Brig/Team/API.hs @@ -102,7 +102,7 @@ servantAPI = :<|> Named @"head-team-invitations" headInvitationByEmail :<|> Named @"get-team-size" teamSizePublic -teamSizePublic :: Member GalleyAPIAccess r => UserId -> TeamId -> (Handler r) TeamSize +teamSizePublic :: (Member GalleyAPIAccess r) => UserId -> TeamId -> (Handler r) TeamSize teamSizePublic uid tid = do ensurePermissions uid tid [AddTeamMember] -- limit this to team admins to reduce risk of involuntary DOS attacks teamSize tid @@ -193,9 +193,9 @@ createInvitationViaScim tid newUser@(NewUserScimInvitation _tid uid loc name ema . logTeam tid . logEmail email - void $ - logInvitationRequest context $ - createInvitation' tid (Just uid) inviteeRole Nothing fromEmail invreq + void + $ logInvitationRequest context + $ createInvitation' tid (Just uid) inviteeRole Nothing fromEmail invreq createUserInviteViaScim newUser @@ -205,12 +205,12 @@ logInvitationRequest context action = eith <- action' case eith of Left err' -> do - Log.warn $ - context - . Log.msg @Text - ( "Failed to create invitation, label: " - <> (LT.toStrict . errorLabel) err' - ) + Log.warn + $ context + . Log.msg @Text + ( "Failed to create invitation, label: " + <> (LT.toStrict . errorLabel) err' + ) pure (Left err') Right result@(_, code) -> do Log.info $ (context . logInvitationCode code) . Log.msg @Text "Successfully created invitation" @@ -235,27 +235,27 @@ createInvitation' tid mUid inviteeRole mbInviterUid fromEmail body = do inviteeEmail <- either (const $ throwStd (errorToWai @'E.InvalidEmail)) pure (Email.validateEmail (irInviteeEmail body)) let uke = userEmailKey inviteeEmail blacklistedEm <- lift $ liftSem $ BlacklistStore.exists uke - when blacklistedEm $ - throwStd blacklistedEmail + when blacklistedEm + $ throwStd blacklistedEmail emailTaken <- lift $ isJust <$> wrapClient (Data.lookupKey uke) - when emailTaken $ - throwStd emailExists + when emailTaken + $ throwStd emailExists -- Validate phone inviteePhone <- for (irInviteePhone body) $ \p -> do validatedPhone <- maybe (throwStd (errorToWai @'E.InvalidPhone)) pure =<< lift (wrapClient $ Phone.validatePhone p) let ukp = userPhoneKey validatedPhone blacklistedPh <- lift $ liftSem $ BlacklistStore.exists ukp - when blacklistedPh $ - throwStd (errorToWai @'E.BlacklistedPhone) + when blacklistedPh + $ throwStd (errorToWai @'E.BlacklistedPhone) phoneTaken <- lift $ isJust <$> wrapClient (Data.lookupKey ukp) - when phoneTaken $ - throwStd phoneExists + when phoneTaken + $ throwStd phoneExists pure validatedPhone maxSize <- setMaxTeamSize <$> view settings pending <- lift $ wrapClient $ DB.countInvitations tid - when (fromIntegral pending >= maxSize) $ - throwStd (errorToWai @'E.TooManyTeamInvitations) + when (fromIntegral pending >= maxSize) + $ throwStd (errorToWai @'E.TooManyTeamInvitations) let locale = irLocale body let inviteeName = irInviteeName body @@ -266,8 +266,8 @@ createInvitation' tid mUid inviteeRole mbInviterUid fromEmail body = do now <- liftIO =<< view currentTime timeout <- setTeamInvitationTimeout <$> view settings (newInv, code) <- - wrapClient $ - DB.insertInvitation + wrapClient + $ DB.insertInvitation showInvitationUrl iid tid @@ -280,19 +280,19 @@ createInvitation' tid mUid inviteeRole mbInviterUid fromEmail body = do timeout (newInv, code) <$ sendInvitationMail inviteeEmail tid fromEmail code locale -deleteInvitation :: Member GalleyAPIAccess r => UserId -> TeamId -> InvitationId -> (Handler r) () +deleteInvitation :: (Member GalleyAPIAccess r) => UserId -> TeamId -> InvitationId -> (Handler r) () deleteInvitation uid tid iid = do ensurePermissions uid tid [AddTeamMember] lift $ wrapClient $ DB.deleteInvitation tid iid -listInvitations :: Member GalleyAPIAccess r => UserId -> TeamId -> Maybe InvitationId -> Maybe (Range 1 500 Int32) -> (Handler r) Public.InvitationList +listInvitations :: (Member GalleyAPIAccess r) => UserId -> TeamId -> Maybe InvitationId -> Maybe (Range 1 500 Int32) -> (Handler r) Public.InvitationList listInvitations uid tid start mSize = do ensurePermissions uid tid [AddTeamMember] showInvitationUrl <- lift $ liftSem $ GalleyAPIAccess.getExposeInvitationURLsToTeamAdmin tid rs <- lift $ wrapClient $ DB.lookupInvitations showInvitationUrl tid start (fromMaybe (unsafeRange 100) mSize) pure $! Public.InvitationList (DB.resultList rs) (DB.resultHasMore rs) -getInvitation :: Member GalleyAPIAccess r => UserId -> TeamId -> InvitationId -> (Handler r) (Maybe Public.Invitation) +getInvitation :: (Member GalleyAPIAccess r) => UserId -> TeamId -> InvitationId -> (Handler r) (Maybe Public.Invitation) getInvitation uid tid iid = do ensurePermissions uid tid [AddTeamMember] showInvitationUrl <- lift $ liftSem $ GalleyAPIAccess.getExposeInvitationURLsToTeamAdmin tid @@ -305,12 +305,13 @@ getInvitationByCode c = do headInvitationByEmail :: Email -> (Handler r) Public.HeadInvitationByEmailResult headInvitationByEmail e = do - lift $ - wrapClient $ - DB.lookupInvitationInfoByEmail e <&> \case - DB.InvitationByEmail _ -> Public.InvitationByEmail - DB.InvitationByEmailNotFound -> Public.InvitationByEmailNotFound - DB.InvitationByEmailMoreThanOne -> Public.InvitationByEmailMoreThanOne + lift + $ wrapClient + $ DB.lookupInvitationInfoByEmail e + <&> \case + DB.InvitationByEmail _ -> Public.InvitationByEmail + DB.InvitationByEmailNotFound -> Public.InvitationByEmailNotFound + DB.InvitationByEmailMoreThanOne -> Public.InvitationByEmailMoreThanOne -- | FUTUREWORK: This should also respond with status 409 in case of -- @DB.InvitationByEmailMoreThanOne@. Refactor so that 'headInvitationByEmailH' and @@ -374,8 +375,8 @@ changeTeamAccountStatuses :: (Handler r) () changeTeamAccountStatuses tid s = do team <- Team.tdTeam <$> lift (liftSem $ GalleyAPIAccess.getTeam tid) - unless (team ^. teamBinding == Binding) $ - throwStd noBindingTeam + unless (team ^. teamBinding == Binding) + $ throwStd noBindingTeam uids <- toList1 =<< lift (fmap (view Teams.userId) . view teamMembers <$> liftSem (GalleyAPIAccess.getTeamMembers tid)) API.changeAccountStatus uids s !>> accountStatusError where diff --git a/services/brig/src/Brig/Team/DB.hs b/services/brig/src/Brig/Team/DB.hs index ec22f1f6d81..f767b3b45e0 100644 --- a/services/brig/src/Brig/Team/DB.hs +++ b/services/brig/src/Brig/Team/DB.hs @@ -148,7 +148,7 @@ lookupInvitationByCode showUrl i = Just InvitationInfo {..} -> lookupInvitation showUrl iiTeam iiInvId _ -> pure Nothing -lookupInvitationCode :: MonadClient m => TeamId -> InvitationId -> m (Maybe InvitationCode) +lookupInvitationCode :: (MonadClient m) => TeamId -> InvitationId -> m (Maybe InvitationCode) lookupInvitationCode t r = fmap runIdentity <$> retry x1 (query1 cqlInvitationCode (params LocalQuorum (t, r))) @@ -156,7 +156,7 @@ lookupInvitationCode t r = cqlInvitationCode :: PrepQuery R (TeamId, InvitationId) (Identity InvitationCode) cqlInvitationCode = "SELECT code FROM team_invitation WHERE team = ? AND id = ?" -lookupInvitationCodeEmail :: MonadClient m => TeamId -> InvitationId -> m (Maybe (InvitationCode, Email)) +lookupInvitationCodeEmail :: (MonadClient m) => TeamId -> InvitationId -> m (Maybe (InvitationCode, Email)) lookupInvitationCodeEmail t r = retry x1 (query1 cqlInvitationCodeEmail (params LocalQuorum (t, r))) where cqlInvitationCodeEmail :: PrepQuery R (TeamId, InvitationId) (InvitationCode, Email) @@ -180,8 +180,8 @@ lookupInvitations showUrl team start (fromRange -> size) = do where trim p = take (fromIntegral size) (result p) toResult more invs = - cassandraResultPage $ - emptyPage + cassandraResultPage + $ emptyPage { result = invs, hasMore = more } @@ -190,7 +190,7 @@ lookupInvitations showUrl team start (fromRange -> size) = do cqlSelectFrom :: PrepQuery R (TeamId, InvitationId) (TeamId, Maybe Role, InvitationId, UTCTimeMillis, Maybe UserId, Email, Maybe Name, Maybe Phone, InvitationCode) cqlSelectFrom = "SELECT team, role, id, created_at, created_by, email, name, phone, code FROM team_invitation WHERE team = ? AND id > ? ORDER BY id ASC" -deleteInvitation :: MonadClient m => TeamId -> InvitationId -> m () +deleteInvitation :: (MonadClient m) => TeamId -> InvitationId -> m () deleteInvitation t i = do codeEmail <- lookupInvitationCodeEmail t i case codeEmail of @@ -212,15 +212,15 @@ deleteInvitation t i = do deleteInvitations :: (MonadClient m) => TeamId -> m () deleteInvitations t = - liftClient $ - runConduit $ - paginateC cqlSelect (paramsP LocalQuorum (Identity t) 100) x1 - .| C.mapM_ (pooledMapConcurrentlyN_ 16 (deleteInvitation t . runIdentity)) + liftClient + $ runConduit + $ paginateC cqlSelect (paramsP LocalQuorum (Identity t) 100) x1 + .| C.mapM_ (pooledMapConcurrentlyN_ 16 (deleteInvitation t . runIdentity)) where cqlSelect :: PrepQuery R (Identity TeamId) (Identity InvitationId) cqlSelect = "SELECT id FROM team_invitation WHERE team = ? ORDER BY id ASC" -lookupInvitationInfo :: MonadClient m => InvitationCode -> m (Maybe InvitationInfo) +lookupInvitationInfo :: (MonadClient m) => InvitationCode -> m (Maybe InvitationInfo) lookupInvitationInfo ic@(InvitationCode c) | c == mempty = pure Nothing | otherwise = @@ -254,15 +254,15 @@ lookupInvitationInfoByEmail email = do pure $ InvitationByEmail (InvitationInfo code tid invId) _ : _ : _ -> do -- edge case: more than one pending invite from different teams - Log.info $ - Log.msg (Log.val "team_invidation_email: multiple pending invites from different teams for the same email") - Log.~~ Log.field "email" (show email) + Log.info + $ Log.msg (Log.val "team_invidation_email: multiple pending invites from different teams for the same email") + Log.~~ Log.field "email" (show email) pure InvitationByEmailMoreThanOne where cqlInvitationEmail :: PrepQuery R (Identity Email) (TeamId, InvitationId, InvitationCode) cqlInvitationEmail = "SELECT team, invitation, code FROM team_invitation_email WHERE email = ?" -countInvitations :: MonadClient m => TeamId -> m Int64 +countInvitations :: (MonadClient m) => TeamId -> m Int64 countInvitations t = maybe 0 runIdentity <$> retry x1 (query1 cqlSelect (params LocalQuorum (Identity t))) @@ -311,15 +311,15 @@ mkInviteUrl ShowInvitationUrl team (InvitationCode c) = do replace "code" = toText c replace x = x - parseHttpsUrl :: Log.MonadLogger m => Text -> m (Maybe (URIRef Absolute)) + parseHttpsUrl :: (Log.MonadLogger m) => Text -> m (Maybe (URIRef Absolute)) parseHttpsUrl url = - either (\e -> logError url e >> pure Nothing) (pure . Just) $ - parseURI laxURIParserOptions (encodeUtf8 url) + either (\e -> logError url e >> pure Nothing) (pure . Just) + $ parseURI laxURIParserOptions (encodeUtf8 url) logError :: (Log.MonadLogger m, Show e) => Text -> e -> m () logError url e = - Log.err $ - Log.msg + Log.err + $ Log.msg (Log.val "Unable to create invitation url. Please check configuration.") - . Log.field "url" url - . Log.field "error" (show e) + . Log.field "url" url + . Log.field "error" (show e) diff --git a/services/brig/src/Brig/Team/Util.hs b/services/brig/src/Brig/Team/Util.hs index bf7a3d0da85..d634994b51d 100644 --- a/services/brig/src/Brig/Team/Util.hs +++ b/services/brig/src/Brig/Team/Util.hs @@ -44,8 +44,8 @@ ensurePermissionsOrPersonalUser u perms = do ensurePermissions :: (Member GalleyAPIAccess r, IsPerm perm) => UserId -> TeamId -> [perm] -> ExceptT Error (AppT r) () ensurePermissions u t perms = do m <- lift $ liftSem $ GalleyAPIAccess.getTeamMember u t - unless (check m) $ - throwStd insufficientTeamPermissions + unless (check m) + $ throwStd insufficientTeamPermissions where check :: Maybe TeamMember -> Bool check (Just m) = all (hasPermission m) perms @@ -54,11 +54,11 @@ ensurePermissions u t perms = do -- | Privilege escalation detection (make sure no `RoleMember` user creates a `RoleOwner`). -- -- There is some code duplication with 'Galley.API.Teams.ensureNotElevated'. -ensurePermissionToAddUser :: Member GalleyAPIAccess r => UserId -> TeamId -> Permissions -> ExceptT Error (AppT r) () +ensurePermissionToAddUser :: (Member GalleyAPIAccess r) => UserId -> TeamId -> Permissions -> ExceptT Error (AppT r) () ensurePermissionToAddUser u t inviteePerms = do minviter <- lift $ liftSem $ GalleyAPIAccess.getTeamMember u t - unless (check minviter) $ - throwStd insufficientTeamPermissions + unless (check minviter) + $ throwStd insufficientTeamPermissions where check :: Maybe TeamMember -> Bool check (Just inviter) = diff --git a/services/brig/src/Brig/Template.hs b/services/brig/src/Brig/Template.hs index d66ba6edbfb..3a4275c72fb 100644 --- a/services/brig/src/Brig/Template.hs +++ b/services/brig/src/Brig/Template.hs @@ -89,8 +89,8 @@ readLocalesDir defLocale base typ load = do defLocaleDir = unpack (locToText defLocale) readLocale :: FilePath -> Locale readLocale l = - fromMaybe (error ("Invalid locale: " ++ show l)) $ - parseLocale (pack l) + fromMaybe (error ("Invalid locale: " ++ show l)) + $ parseLocale (pack l) -- | Lookup a localised item from a 'Localised' structure. forLocale :: diff --git a/services/brig/src/Brig/User/API/Handle.hs b/services/brig/src/Brig/User/API/Handle.hs index bfa3407059a..62ee0250b44 100644 --- a/services/brig/src/Brig/User/API/Handle.hs +++ b/services/brig/src/Brig/User/API/Handle.hs @@ -60,9 +60,10 @@ getHandleInfo self handle = do getRemoteHandleInfo :: Remote Handle -> Handler r (Maybe Public.UserProfile) getRemoteHandleInfo handle = do - lift . Log.info $ - Log.msg (Log.val "getHandleInfo - remote lookup") - . Log.field "domain" (show (tDomain handle)) + lift + . Log.info + $ Log.msg (Log.val "getHandleInfo - remote lookup") + . Log.field "domain" (show (tDomain handle)) Federation.getUserHandleInfo handle !>> fedError getLocalHandleInfo :: diff --git a/services/brig/src/Brig/User/API/Search.hs b/services/brig/src/Brig/User/API/Search.hs index 4d9ae68862c..2396236ab08 100644 --- a/services/brig/src/Brig/User/API/Search.hs +++ b/services/brig/src/Brig/User/API/Search.hs @@ -90,10 +90,11 @@ search searcherId searchTerm maybeDomain maybeMaxResults = do searchRemotely :: (Member FederationConfigStore r) => Domain -> Maybe TeamId -> Text -> (Handler r) (Public.SearchResult Public.Contact) searchRemotely domain mTid searchTerm = do - lift . Log.info $ - msg (val "searchRemotely") - ~~ field "domain" (show domain) - ~~ field "searchTerm" searchTerm + lift + . Log.info + $ msg (val "searchRemotely") + ~~ field "domain" (show domain) + ~~ field "searchTerm" searchTerm mFedCnf <- lift $ liftSem $ E.getFederationConfig domain let onlyInTeams = case restriction <$> mFedCnf of Just FederationRestrictionAllowAll -> Nothing @@ -141,8 +142,8 @@ searchLocally searcherId searchTerm maybeMaxResults = do else pure $ SearchResult 0 0 0 [] FullSearch Nothing Nothing -- Prepend results matching exact handle and results from ES. - pure $ - esResult + pure + $ esResult { searchResults = maybeToList maybeExactHandleMatch <> searchResults esResult, searchFound = exactHandleMatchCount + searchFound esResult, searchReturned = exactHandleMatchCount + searchReturned esResult @@ -175,7 +176,7 @@ searchLocally searcherId searchTerm maybeMaxResults = do <$$> HandleAPI.getLocalHandleInfo lsearcherId handle teamUserSearch :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => UserId -> TeamId -> Maybe Text -> diff --git a/services/brig/src/Brig/User/Auth.hs b/services/brig/src/Brig/User/Auth.hs index 2123c562d90..87053117d10 100644 --- a/services/brig/src/Brig/User/Auth.hs +++ b/services/brig/src/Brig/User/Auth.hs @@ -106,8 +106,8 @@ sendLoginCode phone call force = do Just u -> do lift . liftSem . Log.debug $ field "user" (toByteString u) . field "action" (val "User.sendLoginCode") pw <- lift $ wrapClient $ Data.lookupPassword u - unless (isNothing pw || force) $ - throwE SendLoginPasswordExists + unless (isNothing pw || force) + $ throwE SendLoginPasswordExists lift $ wrapHttpClient $ do l <- Data.lookupLocale u c <- Data.createLoginCode u @@ -118,7 +118,7 @@ sendLoginCode phone call force = do pure c lookupLoginCode :: - Member TinyLog r => + (Member TinyLog r) => Phone -> AppT r (Maybe PendingLoginCode) lookupLoginCode phone = @@ -145,8 +145,9 @@ login (PasswordLogin (PasswordLoginData li pw label code)) typ = do uid <- wrapHttpClientE $ resolveLoginId li lift . liftSem . Log.debug $ field "user" (toByteString uid) . field "action" (val "User.login") wrapHttpClientE $ checkRetryLimit uid - wrapHttpClientE $ - Data.authenticate uid pw `catchE` \case + wrapHttpClientE + $ Data.authenticate uid pw + `catchE` \case AuthInvalidUser -> loginFailed uid AuthInvalidCredentials -> loginFailed uid AuthSuspended -> throwE LoginSuspended @@ -167,14 +168,14 @@ login (SmsLogin (SmsLoginData phone code label)) typ = do lift . liftSem . Log.debug $ field "user" (toByteString uid) . field "action" (val "User.login") wrapHttpClientE $ checkRetryLimit uid ok <- wrapHttpClientE $ Data.verifyLoginCode uid code - unless ok $ - wrapHttpClientE $ - loginFailed uid + unless ok + $ wrapHttpClientE + $ loginFailed uid newAccess @ZAuth.User @ZAuth.Access uid Nothing typ label verifyCode :: forall r. - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => Maybe Code.Value -> VerificationAction -> UserId -> @@ -214,7 +215,7 @@ checkRetryLimit :: (MonadClient m, MonadReader Env m) => UserId -> ExceptT Login checkRetryLimit = withRetryLimit checkBudget withRetryLimit :: - MonadReader Env m => + (MonadReader Env m) => (BudgetKey -> Budget -> ExceptT LoginError m (Budgeted ())) -> UserId -> ExceptT LoginError m () @@ -292,14 +293,16 @@ catchSuspendInactiveUser :: catchSuspendInactiveUser uid errval = do mustsuspend <- lift $ wrapHttpClient $ mustSuspendInactiveUser uid when mustsuspend $ do - lift . liftSem . Log.warn $ - msg (val "Suspending user due to inactivity") - ~~ field "user" (toByteString uid) - ~~ field "action" ("user.suspend" :: String) + lift + . liftSem + . Log.warn + $ msg (val "Suspending user due to inactivity") + ~~ field "user" (toByteString uid) + ~~ field "action" ("user.suspend" :: String) lift $ runExceptT (changeSingleAccountStatus uid Suspended) >>= explicitlyIgnoreErrors throwE errval where - explicitlyIgnoreErrors :: Monad m => Either AccountStatusError () -> m () + explicitlyIgnoreErrors :: (Monad m) => Either AccountStatusError () -> m () explicitlyIgnoreErrors = \case Left InvalidAccountStatus -> pure () Left AccountNotFound -> pure () @@ -340,8 +343,8 @@ resolveLoginId li = do case usr of Nothing -> do pending <- lift $ isPendingActivation li - throwE $ - if pending + throwE + $ if pending then LoginPendingActivation else LoginFailed Just uid -> pure uid @@ -401,7 +404,7 @@ validateTokens uts at = do where -- FUTUREWORK: There is surely a better way to do this getFirstSuccessOrFirstFail :: - Monad m => + (Monad m) => List1 (Either ZAuth.Failure (UserId, Cookie (ZAuth.Token u))) -> ExceptT ZAuth.Failure m (UserId, Cookie (ZAuth.Token u)) getFirstSuccessOrFirstFail tks = case (lefts $ NE.toList $ List1.toNonEmpty tks, rights $ NE.toList $ List1.toNonEmpty tks) of @@ -415,8 +418,8 @@ validateToken :: Maybe (ZAuth.Token a) -> ExceptT ZAuth.Failure (AppT r) (UserId, Cookie (ZAuth.Token u)) validateToken ut at = do - unless (maybe True ((ZAuth.userTokenOf ut ==) . ZAuth.accessTokenOf) at) $ - throwE ZAuth.Invalid + unless (maybe True ((ZAuth.userTokenOf ut ==) . ZAuth.accessTokenOf) at) + $ throwE ZAuth.Invalid ExceptT (ZAuth.validateToken ut) forM_ at $ \token -> ExceptT (ZAuth.validateToken token) @@ -478,7 +481,7 @@ legalHoldLogin (LegalHoldLogin uid pw label) typ = do !>> LegalHoldLoginError assertLegalHoldEnabled :: - Member GalleyAPIAccess r => + (Member GalleyAPIAccess r) => TeamId -> ExceptT LegalHoldLoginError (AppT r) () assertLegalHoldEnabled tid = do @@ -487,6 +490,6 @@ assertLegalHoldEnabled tid = do FeatureStatusDisabled -> throwE LegalHoldLoginLegalHoldNotEnabled FeatureStatusEnabled -> pure () -checkClientId :: MonadClient m => UserId -> ClientId -> ExceptT ZAuth.Failure m () +checkClientId :: (MonadClient m) => UserId -> ClientId -> ExceptT ZAuth.Failure m () checkClientId uid cid = lookupClient uid cid >>= maybe (throwE ZAuth.Invalid) (const (pure ())) diff --git a/services/brig/src/Brig/User/Auth/Cookie.hs b/services/brig/src/Brig/User/Auth/Cookie.hs index ebed216d947..a3c4a14f51d 100644 --- a/services/brig/src/Brig/User/Auth/Cookie.hs +++ b/services/brig/src/Brig/User/Auth/Cookie.hs @@ -113,8 +113,8 @@ nextCookie :: nextCookie c mNewCid = runMaybeT $ do let mOldCid = ZAuth.userTokenClient (cookieValue c) -- If both old and new client IDs are present, they must be equal - when (((/=) <$> mOldCid <*> mNewCid) == Just True) $ - throwError ZAuth.Invalid + when (((/=) <$> mOldCid <*> mNewCid) == Just True) + $ throwError ZAuth.Invalid -- Keep old client ID by default, but use new one if none was set. let mcid = mOldCid <|> mNewCid @@ -135,8 +135,8 @@ nextCookie c mNewCid = runMaybeT $ do lift $ trackSuperseded uid (cookieId c) cs <- lift $ DB.listCookies uid c' <- - hoistMaybe $ - List.find (\x -> cookieId x == ck && cookieType x == PersistentCookie) cs + hoistMaybe + $ List.find (\x -> cookieId x == ck && cookieType x == PersistentCookie) cs t <- lift $ ZAuth.mkUserToken uid mcid (cookieIdNum ck) (cookieExpires c') pure c' {cookieValue = t} maybe (renewCookie c mcid) pure c' @@ -197,8 +197,8 @@ newAccessToken c mt = do Just t -> ZAuth.renewAccessToken (ZAuth.userTokenClient (cookieValue c)) t zSettings <- view (zauthEnv . ZAuth.settings) let ttl = view (ZAuth.settingsTTL (Proxy @a)) zSettings - pure $ - bearerToken + pure + $ bearerToken (ZAuth.accessTokenOf t') (toByteString t') ttl @@ -214,23 +214,24 @@ lookupCookie t = do where setToken c = c {cookieValue = t} -listCookies :: MonadClient m => UserId -> [CookieLabel] -> m [Cookie ()] +listCookies :: (MonadClient m) => UserId -> [CookieLabel] -> m [Cookie ()] listCookies u [] = DB.listCookies u listCookies u ll = filter byLabel <$> DB.listCookies u where byLabel c = maybe False (`elem` ll) (cookieLabel c) -revokeAllCookies :: MonadClient m => UserId -> m () +revokeAllCookies :: (MonadClient m) => UserId -> m () revokeAllCookies u = revokeCookies u [] [] -revokeCookies :: MonadClient m => UserId -> [CookieId] -> [CookieLabel] -> m () +revokeCookies :: (MonadClient m) => UserId -> [CookieId] -> [CookieLabel] -> m () revokeCookies u [] [] = DB.deleteAllCookies u revokeCookies u ids labels = do cc <- filter matching <$> DB.listCookies u DB.deleteCookies u cc where matching c = - cookieId c `elem` ids + cookieId c + `elem` ids || maybe False (`elem` labels) (cookieLabel c) -------------------------------------------------------------------------------- @@ -276,8 +277,8 @@ setResponseCookie c r = do toWebCookie :: (MonadReader Env m, ZAuth.UserTokenLike u) => Cookie (ZAuth.Token u) -> m WebCookie.SetCookie toWebCookie c = do s <- view settings - pure $ - WebCookie.def + pure + $ WebCookie.def { WebCookie.setCookieName = "zuid", WebCookie.setCookieValue = toByteString' (cookieValue c), WebCookie.setCookiePath = Just "/access", @@ -295,16 +296,16 @@ toWebCookie c = do trackSuperseded :: (MonadIO m, Log.MonadLogger m, Prom.MonadMonitor m) => UserId -> CookieId -> m () trackSuperseded u c = do Prom.incCounter cookieSupersededCounter - Log.warn $ - msg (val "Superseded cookie used") - ~~ field "user" (toByteString u) - ~~ field "cookie" (cookieIdNum c) + Log.warn + $ msg (val "Superseded cookie used") + ~~ field "user" (toByteString u) + ~~ field "cookie" (cookieIdNum c) {-# NOINLINE cookieSupersededCounter #-} cookieSupersededCounter :: Prom.Counter cookieSupersededCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.auth.cookie.superseded", Prom.metricHelp = "Number of times user's cookie got superseded" diff --git a/services/brig/src/Brig/User/Auth/Cookie/Limit.hs b/services/brig/src/Brig/User/Auth/Cookie/Limit.hs index 034f3ced85f..9514cd8d52a 100644 --- a/services/brig/src/Brig/User/Auth/Cookie/Limit.hs +++ b/services/brig/src/Brig/User/Auth/Cookie/Limit.hs @@ -77,7 +77,8 @@ instance FromJSON StdDev instance FromJSON CookieThrottle where parseJSON = withObject "User.Auth.Cookie.Limit.CookieThrottle" $ \o -> StdDevThrottle - <$> o .: "stdDev" + <$> o + .: "stdDev" <*> (RetryAfter <$> o .: "retryAfter") -- | Check that the standard deviation of cookie creation dates is /higher/ diff --git a/services/brig/src/Brig/User/Auth/DB/Cookie.hs b/services/brig/src/Brig/User/Auth/DB/Cookie.hs index c0d43ef2341..b4198bc0e98 100644 --- a/services/brig/src/Brig/User/Auth/DB/Cookie.hs +++ b/services/brig/src/Brig/User/Auth/DB/Cookie.hs @@ -29,7 +29,7 @@ import Wire.API.User.Auth newtype TTL = TTL {ttlSeconds :: Int32} deriving (Cql) -insertCookie :: MonadClient m => UserId -> Cookie a -> Maybe TTL -> m () +insertCookie :: (MonadClient m) => UserId -> Cookie a -> Maybe TTL -> m () insertCookie u ck ttl = let i = cookieId ck x = cookieExpires ck @@ -45,7 +45,7 @@ insertCookie u ck ttl = "INSERT INTO user_cookies (user, expires, id, type, created, label, succ_id) \ \VALUES (?, ?, ?, ?, ?, ?, ?) USING TTL ?" -lookupCookie :: MonadClient m => UserId -> UTCTime -> CookieId -> m (Maybe (Cookie ())) +lookupCookie :: (MonadClient m) => UserId -> UTCTime -> CookieId -> m (Maybe (Cookie ())) lookupCookie u t c = fmap mkCookie <$> retry x1 (query1 cql (params LocalQuorum (u, t, c))) where @@ -65,7 +65,7 @@ lookupCookie u t c = \FROM user_cookies \ \WHERE user = ? AND expires = ? AND id = ?" -listCookies :: MonadClient m => UserId -> m [Cookie ()] +listCookies :: (MonadClient m) => UserId -> m [Cookie ()] listCookies u = map toCookie <$> retry x1 (query cql (params LocalQuorum (Identity u))) where @@ -87,7 +87,7 @@ listCookies u = cookieValue = () } -deleteCookies :: MonadClient m => UserId -> [Cookie a] -> m () +deleteCookies :: (MonadClient m) => UserId -> [Cookie a] -> m () deleteCookies u cs = retry x5 . batch $ do setType BatchUnLogged setConsistency LocalQuorum @@ -96,7 +96,7 @@ deleteCookies u cs = retry x5 . batch $ do cql :: PrepQuery W (UserId, UTCTime, CookieId) () cql = "DELETE FROM user_cookies WHERE user = ? AND expires = ? AND id = ?" -deleteAllCookies :: MonadClient m => UserId -> m () +deleteAllCookies :: (MonadClient m) => UserId -> m () deleteAllCookies u = retry x5 (write cql (params LocalQuorum (Identity u))) where cql :: PrepQuery W (Identity UserId) () diff --git a/services/brig/src/Brig/User/EJPD.hs b/services/brig/src/Brig/User/EJPD.hs index 4b9ec8fcb4b..b109637c0f6 100644 --- a/services/brig/src/Brig/User/EJPD.hs +++ b/services/brig/src/Brig/User/EJPD.hs @@ -84,9 +84,8 @@ ejpdRequest (fromMaybe False -> includeContacts) (EJPDRequestBody handles) = do if reallyIncludeContacts then do contacts <- - wrapClient $ -- FUTUREWORK: use polysemy effect, not wrapClient - Conn.lookupContactListWithRelation uid - + wrapClient + $ Conn.lookupContactListWithRelation uid -- FUTUREWORK: use polysemy effect, not wrapClient localContacts <- catMaybes <$> do forM contacts $ \(uid', relationDropHistory -> rel) -> do @@ -110,8 +109,9 @@ ejpdRequest (fromMaybe False -> includeContacts) (EJPDRequestBody handles) = do let listType = Team.toNewListType (memberList ^. Team.teamMemberListType) - pure . Just $ - EJPDTeamContacts + pure + . Just + $ EJPDTeamContacts (Set.fromList $ toEJPDResponseItemLeaf <$> catMaybes contactsFull) listType _ -> do @@ -127,21 +127,21 @@ ejpdRequest (fromMaybe False -> includeContacts) (EJPDRequestBody handles) = do cgh <- asks (view cargoholdEndpoint) let key = toByteString' $ assetKey asset resp <- liftSem $ rpcWithRetries "cargohold" cgh (method GET . paths ["/i/assets", key]) - pure $ - case (statusCode resp, responseJsonEither resp) of + pure + $ case (statusCode resp, responseJsonEither resp) of (200, Right (A.String loc)) -> loc _ -> - T.pack $ - "could not fetch asset: " - <> show key - <> ", error: " - <> show (statusCode resp, responseBody resp) + T.pack + $ "could not fetch asset: " + <> show key + <> ", error: " + <> show (statusCode resp, responseBody resp) pure $ case urls of [] -> Nothing something -> Just (Set.fromList something) - pure $ - EJPDResponseItemRoot + pure + $ EJPDResponseItemRoot { ejpdResponseRootUserId = tUntagged luid, ejpdResponseRootTeamId = userTeam target, ejpdResponseRootName = userDisplayName target, diff --git a/services/brig/src/Brig/User/Search/Index.hs b/services/brig/src/Brig/User/Search/Index.hs index b9c098eb4c4..7d0f03e66da 100644 --- a/services/brig/src/Brig/User/Search/Index.hs +++ b/services/brig/src/Brig/User/Search/Index.hs @@ -132,10 +132,10 @@ newtype IndexIO a = IndexIO (ReaderT IndexEnv IO a) MonadMonitor ) -runIndexIO :: MonadIO m => IndexEnv -> IndexIO a -> m a +runIndexIO :: (MonadIO m) => IndexEnv -> IndexIO a -> m a runIndexIO e (IndexIO m) = liftIO $ runReaderT m e -class MonadIO m => MonadIndexIO m where +class (MonadIO m) => MonadIndexIO m where liftIndexIO :: IndexIO a -> m a instance MonadIndexIO IndexIO where @@ -181,9 +181,9 @@ reindex u = do updateIndex :: (MonadIndexIO m, Prom.MonadMonitor IndexIO) => IndexUpdate -> m () updateIndex (IndexUpdateUser updateType iu) = liftIndexIO $ do Prom.incCounter indexUpdateCounter - info $ - field "user" (Bytes.toByteString (view iuUserId iu)) - . msg (val "Indexing user") + info + $ field "user" (Bytes.toByteString (view iuUserId iu)) + . msg (val "Indexing user") idx <- asks idxName withDefaultESUrl $ indexDoc idx withAdditionalESUrl $ traverse_ indexDoc =<< asks idxAdditionalName @@ -202,9 +202,9 @@ updateIndex (IndexUpdateUser updateType iu) = liftIndexIO $ do docId = ES.DocId (view (iuUserId . re _TextId) iu) updateIndex (IndexUpdateUsers updateType ius) = liftIndexIO $ do Prom.incCounter indexBulkUpdateCounter - info $ - field "num_users" (length ius) - . msg (val "Bulk indexing users") + info + $ field "num_users" (length ius) + . msg (val "Bulk indexing users") -- Sadly, 'bloodhound' is not aware of the versioning capabilities of ES' -- bulk API, thus we need to stitch everything together by hand. bhe <- ES.getBHEnv @@ -214,8 +214,8 @@ updateIndex (IndexUpdateUsers updateType ius) = liftIndexIO $ do req <- parseRequest (view unpacked $ base <> "/" <> idx <> "/" <> mpp <> "/_bulk") authHeaders <- mkAuthHeaders res <- - liftIO $ - httpLbs + liftIO + $ httpLbs req { method = "POST", requestHeaders = [(hContentType, "application/x-ndjson")] <> authHeaders, -- sic @@ -233,7 +233,7 @@ updateIndex (IndexUpdateUsers updateType ius) = liftIndexIO $ do creds <- asks idxCredentials pure $ maybe [] ((: []) . mkBasicAuthHeader) creds - encodeJSONToString :: ToJSON a => a -> Builder + encodeJSONToString :: (ToJSON a) => a -> Builder encodeJSONToString = fromEncoding . toEncoding bulkEncode iu = bulkMeta (view (iuUserId . re _TextId) iu) (docVersion (_iuVersion iu)) @@ -242,11 +242,17 @@ updateIndex (IndexUpdateUsers updateType ius) = liftIndexIO $ do <> "\n" bulkMeta :: Text -> ES.DocVersion -> Builder bulkMeta docId v = - fromEncoding . pairs . pair "index" . pairs $ - "_id" .= docId - <> "_version" .= v + fromEncoding + . pairs + . pair "index" + . pairs + $ "_id" + .= docId + <> "_version" + .= v -- "external_gt or external_gte" - <> "_version_type" .= indexUpdateToVersionControlText updateType + <> "_version_type" + .= indexUpdateToVersionControlText updateType statuses :: ES.Reply -> [(Int, Int)] -- [(Status, Int)] statuses = Map.toList @@ -256,9 +262,9 @@ updateIndex (IndexUpdateUsers updateType ius) = liftIndexIO $ do . responseBody updateIndex (IndexDeleteUser u) = liftIndexIO $ do Prom.incCounter indexDeleteCounter - info $ - field "user" (Bytes.toByteString u) - . msg (val "(Soft) deleting user from index") + info + $ field "user" (Bytes.toByteString u) + . msg (val "(Soft) deleting user from index") idx <- asks idxName r <- ES.getDocument idx mappingName (ES.DocId (review _TextId u)) case statusCode (responseStatus r) of @@ -296,25 +302,25 @@ updateSearchVisibilityInbound status = liftIndexIO $ do -------------------------------------------------------------------------------- -- Administrative -refreshIndex :: MonadIndexIO m => m () +refreshIndex :: (MonadIndexIO m) => m () refreshIndex = liftIndexIO $ do idx <- asks idxName void $ ES.refreshIndex idx createIndexIfNotPresent :: - MonadIndexIO m => + (MonadIndexIO m) => CreateIndexSettings -> m () createIndexIfNotPresent = createIndex' False createIndex :: - MonadIndexIO m => + (MonadIndexIO m) => CreateIndexSettings -> m () createIndex = createIndex' True createIndex' :: - MonadIndexIO m => + (MonadIndexIO m) => -- | Fail if index alredy exists Bool -> CreateIndexSettings -> @@ -322,8 +328,8 @@ createIndex' :: createIndex' failIfExists (CreateIndexSettings settings shardCount mbDeleteTemplate) = liftIndexIO $ do idx <- asks idxName ex <- ES.indexExists idx - when (failIfExists && ex) $ - throwM (IndexError "Index already exists.") + when (failIfExists && ex) + $ throwM (IndexError "Index already exists.") unless ex $ do let fullSettings = settings ++ [ES.AnalysisSetting analysisSettings] @@ -342,17 +348,17 @@ createIndex' failIfExists (CreateIndexSettings settings shardCount mbDeleteTempl ("Delete index template " <> "\"" <> tname <> "\"") ) $ ES.deleteTemplate templateName - unless (ES.isSuccess dr) $ - throwM (IndexError "Deleting index template failed.") + unless (ES.isSuccess dr) + $ throwM (IndexError "Deleting index template failed.") cr <- traceES "Create index" $ ES.createIndexWith fullSettings shardCount idx - unless (ES.isSuccess cr) $ - throwM (IndexError "Index creation failed.") + unless (ES.isSuccess cr) + $ throwM (IndexError "Index creation failed.") mr <- - traceES "Put mapping" $ - ES.putMapping idx (ES.MappingName "user") indexMapping - unless (ES.isSuccess mr) $ - throwM (IndexError "Put Mapping failed.") + traceES "Put mapping" + $ ES.putMapping idx (ES.MappingName "user") indexMapping + unless (ES.isSuccess mr) + $ throwM (IndexError "Put Mapping failed.") analysisSettings :: ES.Analysis analysisSettings = @@ -368,21 +374,21 @@ analysisSettings = ] in ES.Analysis analyzerDef mempty filterDef mempty -updateMapping :: MonadIndexIO m => m () +updateMapping :: (MonadIndexIO m) => m () updateMapping = liftIndexIO $ do idx <- asks idxName ex <- ES.indexExists idx - unless ex $ - throwM (IndexError "Index does not exist.") + unless ex + $ throwM (IndexError "Index does not exist.") -- FUTUREWORK: check return code (ES.isSuccess) and fail if appropriate. -- But to do that we have to consider the consequences of this failing in our helm chart: -- https://github.com/wireapp/wire-server-deploy/blob/92311d189818ffc5e26ff589f81b95c95de8722c/charts/elasticsearch-index/templates/create-index.yaml - void $ - traceES "Put mapping" $ - ES.putMapping idx (ES.MappingName "user") indexMapping + void + $ traceES "Put mapping" + $ ES.putMapping idx (ES.MappingName "user") indexMapping resetIndex :: - MonadIndexIO m => + (MonadIndexIO m) => CreateIndexSettings -> m () resetIndex ciSettings = liftIndexIO $ do @@ -407,9 +413,9 @@ reindexAllWith updateType = do C.liftClient (scanForIndex 1000) >>= loop idx where loop idx page = do - info $ - field "size" (length (C.result page)) - . msg (val "Reindex: processing C* page") + info + $ field "size" (length (C.result page)) + . msg (val "Reindex: processing C* page") unless (null (C.result page)) $ do let teamsInPage = mapMaybe teamInReindexRow (C.result page) lookupFn <- liftIndexIO $ getSearchVisibilityInboundMulti teamsInPage @@ -418,8 +424,9 @@ reindexAllWith updateType = do in reindexRowToIndexUser row sv indexUsers <- mapM reindexRow (C.result page) updateIndex (IndexUpdateUsers updateType indexUsers) - when (C.hasMore page) $ - C.liftClient (C.nextPage page) >>= loop idx + when (C.hasMore page) + $ C.liftClient (C.nextPage page) + >>= loop idx -------------------------------------------------------------------------------- -- Internal @@ -433,7 +440,7 @@ indexUpdateToVersionControl :: IndexDocUpdateType -> (ES.ExternalDocVersion -> E indexUpdateToVersionControl IndexUpdateIfNewerVersion = ES.ExternalGT indexUpdateToVersionControl IndexUpdateIfSameOrNewerVersion = ES.ExternalGTE -traceES :: MonadIndexIO m => ByteString -> IndexIO ES.Reply -> m ES.Reply +traceES :: (MonadIndexIO m) => ByteString -> IndexIO ES.Reply -> m ES.Reply traceES descr act = liftIndexIO $ do info (msg descr) r <- act @@ -673,10 +680,10 @@ instance ToJSON MappingPropertyType where instance ToJSON MappingField where toJSON mf = - object $ - ["type" .= mfType mf] - <> ["analyzer" .= mfAnalyzer mf | isJust (mfAnalyzer mf)] - <> ["search_analyzer" .= mfSearchAnalyzer mf | isJust (mfSearchAnalyzer mf)] + object + $ ["type" .= mfType mf] + <> ["analyzer" .= mfAnalyzer mf | isJust (mfAnalyzer mf)] + <> ["search_analyzer" .= mfSearchAnalyzer mf | isJust (mfSearchAnalyzer mf)] boolQuery :: ES.BoolQuery boolQuery = ES.mkBoolQuery [] [] [] [] @@ -810,7 +817,7 @@ type ReindexRow = teamInReindexRow :: ReindexRow -> Maybe TeamId teamInReindexRow (_f1, f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19, _f20, _f21, _f22) = f2 -reindexRowToIndexUser :: forall m. MonadThrow m => ReindexRow -> SearchVisibilityInbound -> m IndexUser +reindexRowToIndexUser :: forall m. (MonadThrow m) => ReindexRow -> SearchVisibilityInbound -> m IndexUser reindexRowToIndexUser ( u, mteam, @@ -851,8 +858,8 @@ reindexRowToIndexUser v <$> tSsoId, v <$> tEmailUnvalidated ] - pure $ - if shouldIndex + pure + $ if shouldIndex then iu & set iuTeam mteam @@ -940,8 +947,9 @@ getTeamSearchVisibilityInboundMulti tids = do m (Response (Maybe BL.ByteString)) serviceRequest' nm endpoint m r = do let service = mkEndpoint endpoint - recovering x3 rpcHandlers $ - const $ do + recovering x3 rpcHandlers + $ const + $ do let rq = (RPC.method m . r) service res <- try $ RPC.httpLbs rq id case res of @@ -973,8 +981,8 @@ instance Exception ParseException {-# NOINLINE indexUpdateCounter #-} indexUpdateCounter :: Prom.Counter indexUpdateCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.count", Prom.metricHelp = "Number of updates on user index" @@ -983,8 +991,8 @@ indexUpdateCounter = {-# NOINLINE indexUpdateErrorCounter #-} indexUpdateErrorCounter :: Prom.Counter indexUpdateErrorCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.err", Prom.metricHelp = "Number of errors during user index update" @@ -993,8 +1001,8 @@ indexUpdateErrorCounter = {-# NOINLINE indexUpdateSuccessCounter #-} indexUpdateSuccessCounter :: Prom.Counter indexUpdateSuccessCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.ok", Prom.metricHelp = "Number of successful user index updates" @@ -1003,8 +1011,8 @@ indexUpdateSuccessCounter = {-# NOINLINE indexBulkUpdateCounter #-} indexBulkUpdateCounter :: Prom.Counter indexBulkUpdateCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.bulk.count", Prom.metricHelp = "Number of bulk updates on user index" @@ -1013,8 +1021,8 @@ indexBulkUpdateCounter = {-# NOINLINE indexBulkUpdateErrorCounter #-} indexBulkUpdateErrorCounter :: Prom.Counter indexBulkUpdateErrorCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.bulk.err", Prom.metricHelp = "Number of errors during bulk updates on user index" @@ -1023,8 +1031,8 @@ indexBulkUpdateErrorCounter = {-# NOINLINE indexBulkUpdateSuccessCounter #-} indexBulkUpdateSuccessCounter :: Prom.Counter indexBulkUpdateSuccessCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.update.bulk.ok", Prom.metricHelp = "Number of successful bulk updates on user index" @@ -1033,19 +1041,19 @@ indexBulkUpdateSuccessCounter = {-# NOINLINE indexBulkUpdateResponseCounter #-} indexBulkUpdateResponseCounter :: Prom.Vector Prom.Label1 Prom.Counter indexBulkUpdateResponseCounter = - Prom.unsafeRegister $ - Prom.vector ("status") $ - Prom.counter - Prom.Info - { Prom.metricName = "user.index.update.bulk.response", - Prom.metricHelp = "Number of successful bulk updates on user index" - } + Prom.unsafeRegister + $ Prom.vector ("status") + $ Prom.counter + Prom.Info + { Prom.metricName = "user.index.update.bulk.response", + Prom.metricHelp = "Number of successful bulk updates on user index" + } {-# NOINLINE indexDeleteCounter #-} indexDeleteCounter :: Prom.Counter indexDeleteCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "user.index.delete.count", Prom.metricHelp = "Number of deletes on user index" diff --git a/services/brig/src/Brig/User/Search/Index/Types.hs b/services/brig/src/Brig/User/Search/Index/Types.hs index 766c5b5df90..d3665762e94 100644 --- a/services/brig/src/Brig/User/Search/Index/Types.hs +++ b/services/brig/src/Brig/User/Search/Index/Types.hs @@ -131,22 +131,38 @@ instance ToJSON UserDoc where instance FromJSON UserDoc where parseJSON = withObject "UserDoc" $ \o -> UserDoc - <$> o .: "id" - <*> o .:? "team" - <*> o .:? "name" - <*> o .:? "normalized" - <*> o .:? "handle" - <*> o .:? "email" - <*> o .:? "accent_id" - <*> o .:? "account_status" - <*> o .:? "saml_idp" - <*> o .:? "managed_by" - <*> o .:? "created_at" - <*> o .:? "role" - <*> o .:? (fromString . T.unpack $ searchVisibilityInboundFieldName) - <*> o .:? "scim_external_id" - <*> o .:? "sso" - <*> o .:? "email_unvalidated" + <$> o + .: "id" + <*> o + .:? "team" + <*> o + .:? "name" + <*> o + .:? "normalized" + <*> o + .:? "handle" + <*> o + .:? "email" + <*> o + .:? "accent_id" + <*> o + .:? "account_status" + <*> o + .:? "saml_idp" + <*> o + .:? "managed_by" + <*> o + .:? "created_at" + <*> o + .:? "role" + <*> o + .:? (fromString . T.unpack $ searchVisibilityInboundFieldName) + <*> o + .:? "scim_external_id" + <*> o + .:? "sso" + <*> o + .:? "email_unvalidated" searchVisibilityInboundFieldName :: Text searchVisibilityInboundFieldName = "search_visibility_inbound" diff --git a/services/brig/src/Brig/User/Search/TeamSize.hs b/services/brig/src/Brig/User/Search/TeamSize.hs index 1fd23bbf1c3..dce653ab03b 100644 --- a/services/brig/src/Brig/User/Search/TeamSize.hs +++ b/services/brig/src/Brig/User/Search/TeamSize.hs @@ -29,7 +29,7 @@ import Data.Id import Database.Bloodhound qualified as ES import Imports hiding (log, searchable) -teamSize :: MonadIndexIO m => TeamId -> m TeamSize +teamSize :: (MonadIndexIO m) => TeamId -> m TeamSize teamSize t = liftIndexIO $ do indexName <- asks idxName countResEither <- ES.countByIndex indexName (ES.CountQuery query) diff --git a/services/brig/src/Brig/User/Search/TeamUserSearch.hs b/services/brig/src/Brig/User/Search/TeamUserSearch.hs index 90bcb969e96..6939e952adb 100644 --- a/services/brig/src/Brig/User/Search/TeamUserSearch.hs +++ b/services/brig/src/Brig/User/Search/TeamUserSearch.hs @@ -131,24 +131,24 @@ teamUserSearchQuery tid mbSearchText _mRoleFilter mSortBy mSortOrder = term' -> Just term' matchPhraseOrPrefix term' = - ES.QueryMultiMatchQuery $ - ( ES.mkMultiMatchQuery - [ ES.FieldName "email^4", - ES.FieldName "handle^4", - ES.FieldName "normalized^3", - ES.FieldName "email.prefix^3", - ES.FieldName "handle.prefix^2", - ES.FieldName "normalized.prefix" - ] - (ES.QueryString term') - ) + ES.QueryMultiMatchQuery + $ ( ES.mkMultiMatchQuery + [ ES.FieldName "email^4", + ES.FieldName "handle^4", + ES.FieldName "normalized^3", + ES.FieldName "email.prefix^3", + ES.FieldName "handle.prefix^2", + ES.FieldName "normalized.prefix" + ] + (ES.QueryString term') + ) { ES.multiMatchQueryType = Just ES.MultiMatchMostFields, ES.multiMatchQueryOperator = ES.And } teamFilter = - ES.Filter $ - ES.QueryBoolQuery + ES.Filter + $ ES.QueryBoolQuery boolQuery { ES.boolQueryMustMatch = [ES.TermQuery (ES.Term "team" $ idToText tid) Nothing] } diff --git a/services/brig/src/Brig/Version.hs b/services/brig/src/Brig/Version.hs index 9d16efedd7d..07f2473163f 100644 --- a/services/brig/src/Brig/Version.hs +++ b/services/brig/src/Brig/Version.hs @@ -34,8 +34,8 @@ versionAPI = Named $ do let allVersions = Set.difference (Set.fromList supportedVersions) disabled devVersions = Set.difference (Set.fromList developmentVersions) disabled supported = Set.difference allVersions devVersions - pure $ - VersionInfo + pure + $ VersionInfo { vinfoSupported = VersionNumber <$> toList supported, vinfoDevelopment = VersionNumber <$> toList devVersions, vinfoFederation = isJust fed, diff --git a/services/brig/src/Brig/ZAuth.hs b/services/brig/src/Brig/ZAuth.hs index 14e714bd331..ef6acc59dc9 100644 --- a/services/brig/src/Brig/ZAuth.hs +++ b/services/brig/src/Brig/ZAuth.hs @@ -110,13 +110,13 @@ import Wire.API.User.Auth qualified as Auth newtype ZAuth a = ZAuth {unZAuth :: ReaderT Env IO a} deriving (Functor, Applicative, Monad, MonadIO, MonadReader Env) -class MonadIO m => MonadZAuth m where +class (MonadIO m) => MonadZAuth m where liftZAuth :: ZAuth a -> m a instance MonadZAuth ZAuth where liftZAuth = id -runZAuth :: MonadIO m => Env -> ZAuth a -> m a +runZAuth :: (MonadIO m) => Env -> ZAuth a -> m a runZAuth e za = liftIO $ runReaderT (unZAuth za) e data Settings = Settings @@ -194,7 +194,8 @@ instance FromJSON LegalHoldUserTokenTimeout instance FromJSON Settings where parseJSON = withObject "ZAuth.Settings" $ \o -> Settings - <$> o .: "keyIndex" + <$> o + .: "keyIndex" <*> (UserTokenTimeout <$> o .: "userTokenTimeout") <*> (SessionTokenTimeout <$> o .: "sessionTokenTimeout") <*> (AccessTokenTimeout <$> o .: "accessTokenTimeout") @@ -217,7 +218,7 @@ makeLenses ''Env localSettings :: (Settings -> Settings) -> ZAuth a -> ZAuth a localSettings f za = ZAuth (local (over settings f) (unZAuth za)) -readKeys :: Read k => FilePath -> IO (Maybe (NonEmpty k)) +readKeys :: (Read k) => FilePath -> IO (Maybe (NonEmpty k)) readKeys fp = nonEmpty . map read . filter (not . null) . lines <$> readFile fp mkEnv :: NonEmpty SecretKey -> NonEmpty PublicKey -> Settings -> IO Env @@ -227,7 +228,7 @@ mkEnv sk pk sets = do pure $! Env zc zv sets class (UserTokenLike u, AccessTokenLike a) => TokenPair u a where - newAccessToken :: MonadZAuth m => Token u -> m (Token a) + newAccessToken :: (MonadZAuth m) => Token u -> m (Token a) instance TokenPair User Access where newAccessToken = newAccessToken' @@ -238,7 +239,7 @@ instance TokenPair LegalHoldUser LegalHoldAccess where class (FromByteString (Token a), ToByteString a) => AccessTokenLike a where accessTokenOf :: Token a -> UserId accessTokenClient :: Token a -> Maybe ClientId - renewAccessToken :: MonadZAuth m => Maybe ClientId -> Token a -> m (Token a) + renewAccessToken :: (MonadZAuth m) => Maybe ClientId -> Token a -> m (Token a) settingsTTL :: Proxy a -> Lens' Settings Integer instance AccessTokenLike Access where @@ -257,9 +258,9 @@ class (FromByteString (Token u), ToByteString u) => UserTokenLike u where userTokenOf :: Token u -> UserId userTokenClient :: Token u -> Maybe ClientId mkSomeToken :: Token u -> Auth.SomeUserToken - mkUserToken :: MonadZAuth m => UserId -> Maybe ClientId -> Word32 -> UTCTime -> m (Token u) + mkUserToken :: (MonadZAuth m) => UserId -> Maybe ClientId -> Word32 -> UTCTime -> m (Token u) userTokenRand :: Token u -> Word32 - newUserToken :: MonadZAuth m => UserId -> Maybe ClientId -> m (Token u) + newUserToken :: (MonadZAuth m) => UserId -> Maybe ClientId -> m (Token u) newSessionToken :: (MonadThrow m, MonadZAuth m) => UserId -> Maybe ClientId -> m (Token u) userTTL :: Proxy u -> Lens' Settings Integer zauthType :: Type -- see libs/zauth/src/Token.hs @@ -286,66 +287,66 @@ instance UserTokenLike LegalHoldUser where userTTL _ = legalHoldUserTokenTimeout . legalHoldUserTokenTimeoutSeconds zauthType = LU -mkUserToken' :: MonadZAuth m => UserId -> Maybe ClientId -> Word32 -> UTCTime -> m (Token User) +mkUserToken' :: (MonadZAuth m) => UserId -> Maybe ClientId -> Word32 -> UTCTime -> m (Token User) mkUserToken' u cid r t = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - ZC.newToken (utcTimeToPOSIXSeconds t) U Nothing (mkUser (toUUID u) (fmap clientToText cid) r) + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ ZC.newToken (utcTimeToPOSIXSeconds t) U Nothing (mkUser (toUUID u) (fmap clientToText cid) r) -newUserToken' :: MonadZAuth m => UserId -> Maybe ClientId -> m (Token User) +newUserToken' :: (MonadZAuth m) => UserId -> Maybe ClientId -> m (Token User) newUserToken' u c = liftZAuth $ do z <- ask r <- liftIO randomValue - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let UserTokenTimeout ttl = z ^. settings . userTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let UserTokenTimeout ttl = z ^. settings . userTokenTimeout in ZC.userToken ttl (toUUID u) (fmap clientToText c) r -newSessionToken' :: MonadZAuth m => UserId -> Maybe ClientId -> m (Token User) +newSessionToken' :: (MonadZAuth m) => UserId -> Maybe ClientId -> m (Token User) newSessionToken' u c = liftZAuth $ do z <- ask r <- liftIO randomValue - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let SessionTokenTimeout ttl = z ^. settings . sessionTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let SessionTokenTimeout ttl = z ^. settings . sessionTokenTimeout in ZC.sessionToken ttl (toUUID u) (fmap clientToText c) r -newAccessToken' :: MonadZAuth m => Token User -> m (Token Access) +newAccessToken' :: (MonadZAuth m) => Token User -> m (Token Access) newAccessToken' xt = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let AccessTokenTimeout ttl = z ^. settings . accessTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let AccessTokenTimeout ttl = z ^. settings . accessTokenTimeout in ZC.accessToken1 ttl (xt ^. body . user) (xt ^. body . client) -renewAccessToken' :: MonadZAuth m => Maybe ClientId -> Token Access -> m (Token Access) +renewAccessToken' :: (MonadZAuth m) => Maybe ClientId -> Token Access -> m (Token Access) renewAccessToken' mcid old = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let AccessTokenTimeout ttl = z ^. settings . accessTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let AccessTokenTimeout ttl = z ^. settings . accessTokenTimeout in ZC.renewToken ttl (old ^. header) ( clientId .~ fmap clientToText mcid - $ (old ^. body) + $ (old ^. body) ) -newBotToken :: MonadZAuth m => ProviderId -> BotId -> ConvId -> m (Token Bot) +newBotToken :: (MonadZAuth m) => ProviderId -> BotId -> ConvId -> m (Token Bot) newBotToken pid bid cid = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - ZC.botToken (toUUID pid) (toUUID (botUserId bid)) (toUUID cid) + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ ZC.botToken (toUUID pid) (toUUID (botUserId bid)) (toUUID cid) -newProviderToken :: MonadZAuth m => ProviderId -> m (Token Provider) +newProviderToken :: (MonadZAuth m) => ProviderId -> m (Token Provider) newProviderToken pid = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let ProviderTokenTimeout ttl = z ^. settings . providerTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let ProviderTokenTimeout ttl = z ^. settings . providerTokenTimeout in ZC.providerToken ttl (toUUID pid) -- FUTUREWORK: this function is very similar to mkUserToken', @@ -355,7 +356,7 @@ newProviderToken pid = liftZAuth $ do -- Possibly some duplication could be removed. -- See https://github.com/wireapp/wire-server/pull/761/files#r318612423 mkLegalHoldUserToken :: - MonadZAuth m => + (MonadZAuth m) => UserId -> Maybe ClientId -> Word32 -> @@ -363,44 +364,44 @@ mkLegalHoldUserToken :: m (Token LegalHoldUser) mkLegalHoldUserToken u c r t = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - ZC.newToken - (utcTimeToPOSIXSeconds t) - LU - Nothing - (mkLegalHoldUser (toUUID u) (fmap clientToText c) r) - -newLegalHoldUserToken :: MonadZAuth m => UserId -> Maybe ClientId -> m (Token LegalHoldUser) + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ ZC.newToken + (utcTimeToPOSIXSeconds t) + LU + Nothing + (mkLegalHoldUser (toUUID u) (fmap clientToText c) r) + +newLegalHoldUserToken :: (MonadZAuth m) => UserId -> Maybe ClientId -> m (Token LegalHoldUser) newLegalHoldUserToken u c = liftZAuth $ do z <- ask r <- liftIO randomValue - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let LegalHoldUserTokenTimeout ttl = z ^. settings . legalHoldUserTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let LegalHoldUserTokenTimeout ttl = z ^. settings . legalHoldUserTokenTimeout in ZC.legalHoldUserToken ttl (toUUID u) (fmap clientToText c) r -newLegalHoldAccessToken :: MonadZAuth m => Token LegalHoldUser -> m (Token LegalHoldAccess) +newLegalHoldAccessToken :: (MonadZAuth m) => Token LegalHoldUser -> m (Token LegalHoldAccess) newLegalHoldAccessToken xt = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let LegalHoldAccessTokenTimeout ttl = z ^. settings . legalHoldAccessTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let LegalHoldAccessTokenTimeout ttl = z ^. settings . legalHoldAccessTokenTimeout in ZC.legalHoldAccessToken1 ttl (xt ^. body . legalHoldUser . user) (xt ^. body . legalHoldUser . client) renewLegalHoldAccessToken :: - MonadZAuth m => + (MonadZAuth m) => Maybe ClientId -> Token LegalHoldAccess -> m (Token LegalHoldAccess) renewLegalHoldAccessToken _mcid old = liftZAuth $ do z <- ask - liftIO $ - ZC.runCreate (z ^. private) (z ^. settings . keyIndex) $ - let LegalHoldAccessTokenTimeout ttl = z ^. settings . legalHoldAccessTokenTimeout + liftIO + $ ZC.runCreate (z ^. private) (z ^. settings . keyIndex) + $ let LegalHoldAccessTokenTimeout ttl = z ^. settings . legalHoldAccessTokenTimeout in ZC.renewToken ttl (old ^. header) diff --git a/services/brig/test/integration/API/Calling.hs b/services/brig/test/integration/API/Calling.hs index c8008d01cb6..66f4864f580 100644 --- a/services/brig/test/integration/API/Calling.hs +++ b/services/brig/test/integration/API/Calling.hs @@ -47,16 +47,16 @@ import Wire.API.User tests :: Manager -> Brig -> Opts.Opts -> FilePath -> FilePath -> IO TestTree tests m b opts turn turnV2 = do - pure $ - testGroup "calling" $ - [ testGroup "turn" $ - [ test m "basic /calls/config - 200" $ testCallsConfig b, - -- FIXME: requires tests to run on same host as brig - test m "multiple servers using files /calls/config - 200" . withTurnFile turn $ testCallsConfigMultiple b, - test m "multiple servers using SRV /calls/config - 200" $ testCallsConfigSRV b opts, - test m "multiple servers using files /calls/config/v2 - 200" . withTurnFile turnV2 $ testCallsConfigMultipleV2 b, - test m "multiple servers using SRV records /calls/config/v2 - 200" $ testCallsConfigV2SRV b opts - ], + pure + $ testGroup "calling" + $ [ testGroup "turn" + $ [ test m "basic /calls/config - 200" $ testCallsConfig b, + -- FIXME: requires tests to run on same host as brig + test m "multiple servers using files /calls/config - 200" . withTurnFile turn $ testCallsConfigMultiple b, + test m "multiple servers using SRV /calls/config - 200" $ testCallsConfigSRV b opts, + test m "multiple servers using files /calls/config/v2 - 200" . withTurnFile turnV2 $ testCallsConfigMultipleV2 b, + test m "multiple servers using SRV records /calls/config/v2 - 200" $ testCallsConfigV2SRV b opts + ], testGroup "sft" [ test m "SFT servers /calls/config/v2 - 200" $ testSFT b opts, @@ -107,8 +107,8 @@ testSFT b opts = do -- These values are controlled by https://github.com/zinfra/cailleach/tree/77ca2d23cf2959aa183dd945d0a0b13537a8950d/environments/dns-integration-tests let Right server1 = mkHttpsUrl =<< first show (parseURI laxURIParserOptions "https://sft01.integration-tests.zinfra.io:443") let Right server2 = mkHttpsUrl =<< first show (parseURI laxURIParserOptions "https://sft02.integration-tests.zinfra.io:8443") - liftIO $ - assertEqual + liftIO + $ assertEqual "when SFT discovery is enabled, sft_servers should be returned" (Set.fromList [sftServer server1, sftServer server2]) (Set.fromList $ maybe [] NonEmpty.toList $ cfg1 ^. rtcConfSftServers) @@ -125,7 +125,7 @@ testSFTUnavailable b opts domain = do (cfg ^. rtcConfSftServersAll) modifyAndAssert :: - HasCallStack => + (HasCallStack) => Brig -> UserId -> (UserId -> Brig -> Http RTCConfiguration) -> @@ -178,11 +178,11 @@ testCallsConfigSRV b opts = do uid <- userId <$> randomUser b let dnsOpts = Opts.TurnSourceDNS (Opts.TurnDnsOpts "integration-tests.zinfra.io" (Just 0.5)) config <- - withSettingsOverrides (opts & Opts.turnL . Opts.serversSourceL .~ dnsOpts) $ - responseJsonError - =<< ( retryWhileN 10 (\r -> statusCode r /= 200) (getTurnConfiguration "" uid b) - statusCode r /= 200) (getTurnConfiguration "" uid b) + randomUser b let dnsOpts = Opts.TurnSourceDNS (Opts.TurnDnsOpts "integration-tests.zinfra.io" (Just 0.5)) config <- - withSettingsOverrides (opts & Opts.turnL . Opts.serversSourceL .~ dnsOpts) $ - responseJsonError - =<< ( retryWhileN 10 (\r -> statusCode r /= 200) (getTurnConfiguration "v2" uid b) - statusCode r /= 200) (getTurnConfiguration "v2" uid b) + RTCConfiguration -> NonEmpty TurnURI -> Http () +assertConfiguration :: (HasCallStack) => RTCConfiguration -> NonEmpty TurnURI -> Http () assertConfiguration cfg expected = do let actual = concatMap (toList . view iceURLs) $ toList $ cfg ^. rtcConfIceServers liftIO $ assertEqual "Expected adverstised TURN servers to match actual ones" (sort $ toList expected) (sort actual) @@ -220,10 +220,10 @@ assertConfiguration cfg expected = do getTurnConfigurationV1 :: UserId -> Brig -> Http RTCConfiguration getTurnConfigurationV1 = getAndValidateTurnConfiguration "" -getTurnConfigurationV2 :: HasCallStack => UserId -> Brig -> ((MonadHttp m, MonadIO m, MonadCatch m) => m RTCConfiguration) +getTurnConfigurationV2 :: (HasCallStack) => UserId -> Brig -> ((MonadHttp m, MonadIO m, MonadCatch m) => m RTCConfiguration) getTurnConfigurationV2 = getAndValidateTurnConfiguration "v2" -getTurnConfiguration :: ByteString -> UserId -> Brig -> (MonadHttp m => m (Response (Maybe LB.ByteString))) +getTurnConfiguration :: ByteString -> UserId -> Brig -> ((MonadHttp m) => m (Response (Maybe LB.ByteString))) getTurnConfiguration suffix u b = get ( b @@ -232,7 +232,7 @@ getTurnConfiguration suffix u b = . zConn "conn" ) -getAndValidateTurnConfiguration :: HasCallStack => ByteString -> UserId -> Brig -> ((MonadIO m, MonadHttp m, MonadCatch m) => m RTCConfiguration) +getAndValidateTurnConfiguration :: (HasCallStack) => ByteString -> UserId -> Brig -> ((MonadIO m, MonadHttp m, MonadCatch m) => m RTCConfiguration) getAndValidateTurnConfiguration suffix u b = responseJsonError =<< (getTurnConfiguration suffix u b Int -> UserId -> Brig -> Http RTCConfiguration +getAndValidateTurnConfigurationLimit :: (HasCallStack) => Int -> UserId -> Brig -> Http RTCConfiguration getAndValidateTurnConfigurationLimit limit u b = responseJsonError =<< (getTurnConfigurationV2Limit limit u b ByteString -> Port -> Maybe Transport -> TurnURI toTurnURI s h = turnURI s ip where ip = - fromMaybe (error "Failed to parse host address") $ - fromByteString h + fromMaybe (error "Failed to parse host address") + $ fromByteString h type TurnUpdater = String -> IO () diff --git a/services/brig/test/integration/API/Federation.hs b/services/brig/test/integration/API/Federation.hs index 4d09484d7ff..a73c4827c1b 100644 --- a/services/brig/test/integration/API/Federation.hs +++ b/services/brig/test/integration/API/Federation.hs @@ -53,8 +53,8 @@ import Wire.API.UserMap (UserMap (UserMap)) -- Note: POST /federation/send-connection-action is implicitly tested in API.User.Connection tests :: Manager -> Opt.Opts -> Brig -> FedClient 'Brig -> IO TestTree tests m opts brig fedBrigClient = - pure $ - testGroup + pure + $ testGroup "federation" [ test m "POST /federation/search-users : Found" (testSearchSuccess opts brig), test m "POST /federation/search-users : Found (fulltext)" (testFulltextSearchSuccess opts brig), @@ -89,9 +89,9 @@ testSearchSuccess opts brig = do let domain = Domain "example.com" searchResponse <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig $ - SearchRequest (fromHandle handle) Nothing Nothing + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig + $ SearchRequest (fromHandle handle) Nothing Nothing liftIO $ do let contacts = contactQualifiedId <$> S.contacts searchResponse @@ -106,9 +106,9 @@ testFulltextSearchSuccess opts brig = do let domain = Domain "example.com" searchResponse <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig $ - SearchRequest (fromName $ userDisplayName user) Nothing Nothing + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig + $ SearchRequest (fromName $ userDisplayName user) Nothing Nothing liftIO $ do let contacts = contactQualifiedId <$> S.contacts searchResponse @@ -133,9 +133,9 @@ testFulltextSearchMultipleUsers opts brig = do let domain = Domain "example.com" searchResponse <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig $ - SearchRequest (fromHandle handle) Nothing Nothing + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig + $ SearchRequest (fromHandle handle) Nothing Nothing liftIO $ do let contacts = contactQualifiedId <$> S.contacts searchResponse @@ -146,9 +146,9 @@ testSearchNotFound opts = do let domain = Domain "example.com" searchResponse <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig $ - SearchRequest "this-handle-should-not-exist" Nothing Nothing + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig + $ SearchRequest "this-handle-should-not-exist" Nothing Nothing liftIO $ assertEqual "should return empty array of users" [] (S.contacts searchResponse) @@ -157,9 +157,9 @@ testSearchNotFoundEmpty opts = do let domain = Domain "example.com" searchResponse <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig $ - SearchRequest "this-handle-should-not-exist" Nothing Nothing + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig + $ SearchRequest "this-handle-should-not-exist" Nothing Nothing liftIO $ assertEqual "should return empty array of users" [] (S.contacts searchResponse) @@ -176,18 +176,19 @@ testSearchRestrictions opts brig = do let opts' = opts - & Opt.optionSettings . Opt.federationDomainConfigs - ?~ [ Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainNoSearch NoSearch FederationRestrictionAllowAll, - Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainExactHandle ExactHandleSearch FederationRestrictionAllowAll, - Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainFullSearch FullSearch FederationRestrictionAllowAll - ] - - let expectSearch :: HasCallStack => Domain -> Either Handle Name -> Maybe (Qualified UserId) -> FederatedUserSearchPolicy -> WaiTest.Session () + & Opt.optionSettings + . Opt.federationDomainConfigs + ?~ [ Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainNoSearch NoSearch FederationRestrictionAllowAll, + Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainExactHandle ExactHandleSearch FederationRestrictionAllowAll, + Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainFullSearch FullSearch FederationRestrictionAllowAll + ] + + let expectSearch :: (HasCallStack) => Domain -> Either Handle Name -> Maybe (Qualified UserId) -> FederatedUserSearchPolicy -> WaiTest.Session () expectSearch domain handleOrName mExpectedUser expectedSearchPolicy = do let squery = either fromHandle fromName handleOrName searchResponse <- - runWaiTestFedClient domain $ - createWaiTestFedClient @"search-users" @'Brig (SearchRequest squery Nothing Nothing) + runWaiTestFedClient domain + $ createWaiTestFedClient @"search-users" @'Brig (SearchRequest squery Nothing Nothing) liftIO $ do case (mExpectedUser, handleOrName) of (Just expectedUser, Right _) -> @@ -220,16 +221,17 @@ testGetUserByHandleRestrictions opts brig = do let opts' = opts - & Opt.optionSettings . Opt.federationDomainConfigs - ?~ [ Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainNoSearch NoSearch FederationRestrictionAllowAll, - Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainExactHandle ExactHandleSearch FederationRestrictionAllowAll, - Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainFullSearch FullSearch FederationRestrictionAllowAll - ] + & Opt.optionSettings + . Opt.federationDomainConfigs + ?~ [ Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainNoSearch NoSearch FederationRestrictionAllowAll, + Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainExactHandle ExactHandleSearch FederationRestrictionAllowAll, + Opt.ImplicitNoFederationRestriction $ FD.FederationDomainConfig domainFullSearch FullSearch FederationRestrictionAllowAll + ] let expectSearch domain expectedUser = do maybeUserProfile <- - runWaiTestFedClient domain $ - createWaiTestFedClient @"get-user-by-handle" @'Brig handle + runWaiTestFedClient domain + $ createWaiTestFedClient @"get-user-by-handle" @'Brig handle liftIO $ assertEqual "Unexpected search result" expectedUser (profileQualifiedId <$> maybeUserProfile) withSettingsOverrides opts' $ do @@ -245,9 +247,9 @@ testGetUserByHandleSuccess opts brig = do let domain = Domain "example.com" maybeProfile <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"get-user-by-handle" @'Brig $ - handle + runWaiTestFedClient domain + $ createWaiTestFedClient @"get-user-by-handle" @'Brig + $ handle liftIO $ do case maybeProfile of @@ -262,9 +264,9 @@ testGetUserByHandleNotFound opts = do let domain = Domain "example.com" maybeProfile <- withSettingsOverrides (allowFullSearch domain opts) $ do - runWaiTestFedClient domain $ - createWaiTestFedClient @"get-user-by-handle" @'Brig $ - fromJust (parseHandle hdl) + runWaiTestFedClient domain + $ createWaiTestFedClient @"get-user-by-handle" @'Brig + $ fromJust (parseHandle hdl) liftIO $ assertEqual "should not return any UserProfile" Nothing maybeProfile @@ -286,18 +288,18 @@ testGetUsersByIdsPartial brig fedBrigClient = do presentUser <- randomUser brig absentUserId :: UserId <- Id <$> lift UUIDv4.nextRandom profiles <- - runFedClient @"get-users-by-ids" fedBrigClient (Domain "example.com") $ - [User.userId presentUser, absentUserId] - liftIO $ - assertEqual "should return the present user and skip the absent ones" [userQualifiedId presentUser] (profileQualifiedId <$> profiles) + runFedClient @"get-users-by-ids" fedBrigClient (Domain "example.com") + $ [User.userId presentUser, absentUserId] + liftIO + $ assertEqual "should return the present user and skip the absent ones" [userQualifiedId presentUser] (profileQualifiedId <$> profiles) testGetUsersByIdsFederationRestrictionAllowAllFound :: FedClient 'Brig -> Http () testGetUsersByIdsFederationRestrictionAllowAllFound fedBrigClient = do absentUserId1 :: UserId <- Id <$> lift UUIDv4.nextRandom absentUserId2 :: UserId <- Id <$> lift UUIDv4.nextRandom profiles <- runFedClient @"get-users-by-ids" fedBrigClient (Domain "example.com") [absentUserId1, absentUserId2] - liftIO $ - assertEqual "should return empty list" [] profiles + liftIO + $ assertEqual "should return empty list" [] profiles testClaimPrekeySuccess :: Brig -> FedClient 'Brig -> Http () testClaimPrekeySuccess brig fedBrigClient = do @@ -306,8 +308,8 @@ testClaimPrekeySuccess brig fedBrigClient = do let new = defNewClient PermanentClientType [head somePrekeys] (head someLastPrekeys) c <- responseJsonError =<< addClient brig uid new mkey <- runFedClient @"claim-prekey" fedBrigClient (Domain "example.com") (uid, clientId c) - liftIO $ - assertEqual + liftIO + $ assertEqual "should return prekey 1" (Just (PrekeyId 1)) (fmap (prekeyId . prekeyData) mkey) @@ -318,8 +320,8 @@ testClaimPrekeyBundleSuccess brig fedBrigClient = do (quid, clients) <- generateClientPrekeys brig prekeys let sortClients = sortBy (compare `on` prekeyClient) bundle <- runFedClient @"claim-prekey-bundle" fedBrigClient (Domain "example.com") (qUnqualified quid) - liftIO $ - assertEqual + liftIO + $ assertEqual "bundle should contain the clients" (sortClients clients) (sortClients . prekeyClients $ bundle) @@ -336,8 +338,8 @@ testClaimMultiPrekeyBundleSuccess brig fedBrigClient = do let uc = UserClients (Map.fromList [mkClients <$> c1, mkClients <$> c2]) ucm = mkUserClientPrekeyMap (Map.fromList [mkClientMap <$> c1, mkClientMap <$> c2]) ucmResponse <- runFedClient @"claim-multi-prekey-bundle" fedBrigClient (Domain "example.com") uc - liftIO $ - assertEqual + liftIO + $ assertEqual "should return the UserClientMap" ucm ucmResponse @@ -354,8 +356,8 @@ testGetUserClients brig fedBrigClient = do uid1 <- User.userId <$> randomUser brig clients :: [Client] <- addTestClients brig uid1 [0, 1, 2] UserMap userClients <- runFedClient @"get-user-clients" fedBrigClient (Domain "example.com") (GetUserClients [uid1]) - liftIO $ - assertEqual + liftIO + $ assertEqual "client set for user should match" (Just (Set.fromList (fmap clientId clients))) (fmap (Set.map pubClientId) . Map.lookup uid1 $ userClients) @@ -364,8 +366,8 @@ testGetUserClientsNotFound :: FedClient 'Brig -> Http () testGetUserClientsNotFound fedBrigClient = do absentUserId <- randomId UserMap userClients <- runFedClient @"get-user-clients" fedBrigClient (Domain "example.com") (GetUserClients [absentUserId]) - liftIO $ - assertEqual + liftIO + $ assertEqual "client set for user should match" (Just (Set.fromList [])) (fmap (Set.map pubClientId) . Map.lookup absentUserId $ userClients) diff --git a/services/brig/test/integration/API/Internal.hs b/services/brig/test/integration/API/Internal.hs index b4d730fcd94..537b1c2e11b 100644 --- a/services/brig/test/integration/API/Internal.hs +++ b/services/brig/test/integration/API/Internal.hs @@ -55,13 +55,13 @@ import Wire.API.User.Client tests :: Opt.Opts -> Manager -> Cass.ClientState -> Brig -> Endpoint -> Gundeck -> Galley -> IO TestTree tests opts mgr db brig brigep _gundeck galley = do - pure $ - testGroup "api/internal" $ - [ test mgr "account features: conferenceCalling" $ - testFeatureConferenceCallingByAccount opts mgr db brig brigep galley, + pure + $ testGroup "api/internal" + $ [ test mgr "account features: conferenceCalling" + $ testFeatureConferenceCallingByAccount opts mgr db brig brigep galley, test mgr "suspend and unsuspend user" $ testSuspendUser db brig, - test mgr "suspend non existing user and verify no db entry" $ - testSuspendNonExistingUser db brig, + test mgr "suspend non existing user and verify no db entry" + $ testSuspendNonExistingUser db brig, test mgr "mls/clients" $ testGetMlsClients brig, test mgr "writetimeToInt64" $ testWritetimeRepresentation opts mgr db brig brigep galley ] @@ -177,7 +177,7 @@ testGetMlsClients brig = do . paths ["i", "mls", "clients", toByteString' (qUnqualified qusr)] . queryItem "ciphersuite" "0x0001" ) - Qualified UserId -> Int -> Http ClientId createClient brig u i = - fmap clientId $ - responseJsonError - =<< addClient - brig - (qUnqualified u) - (defNewClient PermanentClientType [somePrekeys !! i] (someLastPrekeys !! i)) - (Request -> Request) -> UserId -> m ResponseLBS getFeatureConfig galley uid = do diff --git a/services/brig/test/integration/API/MLS/Util.hs b/services/brig/test/integration/API/MLS/Util.hs index c2725fd0a3d..58a05d50810 100644 --- a/services/brig/test/integration/API/MLS/Util.hs +++ b/services/brig/test/integration/API/MLS/Util.hs @@ -53,38 +53,42 @@ instance Default KeyingInfo where cliCmd :: FilePath -> ClientIdentity -> [String] -> CreateProcess cliCmd tmp qcid cmnds = - proc "mls-test-cli" $ - ["--store", tmp (show qcid <> ".db")] <> cmnds + proc "mls-test-cli" + $ ["--store", tmp (show qcid <> ".db")] + <> cmnds initStore :: - HasCallStack => - MonadIO m => + (HasCallStack) => + (MonadIO m) => FilePath -> ClientIdentity -> m () initStore tmp qcid = do - void . liftIO . flip spawn Nothing $ - cliCmd tmp qcid ["init", show qcid] + void + . liftIO + . flip spawn Nothing + $ cliCmd tmp qcid ["init", show qcid] generateKeyPackage :: - HasCallStack => - MonadIO m => + (HasCallStack) => + (MonadIO m) => FilePath -> ClientIdentity -> Maybe Timeout -> m (RawMLS KeyPackage, KeyPackageRef) generateKeyPackage tmp qcid lifetime = do kp <- - liftIO $ - decodeMLSError <=< flip spawn Nothing $ - cliCmd tmp qcid $ - ["key-package", "create"] - <> (("--lifetime " <>) . show . (#> Second) <$> maybeToList lifetime) + liftIO + $ decodeMLSError + <=< flip spawn Nothing + $ cliCmd tmp qcid + $ ["key-package", "create"] + <> (("--lifetime " <>) . show . (#> Second) <$> maybeToList lifetime) let ref = fromJust (kpRef' kp) pure (kp, ref) uploadKeyPackages :: - HasCallStack => + (HasCallStack) => Brig -> FilePath -> KeyingInfo -> @@ -96,19 +100,20 @@ uploadKeyPackages brig tmp KeyingInfo {..} u c n = do let cid = mkClientIdentity u c initStore tmp cid kps <- replicateM n (fst <$> generateKeyPackage tmp cid kiLifetime) - when (kiSetKey == SetKey) $ - do + when (kiSetKey == SetKey) + $ do pk <- - liftIO . flip spawn Nothing $ - cliCmd tmp cid ["public-key"] + liftIO + . flip spawn Nothing + $ cliCmd tmp cid ["public-key"] put ( brig . paths ["clients", toByteString' c] . zUser (qUnqualified u) . json defUpdateClient {updateClientMLSPublicKeys = Map.fromList [(Ed25519, pk)]} ) - !!! const 200 - === statusCode + !!! const 200 + === statusCode let upload = object ["key_packages" .= toJSON (map (Base64ByteString . raw) kps)] post ( brig @@ -119,7 +124,7 @@ uploadKeyPackages brig tmp KeyingInfo {..} u c n = do !!! const (case kiSetKey of SetKey -> 201; DontSetKey -> 400) === statusCode -getKeyPackageCount :: HasCallStack => Brig -> Qualified UserId -> ClientId -> Http KeyPackageCount +getKeyPackageCount :: (HasCallStack) => Brig -> Qualified UserId -> ClientId -> Http KeyPackageCount getKeyPackageCount brig u c = responseJsonError =<< get @@ -127,10 +132,10 @@ getKeyPackageCount brig u c = . paths ["mls", "key-packages", "self", toByteString' c, "count"] . zUser (qUnqualified u) ) - ByteString -> IO a +decodeMLSError :: (ParseMLS a) => ByteString -> IO a decodeMLSError s = case decodeMLS' s of Left e -> assertFailure ("Could not parse MLS object: " <> Text.unpack e) Right x -> pure x diff --git a/services/brig/test/integration/API/Metrics.hs b/services/brig/test/integration/API/Metrics.hs index cc93b37cca0..6fce24b435d 100644 --- a/services/brig/test/integration/API/Metrics.hs +++ b/services/brig/test/integration/API/Metrics.hs @@ -37,8 +37,8 @@ import Wire.API.User tests :: Manager -> Opt.Opts -> Brig -> IO TestTree tests manager opts brig = do - pure $ - testGroup + pure + $ testGroup "metrics" [ testCase "prometheus" . void $ runHttpT manager (testPrometheusMetrics brig), testCase "work" . void $ runHttpT manager (testMetricsEndpoint opts brig) diff --git a/services/brig/test/integration/API/OAuth.hs b/services/brig/test/integration/API/OAuth.hs index cd08aae8317..0f1dd659d34 100644 --- a/services/brig/test/integration/API/OAuth.hs +++ b/services/brig/test/integration/API/OAuth.hs @@ -357,7 +357,8 @@ testAccessResourceSuccessNginz brig nginz = do zauthToken <- decodeToken <$> (login nginz (defEmailLogin email) PersistentCookie toByteString' zauthToken)) toByteString' zauthToken)) + tokens) where - extractRefreshTokenId :: MonadIO m => JWK -> OAuthRefreshToken -> m OAuthRefreshTokenId + extractRefreshTokenId :: (MonadIO m) => JWK -> OAuthRefreshToken -> m OAuthRefreshTokenId extractRefreshTokenId jwk rt = do fromMaybe (error "invalid sub") . hcsSub <$> liftIO (verifyRefreshToken jwk (unOAuthToken rt)) @@ -534,8 +535,9 @@ testRefreshTokenNonExistingId opts brig = do resp <- createOAuthAccessToken brig accessTokenRequest key <- liftIO $ readJwk (fromMaybe "path to jwk not set" (Opt.setOAuthJwkKeyPair $ Opt.optSettings opts)) <&> fromMaybe (error "invalid key") badRefreshToken <- - liftIO $ - OAuthToken <$> do + liftIO + $ OAuthToken + <$> do claims <- verifyRefreshToken key (unOAuthToken $ resp.refreshToken) rid :: OAuthRefreshTokenId <- randomId sub <- maybe (error "creating sub claim failed") pure $ idToText rid ^? stringOrUri @@ -670,7 +672,8 @@ testWriteConversationsCodeSuccessNginz brig nginz = do resp <- getAccessTokenForScope brig uid [WriteConversations, WriteConversationsCode] conv <- responseJsonError - =<< createTeamConv nginz authHeader resp.accessToken tid "oauth test group" Request) -> (OAuthAccessToken -> Request -> Request) -> OAuthAccessToken -> ConvId -> Http ResponseLBS postConvCode svc mkHeader token c = do - post $ - svc - . paths ["conversations", toByteString' c, "code"] - . mkHeader token - . json (CreateConversationCodeRequest Nothing) + post + $ svc + . paths ["conversations", toByteString' c, "code"] + . mkHeader token + . json (CreateConversationCodeRequest Nothing) getAccessTokenForScope :: Brig -> UserId -> [OAuthScope] -> Http OAuthAccessTokenResponse getAccessTokenForScope brig uid scopes = do @@ -703,11 +706,11 @@ createTeamConv :: createTeamConv svc mkHeader token tid name = do let tinfo = Conv.ConvTeamInfo tid let conv = Conv.NewConv [] [] (checked name) (Set.fromList [CodeAccess]) Nothing (Just tinfo) Nothing Nothing Role.roleNameWireAdmin BaseProtocolProteusTag - post $ - svc - . path "conversations" - . mkHeader token - . json conv + post + $ svc + . path "conversations" + . mkHeader token + . json conv getFeatureConfigs :: (Request -> Request) -> @@ -715,10 +718,10 @@ getFeatureConfigs :: OAuthAccessToken -> Http ResponseLBS getFeatureConfigs svc mkHeader token = do - get $ - svc - . path "feature-configs" - . mkHeader token + get + $ svc + . path "feature-configs" + . mkHeader token createOAuthApplicationWithAccountAccess :: Brig -> UserId -> Http OAuthAccessTokenResponse createOAuthApplicationWithAccountAccess brig uid = do @@ -732,10 +735,10 @@ verifyRefreshToken jwk jwt = fromRight (error "invalid jwt or jwk") <$> runJOSE (verifyClaims (defaultJWTValidationSettings (const True)) jwk jwt :: JOSE JWTError IO ClaimsSet) -authHeader :: ToHttpApiData a => a -> Request -> Request +authHeader :: (ToHttpApiData a) => a -> Request -> Request authHeader = bearer "Authorization" -bearer :: ToHttpApiData a => HeaderName -> a -> Request -> Request +bearer :: (ToHttpApiData a) => HeaderName -> a -> Request -> Request bearer name = header name . toHeader . Bearer newOAuthClientRequestBody :: Text -> Text -> OAuthClientConfig @@ -836,8 +839,9 @@ signRefreshToken key claims = do badKey :: JWK badKey = do - fromMaybe (error "invalid jwk") . A.decode $ - [r| {"kty":"OKP","crv":"Ed25519","x":"VWWycQ0yCoKAwN-DjjyQVWMRan1VOFUGlZpSTaLw1OA","d":"kH9sO4hDmRQi31IncBvwiaRB9xo9UHVaSvfV7RWiQOg"} |] + fromMaybe (error "invalid jwk") + . A.decode + $ [r| {"kty":"OKP","crv":"Ed25519","x":"VWWycQ0yCoKAwN-DjjyQVWMRan1VOFUGlZpSTaLw1OA","d":"kH9sO4hDmRQi31IncBvwiaRB9xo9UHVaSvfV7RWiQOg"} |] mkUrl :: ByteString -> RedirectUrl mkUrl = fromMaybe (error "invalid url") . fromByteString @@ -845,7 +849,7 @@ mkUrl = fromMaybe (error "invalid url") . fromByteString revokeOAuthRefreshToken :: (MonadHttp m) => Brig -> OAuthRevokeRefreshTokenRequest -> m ResponseLBS revokeOAuthRefreshToken brig req = post (brig . paths ["oauth", "revoke"] . json req) -instance ToHttpApiData a => ToHttpApiData (Bearer a) where +instance (ToHttpApiData a) => ToHttpApiData (Bearer a) where toHeader = (<>) "Bearer " . toHeader . unBearer toUrlPiece = T.decodeUtf8 . toHeader diff --git a/services/brig/test/integration/API/Provider.hs b/services/brig/test/integration/API/Provider.hs index 0d4bf057042..71bcf3648f4 100644 --- a/services/brig/test/integration/API/Provider.hs +++ b/services/brig/test/integration/API/Provider.hs @@ -103,8 +103,8 @@ import Wire.API.User.Client.Prekey tests :: Domain -> Config -> Manager -> DB.ClientState -> Brig -> Cannon -> Galley -> Nginz -> IO TestTree tests dom conf p db b c g n = do - pure $ - testGroup + pure + $ testGroup "provider" [ testGroup "account" @@ -114,8 +114,8 @@ tests dom conf p db b c g n = do test p "update" $ testUpdateProvider db b, test p "delete" $ testDeleteProvider db b, test p "password-reset" $ testPasswordResetProvider db b, - test p "email/password update with password reset" $ - testPasswordResetAfterEmailUpdateProvider db b + test p "email/password update with password reset" + $ testPasswordResetAfterEmailUpdateProvider db b ], testGroup "service" @@ -128,19 +128,19 @@ tests dom conf p db b c g n = do ], testGroup "service whitelist" - [ test p "search permissions" $ - testWhitelistSearchPermissions conf db b g, - test p "update permissions" $ - testWhitelistUpdatePermissions conf db b g, - test p "basic functionality" $ - testWhitelistBasic conf db b g, + [ test p "search permissions" + $ testWhitelistSearchPermissions conf db b g, + test p "update permissions" + $ testWhitelistUpdatePermissions conf db b g, + test p "basic functionality" + $ testWhitelistBasic conf db b g, test p "search" $ testSearchWhitelist conf db b g, - test p "search honors enabling and whitelisting" $ - testSearchWhitelistHonorUpdates conf db b, - test p "de-whitelisted bots are removed" $ - testWhitelistKickout dom conf db b g c, - test p "de-whitelisting works with deleted conversations" $ - testDeWhitelistDeletedConv conf db b g c, + test p "search honors enabling and whitelisting" + $ testSearchWhitelistHonorUpdates conf db b, + test p "de-whitelisted bots are removed" + $ testWhitelistKickout dom conf db b g c, + test p "de-whitelisting works with deleted conversations" + $ testDeWhitelistDeletedConv conf db b g c, test p "whitelist via nginz" $ testWhitelistNginz conf db b n ], testGroup @@ -465,22 +465,22 @@ testListServices config db brig = do -- This is how we're going to call our /services endpoint. Every time we -- would call it twice (with tags and without) and assert that results -- match. - let search :: HasCallStack => Name -> Http ServiceProfilePage + let search :: (HasCallStack) => Name -> Http ServiceProfilePage search name = do r1 <- searchServices brig 20 uid (Just name) Nothing r2 <- searchServices brig 20 uid (Just name) (Just (match1 SocialTag)) -- We could also compare 'serviceProfilePageHasMore' here, but -- then the test wouldn't pass (even though it should!). -- See Note [buggy pagination] for more details. - liftIO $ - assertEqual + liftIO + $ assertEqual ("search for " <> show name <> " without and with tags") (serviceProfilePageResults r1) (serviceProfilePageResults r2) pure r1 -- This function searches for a prefix and check that the results match -- our known list of services - let searchAndCheck :: HasCallStack => Name -> Http [ServiceProfile] + let searchAndCheck :: (HasCallStack) => Name -> Http [ServiceProfile] searchAndCheck name = do result <- search name assertServiceDetails ("name " <> show name) (select name services) result @@ -587,9 +587,9 @@ testClaimUserPrekeys config db brig galley = withTestService config db brig defS actual <- responseJsonError =<< claimUsersPrekeys brig bid userClients pure e evt -> assertFailure $ "expected TestBotMessage, got: " <> show evt assertAccessUpdateOrMemberLeave :: (HasCallStack, MonadIO m) => Qualified UserId -> ConversationAccessData -> Qualified UserId -> [Qualified UserId] -> Qualified ConvId -> Event -> m () - assertAccessUpdateOrMemberLeave updFrom upd leaveFrom gone cnv e = liftIO $ - case evtType e of + assertAccessUpdateOrMemberLeave updFrom upd leaveFrom gone cnv e = liftIO + $ case evtType e of ConvAccessUpdate -> do assertEqual "conv" cnv (evtConv e) assertEqual "user" updFrom (evtFrom e) @@ -923,12 +923,12 @@ testSearchWhitelist config db brig galley = do -- endpoint. Every time we call it twice (with filter_disabled=false and -- without) and assert that results match – which should always be the -- case since in this test we won't have any disabled services. - let search :: HasCallStack => Maybe Text -> Http ServiceProfilePage + let search :: (HasCallStack) => Maybe Text -> Http ServiceProfilePage search mbName = do r1 <- searchServiceWhitelist brig 20 uid tid mbName r2 <- searchServiceWhitelistAll brig 20 uid tid mbName - liftIO $ - assertEqual + liftIO + $ assertEqual ("search for " <> show mbName <> " with and without filtering") r1 r2 @@ -950,7 +950,7 @@ testSearchWhitelist config db brig galley = do liftIO $ assertEqual "has more" True (serviceProfilePageHasMore page) -- This function searches for a prefix and check that the results match -- our known list of services - let searchAndCheck :: HasCallStack => Name -> Http [ServiceProfile] + let searchAndCheck :: (HasCallStack) => Name -> Http [ServiceProfile] searchAndCheck (Name name) = do result <- search (Just name) assertServiceDetails ("name " <> show name) (select name services) result @@ -1021,7 +1021,8 @@ testWhitelistBasic config db brig galley = -- Check that after whitelisting the service, it can be added to the conversation whitelistService brig owner tid pid sid bid <- - fmap rsAddBotId . responseJsonError + fmap rsAddBotId + . responseJsonError =<< (addBot brig owner pid sid cid >= \case + liftIO + $ timeout (2 # Second) (readChan buf) + >>= \case Nothing -> pure () Just (TestBotCreated _) -> assertFailure "bot got a TestBotCreated event" Just (TestBotMessage e) -> assertFailure ("bot got an event: " <> show (evtType e)) @@ -1098,21 +1100,21 @@ registerProvider :: NewProvider -> Http ResponseLBS registerProvider brig new = - post $ - brig - . path "/provider/register" - . contentJson - . body (RequestBodyLBS (encode new)) + post + $ brig + . path "/provider/register" + . contentJson + . body (RequestBodyLBS (encode new)) getProviderActivationCodeInternal :: Brig -> Email -> Http ResponseLBS getProviderActivationCodeInternal brig email = - get $ - brig - . path "/i/provider/activation-code" - . queryItem "email" (toByteString' email) + get + $ brig + . path "/i/provider/activation-code" + . queryItem "email" (toByteString' email) activateProvider :: Brig -> @@ -1120,11 +1122,11 @@ activateProvider :: Code.Value -> Http ResponseLBS activateProvider brig key val = - get $ - brig - . path "/provider/activate" - . queryItem "key" (toByteString' key) - . queryItem "code" (toByteString' val) + get + $ brig + . path "/provider/activate" + . queryItem "key" (toByteString' key) + . queryItem "code" (toByteString' val) loginProvider :: Brig -> @@ -1132,11 +1134,11 @@ loginProvider :: PlainTextPassword6 -> Http ResponseLBS loginProvider brig email pw = - post $ - brig - . path "/provider/login" - . contentJson - . body (RequestBodyLBS (encode (ProviderLogin email pw))) + post + $ brig + . path "/provider/login" + . contentJson + . body (RequestBodyLBS (encode (ProviderLogin email pw))) updateProvider :: Brig -> @@ -1144,13 +1146,13 @@ updateProvider :: UpdateProvider -> Http ResponseLBS updateProvider brig pid upd = - put $ - brig - . path "/provider" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ brig + . path "/provider" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode upd)) updateProviderPassword :: Brig -> @@ -1158,13 +1160,13 @@ updateProviderPassword :: PasswordChange -> Http ResponseLBS updateProviderPassword brig pid upd = - put $ - brig - . path "/provider/password" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ brig + . path "/provider/password" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode upd)) initiateEmailUpdateProvider :: Brig -> @@ -1172,35 +1174,35 @@ initiateEmailUpdateProvider :: EmailUpdate -> Http ResponseLBS initiateEmailUpdateProvider brig pid upd = - put $ - brig - . path "/provider/email" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ brig + . path "/provider/email" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode upd)) initiatePasswordResetProvider :: Brig -> PasswordReset -> Http ResponseLBS initiatePasswordResetProvider brig npr = - post $ - brig - . path "/provider/password-reset" - . contentJson - . body (RequestBodyLBS (encode npr)) + post + $ brig + . path "/provider/password-reset" + . contentJson + . body (RequestBodyLBS (encode npr)) completePasswordResetProvider :: Brig -> CompletePasswordReset -> Http ResponseLBS completePasswordResetProvider brig e = - post $ - brig - . path "/provider/password-reset/complete" - . contentJson - . body (RequestBodyLBS (encode e)) + post + $ brig + . path "/provider/password-reset/complete" + . contentJson + . body (RequestBodyLBS (encode e)) deleteProvider :: Brig -> @@ -1208,24 +1210,24 @@ deleteProvider :: PlainTextPassword6 -> Http ResponseLBS deleteProvider brig pid pw = - delete $ - brig - . path "/provider" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode (DeleteProvider pw))) + delete + $ brig + . path "/provider" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode (DeleteProvider pw))) getProvider :: Brig -> ProviderId -> Http ResponseLBS getProvider brig pid = - get $ - brig - . path "/provider" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) + get + $ brig + . path "/provider" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) getProviderProfile :: Brig -> @@ -1233,11 +1235,11 @@ getProviderProfile :: UserId -> Http ResponseLBS getProviderProfile brig pid uid = - get $ - brig - . paths ["providers", toByteString' pid] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . paths ["providers", toByteString' pid] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) addService :: Brig -> @@ -1245,13 +1247,13 @@ addService :: NewService -> Http ResponseLBS addService brig pid new = - post $ - brig - . path "/provider/services" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode new)) + post + $ brig + . path "/provider/services" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode new)) getService :: Brig -> @@ -1259,27 +1261,27 @@ getService :: ServiceId -> Http ResponseLBS getService brig pid sid = - get $ - brig - . paths ["provider", "services", toByteString' sid] - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) + get + $ brig + . paths ["provider", "services", toByteString' sid] + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) getServices :: Brig -> ProviderId -> Http ResponseLBS getServices brig pid = - get $ - brig - . path "/provider/services" - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) + get + $ brig + . path "/provider/services" + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) getProviderServices :: Brig -> UserId -> ProviderId -> Http ResponseLBS getProviderServices brig uid pid = - get $ - brig - . paths ["providers", toByteString' pid, "services"] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . paths ["providers", toByteString' pid, "services"] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) getServiceProfile :: Brig -> @@ -1288,11 +1290,11 @@ getServiceProfile :: ServiceId -> Http ResponseLBS getServiceProfile brig uid pid sid = - get $ - brig - . paths ["providers", toByteString' pid, "services", toByteString' sid] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . paths ["providers", toByteString' pid, "services", toByteString' sid] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) updateService :: Brig -> @@ -1301,13 +1303,13 @@ updateService :: UpdateService -> Http ResponseLBS updateService brig pid sid upd = - put $ - brig - . paths ["provider", "services", toByteString' sid] - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ brig + . paths ["provider", "services", toByteString' sid] + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode upd)) updateServiceConn :: Brig -> @@ -1316,13 +1318,13 @@ updateServiceConn :: UpdateServiceConn -> Http ResponseLBS updateServiceConn brig pid sid upd = - put $ - brig - . paths ["provider", "services", toByteString' sid, "connection"] - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ brig + . paths ["provider", "services", toByteString' sid, "connection"] + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode upd)) updateServiceWhitelist :: Brig -> @@ -1331,14 +1333,14 @@ updateServiceWhitelist :: UpdateServiceWhitelist -> Http ResponseLBS updateServiceWhitelist brig uid tid upd = - post $ - brig - . paths ["teams", toByteString' tid, "services", "whitelist"] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode upd)) + post + $ brig + . paths ["teams", toByteString' tid, "services", "whitelist"] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode upd)) deleteService :: Brig -> @@ -1347,13 +1349,13 @@ deleteService :: PlainTextPassword6 -> Http ResponseLBS deleteService brig pid sid pw = - delete $ - brig - . paths ["provider", "services", toByteString' sid] - . header "Z-Type" "provider" - . header "Z-Provider" (toByteString' pid) - . contentJson - . body (RequestBodyLBS (encode (DeleteService pw))) + delete + $ brig + . paths ["provider", "services", toByteString' sid] + . header "Z-Type" "provider" + . header "Z-Provider" (toByteString' pid) + . contentJson + . body (RequestBodyLBS (encode (DeleteService pw))) listServiceProfilesByPrefix :: Brig -> @@ -1362,13 +1364,13 @@ listServiceProfilesByPrefix :: Int -> Http ResponseLBS listServiceProfilesByPrefix brig uid start size = - get $ - brig - . path "/services" - . queryItem "start" (toByteString' start) - . queryItem "size" (toByteString' size) - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . path "/services" + . queryItem "start" (toByteString' start) + . queryItem "size" (toByteString' size) + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) listTeamServiceProfilesByPrefix :: Brig -> @@ -1380,14 +1382,14 @@ listTeamServiceProfilesByPrefix :: Int -> Http ResponseLBS listTeamServiceProfilesByPrefix brig uid tid mbPrefix filterDisabled size = - get $ - brig - . paths ["teams", toByteString' tid, "services", "whitelisted"] - . maybe id (queryItem "prefix" . toByteString') mbPrefix - . (if filterDisabled then id else queryItem "filter_disabled" "false") - . queryItem "size" (toByteString' size) - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . paths ["teams", toByteString' tid, "services", "whitelisted"] + . maybe id (queryItem "prefix" . toByteString') mbPrefix + . (if filterDisabled then id else queryItem "filter_disabled" "false") + . queryItem "size" (toByteString' size) + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) listServiceProfilesByTag :: Brig -> @@ -1397,14 +1399,14 @@ listServiceProfilesByTag :: Int -> Http ResponseLBS listServiceProfilesByTag brig uid tags start size = - get $ - brig - . path "/services" - . queryItem "tags" (toByteString' cond) - . maybe id (queryItem "start" . toByteString') start - . queryItem "size" (toByteString' size) - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) + get + $ brig + . path "/services" + . queryItem "tags" (toByteString' cond) + . maybe id (queryItem "start" . toByteString') start + . queryItem "size" (toByteString' size) + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) where cond :: QueryAnyTags 1 3 cond = @@ -1420,14 +1422,14 @@ addBot :: ConvId -> Http ResponseLBS addBot brig uid pid sid cid = - post $ - brig - . paths ["conversations", toByteString' cid, "bots"] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode (AddBot pid sid Nothing))) + post + $ brig + . paths ["conversations", toByteString' cid, "bots"] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode (AddBot pid sid Nothing))) removeBot :: Brig -> @@ -1436,12 +1438,12 @@ removeBot :: BotId -> Http ResponseLBS removeBot brig uid cid bid = - delete $ - brig - . paths ["conversations", toByteString' cid, "bots", toByteString' bid] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) - . header "Z-Connection" "conn" + delete + $ brig + . paths ["conversations", toByteString' cid, "bots", toByteString' bid] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) + . header "Z-Connection" "conn" data RemoveBot = RemoveBot { _rmBotConv :: !ConvId, @@ -1462,11 +1464,11 @@ removeBotInternal :: BotId -> Http ResponseLBS removeBotInternal galley uid cid bid = - delete $ - galley - . paths ["i", "bots"] - . header "Z-User" (toByteString' uid) - . Bilge.json (RemoveBot cid bid) + delete + $ galley + . paths ["i", "bots"] + . header "Z-User" (toByteString' uid) + . Bilge.json (RemoveBot cid bid) createConv :: Galley -> @@ -1482,14 +1484,14 @@ createConvWithAccessRoles :: [UserId] -> Http ResponseLBS createConvWithAccessRoles ars g u us = - post $ - g - . path "/conversations" - . header "Z-User" (toByteString' u) - . header "Z-Type" "access" - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode conv)) + post + $ g + . path "/conversations" + . header "Z-User" (toByteString' u) + . header "Z-Type" "access" + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode conv)) where conv = NewConv us [] Nothing Set.empty ars Nothing Nothing Nothing roleNameWireAdmin BaseProtocolProteusTag @@ -1501,14 +1503,14 @@ postMessage :: [(UserId, ClientId, Text)] -> Http ResponseLBS postMessage galley fromu fromc cid rcps = - post $ - galley - . paths ["conversations", toByteString' cid, "otr", "messages"] - . header "Z-Type" "access" - . header "Z-User" (toByteString' fromu) - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode (mkMessage fromc rcps))) + post + $ galley + . paths ["conversations", toByteString' cid, "otr", "messages"] + . header "Z-Type" "access" + . header "Z-User" (toByteString' fromu) + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode (mkMessage fromc rcps))) postBotMessage :: Galley -> @@ -1518,15 +1520,15 @@ postBotMessage :: [(UserId, ClientId, Text)] -> Http ResponseLBS postBotMessage galley fromb fromc cid rcps = - post $ - galley - . path "/bot/messages" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' fromb) - . header "Z-Conversation" (toByteString' cid) - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode (mkMessage fromc rcps))) + post + $ galley + . path "/bot/messages" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' fromb) + . header "Z-Conversation" (toByteString' cid) + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode (mkMessage fromc rcps))) getBotConv :: Galley -> @@ -1534,12 +1536,12 @@ getBotConv :: ConvId -> Http ResponseLBS getBotConv galley bid cid = - get $ - galley - . path "/bot/conversation" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) - . header "Z-Conversation" (toByteString' cid) + get + $ galley + . path "/bot/conversation" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) + . header "Z-Conversation" (toByteString' cid) updateConversationAccess :: Galley -> @@ -1549,19 +1551,19 @@ updateConversationAccess :: Set AccessRole -> Http ResponseLBS updateConversationAccess galley uid qcid access role = - put $ - galley - . paths - [ "conversations", - toByteString' (qDomain qcid), - toByteString' (qUnqualified qcid), - "access" - ] - . header "Z-Type" "access" - . header "Z-User" (toByteString' uid) - . header "Z-Connection" "conn" - . contentJson - . body (RequestBodyLBS (encode upd)) + put + $ galley + . paths + [ "conversations", + toByteString' (qDomain qcid), + toByteString' (qUnqualified qcid), + "access" + ] + . header "Z-Type" "access" + . header "Z-User" (toByteString' uid) + . header "Z-Connection" "conn" + . contentJson + . body (RequestBodyLBS (encode upd)) where upd = ConversationAccessData (Set.fromList access) role @@ -1583,70 +1585,70 @@ enabled2ndFaForTeamInternal galley tid = do getBotSelf :: Brig -> BotId -> Http ResponseLBS getBotSelf brig bid = - get $ - brig - . path "/bot/self" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) + get + $ brig + . path "/bot/self" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) getBotClient :: Brig -> BotId -> Http ResponseLBS getBotClient brig bid = - get $ - brig - . path "/bot/client" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) - . contentJson + get + $ brig + . path "/bot/client" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) + . contentJson getBotPreKeyIds :: Brig -> BotId -> Http ResponseLBS getBotPreKeyIds brig bid = - get $ - brig - . path "/bot/client/prekeys" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) + get + $ brig + . path "/bot/client/prekeys" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) updateBotPrekeys :: Brig -> BotId -> [Prekey] -> Http ResponseLBS updateBotPrekeys brig bid prekeys = - post $ - brig - . path "/bot/client/prekeys" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) - . contentJson - . body (RequestBodyLBS (encode (UpdateBotPrekeys prekeys))) + post + $ brig + . path "/bot/client/prekeys" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) + . contentJson + . body (RequestBodyLBS (encode (UpdateBotPrekeys prekeys))) claimUsersPrekeys :: Brig -> BotId -> UserClients -> Http ResponseLBS claimUsersPrekeys brig bid ucs = - post $ - brig - . path "/bot/users/prekeys" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) - . contentJson - . body (RequestBodyLBS (encode ucs)) + post + $ brig + . path "/bot/users/prekeys" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) + . contentJson + . body (RequestBodyLBS (encode ucs)) listUserProfiles :: Brig -> BotId -> [UserId] -> Http ResponseLBS listUserProfiles brig bid uids = - get $ - brig - . path "/bot/users" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) - . queryItem "ids" (C8.intercalate "," $ toByteString' <$> uids) + get + $ brig + . path "/bot/users" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) + . queryItem "ids" (C8.intercalate "," $ toByteString' <$> uids) getUserClients :: Brig -> BotId -> UserId -> Http ResponseLBS getUserClients brig bid uid = - get $ - brig - . paths ["bot", "users", toByteString' uid, "clients"] - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bid) + get + $ brig + . paths ["bot", "users", toByteString' uid, "clients"] + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bid) -------------------------------------------------------------------------------- -- DB Operations -lookupCode :: MonadIO m => DB.ClientState -> Code.Gen -> Code.Scope -> m (Maybe Code.Code) +lookupCode :: (MonadIO m) => DB.ClientState -> Code.Gen -> Code.Scope -> m (Maybe Code.Code) lookupCode db gen = liftIO . DB.runClient db . Code.lookup (Code.genKey gen) -------------------------------------------------------------------------------- @@ -1710,7 +1712,7 @@ testRegisterProvider db' brig = do assertEqual "description" defProviderDescr (providerDescr p) assertEqual "profile" (ProviderProfile p) pp -randomProvider :: HasCallStack => DB.ClientState -> Brig -> Http Provider +randomProvider :: (HasCallStack) => DB.ClientState -> Brig -> Http Provider randomProvider db brig = do email <- randomEmail gen <- Code.mkGen (Code.ForEmail email) @@ -1729,7 +1731,7 @@ randomProvider db brig = do let Just prv = responseJsonMaybe _rs pure prv -addGetService :: HasCallStack => Brig -> ProviderId -> NewService -> Http Service +addGetService :: (HasCallStack) => Brig -> ProviderId -> NewService -> Http Service addGetService brig pid new = do _rs <- addService brig pid new Brig -> ProviderId -> ServiceId -> Http () +enableService :: (HasCallStack) => Brig -> ProviderId -> ServiceId -> Http () enableService brig pid sid = do let upd = (mkUpdateServiceConn defProviderPassword) @@ -1747,7 +1749,7 @@ enableService brig pid sid = do updateServiceConn brig pid sid upd !!! const 200 === statusCode -disableService :: HasCallStack => Brig -> ProviderId -> ServiceId -> Http () +disableService :: (HasCallStack) => Brig -> ProviderId -> ServiceId -> Http () disableService brig pid sid = do let upd = (mkUpdateServiceConn defProviderPassword) @@ -1757,7 +1759,7 @@ disableService brig pid sid = do !!! const 200 === statusCode whitelistServiceNginz :: - HasCallStack => + (HasCallStack) => Nginz -> -- | Team owner User -> @@ -1779,15 +1781,15 @@ updateServiceWhitelistNginz nginz user tid upd = do let Just email = userEmail user rs <- login nginz (defEmailLogin email) PersistentCookie toByteString' t) - . contentJson - . body (RequestBodyLBS (encode upd)) + post + $ nginz + . paths ["teams", toByteString' tid, "services", "whitelist"] + . header "Authorization" ("Bearer " <> toByteString' t) + . contentJson + . body (RequestBodyLBS (encode upd)) whitelistService :: - HasCallStack => + (HasCallStack) => Brig -> -- | Team owner UserId -> @@ -1803,7 +1805,7 @@ whitelistService brig uid tid pid sid = const 200 === statusCode dewhitelistService :: - HasCallStack => + (HasCallStack) => Brig -> -- | Team owner UserId -> @@ -1818,7 +1820,7 @@ dewhitelistService brig uid tid pid sid = -- TODO: allow both 200 and 204 here and use it in 'testWhitelistEvents' const 200 === statusCode -defNewService :: MonadIO m => Config -> m NewService +defNewService :: (MonadIO m) => Config -> m NewService defNewService config = liftIO $ do key <- readServiceKey (publicKey config) pure @@ -1879,32 +1881,32 @@ defServiceAssets = -- TODO: defServiceToken :: ServiceToken -readServiceKey :: MonadIO m => FilePath -> m ServiceKeyPEM +readServiceKey :: (MonadIO m) => FilePath -> m ServiceKeyPEM readServiceKey fp = liftIO $ do bs <- BS.readFile fp let Right [k] = pemParseBS bs pure (ServiceKeyPEM k) -randServiceKey :: MonadIO m => m ServiceKeyPEM +randServiceKey :: (MonadIO m) => m ServiceKeyPEM randServiceKey = liftIO $ do kp <- generateRSAKey' 4096 65537 Right [k] <- pemParseBS . C8.pack <$> writePublicKey kp pure (ServiceKeyPEM k) -waitFor :: MonadIO m => Timeout -> (a -> Bool) -> m a -> m a +waitFor :: (MonadIO m) => Timeout -> (a -> Bool) -> m a -> m a waitFor t f ma = do a <- ma if - | f a -> pure a - | t <= 0 -> liftIO $ throwM TimedOut - | otherwise -> do - liftIO $ threadDelay (1 # Second) - waitFor (t - 1 # Second) f ma + | f a -> pure a + | t <= 0 -> liftIO $ throwM TimedOut + | otherwise -> do + liftIO $ threadDelay (1 # Second) + waitFor (t - 1 # Second) f ma withFreePortAnyAddr :: (MonadMask m, MonadIO m) => ((Warp.Port, Socket) -> m a) -> m a withFreePortAnyAddr = bracket openFreePortAnyAddr (liftIO . Socket.close . snd) -openFreePortAnyAddr :: MonadIO m => m (Warp.Port, Socket) +openFreePortAnyAddr :: (MonadIO m) => m (Warp.Port, Socket) openFreePortAnyAddr = liftIO $ bindRandomPortTCP "*" -- | Run a test case with an external service application. @@ -1924,10 +1926,10 @@ registerService config sPort db brig = do prv <- randomProvider db brig new <- defNewService config let Just url = - fromByteString $ - encodeUtf8 (botHost config) - <> ":" - <> C8.pack (show sPort) + fromByteString + $ encodeUtf8 (botHost config) + <> ":" + <> C8.pack (show sPort) svc <- addGetService brig (providerId prv) (new {newServiceUrl = url}) let pid = providerId prv let sid = serviceId svc @@ -1946,9 +1948,10 @@ runService config sPort sock mkApp go = do let defs = Warp.defaultSettings {Warp.settingsPort = sPort} buf <- liftIO newChan srv <- - liftIO . Async.async $ - Warp.runTLSSocket tlss defs sock $ - mkApp buf + liftIO + . Async.async + $ Warp.runTLSSocket tlss defs sock + $ mkApp buf go buf `finally` liftIO (Async.cancel srv) data TestBot = TestBot @@ -2014,52 +2017,52 @@ defServiceApp buf = k $ responseLBS status200 [] "success" wsAssertMemberJoin :: (HasCallStack, MonadIO m) => WS.WebSocket -> Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> m () -wsAssertMemberJoin ws conv usr new = void $ - liftIO $ - WS.assertMatch (5 # Second) ws $ - \n -> do - let e = List1.head (unpackEvents n) - ntfTransient n @?= False - evtConv e @?= conv - evtType e @?= MemberJoin - evtFrom e @?= usr - evtData e @?= EdMembersJoin (SimpleMembers (fmap (\u -> SimpleMember u roleNameWireAdmin) new)) +wsAssertMemberJoin ws conv usr new = void + $ liftIO + $ WS.assertMatch (5 # Second) ws + $ \n -> do + let e = List1.head (unpackEvents n) + ntfTransient n @?= False + evtConv e @?= conv + evtType e @?= MemberJoin + evtFrom e @?= usr + evtData e @?= EdMembersJoin (SimpleMembers (fmap (\u -> SimpleMember u roleNameWireAdmin) new)) wsAssertMemberLeave :: (HasCallStack, MonadIO m) => WS.WebSocket -> Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> m () -wsAssertMemberLeave ws conv usr old = void $ - liftIO $ - WS.assertMatch (5 # Second) ws $ - \n -> do - let e = List1.head (unpackEvents n) - ntfTransient n @?= False - evtConv e @?= conv - evtType e @?= MemberLeave - evtFrom e @?= usr - evtData e @?= EdMembersLeave EdReasonRemoved (QualifiedUserIdList old) +wsAssertMemberLeave ws conv usr old = void + $ liftIO + $ WS.assertMatch (5 # Second) ws + $ \n -> do + let e = List1.head (unpackEvents n) + ntfTransient n @?= False + evtConv e @?= conv + evtType e @?= MemberLeave + evtFrom e @?= usr + evtData e @?= EdMembersLeave EdReasonRemoved (QualifiedUserIdList old) wsAssertConvDelete :: (HasCallStack, MonadIO m) => WS.WebSocket -> Qualified ConvId -> Qualified UserId -> m () -wsAssertConvDelete ws conv from = void $ - liftIO $ - WS.assertMatch (5 # Second) ws $ - \n -> do - let e = List1.head (WS.unpackPayload n) - ntfTransient n @?= False - evtConv e @?= conv - evtType e @?= ConvDelete - evtFrom e @?= from - evtData e @?= EdConvDelete +wsAssertConvDelete ws conv from = void + $ liftIO + $ WS.assertMatch (5 # Second) ws + $ \n -> do + let e = List1.head (WS.unpackPayload n) + ntfTransient n @?= False + evtConv e @?= conv + evtType e @?= ConvDelete + evtFrom e @?= from + evtData e @?= EdConvDelete wsAssertMessage :: (HasCallStack, MonadIO m) => WS.WebSocket -> Qualified ConvId -> Qualified UserId -> ClientId -> ClientId -> Text -> m () -wsAssertMessage ws conv fromu fromc to txt = void $ - liftIO $ - WS.assertMatch (5 # Second) ws $ - \n -> do - let e = List1.head (unpackEvents n) - ntfTransient n @?= False - evtConv e @?= conv - evtType e @?= OtrMessageAdd - evtFrom e @?= fromu - evtData e @?= EdOtrMessage (OtrMessage fromc to txt (Just "data")) +wsAssertMessage ws conv fromu fromc to txt = void + $ liftIO + $ WS.assertMatch (5 # Second) ws + $ \n -> do + let e = List1.head (unpackEvents n) + ntfTransient n @?= False + evtConv e @?= conv + evtType e @?= OtrMessageAdd + evtFrom e @?= fromu + evtData e @?= EdOtrMessage (OtrMessage fromc to txt (Just "data")) svcAssertMemberJoin :: (HasCallStack, MonadIO m) => Chan TestBotEvent -> Qualified UserId -> [Qualified UserId] -> Qualified ConvId -> m () svcAssertMemberJoin buf usr new cnv = liftIO $ do @@ -2145,7 +2148,7 @@ mkMessage fromc rcps = ] where mk (u, c, m) = (text u, HashMap.singleton (text c) m) - text :: ToByteString a => a -> Text + text :: (ToByteString a) => a -> Text text = fromJust . fromByteString . toByteString' -- | A list of 20 services, all having names that begin with the given prefix. @@ -2322,7 +2325,7 @@ testMessageBotUtil quid uc cid pid sid sref buf brig galley cannon = do wsAssertMemberLeave ws qcid (tUntagged lbuid) [tUntagged lbuid] prepareBotUsersTeam :: - HasCallStack => + (HasCallStack) => Brig -> Galley -> ServiceRef -> @@ -2352,7 +2355,7 @@ testWhitelistNginz config db brig nginz = withTestService config db brig defServ whitelistServiceNginz nginz adminUser tid pid sid addBotConv :: - HasCallStack => + (HasCallStack) => Domain -> Brig -> WS.Cannon -> @@ -2389,7 +2392,7 @@ addBotConv localDomain brig cannon uid1 uid2 cid pid sid buf = do -- | Given some endpoint that can search for services by name prefix, check -- that it doesn't break when service name changes. searchAndAssertNameChange :: - HasCallStack => + (HasCallStack) => Brig -> -- | Service provider ProviderId -> @@ -2405,7 +2408,8 @@ searchAndAssertNameChange :: searchAndAssertNameChange brig pid sid uid uniq search = do -- First let's figure out how the service is called now origName <- - fmap serviceProfileName . responseJsonError + fmap serviceProfileName + . responseJsonError =<< (getServiceProfile brig uid pid sid + (HasCallStack) => Brig -> Int -> UserId -> @@ -2478,7 +2482,7 @@ searchServices brig size uid mbStart mbTags = case (mbStart, mbTags) of -- | Call the endpoint that searches through whitelisted services. searchServiceWhitelist :: - HasCallStack => + (HasCallStack) => Brig -> Int -> UserId -> @@ -2494,7 +2498,7 @@ searchServiceWhitelist brig size uid tid mbStart = -- | Call the endpoint that searches through whitelisted services, and don't -- filter out disabled services. searchServiceWhitelistAll :: - HasCallStack => + (HasCallStack) => Brig -> Int -> UserId -> diff --git a/services/brig/test/integration/API/RichInfo/Util.hs b/services/brig/test/integration/API/RichInfo/Util.hs index 896f90735b8..4af5ea198e2 100644 --- a/services/brig/test/integration/API/RichInfo/Util.hs +++ b/services/brig/test/integration/API/RichInfo/Util.hs @@ -29,7 +29,7 @@ import Util import Wire.API.User.RichInfo getRichInfo :: - HasCallStack => + (HasCallStack) => Brig -> -- | The user who is performing the query UserId -> @@ -44,16 +44,17 @@ getRichInfo brig self uid = do . zUser self ) if - | statusCode r == 200 -> Right <$> responseJsonError r - | statusCode r `elem` [403, 404] -> pure . Left . statusCode $ r - | otherwise -> - error $ - "expected status code 200, 403, or 404, got: " <> show (statusCode r) + | statusCode r == 200 -> Right <$> responseJsonError r + | statusCode r `elem` [403, 404] -> pure . Left . statusCode $ r + | otherwise -> + error + $ "expected status code 200, 403, or 404, got: " + <> show (statusCode r) -- | This contacts an internal end-point. Note the asymmetry between this and the external -- GET end-point in the body: here we need to wrap the 'RichInfo' in a 'RichInfoUpdate'. putRichInfo :: - HasCallStack => + (HasCallStack) => Brig -> -- | The user whose rich info is being updated UserId -> diff --git a/services/brig/test/integration/API/Search.hs b/services/brig/test/integration/API/Search.hs index 6ffe569c113..4bb318aa437 100644 --- a/services/brig/test/integration/API/Search.hs +++ b/services/brig/test/integration/API/Search.hs @@ -75,9 +75,9 @@ import Wire.API.User.Search qualified as Search tests :: Opt.Opts -> Manager -> Galley -> Brig -> IO TestTree tests opts mgr galley brig = do testSetupOutboundOnly <- runHttpT mgr prepareUsersForSearchVisibilityNoNameOutsideTeamTests - pure $ - testGroup "search" $ - [ testWithBothIndices opts mgr "by-name" $ testSearchByName brig, + pure + $ testGroup "search" + $ [ testWithBothIndices opts mgr "by-name" $ testSearchByName brig, testWithBothIndices opts mgr "by-handle" $ testSearchByHandle brig, testWithBothIndices opts mgr "size - when exact handle matches a team user" $ testSearchSize brig True, testWithBothIndices opts mgr "size - when exact handle matches a non team user" $ testSearchSize brig False, @@ -91,49 +91,49 @@ tests opts mgr galley brig = do testWithBothIndices opts mgr "user with umlaut" $ testSearchWithUmlaut brig, testWithBothIndices opts mgr "user with japanese name" $ testSearchCJK brig, test mgr "migration to new index" $ testMigrationToNewIndex opts brig, - testGroup "team A: SearchVisibilityStandard (= unrestricted outbound search)" $ - [ testGroup "team A: SearchableByOwnTeam (= restricted inbound search)" $ - [ testWithBothIndices opts mgr " I. non-team user cannot find team A member by display name" $ testSearchTeamMemberAsNonMemberDisplayName mgr brig galley FeatureStatusDisabled, - testWithBothIndices opts mgr " II. non-team user can find team A member by exact handle" $ testSearchTeamMemberAsNonMemberExactHandle mgr brig galley FeatureStatusDisabled, - testWithBothIndices opts mgr "III. team B member cannot find team A member by display name" $ testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley FeatureStatusDisabled, - testWithBothIndices opts mgr " IV. team B member can find team A member by exact handle" $ testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley FeatureStatusDisabled, - testWithBothIndices opts mgr " V. team A member can find team A member by display name" $ testSearchTeamMemberAsSameMember mgr brig galley FeatureStatusDisabled, - testWithBothIndices opts mgr " VI. team A member can find non-team user by display name" $ testSeachNonMemberAsTeamMember brig, - testGroup "order" $ - [ test mgr "team-mates are listed before team-outsiders (exact match)" $ testSearchOrderingAsTeamMemberExactMatch brig, - test mgr "team-mates are listed before team-outsiders (prefix match)" $ testSearchOrderingAsTeamMemberPrefixMatch brig, - test mgr "team-mates are listed before team-outsiders (worse name match)" $ testSearchOrderingAsTeamMemberWorseNameMatch brig, - test mgr "team-mates are listed after team-outsiders (worse handle match)" $ testSearchOrderingAsTeamMemberWorseHandleMatch brig + testGroup "team A: SearchVisibilityStandard (= unrestricted outbound search)" + $ [ testGroup "team A: SearchableByOwnTeam (= restricted inbound search)" + $ [ testWithBothIndices opts mgr " I. non-team user cannot find team A member by display name" $ testSearchTeamMemberAsNonMemberDisplayName mgr brig galley FeatureStatusDisabled, + testWithBothIndices opts mgr " II. non-team user can find team A member by exact handle" $ testSearchTeamMemberAsNonMemberExactHandle mgr brig galley FeatureStatusDisabled, + testWithBothIndices opts mgr "III. team B member cannot find team A member by display name" $ testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley FeatureStatusDisabled, + testWithBothIndices opts mgr " IV. team B member can find team A member by exact handle" $ testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley FeatureStatusDisabled, + testWithBothIndices opts mgr " V. team A member can find team A member by display name" $ testSearchTeamMemberAsSameMember mgr brig galley FeatureStatusDisabled, + testWithBothIndices opts mgr " VI. team A member can find non-team user by display name" $ testSeachNonMemberAsTeamMember brig, + testGroup "order" + $ [ test mgr "team-mates are listed before team-outsiders (exact match)" $ testSearchOrderingAsTeamMemberExactMatch brig, + test mgr "team-mates are listed before team-outsiders (prefix match)" $ testSearchOrderingAsTeamMemberPrefixMatch brig, + test mgr "team-mates are listed before team-outsiders (worse name match)" $ testSearchOrderingAsTeamMemberWorseNameMatch brig, + test mgr "team-mates are listed after team-outsiders (worse handle match)" $ testSearchOrderingAsTeamMemberWorseHandleMatch brig + ] + ], + testGroup "team A: SearchableByAllTeams (= unrestricted inbound search)" + $ [ test mgr " I. non-team user cannot find team A member via display name" $ testSearchTeamMemberAsNonMemberDisplayName mgr brig galley FeatureStatusEnabled, + test mgr " II. non-team user can find team A member by exact handle" $ testSearchTeamMemberAsNonMemberExactHandle mgr brig galley FeatureStatusEnabled, + test mgr "III*. team B member can find team A member by display name" $ testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley FeatureStatusEnabled, + test mgr " IV. team B member can find team A member by exact handle" $ testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley FeatureStatusEnabled, + test mgr " V. team A member can find team A member by display name" $ testSearchTeamMemberAsSameMember mgr brig galley FeatureStatusEnabled ] - ], - testGroup "team A: SearchableByAllTeams (= unrestricted inbound search)" $ - [ test mgr " I. non-team user cannot find team A member via display name" $ testSearchTeamMemberAsNonMemberDisplayName mgr brig galley FeatureStatusEnabled, - test mgr " II. non-team user can find team A member by exact handle" $ testSearchTeamMemberAsNonMemberExactHandle mgr brig galley FeatureStatusEnabled, - test mgr "III*. team B member can find team A member by display name" $ testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley FeatureStatusEnabled, - test mgr " IV. team B member can find team A member by exact handle" $ testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley FeatureStatusEnabled, - test mgr " V. team A member can find team A member by display name" $ testSearchTeamMemberAsSameMember mgr brig galley FeatureStatusEnabled - ] - ], - testGroup "searchSameTeamOnly == true (server setting)" $ - [ testWithBothIndicesAndOpts opts mgr "any team user cannot find any non-team user by display name or exact handle" $ testSearchSameTeamOnly brig - ], - testGroup "team A: SearchVisibilityNoNameOutsideTeam (restricted outbound search)" $ - [ testGroup "team A: SearchableByOwnTeam (= restricted inbound search)" $ - [ test mgr "I. non-team user cannot find team A member by display name" $ testSearchTeamMemberAsNonMemberOutboundOnly brig testSetupOutboundOnly, - test mgr "team A member cannot find team B member by display name" $ testSearchTeamMemberAsOtherMemberOutboundOnly brig testSetupOutboundOnly, - test mgr "team A member can find team B member by by exact handle" $ testSearchOutboundOnlyCanFindOtherByHandle brig testSetupOutboundOnly, - test mgr "V. team A member can find other team A member by display name or exact handle" $ testSearchTeamMemberAsSameMemberOutboundOnly brig testSetupOutboundOnly, - test mgr "team A member cannot find non-team user by display name" $ testSearchNonMemberOutboundOnlyByDisplay brig testSetupOutboundOnly, - test mgr "team A member can find non-team user by exact handle" $ testSearchNonMemberOutboundOnlyByHandle brig testSetupOutboundOnly - ] - ], - testGroup "federated" $ - [ test mgr "search passing own domain" $ testSearchWithDomain brig, - test mgr "remote lookup should call remote code path" $ testSearchOtherDomain opts brig - -- FUTUREWORK(federation): we need tests for: - -- failure/error cases on search (augment the federatorMock?) - -- wire-api-federation Servant-Api vs protobuf-client interactions - ], + ], + testGroup "searchSameTeamOnly == true (server setting)" + $ [ testWithBothIndicesAndOpts opts mgr "any team user cannot find any non-team user by display name or exact handle" $ testSearchSameTeamOnly brig + ], + testGroup "team A: SearchVisibilityNoNameOutsideTeam (restricted outbound search)" + $ [ testGroup "team A: SearchableByOwnTeam (= restricted inbound search)" + $ [ test mgr "I. non-team user cannot find team A member by display name" $ testSearchTeamMemberAsNonMemberOutboundOnly brig testSetupOutboundOnly, + test mgr "team A member cannot find team B member by display name" $ testSearchTeamMemberAsOtherMemberOutboundOnly brig testSetupOutboundOnly, + test mgr "team A member can find team B member by by exact handle" $ testSearchOutboundOnlyCanFindOtherByHandle brig testSetupOutboundOnly, + test mgr "V. team A member can find other team A member by display name or exact handle" $ testSearchTeamMemberAsSameMemberOutboundOnly brig testSetupOutboundOnly, + test mgr "team A member cannot find non-team user by display name" $ testSearchNonMemberOutboundOnlyByDisplay brig testSetupOutboundOnly, + test mgr "team A member can find non-team user by exact handle" $ testSearchNonMemberOutboundOnlyByHandle brig testSetupOutboundOnly + ] + ], + testGroup "federated" + $ [ test mgr "search passing own domain" $ testSearchWithDomain brig, + test mgr "remote lookup should call remote code path" $ testSearchOtherDomain opts brig + -- FUTUREWORK(federation): we need tests for: + -- failure/error cases on search (augment the federatorMock?) + -- wire-api-federation Servant-Api vs protobuf-client interactions + ], test mgr "user with unvalidated email" $ testSearchWithUnvalidatedEmail brig ] where @@ -151,7 +151,7 @@ tests opts mgr galley brig = do type TestConstraints m = (MonadFail m, MonadCatch m, MonadIO m, MonadHttp m) -testSearchWithUnvalidatedEmail :: TestConstraints m => Brig -> m () +testSearchWithUnvalidatedEmail :: (TestConstraints m) => Brig -> m () testSearchWithUnvalidatedEmail brig = do (tid, owner, user : _) <- createPopulatedBindingTeamWithNamesAndHandles brig 1 let uid = userId user @@ -180,18 +180,18 @@ testSearchWithUnvalidatedEmail brig = do assertBool "unvalidated email should be null" (isNothing . Search.teamContactEmailUnvalidated $ tc) ) where - searchAndCheckResult :: TestConstraints m => Brig -> TeamId -> UserId -> UserId -> (Search.TeamContact -> Assertion) -> m () + searchAndCheckResult :: (TestConstraints m) => Brig -> TeamId -> UserId -> UserId -> (Search.TeamContact -> Assertion) -> m () searchAndCheckResult b tid ownerId userToSearchFor assertion = executeTeamUserSearch b tid ownerId Nothing Nothing Nothing Nothing >>= checkResult userToSearchFor assertion . searchResults - checkResult :: TestConstraints m => UserId -> (Search.TeamContact -> Assertion) -> [Search.TeamContact] -> m () + checkResult :: (TestConstraints m) => UserId -> (Search.TeamContact -> Assertion) -> [Search.TeamContact] -> m () checkResult userToSearchFor assertion results = liftIO $ do let mbTeamContact = find ((==) userToSearchFor . Search.teamContactUserId) results case mbTeamContact of Nothing -> fail "no team contact found" Just teamContact -> assertion teamContact -testSearchByName :: TestConstraints m => Brig -> m () +testSearchByName :: (TestConstraints m) => Brig -> m () testSearchByName brig = do u1 <- randomUser brig u2 <- randomUser brig @@ -206,7 +206,7 @@ testSearchByName brig = do assertCan'tFind brig uid1 quid1 (fromName (userDisplayName u1)) assertCan'tFind brig uid2 quid2 (fromName (userDisplayName u2)) -testSearchByLastOrMiddleName :: TestConstraints m => Brig -> m () +testSearchByLastOrMiddleName :: (TestConstraints m) => Brig -> m () testSearchByLastOrMiddleName brig = do searcher <- userId <$> randomUser brig firstName <- randomHandle @@ -220,7 +220,7 @@ testSearchByLastOrMiddleName brig = do assertCanFind brig searcher searched lastName assertCanFind brig searcher searched (firstName <> " " <> lastName) -testSearchNonAsciiNames :: TestConstraints m => Brig -> m () +testSearchNonAsciiNames :: (TestConstraints m) => Brig -> m () testSearchNonAsciiNames brig = do searcher <- userId <$> randomUser brig suffix <- randomHandle @@ -231,7 +231,7 @@ testSearchNonAsciiNames brig = do -- This is pathetic transliteration, but it is what we have. assertCanFind brig searcher searched ("saktimana" <> suffix) -testSearchCJK :: TestConstraints m => Brig -> m () +testSearchCJK :: (TestConstraints m) => Brig -> m () testSearchCJK brig = do searcher <- randomUser brig user <- createUser' True "藤崎詩織" brig @@ -248,7 +248,7 @@ testSearchCJK brig = do assertCanFind brig (User.userId searcher) user''.userQualifiedId "ジョン" assertCanFind brig (User.userId searcher) user''.userQualifiedId "じょん" -testSearchWithUmlaut :: TestConstraints m => Brig -> m () +testSearchWithUmlaut :: (TestConstraints m) => Brig -> m () testSearchWithUmlaut brig = do searcher <- randomUser brig user <- createUser' True "Özi Müller" brig @@ -256,7 +256,7 @@ testSearchWithUmlaut brig = do assertCanFind brig (User.userId searcher) user.userQualifiedId "ozi muller" assertCanFind brig (User.userId searcher) user.userQualifiedId "Özi Müller" -testSearchByHandle :: TestConstraints m => Brig -> m () +testSearchByHandle :: (TestConstraints m) => Brig -> m () testSearchByHandle brig = do u1 <- randomUserWithHandle brig u2 <- randomUser brig @@ -266,7 +266,7 @@ testSearchByHandle brig = do Just h = fromHandle <$> userHandle u1 assertCanFind brig uid2 quid1 h -testSearchEmpty :: TestConstraints m => Brig -> m () +testSearchEmpty :: (TestConstraints m) => Brig -> m () testSearchEmpty brig = do -- This user exists just in case empty string starts matching everything _someUser <- randomUserWithHandle brig @@ -275,7 +275,7 @@ testSearchEmpty brig = do res <- searchResults <$> executeSearch brig (userId searcher) "" liftIO $ assertEqual "nothing should be returned" [] res -testSearchSize :: TestConstraints m => Brig -> Bool -> m () +testSearchSize :: (TestConstraints m) => Brig -> Bool -> m () testSearchSize brig exactHandleInTeam = do (handleMatch, searchTerm) <- if exactHandleInTeam @@ -304,7 +304,7 @@ testSearchSize brig exactHandleInTeam = do Nothing (find ((userQualifiedId handleMatch ==) . contactQualifiedId) (tail res)) -testSearchNoMatch :: TestConstraints m => Brig -> m () +testSearchNoMatch :: (TestConstraints m) => Brig -> m () testSearchNoMatch brig = do u1 <- randomUser brig _ <- randomUser brig @@ -314,7 +314,7 @@ testSearchNoMatch brig = do result <- searchResults <$> executeSearch brig uid1 "nomatch" liftIO $ assertEqual "Expected 0 results" 0 (length result) -testSearchNoExtraResults :: TestConstraints m => Brig -> m () +testSearchNoExtraResults :: (TestConstraints m) => Brig -> m () testSearchNoExtraResults brig = do u1 <- randomUser brig u2 <- randomUser brig @@ -322,17 +322,17 @@ testSearchNoExtraResults brig = do quid2 = userQualifiedId u2 refreshIndex brig resultUIds <- map contactQualifiedId . searchResults <$> executeSearch brig uid1 (fromName $ userDisplayName u2) - liftIO $ - assertEqual "Expected search returns only the searched" [quid2] resultUIds + liftIO + $ assertEqual "Expected search returns only the searched" [quid2] resultUIds testReindex :: Brig -> Http () testReindex brig = do u <- randomUser brig ((), regular) <- - runConcurrently $ - (,) - <$> Concurrently (reindex brig) - <*> Concurrently (replicateM 5 $ delayed *> mkRegularUser) + runConcurrently + $ (,) + <$> Concurrently (reindex brig) + <*> Concurrently (replicateM 5 $ delayed *> mkRegularUser) refreshIndex brig for_ regular $ \u' -> do let Just h = fromHandle <$> userHandle u' @@ -355,7 +355,7 @@ testReindex brig = do -- See also the "cassandra writetime hypothesis": -- https://wearezeta.atlassian.net/browse/BE-523 -- https://github.com/wireapp/wire-server/pull/1798#issuecomment-933174913 -_testOrderName :: TestConstraints m => Brig -> m () +_testOrderName :: (TestConstraints m) => Brig -> m () _testOrderName brig = do searcher <- userId <$> randomUser brig Name searchedWord <- randomNameWithMaxLen 122 @@ -366,13 +366,13 @@ _testOrderName brig = do let resultUIds = map contactQualifiedId results let expectedOrder = [nameMatch, namePrefixMatch] let dbg = "results: " <> show results <> "\nsearchedWord: " <> cs searchedWord - liftIO $ - assertEqual + liftIO + $ assertEqual ("Expected order: name match, name prefix match.\n\nSince this test fails sporadically for unknown reasons here is some debug info:\n" <> dbg) expectedOrder resultUIds -testOrderHandle :: TestConstraints m => Brig -> m () +testOrderHandle :: (TestConstraints m) => Brig -> m () testOrderHandle brig = do searcher <- userId <$> randomUser brig searchedWord <- randomHandle @@ -384,13 +384,13 @@ testOrderHandle brig = do results <- searchResults <$> executeSearch brig searcher searchedWord let resultUIds = map contactQualifiedId results let expectedOrder = [handleMatch, handlePrefixMatch] - liftIO $ - assertEqual + liftIO + $ assertEqual "Expected order: handle match, handle prefix match." expectedOrder resultUIds -testSearchTeamMemberAsNonMemberDisplayName :: TestConstraints m => Manager -> Brig -> Galley -> FeatureStatus -> m () +testSearchTeamMemberAsNonMemberDisplayName :: (TestConstraints m) => Manager -> Brig -> Galley -> FeatureStatus -> m () testSearchTeamMemberAsNonMemberDisplayName mgr brig galley inboundVisibility = do nonTeamMember <- randomUser brig (tid, _, [teamMember, teamBTargetReindexedAfter]) <- createPopulatedBindingTeamWithNamesAndHandles brig 2 @@ -401,7 +401,7 @@ testSearchTeamMemberAsNonMemberDisplayName mgr brig galley inboundVisibility = d assertCan'tFind brig (userId nonTeamMember) (userQualifiedId teamMember) (fromName (userDisplayName teamMember)) assertCan'tFind brig (userId nonTeamMember) (userQualifiedId teamBTargetReindexedAfter) (fromName (userDisplayName teamBTargetReindexedAfter)) -testSearchTeamMemberAsNonMemberExactHandle :: TestConstraints m => Manager -> Brig -> Galley -> FeatureStatus -> m () +testSearchTeamMemberAsNonMemberExactHandle :: (TestConstraints m) => Manager -> Brig -> Galley -> FeatureStatus -> m () testSearchTeamMemberAsNonMemberExactHandle mgr brig galley inboundVisibility = do nonTeamMember <- randomUser brig (tid, _, [teamMember, teamMemberReindexedAfter]) <- createPopulatedBindingTeamWithNamesAndHandles brig 2 @@ -415,7 +415,7 @@ testSearchTeamMemberAsNonMemberExactHandle mgr brig galley inboundVisibility = d assertCanFind brig (userId nonTeamMember) (userQualifiedId teamMember) (fromHandle teamMemberHandle) assertCanFind brig (userId nonTeamMember) (userQualifiedId teamMemberReindexedAfter) (fromHandle teamMemberReindexedAfterHandle) -testSearchTeamMemberAsOtherMemberDisplayName :: TestConstraints m => Manager -> Brig -> Galley -> FeatureStatus -> m () +testSearchTeamMemberAsOtherMemberDisplayName :: (TestConstraints m) => Manager -> Brig -> Galley -> FeatureStatus -> m () testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley inboundVisibility = do (_, _, [teamBSearcher]) <- createPopulatedBindingTeamWithNamesAndHandles brig 1 (tidA, _, [teamATarget, teamATargetReindexedAfter]) <- createPopulatedBindingTeamWithNamesAndHandles brig 2 @@ -433,7 +433,7 @@ testSearchTeamMemberAsOtherMemberDisplayName mgr brig galley inboundVisibility = FeatureStatusEnabled -> assertCanFind FeatureStatusDisabled -> assertCan'tFind -testSearchTeamMemberAsOtherMemberExactHandle :: TestConstraints m => Manager -> Brig -> Galley -> FeatureStatus -> m () +testSearchTeamMemberAsOtherMemberExactHandle :: (TestConstraints m) => Manager -> Brig -> Galley -> FeatureStatus -> m () testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley inboundVisibility = do (_, _, [teamASearcher]) <- createPopulatedBindingTeamWithNamesAndHandles brig 1 (tidA, _, [teamATarget, teamATargetReindexedAfter]) <- createPopulatedBindingTeamWithNamesAndHandles brig 2 @@ -444,21 +444,21 @@ testSearchTeamMemberAsOtherMemberExactHandle mgr brig galley inboundVisibility = assertCanFind brig (userId teamASearcher) (userQualifiedId teamATarget) (fromHandle teamATargetHandle) assertCanFind brig (userId teamASearcher) (userQualifiedId teamATargetReindexedAfter) (fromHandle (fromJust (userHandle teamATargetReindexedAfter'))) -testSearchTeamMemberAsSameMember :: TestConstraints m => Manager -> Brig -> Galley -> FeatureStatus -> m () +testSearchTeamMemberAsSameMember :: (TestConstraints m) => Manager -> Brig -> Galley -> FeatureStatus -> m () testSearchTeamMemberAsSameMember mgr brig galley inboundVisibility = do (tid, _, [teamASearcher, teamATarget]) <- createPopulatedBindingTeam brig 2 circumventSettingsOverride mgr $ setTeamSearchVisibilityInboundAvailable galley tid inboundVisibility refreshIndex brig assertCanFind brig (userId teamASearcher) (userQualifiedId teamATarget) (fromName (userDisplayName teamATarget)) -testSeachNonMemberAsTeamMember :: TestConstraints m => Brig -> m () +testSeachNonMemberAsTeamMember :: (TestConstraints m) => Brig -> m () testSeachNonMemberAsTeamMember brig = do nonTeamMember <- randomUser brig (_, _, [teamMember]) <- createPopulatedBindingTeam brig 1 refreshIndex brig assertCanFind brig (userId teamMember) (userQualifiedId nonTeamMember) (fromName (userDisplayName nonTeamMember)) -testSearchOrderingAsTeamMemberExactMatch :: TestConstraints m => Brig -> m () +testSearchOrderingAsTeamMemberExactMatch :: (TestConstraints m) => Brig -> m () testSearchOrderingAsTeamMemberExactMatch brig = do searchedName <- randomName mapM_ (\(_ :: Int) -> createUser' True (fromName searchedName) brig) [0 .. 99] @@ -466,12 +466,12 @@ testSearchOrderingAsTeamMemberExactMatch brig = do refreshIndex brig result <- executeSearch brig (userId searcher) (fromName searchedName) let resultUserIds = contactQualifiedId <$> searchResults result - liftIO $ - case elemIndex (userQualifiedId teamSearchee) resultUserIds of + liftIO + $ case elemIndex (userQualifiedId teamSearchee) resultUserIds of Nothing -> assertFailure "team mate not found in search" Just teamSearcheeIndex -> assertEqual "teammate is not the first result" 0 teamSearcheeIndex -testSearchOrderingAsTeamMemberPrefixMatch :: TestConstraints m => Brig -> m () +testSearchOrderingAsTeamMemberPrefixMatch :: (TestConstraints m) => Brig -> m () testSearchOrderingAsTeamMemberPrefixMatch brig = do searchedName <- randomNameWithMaxLen 122 -- 6 characters for "suffix" mapM_ (\(i :: Int) -> createUser' True (fromName searchedName <> Text.pack (show i)) brig) [0 .. 99] @@ -479,12 +479,12 @@ testSearchOrderingAsTeamMemberPrefixMatch brig = do refreshIndex brig result <- executeSearch brig (userId searcher) (fromName searchedName) let resultUserIds = contactQualifiedId <$> searchResults result - liftIO $ - case elemIndex (userQualifiedId teamSearchee) resultUserIds of + liftIO + $ case elemIndex (userQualifiedId teamSearchee) resultUserIds of Nothing -> assertFailure "team mate not found in search" Just teamSearcheeIndex -> assertEqual "teammate is not the first result" 0 teamSearcheeIndex -testSearchOrderingAsTeamMemberWorseNameMatch :: TestConstraints m => Brig -> m () +testSearchOrderingAsTeamMemberWorseNameMatch :: (TestConstraints m) => Brig -> m () testSearchOrderingAsTeamMemberWorseNameMatch brig = do searchedTerm <- randomHandle _ <- createUser' True searchedTerm brig @@ -492,12 +492,12 @@ testSearchOrderingAsTeamMemberWorseNameMatch brig = do refreshIndex brig result <- executeSearch brig (userId searcher) searchedTerm let resultUserIds = contactQualifiedId <$> searchResults result - liftIO $ - case elemIndex (userQualifiedId teamSearchee) resultUserIds of + liftIO + $ case elemIndex (userQualifiedId teamSearchee) resultUserIds of Nothing -> assertFailure "team mate not found in search" Just teamSearcheeIndex -> assertEqual "teammate is not the first result" 0 teamSearcheeIndex -testSearchOrderingAsTeamMemberWorseHandleMatch :: TestConstraints m => Brig -> m () +testSearchOrderingAsTeamMemberWorseHandleMatch :: (TestConstraints m) => Brig -> m () testSearchOrderingAsTeamMemberWorseHandleMatch brig = do searchedTerm <- randomHandle nonTeamSearchee <- createUser' True searchedTerm brig @@ -514,7 +514,7 @@ testSearchOrderingAsTeamMemberWorseHandleMatch brig = do Nothing -> assertFailure "team mate not found in search" Just teamSearcheeIndex -> assertEqual "teammate is not the second result" 1 teamSearcheeIndex -testSearchSameTeamOnly :: TestConstraints m => Brig -> Opt.Opts -> m () +testSearchSameTeamOnly :: (TestConstraints m) => Brig -> Opt.Opts -> m () testSearchSameTeamOnly brig opts = do nonTeamMember' <- randomUser brig nonTeamMember <- setRandomHandle brig nonTeamMember' @@ -557,7 +557,7 @@ testSearchNonMemberOutboundOnlyByHandle brig ((_, _, teamAMember), (_, _, _), no let teamMemberAHandle = fromMaybe (error "nonTeamMember must have a handle") (userHandle nonTeamMember) assertCanFind brig (userId teamAMember) (userQualifiedId nonTeamMember) (fromHandle teamMemberAHandle) -testSearchWithDomain :: TestConstraints m => Brig -> m () +testSearchWithDomain :: (TestConstraints m) => Brig -> m () testSearchWithDomain brig = do searcher <- randomUser brig searchee <- randomUser brig @@ -571,7 +571,7 @@ testSearchWithDomain brig = do -- | WARNING: this test only tests that brig will indeed make a call to federator -- (i.e. does the correct if/else branching based on the domain), -- it does not test any of the federation API details. This needs to be tested separately. -testSearchOtherDomain :: TestConstraints m => Opt.Opts -> Brig -> m () +testSearchOtherDomain :: (TestConstraints m) => Opt.Opts -> Brig -> m () testSearchOtherDomain opts brig = do user <- randomUser brig -- We cannot assert on a real federated request here, so we make a request to @@ -613,8 +613,12 @@ testMigrationToNewIndex opts brig = do withOldESProxy opts $ \oldESUrl oldESIndex -> do let optsOldIndex = opts - & Opt.elasticsearchL . Opt.indexL .~ (ES.IndexName oldESIndex) - & Opt.elasticsearchL . Opt.urlL .~ (ES.Server oldESUrl) + & Opt.elasticsearchL + . Opt.indexL + .~ (ES.IndexName oldESIndex) + & Opt.elasticsearchL + . Opt.urlL + .~ (ES.Server oldESUrl) -- Phase 1: Using old index only (phase1NonTeamUser, teamOwner, phase1TeamUser1, phase1TeamUser2, tid) <- withSettingsOverrides optsOldIndex $ do nonTeamUser <- randomUser brig @@ -624,10 +628,18 @@ testMigrationToNewIndex opts brig = do -- Phase 2: Using old index for search, writing to both indices, migrations have not run let phase2OptsWhile = optsOldIndex - & Opt.elasticsearchL . Opt.additionalWriteIndexL ?~ (opts ^. Opt.elasticsearchL . Opt.indexL) - & Opt.elasticsearchL . Opt.additionalWriteIndexUrlL ?~ (opts ^. Opt.elasticsearchL . Opt.urlL) - & Opt.elasticsearchL . Opt.additionalCaCertL .~ (opts ^. Opt.elasticsearchL . Opt.caCertL) - & Opt.elasticsearchL . Opt.additionalInsecureSkipVerifyTlsL .~ (opts ^. Opt.elasticsearchL . Opt.insecureSkipVerifyTlsL) + & Opt.elasticsearchL + . Opt.additionalWriteIndexL + ?~ (opts ^. Opt.elasticsearchL . Opt.indexL) + & Opt.elasticsearchL + . Opt.additionalWriteIndexUrlL + ?~ (opts ^. Opt.elasticsearchL . Opt.urlL) + & Opt.elasticsearchL + . Opt.additionalCaCertL + .~ (opts ^. Opt.elasticsearchL . Opt.caCertL) + & Opt.elasticsearchL + . Opt.additionalInsecureSkipVerifyTlsL + .~ (opts ^. Opt.elasticsearchL . Opt.insecureSkipVerifyTlsL) (phase2NonTeamUser, phase2TeamUser) <- withSettingsOverrides phase2OptsWhile $ do phase2NonTeamUser <- randomUser brig phase2TeamUser <- inviteAndRegisterUser teamOwner tid brig @@ -706,8 +718,8 @@ indexProxyServer idx opts mgr = proxyToHost = URI.hostBS . URI.authorityHost . fromMaybe (error "No Host") . URI.uriAuthority $ proxyURI proxyToPort = URI.portNumber . fromMaybe (URI.Port 9200) . URI.authorityPort . fromMaybe (error "No Host") . URI.uriAuthority $ proxyURI proxyApp req = - pure $ - if headMay (Wai.pathInfo req) == Just idx + pure + $ if headMay (Wai.pathInfo req) == Just idx then Wai.WPRProxyDestSecure (Wai.ProxyDest proxyToHost proxyToPort) else Wai.WPRResponse (Wai.responseLBS HTTP.status400 [] $ "Refusing to proxy to path=" <> cs (Wai.rawPathInfo req)) in waiProxyTo proxyApp Wai.defaultOnExc mgr @@ -732,7 +744,7 @@ testWithBothIndices opts mgr name f = do test mgr "old-index" $ withOldIndex opts f ] -testWithBothIndicesAndOpts :: Opt.Opts -> Manager -> TestName -> (HasCallStack => Opt.Opts -> Http ()) -> TestTree +testWithBothIndicesAndOpts :: Opt.Opts -> Manager -> TestName -> ((HasCallStack) => Opt.Opts -> Http ()) -> TestTree testWithBothIndicesAndOpts opts mgr name f = testGroup name @@ -796,8 +808,8 @@ analysisSettings = --- | This was copied from at Brig.User.Search.Index.indexMapping at commit 75e6f6e oldMapping :: Value oldMapping = - fromJust $ - decode + fromJust + $ decode [r| { "dynamic": false, diff --git a/services/brig/test/integration/API/Search/Util.hs b/services/brig/test/integration/API/Search/Util.hs index 3141b4be83f..1edb8ca2659 100644 --- a/services/brig/test/integration/API/Search/Util.hs +++ b/services/brig/test/integration/API/Search/Util.hs @@ -49,7 +49,7 @@ executeSearch' brig self q maybeDomain maybeSize = do Brig -> UserId -> Text -> Maybe Domain -> Maybe Int -> m ResponseLBS +searchRequest :: (MonadHttp m) => Brig -> UserId -> Text -> Maybe Domain -> Maybe Int -> m ResponseLBS searchRequest brig self q maybeDomain maybeSize = do get ( brig @@ -81,33 +81,37 @@ assertCanFind :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> assertCanFind brig self expected q = do r <- searchResults <$> executeSearch brig self q liftIO $ do - assertBool ("No results for query: " <> show q) $ - not (null r) - assertBool ("User not in results for query: " <> show q) $ - expected `elem` map contactQualifiedId r + assertBool ("No results for query: " <> show q) + $ not (null r) + assertBool ("User not in results for query: " <> show q) + $ expected + `elem` map contactQualifiedId r assertCanFindWithDomain :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> UserId -> Qualified UserId -> Text -> Domain -> m () assertCanFindWithDomain brig self expected q domain = do r <- searchResults <$> executeSearchWithDomain brig self q domain liftIO $ do - assertBool ("No results for query: " <> show q) $ - not (null r) - assertBool ("User not in results for query: " <> show q) $ - expected `elem` map contactQualifiedId r + assertBool ("No results for query: " <> show q) + $ not (null r) + assertBool ("User not in results for query: " <> show q) + $ expected + `elem` map contactQualifiedId r assertCan'tFind :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> UserId -> Qualified UserId -> Text -> m () assertCan'tFind brig self expected q = do r <- searchResults <$> executeSearch brig self q liftIO $ do - assertBool ("User shouldn't be present in results for query: " <> show q) $ - expected `notElem` map contactQualifiedId r + assertBool ("User shouldn't be present in results for query: " <> show q) + $ expected + `notElem` map contactQualifiedId r assertCan'tFindWithDomain :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> UserId -> Qualified UserId -> Text -> Domain -> m () assertCan'tFindWithDomain brig self expected q domain = do r <- searchResults <$> executeSearchWithDomain brig self q domain liftIO $ do - assertBool ("User shouldn't be present in results for query: " <> show q) $ - expected `notElem` map contactQualifiedId r + assertBool ("User shouldn't be present in results for query: " <> show q) + $ expected + `notElem` map contactQualifiedId r executeTeamUserSearch :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => diff --git a/services/brig/test/integration/API/Settings.hs b/services/brig/test/integration/API/Settings.hs index f600817a0e8..42d515d6754 100644 --- a/services/brig/test/integration/API/Settings.hs +++ b/services/brig/test/integration/API/Settings.hs @@ -51,17 +51,17 @@ tests defOpts manager brig galley = pure $ do [ testGroup "/users/" $ ((,) <$> [minBound ..] <*> allEmailVisibilities) - <&> \(viewingUserIs, visibility) -> do - testCase (show (viewingUserIs, visibility)) - . runHttpT manager - $ testUsersEmailVisibleIffExpected defOpts brig galley viewingUserIs visibility, + <&> \(viewingUserIs, visibility) -> do + testCase (show (viewingUserIs, visibility)) + . runHttpT manager + $ testUsersEmailVisibleIffExpected defOpts brig galley viewingUserIs visibility, testGroup "/users/:uid" $ ((,) <$> [minBound ..] <*> allEmailVisibilities) - <&> \(viewingUserIs, visibility) -> do - testCase (show (viewingUserIs, visibility)) - . runHttpT manager - $ testGetUserEmailShowsEmailsIffExpected defOpts brig galley viewingUserIs visibility + <&> \(viewingUserIs, visibility) -> do + testCase (show (viewingUserIs, visibility)) + . runHttpT manager + $ testGetUserEmailShowsEmailsIffExpected defOpts brig galley viewingUserIs visibility ] ] @@ -98,15 +98,16 @@ expectEmailVisible EmailVisibleToSelf = \case DifferentTeam -> False NoTeam -> False -jsonField :: FromJSON a => Key -> Value -> Maybe a +jsonField :: (FromJSON a) => Key -> Value -> Maybe a jsonField f u = u ^? key f >>= maybeFromJSON testUsersEmailVisibleIffExpected :: Opts -> Brig -> Galley -> ViewingUserIs -> EmailVisibilityConfig -> Http () testUsersEmailVisibleIffExpected opts brig galley viewingUserIs visibilitySetting = do (viewerId, userA, userB, nonTeamUser) <- setup brig galley viewingUserIs let uids = - C8.intercalate "," $ - toByteString' <$> [userId userA, userId userB, userId nonTeamUser] + C8.intercalate "," + $ toByteString' + <$> [userId userA, userId userB, userId nonTeamUser] expected :: Set (Maybe UserId, Maybe Email) expected = Set.fromList diff --git a/services/brig/test/integration/API/SystemSettings.hs b/services/brig/test/integration/API/SystemSettings.hs index 40b20c0606f..0652fa3f308 100644 --- a/services/brig/test/integration/API/SystemSettings.hs +++ b/services/brig/test/integration/API/SystemSettings.hs @@ -55,14 +55,15 @@ testGetSettings opts = liftIO $ do -- modified options) directly on the `Request`. No real HTTP request is -- made. This happens due to the `MonadHttp WaiTest.Session` instance. queriedSettings <- withSettingsOverrides newOpts $ getSystemSettings - liftIO $ - queriedSettings @?= SystemSettingsPublic expectedRes + liftIO + $ queriedSettings + @?= SystemSettingsPublic expectedRes getSystemSettings :: WaiTest.Session SystemSettingsPublic getSystemSettings = responseJsonError =<< get (path (BS.pack ("/" ++ cs latestVersion ++ "/system/settings/unauthorized"))) - Http () testGetSettingsInternal opts = liftIO $ do diff --git a/services/brig/test/integration/API/Team.hs b/services/brig/test/integration/API/Team.hs index 5b56b4f414b..908d61c51d1 100644 --- a/services/brig/test/integration/API/Team.hs +++ b/services/brig/test/integration/API/Team.hs @@ -83,53 +83,53 @@ tests :: Opt.Opts -> Manager -> Nginz -> Brig -> Cannon -> Galley -> UserJournal tests conf m n b c g aws = do let tl = TeamSizeLimit . Opt.setMaxTeamSize . Opt.optSettings $ conf let it = Opt.setTeamInvitationTimeout . Opt.optSettings $ conf - pure $ - testGroup + pure + $ testGroup "team" - [ testGroup "invitation" $ - [ test m "post /teams/:tid/invitations - 201" $ testInvitationEmail b, - test m "get /teams/:tid/invitations/:iid - 200" $ testGetInvitation b, - test m "delete /teams/:tid/invitations/:iid - 200" $ testDeleteInvitation b, - test m "post /teams/:tid/invitations - invitation url" $ testInvitationUrl conf b, - test m "post /teams/:tid/invitations - no invitation url" $ testNoInvitationUrl conf b, - test m "post /teams/:tid/invitations - email lookup" $ testInvitationEmailLookup b, - test m "post /teams/:tid/invitations - email lookup nginz" $ testInvitationEmailLookupNginz b n, - test m "post /teams/:tid/invitations - email lookup register" $ testInvitationEmailLookupRegister b, - test m "post /teams/:tid/invitations - 403 no permission" $ testInvitationNoPermission b, - test m "post /teams/:tid/invitations - 403 too many pending" $ testInvitationTooManyPending conf b tl, - test m "post /teams/:tid/invitations - roles" $ testInvitationRoles b g, - test m "post /register - 201 accepted" $ testInvitationEmailAccepted b g, - test m "post /register - 201 accepted (with domain blocking customer extension)" $ testInvitationEmailAcceptedInBlockedDomain conf b g, - test m "post /register - 201 extended accepted" $ testInvitationEmailAndPhoneAccepted b g, - test m "post /register user & team - 201 accepted" $ testCreateTeam b g aws, - test m "post /register user & team - 201 preverified" $ testCreateTeamPreverified b g aws, - test m "post /register - 400 no passwordless" $ testTeamNoPassword b, - test m "post /register - 400 code already used" $ testInvitationCodeExists b, - test m "post /register - 400 bad code" $ testInvitationInvalidCode b, - test m "post /register - 400 no wireless" $ testInvitationCodeNoIdentity b, - test m "post /register - 400 mutually exclusive" $ testInvitationMutuallyExclusive b, - test m "post /register - 403 too many members" $ testInvitationTooManyMembers b g tl, - test m "get /teams/:tid/invitations - 200 (paging)" $ testInvitationPaging conf b, - test m "get /teams/:tid/invitations/info - 200" $ testInvitationInfo b, - test m "get /teams/:tid/invitations/info - 400" $ testInvitationInfoBadCode b, - test m "get /teams/:tid/invitations/info - 400 expired" $ testInvitationInfoExpired b it, - -- "get /i/teams/invitations/by-email?email=..." is tested in 'testCreateUserNoIdP', 'testCreateUserTimeout' - -- in spar's integration tests, module "Test.Spar.Scim.UserSpec" - test m "post /i/teams/:tid/suspend - 200" $ testSuspendTeam b, - test m "put /self - 200 update events" $ testUpdateEvents b c, - test m "delete /self - 200 (ensure no orphan teams)" $ testDeleteTeamUser b g, - test m "post /connections - 403 (same binding team)" $ testConnectionSameTeam b - ], - testGroup "sso" $ - [ test m "post /i/users - 201 internal-SSO" $ testCreateUserInternalSSO b g, - test m "delete /i/users/:uid - 202 internal-SSO (ensure no orphan teams)" $ testDeleteUserSSO b g, - test m "get /i/teams/:tid/is-team-owner/:uid" $ testSSOIsTeamOwner b g, - test m "2FA disabled for SSO user" $ test2FaDisabledForSsoUser b g - ], - testGroup "size" $ - [ test m "get /i/teams/:tid/size" $ testTeamSizeInternal b, - test m "get /teams/:tid/size" $ testTeamSizePublic b - ] + [ testGroup "invitation" + $ [ test m "post /teams/:tid/invitations - 201" $ testInvitationEmail b, + test m "get /teams/:tid/invitations/:iid - 200" $ testGetInvitation b, + test m "delete /teams/:tid/invitations/:iid - 200" $ testDeleteInvitation b, + test m "post /teams/:tid/invitations - invitation url" $ testInvitationUrl conf b, + test m "post /teams/:tid/invitations - no invitation url" $ testNoInvitationUrl conf b, + test m "post /teams/:tid/invitations - email lookup" $ testInvitationEmailLookup b, + test m "post /teams/:tid/invitations - email lookup nginz" $ testInvitationEmailLookupNginz b n, + test m "post /teams/:tid/invitations - email lookup register" $ testInvitationEmailLookupRegister b, + test m "post /teams/:tid/invitations - 403 no permission" $ testInvitationNoPermission b, + test m "post /teams/:tid/invitations - 403 too many pending" $ testInvitationTooManyPending conf b tl, + test m "post /teams/:tid/invitations - roles" $ testInvitationRoles b g, + test m "post /register - 201 accepted" $ testInvitationEmailAccepted b g, + test m "post /register - 201 accepted (with domain blocking customer extension)" $ testInvitationEmailAcceptedInBlockedDomain conf b g, + test m "post /register - 201 extended accepted" $ testInvitationEmailAndPhoneAccepted b g, + test m "post /register user & team - 201 accepted" $ testCreateTeam b g aws, + test m "post /register user & team - 201 preverified" $ testCreateTeamPreverified b g aws, + test m "post /register - 400 no passwordless" $ testTeamNoPassword b, + test m "post /register - 400 code already used" $ testInvitationCodeExists b, + test m "post /register - 400 bad code" $ testInvitationInvalidCode b, + test m "post /register - 400 no wireless" $ testInvitationCodeNoIdentity b, + test m "post /register - 400 mutually exclusive" $ testInvitationMutuallyExclusive b, + test m "post /register - 403 too many members" $ testInvitationTooManyMembers b g tl, + test m "get /teams/:tid/invitations - 200 (paging)" $ testInvitationPaging conf b, + test m "get /teams/:tid/invitations/info - 200" $ testInvitationInfo b, + test m "get /teams/:tid/invitations/info - 400" $ testInvitationInfoBadCode b, + test m "get /teams/:tid/invitations/info - 400 expired" $ testInvitationInfoExpired b it, + -- "get /i/teams/invitations/by-email?email=..." is tested in 'testCreateUserNoIdP', 'testCreateUserTimeout' + -- in spar's integration tests, module "Test.Spar.Scim.UserSpec" + test m "post /i/teams/:tid/suspend - 200" $ testSuspendTeam b, + test m "put /self - 200 update events" $ testUpdateEvents b c, + test m "delete /self - 200 (ensure no orphan teams)" $ testDeleteTeamUser b g, + test m "post /connections - 403 (same binding team)" $ testConnectionSameTeam b + ], + testGroup "sso" + $ [ test m "post /i/users - 201 internal-SSO" $ testCreateUserInternalSSO b g, + test m "delete /i/users/:uid - 202 internal-SSO (ensure no orphan teams)" $ testDeleteUserSSO b g, + test m "get /i/teams/:tid/is-team-owner/:uid" $ testSSOIsTeamOwner b g, + test m "2FA disabled for SSO user" $ test2FaDisabledForSsoUser b g + ], + testGroup "size" + $ [ test m "get /i/teams/:tid/size" $ testTeamSizeInternal b, + test m "get /teams/:tid/size" $ testTeamSizePublic b + ] ] testTeamSizeInternal :: Brig -> Http () @@ -153,10 +153,11 @@ testTeamSize brig req = do SearchUtil.refreshIndex brig assertSize tid owner expectedSize where - assertSize :: HasCallStack => TeamId -> UserId -> Natural -> Http () + assertSize :: (HasCallStack) => TeamId -> UserId -> Natural -> Http () assertSize tid uid expectedSize = - void $ - get (req tid uid) MockT IO Wai.Response invitationUrlGalleyMock featureStatus tid inviter (ReceivedRequest mth pth body_) - | mth == "GET" - && pth == ["i", "teams", Text.pack (show tid), "features", "exposeInvitationURLsToTeamAdmin"] = - pure . Wai.responseLBS HTTP.status200 mempty $ - encode + | mth + == "GET" + && pth + == ["i", "teams", Text.pack (show tid), "features", "exposeInvitationURLsToTeamAdmin"] = + pure + . Wai.responseLBS HTTP.status200 mempty + $ encode ( withStatus featureStatus LockStatusUnlocked ExposeInvitationURLsToTeamAdminConfig FeatureTTLUnlimited ) - | mth == "GET" - && pth == ["i", "teams", Text.pack (show tid), "members", Text.pack (show inviter)] = - pure . Wai.responseLBS HTTP.status200 mempty $ - encode (mkTeamMember inviter fullPermissions Nothing UserLegalHoldDisabled) - | mth == "GET" - && pth == ["i", "feature-configs"] = + | mth + == "GET" + && pth + == ["i", "teams", Text.pack (show tid), "members", Text.pack (show inviter)] = + pure + . Wai.responseLBS HTTP.status200 mempty + $ encode (mkTeamMember inviter fullPermissions Nothing UserLegalHoldDisabled) + | mth + == "GET" + && pth + == ["i", "feature-configs"] = pure $ Wai.responseLBS HTTP.status200 mempty (encode (def @AllFeatureConfigs)) | otherwise = let errBody = - encode . object $ - [ "msg" .= ("unexpecUnexpected request to mocked galley" :: Text), - "method" .= show mth, - "path" .= pth, - "body" .= (cs @_ @Text body_) - ] + encode + . object + $ [ "msg" .= ("unexpecUnexpected request to mocked galley" :: Text), + "method" .= show mth, + "path" .= pth, + "body" .= (cs @_ @Text body_) + ] in pure $ Wai.responseLBS HTTP.status500 mempty errBody -- FUTUREWORK: This test should be rewritten to be free of mocks once Galley is @@ -395,7 +405,7 @@ registerInvite brig tid inv invemail = do pure invitee -- | Admins can invite external partners, but not owners. -testInvitationRoles :: HasCallStack => Brig -> Galley -> Http () +testInvitationRoles :: (HasCallStack) => Brig -> Galley -> Http () testInvitationRoles brig galley = do (owner, tid) <- createUserWithTeam brig -- owner creates a member alice. @@ -467,7 +477,7 @@ testInvitationEmailAndPhoneAccepted brig galley = do -- | FUTUREWORK: this is an alternative helper to 'createPopulatedBindingTeam'. it has been -- added concurrently, and the two should probably be consolidated. createAndVerifyInvitation :: - HasCallStack => + (HasCallStack) => (InvitationCode -> RequestBody) -> InvitationRequest -> Brig -> @@ -533,7 +543,7 @@ createAndVerifyInvitation' replacementBrigApp acceptFn invite brig galley = do conns <- responseJsonError =<< listConnections brig invitee - Opt.Opts -> Brig -> Http () +testInvitationPaging :: (HasCallStack) => Opt.Opts -> Brig -> Http () testInvitationPaging opts brig = do before <- liftIO $ toUTCTimeMillis . addUTCTime (-1) <$> getCurrentTime (uid, tid) <- createUserWithTeam brig @@ -738,13 +752,14 @@ testInvitationPaging opts brig = do invite email = stdInvitationRequest email longerTimeout = opts {Opt.optSettings = (Opt.optSettings opts) {Opt.setTeamInvitationTimeout = 300}} emails <- - withSettingsOverrides longerTimeout $ - replicateM total $ do + withSettingsOverrides longerTimeout + $ replicateM total + $ do email <- randomEmail postInvitation brig tid uid (invite email) !!! const 201 === statusCode pure email after1ms <- liftIO $ toUTCTimeMillis . addUTCTime 1 <$> getCurrentTime - let getPages :: HasCallStack => Int -> Maybe InvitationId -> Int -> Http [[Invitation]] + let getPages :: (HasCallStack) => Int -> Maybe InvitationId -> Int -> Http [[Invitation]] getPages count start step = do let range = queryRange (toByteString' <$> start) (Just step) r <- @@ -755,7 +770,7 @@ testInvitationPaging opts brig = do if more then (invs :) <$> getPages (count + step) (fmap inInvitation . listToMaybe . reverse $ invs) step else pure [invs] - let checkSize :: HasCallStack => Int -> [Int] -> Http () + let checkSize :: (HasCallStack) => Int -> [Int] -> Http () checkSize pageSize expectedSizes = getPages 0 Nothing pageSize >>= \invss -> liftIO $ do assertEqual "page sizes" expectedSizes (take (length expectedSizes) (map length invss)) @@ -813,8 +828,8 @@ testInvitationInfoExpired brig timeout = do awaitExpiry n t i = do liftIO $ threadDelay 1000000 r <- getCode t i - when (statusCode r == 200 && n > 0) $ - awaitExpiry (n - 1) t i + when (statusCode r == 200 && n > 0) + $ awaitExpiry (n - 1) t i testSuspendTeam :: Brig -> Http () testSuspendTeam brig = do @@ -942,8 +957,8 @@ testCreateUserInternalSSO brig galley = do -- self profile contains sso id let Just uid = userId <$> responseJsonMaybe resp profile <- getSelfProfile brig uid - liftIO $ - assertEqual + liftIO + $ assertEqual "self profile user identity mismatch" (Just ssoid) (userSSOId $ selfUser profile) diff --git a/services/brig/test/integration/API/Team/Util.hs b/services/brig/test/integration/API/Team/Util.hs index 7fff7162fa9..75d871041c9 100644 --- a/services/brig/test/integration/API/Team/Util.hs +++ b/services/brig/test/integration/API/Team/Util.hs @@ -93,7 +93,7 @@ createPopulatedBindingTeamWithNames brig names = do inv <- responseJsonError =<< postInvitation brig tid (userId inviter) invite - getSelfProfile brig (userId user) liftIO $ assertBool "Team ID in self profile and team table do not match" (selfTeam == Just tid) @@ -186,7 +187,7 @@ inviteAndRegisterUser u tid brig = do inv <- responseJsonError =<< postInvitation brig tid u invite - UserId -> TeamId -> (UserId, Permissions) -> Galley -> Http () +updatePermissions :: (HasCallStack) => UserId -> TeamId -> (UserId, Permissions) -> Galley -> Http () updatePermissions from tid (to, perm) galley = put ( galley @@ -217,10 +218,10 @@ updatePermissions from tid (to, perm) galley = where changeMember = Member.mkNewTeamMember to perm Nothing -createTeamConv :: HasCallStack => Galley -> TeamId -> UserId -> [UserId] -> Maybe Milliseconds -> Http ConvId +createTeamConv :: (HasCallStack) => Galley -> TeamId -> UserId -> [UserId] -> Maybe Milliseconds -> Http ConvId createTeamConv = createTeamConvWithRole roleNameWireAdmin -createTeamConvWithRole :: HasCallStack => RoleName -> Galley -> TeamId -> UserId -> [UserId] -> Maybe Milliseconds -> Http ConvId +createTeamConvWithRole :: (HasCallStack) => RoleName -> Galley -> TeamId -> UserId -> [UserId] -> Maybe Milliseconds -> Http ConvId createTeamConvWithRole role g tid u us mtimer = do let tinfo = Just $ ConvTeamInfo tid let conv = @@ -246,11 +247,11 @@ createTeamConvWithRole role g tid u us mtimer = do ) Galley -> TeamId -> ConvId -> UserId -> Http () +deleteTeamConv :: (HasCallStack) => Galley -> TeamId -> ConvId -> UserId -> Http () deleteTeamConv g tid cid u = do delete ( g @@ -261,7 +262,7 @@ deleteTeamConv g tid cid u = do !!! const 200 === statusCode -deleteTeam :: HasCallStack => Galley -> TeamId -> UserId -> Http () +deleteTeam :: (HasCallStack) => Galley -> TeamId -> UserId -> Http () deleteTeam g tid u = do delete ( g @@ -276,16 +277,17 @@ deleteTeam g tid u = do newTeam :: BindingNewTeam newTeam = BindingNewTeam $ newNewTeam (unsafeRange "teamName") DefaultIcon -putLegalHoldEnabled :: HasCallStack => TeamId -> FeatureStatus -> Galley -> Http () +putLegalHoldEnabled :: (HasCallStack) => TeamId -> FeatureStatus -> Galley -> Http () putLegalHoldEnabled tid enabled g = do - void . put $ - g - . paths ["i", "teams", toByteString' tid, "features", "legalhold"] - . contentJson - . lbytes (encode (Public.WithStatusNoLock enabled Public.LegalholdConfig Public.FeatureTTLUnlimited)) - . expect2xx - -putLHWhitelistTeam :: HasCallStack => Galley -> TeamId -> Http ResponseLBS + void + . put + $ g + . paths ["i", "teams", toByteString' tid, "features", "legalhold"] + . contentJson + . lbytes (encode (Public.WithStatusNoLock enabled Public.LegalholdConfig Public.FeatureTTLUnlimited)) + . expect2xx + +putLHWhitelistTeam :: (HasCallStack) => Galley -> TeamId -> Http ResponseLBS putLHWhitelistTeam galley tid = do put ( galley @@ -297,8 +299,9 @@ accept = acceptWithName (Name "Bob") acceptWithName :: Name -> Email -> InvitationCode -> RequestBody acceptWithName name email code = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= fromName name, "email" .= fromEmail email, "password" .= defPassword, @@ -307,8 +310,9 @@ acceptWithName name email code = extAccept :: Email -> Name -> Phone -> ActivationCode -> InvitationCode -> RequestBody extAccept email name phone phoneCode code = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= name, "email" .= fromEmail email, "password" .= defPassword, @@ -325,8 +329,9 @@ register e t brig = . path "/register" . contentJson . body - ( RequestBodyLBS . encode $ - object + ( RequestBodyLBS + . encode + $ object [ "name" .= ("Bob" :: Text), "email" .= fromEmail e, "password" .= defPassword, @@ -342,8 +347,9 @@ register' e t c brig = . path "/register" . contentJson . body - ( RequestBodyLBS . encode $ - object + ( RequestBodyLBS + . encode + $ object [ "name" .= ("Bob" :: Text), "email" .= fromEmail e, "email_code" .= c, @@ -356,10 +362,10 @@ register' e t c brig = getInvitationInfo :: Brig -> InvitationCode -> (MonadIO m, MonadHttp m) => m (Maybe Invitation) getInvitationInfo brig c = do r <- - get $ - brig - . path "/teams/invitations/info" - . queryItem "code" (toByteString' c) + get + $ brig + . path "/teams/invitations/info" + . queryItem "code" (toByteString' c) pure . decode . fromMaybe "" $ responseBody r getInvitation :: Brig -> TeamId -> InvitationId -> UserId -> Http ResponseLBS @@ -378,26 +384,26 @@ postInvitation :: InvitationRequest -> m ResponseLBS postInvitation brig t u i = - post $ - brig - . paths ["teams", toByteString' t, "invitations"] - . contentJson - . body (RequestBodyLBS $ encode i) - . zAuthAccess u "conn" + post + $ brig + . paths ["teams", toByteString' t, "invitations"] + . contentJson + . body (RequestBodyLBS $ encode i) + . zAuthAccess u "conn" suspendTeam :: Brig -> TeamId -> Http (Response (Maybe LByteString)) suspendTeam brig t = - post $ - brig - . paths ["i", "teams", toByteString' t, "suspend"] - . contentJson + post + $ brig + . paths ["i", "teams", toByteString' t, "suspend"] + . contentJson unsuspendTeam :: Brig -> TeamId -> Http ResponseLBS unsuspendTeam brig t = - post $ - brig - . paths ["i", "teams", toByteString' t, "unsuspend"] - . contentJson + post + $ brig + . paths ["i", "teams", toByteString' t, "unsuspend"] + . contentJson getTeam :: (HasCallStack, MonadIO m, MonadHttp m, HasCallStack, MonadCatch m) => Galley -> TeamId -> m Team.TeamData getTeam galley t = @@ -420,7 +426,7 @@ getInvitationCode brig t ref = do let lbs = fromMaybe "" $ responseBody r pure $ fromByteString (maybe (error "No code?") T.encodeUtf8 (lbs ^? key "code" . _String)) -assertNoInvitationCode :: HasCallStack => Brig -> TeamId -> InvitationId -> (MonadIO m, MonadHttp m, MonadCatch m) => m () +assertNoInvitationCode :: (HasCallStack) => Brig -> TeamId -> InvitationId -> (MonadIO m, MonadHttp m, MonadCatch m) => m () assertNoInvitationCode brig t i = get ( brig @@ -457,7 +463,7 @@ setTeamTeamSearchVisibilityAvailable galley tid status = !!! do const 200 === statusCode -setTeamSearchVisibility :: HasCallStack => Galley -> TeamId -> TeamSearchVisibility -> Http () +setTeamSearchVisibility :: (HasCallStack) => Galley -> TeamId -> TeamSearchVisibility -> Http () setTeamSearchVisibility galley tid typ = put ( galley diff --git a/services/brig/test/integration/API/TeamUserSearch.hs b/services/brig/test/integration/API/TeamUserSearch.hs index 84e2a8a3701..1d2421d9007 100644 --- a/services/brig/test/integration/API/TeamUserSearch.hs +++ b/services/brig/test/integration/API/TeamUserSearch.hs @@ -42,9 +42,9 @@ type TestConstraints m = (MonadFail m, MonadCatch m, MonadIO m, MonadHttp m) tests :: Opt.Opts -> Manager -> Galley -> Brig -> IO TestTree tests opts mgr _galley brig = do - pure $ - testGroup "/teams/:tid/search" $ - [ testWithNewIndex "can find user by email" (testSearchByEmailSameTeam brig), + pure + $ testGroup "/teams/:tid/search" + $ [ testWithNewIndex "can find user by email" (testSearchByEmailSameTeam brig), testWithNewIndex "empty query returns the whole team sorted" (testEmptyQuerySorted brig), testWithNewIndex "sorting by some properties works" (testSort brig), testWithNewIndex "call to search with remaining properties succeeds" (testSortCallSucceeds brig), @@ -53,7 +53,7 @@ tests opts mgr _galley brig = do where testWithNewIndex name f = test mgr name $ withSettingsOverrides opts f -testSearchByEmail :: TestConstraints m => Brig -> m (TeamId, UserId, User) -> Bool -> m () +testSearchByEmail :: (TestConstraints m) => Brig -> m (TeamId, UserId, User) -> Bool -> m () testSearchByEmail brig mkSearcherAndSearchee canFind = do (tid, searcher, searchee) <- mkSearcherAndSearchee eml <- randomEmail @@ -63,43 +63,45 @@ testSearchByEmail brig mkSearcherAndSearchee canFind = do let check = if canFind then assertTeamUserSearchCanFind else assertTeamUserSearchCannotFind check brig tid searcher (userId searchee) (fromEmail eml) -testSearchByEmailSameTeam :: TestConstraints m => Brig -> m () +testSearchByEmailSameTeam :: (TestConstraints m) => Brig -> m () testSearchByEmailSameTeam brig = do let mkSearcherAndSearchee = do (tid, userId -> ownerId, [u1]) <- createPopulatedBindingTeamWithNamesAndHandles brig 1 pure (tid, ownerId, u1) testSearchByEmail brig mkSearcherAndSearchee True -assertTeamUserSearchCanFind :: TestConstraints m => Brig -> TeamId -> UserId -> UserId -> Text -> m () +assertTeamUserSearchCanFind :: (TestConstraints m) => Brig -> TeamId -> UserId -> UserId -> Text -> m () assertTeamUserSearchCanFind brig teamid self expected q = do r <- searchResults <$> executeTeamUserSearch brig teamid self (Just q) Nothing Nothing Nothing liftIO $ do - assertBool ("No results for query: " <> show q) $ - not (null r) - assertBool ("User not in results for query: " <> show q) $ - expected `elem` map teamContactUserId r + assertBool ("No results for query: " <> show q) + $ not (null r) + assertBool ("User not in results for query: " <> show q) + $ expected + `elem` map teamContactUserId r -assertTeamUserSearchCannotFind :: TestConstraints m => Brig -> TeamId -> UserId -> UserId -> Text -> m () +assertTeamUserSearchCannotFind :: (TestConstraints m) => Brig -> TeamId -> UserId -> UserId -> Text -> m () assertTeamUserSearchCannotFind brig teamid self expected q = do r <- searchResults <$> executeTeamUserSearch brig teamid self (Just q) Nothing Nothing Nothing liftIO $ do - assertBool ("User shouldn't be present in results for query: " <> show q) $ - expected `notElem` map teamContactUserId r + assertBool ("User shouldn't be present in results for query: " <> show q) + $ expected + `notElem` map teamContactUserId r -testEmptyQuerySorted :: TestConstraints m => Brig -> m () +testEmptyQuerySorted :: (TestConstraints m) => Brig -> m () testEmptyQuerySorted brig = do (tid, userId -> ownerId, users) <- createPopulatedBindingTeamWithNamesAndHandles brig 4 refreshIndex brig r <- searchResults <$> executeTeamUserSearch brig tid ownerId (Just "") Nothing Nothing Nothing let creationDates = fmap teamContactCreatedAt r - liftIO $ - assertEqual + liftIO + $ assertEqual "user ids" (sort (fmap userId users <> [ownerId])) (sort (fmap teamContactUserId r)) liftIO $ assertEqual "sorted team contacts" (sortOn Down creationDates) creationDates -testSort :: TestConstraints m => Brig -> m () +testSort :: (TestConstraints m) => Brig -> m () testSort brig = do (tid, userId -> ownerId, usersImplicitOrder) <- createPopulatedBindingTeamWithNamesAndHandles brig 4 -- Shuffle here to guard against false positives in this test. @@ -131,7 +133,7 @@ testSort brig = do -- Creating test users for these cases is hard, so we skip it. -- This test checks that the search query at least succeeds and returns the users of the team (without testing correct order). -testSortCallSucceeds :: TestConstraints m => Brig -> m () +testSortCallSucceeds :: (TestConstraints m) => Brig -> m () testSortCallSucceeds brig = do (tid, userId -> ownerId, users) <- createPopulatedBindingTeamWithNamesAndHandles brig 4 refreshIndex brig @@ -140,7 +142,7 @@ testSortCallSucceeds brig = do r <- searchResults <$> executeTeamUserSearch brig tid ownerId Nothing Nothing (Just tuSortBy) (Just SortOrderAsc) liftIO $ assertEqual ("length of users sorted by " <> cs (toByteString tuSortBy)) n (length r) -testEmptyQuerySortedWithPagination :: TestConstraints m => Brig -> m () +testEmptyQuerySortedWithPagination :: (TestConstraints m) => Brig -> m () testEmptyQuerySortedWithPagination brig = do (tid, userId -> ownerId, _) <- createPopulatedBindingTeamWithNamesAndHandles brig 20 refreshIndex brig diff --git a/services/brig/test/integration/API/User.hs b/services/brig/test/integration/API/User.hs index 59e79905156..c891745ef76 100644 --- a/services/brig/test/integration/API/User.hs +++ b/services/brig/test/integration/API/User.hs @@ -60,8 +60,8 @@ tests conf fbc p b c ch g n aws db userJournalWatcher = do let cl = ConnectionLimit $ Opt.setUserMaxConnections (Opt.optSettings conf) let at = Opt.setActivationTimeout (Opt.optSettings conf) z <- mkZAuthEnv (Just conf) - pure $ - testGroup + pure + $ testGroup "user" [ API.User.Client.tests cl at conf p db n b c g, API.User.Account.tests cl at conf p b c ch g aws userJournalWatcher, diff --git a/services/brig/test/integration/API/User/Account.hs b/services/brig/test/integration/API/User/Account.hs index fa5f3277db8..449ae2dcd38 100644 --- a/services/brig/test/integration/API/User/Account.hs +++ b/services/brig/test/integration/API/User/Account.hs @@ -226,11 +226,11 @@ testUpdateUserEmailByTeamOwner opts brig = do checkActivationCode :: Email -> Bool -> Http () checkActivationCode email shouldExist = do maybeActivationCode <- Util.getActivationCode brig (Left email) - void $ - lift $ - if shouldExist - then assertBool "activation code should exists" (isJust maybeActivationCode) - else assertBool "activation code should not exists" (isNothing maybeActivationCode) + void + $ lift + $ if shouldExist + then assertBool "activation code should exists" (isJust maybeActivationCode) + else assertBool "activation code should not exists" (isNothing maybeActivationCode) checkSetUserEmail :: User -> User -> Email -> Int -> Http () checkSetUserEmail teamOwner emailOwner email expectedStatusCode = @@ -313,7 +313,7 @@ assertOnlySelfConversations galley uid = do ) . zAuthAccess uid "conn" ) - liftIO $ cnvType conv @?= SelfConv @@ -338,8 +338,9 @@ assertOnlySelfConversations galley uid = do testCreateUserEmptyName :: Brig -> Http () testCreateUserEmptyName brig = do let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object ["name" .= ("" :: Text)] post (brig . path "/register" . contentJson . body p) !!! const 400 === statusCode @@ -351,8 +352,9 @@ testCreateUserLongName :: Brig -> Http () testCreateUserLongName brig = do let nameTooLong = cs $ concat $ replicate 129 "a" let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object ["name" .= (nameTooLong :: Text)] post (brig . path "/register" . contentJson . body p) !!! const 400 === statusCode @@ -360,8 +362,9 @@ testCreateUserLongName brig = do testCreateUserAnon :: Brig -> Galley -> Http () testCreateUserAnon brig galley = do let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object ["name" .= ("Mr. Pink" :: Text)] rs <- post (brig . path "/register" . contentJson . body p) @@ -383,8 +386,9 @@ testCreateUserPending (Opt.setRestrictUserCreation . Opt.optSettings -> Just Tru testCreateUserPending _ brig = do e <- randomEmail let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Mr. Pink" :: Text), "email" .= fromEmail e, "password" .= defPassword @@ -417,8 +421,9 @@ testCreateUserNoEmailNoPassword :: Brig -> Http () testCreateUserNoEmailNoPassword brig = do p <- randomPhone let newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p ] @@ -442,8 +447,9 @@ testCreateUserConflict _ brig = do -- trusted email domains u <- createUser "conflict" brig let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("conflict1" :: Text), "email" .= (fromEmail <$> userEmail u), -- dup. email "password" .= defPassword @@ -455,8 +461,9 @@ testCreateUserConflict _ brig = do u2 <- createUserUntrustedEmail "conflict" brig let Just (Email loc dom) = userEmail u2 let p2 = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("conflict2" :: Text), "email" .= (T.takeWhile (/= '+') loc <> "@" <> dom), -- dup. email "password" .= defPassword @@ -473,8 +480,9 @@ testCreateUserInvalidEmailOrPhone (Opt.setRestrictUserCreation . Opt.optSettings testCreateUserInvalidEmailOrPhone _ brig = do email <- randomEmail let reqEmail = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("foo" :: Text), "email" .= fromEmail email, "password" .= defPassword, @@ -485,8 +493,9 @@ testCreateUserInvalidEmailOrPhone _ brig = do phone <- randomPhone let reqPhone = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("foo" :: Text), "email" .= ("invalid@email" :: Text), -- invalid since there's only a single label "password" .= defPassword, @@ -505,16 +514,17 @@ testCreateUserBlacklist _ brig aws = flip finally (removeBlacklist brig e) $ do post (brig . path "/register" . contentJson . body (p e)) !!! const 201 === statusCode -- If we are using a local env, we need to fake this bounce - unless (Util.isRealSESEnv aws) $ - forceBlacklist typ e + unless (Util.isRealSESEnv aws) + $ forceBlacklist typ e -- Typically bounce/complaint messages arrive instantaneously awaitBlacklist 30 e post (brig . path "/register" . contentJson . body (p e)) !!! do const 403 === statusCode const (Just "blacklisted-email") === fmap Error.label . responseJsonMaybe p email = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "email" .= email, "password" .= defPassword @@ -543,10 +553,12 @@ testCreateUserExternalSSO brig = do teamid <- Id <$> liftIO UUID.nextRandom let ssoid = UserSSOId mkSimpleSampleUref p withsso withteam = - RequestBodyLBS . encode . object $ - ["name" .= ("foo" :: Text)] - <> ["sso_id" .= Just ssoid | withsso] - <> ["team_id" .= Just teamid | withteam] + RequestBodyLBS + . encode + . object + $ ["name" .= ("foo" :: Text)] + <> ["sso_id" .= Just ssoid | withsso] + <> ["team_id" .= Just teamid | withteam] post (brig . path "/register" . contentJson . body (p False True)) !!! const 400 === statusCode post (brig . path "/register" . contentJson . body (p True False)) @@ -570,16 +582,16 @@ testActivateWithExpiry _ brig timeout = do awaitExpiry (round timeout + 5) kc activate brig kc !!! const 404 === statusCode where - actualBody :: HasCallStack => ResponseLBS -> Maybe (Maybe UserIdentity, Bool) + actualBody :: (HasCallStack) => ResponseLBS -> Maybe (Maybe UserIdentity, Bool) actualBody rs = do a <- responseJsonMaybe rs Just (Just (activatedIdentity a), activatedFirst a) - awaitExpiry :: HasCallStack => Int -> ActivationPair -> Http () + awaitExpiry :: (HasCallStack) => Int -> ActivationPair -> Http () awaitExpiry n kc = do liftIO $ threadDelay 1000000 r <- activate brig kc - when (statusCode r == 204 && n > 0) $ - awaitExpiry (n - 1) kc + when (statusCode r == 204 && n > 0) + $ awaitExpiry (n - 1) kc testNonExistingUserUnqualified :: Brig -> Http () testNonExistingUserUnqualified brig = do @@ -739,7 +751,7 @@ testMultipleUsersUnqualified brig = do Set.fromList . map (field "name" &&& field "email") <$> responseJsonMaybe r - field :: FromJSON a => Key -> Value -> Maybe a + field :: (FromJSON a) => Key -> Value -> Maybe a field f u = u ^? key f >>= maybeFromJSON testMultipleUsersV3 :: Brig -> Http () @@ -771,7 +783,7 @@ testMultipleUsersV3 brig = do Set.fromList . map (field "name" &&& field "email") <$> responseJsonMaybe r - field :: FromJSON a => Key -> Value -> Maybe a + field :: (FromJSON a) => Key -> Value -> Maybe a field f u = u ^? key f >>= maybeFromJSON testMultipleUsers :: Opt.Opts -> Brig -> Http () @@ -820,8 +832,9 @@ testMultipleUsers opts brig = do throw $ MockErrorResponse Http.status500 "Down for maintenance" -- Galley isn't needed, but this is what mock federators are available. galleyHandler _ = error "not mocked" - (response, _rpcCalls, _galleyCalls) <- liftIO $ - withMockedFederatorAndGalley opts (Domain "example.com") fedMockResponse galleyHandler $ do + (response, _rpcCalls, _galleyCalls) <- liftIO + $ withMockedFederatorAndGalley opts (Domain "example.com") fedMockResponse galleyHandler + $ do post ( brig . zUser (userId u1) @@ -889,10 +902,10 @@ testCreateUserAnonExpiry b = do deleted :: ResponseLBS -> Maybe Bool deleted r = field "deleted" =<< responseJsonMaybe r - field :: FromJSON a => Key -> Value -> Maybe a + field :: (FromJSON a) => Key -> Value -> Maybe a field f u = u ^? key f >>= maybeFromJSON -testUserUpdate :: HasCallStack => Brig -> Cannon -> UserJournalWatcher -> Http () +testUserUpdate :: (HasCallStack) => Brig -> Cannon -> UserJournalWatcher -> Http () testUserUpdate brig cannon userJournalWatcher = do aliceUser <- randomUser brig Util.assertUserActivateJournaled userJournalWatcher aliceUser "user create alice" @@ -1042,8 +1055,9 @@ testCreateAccountPendingActivationKey _ brig = do Nothing -> liftIO $ assertFailure "missing activation key/code" Just kc@(_, c) -> do let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("foo" :: Text), "phone" .= phn, "phone_code" .= c @@ -1110,8 +1124,9 @@ testGetByIdentity brig = do let emailBs = T.encodeUtf8 $ fromEmail e phoneBs = T.encodeUtf8 $ fromPhone p newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p, "email" .= fromEmail e @@ -1133,8 +1148,9 @@ testPasswordSet :: Brig -> Http () testPasswordSet brig = do p <- randomPhone let newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p ] @@ -1153,8 +1169,9 @@ testPasswordSet brig = do !!! const 200 === statusCode where pwSet = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "new_password" .= ("a_very_long_password" :: Text) ] @@ -1162,8 +1179,9 @@ testPasswordSetInvalidPasswordLength :: Brig -> Http () testPasswordSetInvalidPasswordLength brig = do p <- randomPhone let newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p ] @@ -1175,8 +1193,9 @@ testPasswordSetInvalidPasswordLength brig = do !!! const 400 === statusCode where shortPassword = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "new_password" .= ("secret" :: Text) ] @@ -1201,20 +1220,23 @@ testPasswordChange brig = do where newPass = plainTextPassword6Unsafe "topsecret" pwChange = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "old_password" .= defPassword, "new_password" .= newPass ] pwChange' = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "old_password" .= newPass, "new_password" .= newPass ] pwSet = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "new_password" .= newPass ] @@ -1383,8 +1405,8 @@ testDeleteUserByPassword brig cannon userJournalWatcher = do eml <- randomEmail let Just oldeml = userEmail u initiateEmailUpdateLogin brig eml (emailLogin oldeml defPassword Nothing) uid1 !!! (const 202 === statusCode) - setHandleAndDeleteUser brig cannon u [uid2, uid3] userJournalWatcher $ - \uid -> deleteUser uid (Just defPassword) brig !!! const 200 === statusCode + setHandleAndDeleteUser brig cannon u [uid2, uid3] userJournalWatcher + $ \uid -> deleteUser uid (Just defPassword) brig !!! const 200 === statusCode -- Activating the new email address now should not work act <- getActivationCode brig (Left eml) case act of @@ -1415,8 +1437,8 @@ testDeleteUserWithLegalHold brig cannon userJournalWatcher = do addClientInternal brig uid (defNewClient LegalHoldClientType [Imports.head somePrekeys] (Imports.head someLastPrekeys)) !!! const 201 === statusCode Util.assertUserActivateJournaled userJournalWatcher user "user activate testDeleteInternal1: " - setHandleAndDeleteUser brig cannon user [] userJournalWatcher $ - \uid' -> deleteUser uid' (Just defPassword) brig !!! const 200 === statusCode + setHandleAndDeleteUser brig cannon user [] userJournalWatcher + $ \uid' -> deleteUser uid' (Just defPassword) brig !!! const 200 === statusCode testDeleteUserByCode :: Brig -> Http () testDeleteUserByCode brig = do @@ -1438,8 +1460,9 @@ testDeleteUserByCode brig = do where send k c = post (brig . path "/delete" . contentJson . body (payload k c)) payload k c = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object ["key" .= k, "code" .= c] testDeleteAnonUser :: Brig -> Http () @@ -1480,7 +1503,7 @@ testUpdateSSOId brig galley = do . Bilge.json (UserSSOId (mkSampleUref "1" "1")) ) !!! const 404 === statusCode - let go :: HasCallStack => User -> UserSSOId -> Http () + let go :: (HasCallStack) => User -> UserSSOId -> Http () go user ssoid = do let uid = userId user put @@ -1625,21 +1648,25 @@ testTooManyMembersForLegalhold opts brig = do inv <- responseJsonError =<< postInvitation brig tid owner invite - Cannon -> UserJournalWatcher testDeleteUserWithCompletelyDeletedUser brig cannon userJournalWatcher = do u <- randomUser brig Util.assertUserActivateJournaled userJournalWatcher u "user activate testDeleteUserWithCompletelyDeletedUser" - setHandleAndDeleteUser brig cannon u [] userJournalWatcher $ - \uid -> deleteUserInternal uid brig !!! const 202 === statusCode + setHandleAndDeleteUser brig cannon u [] userJournalWatcher + $ \uid -> deleteUserInternal uid brig !!! const 202 === statusCode do let uid = userId u deleteUserInternal uid brig @@ -1678,17 +1705,17 @@ testDeleteUserWithNoUser brig = do !!! do const 404 === statusCode -testDeleteUserWithNotDeletedUser :: HasCallStack => Brig -> Cannon -> UserJournalWatcher -> Http () +testDeleteUserWithNotDeletedUser :: (HasCallStack) => Brig -> Cannon -> UserJournalWatcher -> Http () testDeleteUserWithNotDeletedUser brig cannon userJournalWatcher = do u <- randomUser brig Util.assertUserActivateJournaled userJournalWatcher u "user activate testDeleteUserWithNotDeletedUser" do - setHandleAndDeleteUser brig cannon u [] userJournalWatcher $ - ( \uid' -> - deleteUserInternal uid' brig - !!! do - const 202 === statusCode - ) + setHandleAndDeleteUser brig cannon u [] userJournalWatcher + $ ( \uid' -> + deleteUserInternal uid' brig + !!! do + const 202 === statusCode + ) testDeleteUserWithDanglingProperty :: Brig -> Cannon -> UserJournalWatcher -> Http () testDeleteUserWithDanglingProperty brig cannon userJournalWatcher = do diff --git a/services/brig/test/integration/API/User/Auth.hs b/services/brig/test/integration/API/User/Auth.hs index a03af8237bc..7877946b102 100644 --- a/services/brig/test/integration/API/User/Auth.hs +++ b/services/brig/test/integration/API/User/Auth.hs @@ -76,14 +76,14 @@ import Wire.API.User.Client -- with this are failing then assumption that -- 'whitelist-teams-and-implicit-consent' is set in all test environments is no -- longer correct. -onlyIfLhWhitelisted :: MonadIO m => m () -> m () +onlyIfLhWhitelisted :: (MonadIO m) => m () -> m () onlyIfLhWhitelisted action = do let isGalleyLegalholdFeatureWhitelist = True if isGalleyLegalholdFeatureWhitelist then action else - liftIO $ - hPutStrLn + liftIO + $ hPutStrLn stderr "*** skipping test. This test only works if you manually adjust the server config files\ \(the 'withLHWhitelist' trick does not work because it does not allow \ @@ -193,7 +193,7 @@ testLoginWith6CharPassword brig db = do writeDirectlyToDB uid pw = liftIO (runClient db (updatePassword uid pw >> revokeAllCookies uid)) - updatePassword :: MonadClient m => UserId -> PlainTextPassword6 -> m () + updatePassword :: (MonadClient m) => UserId -> PlainTextPassword6 -> m () updatePassword u t = do p <- liftIO $ mkSafePassword t retry x5 $ write userPasswordUpdate (params LocalQuorum (p, u)) @@ -204,10 +204,10 @@ testLoginWith6CharPassword brig db = do -------------------------------------------------------------------------------- -- ZAuth test environment for generating arbitrary tokens. -randomAccessToken :: forall u a. ZAuth.TokenPair u a => ZAuth (ZAuth.Token a) +randomAccessToken :: forall u a. (ZAuth.TokenPair u a) => ZAuth (ZAuth.Token a) randomAccessToken = randomUserToken @u >>= ZAuth.newAccessToken -randomUserToken :: ZAuth.UserTokenLike u => ZAuth (ZAuth.Token u) +randomUserToken :: (ZAuth.UserTokenLike u) => ZAuth (ZAuth.Token u) randomUserToken = do r <- Id <$> liftIO UUID.nextRandom ZAuth.newUserToken r Nothing @@ -265,8 +265,10 @@ testNginzLegalHold b g n = do pure (c, t) qconv <- - fmap cnvQualifiedId . responseJsonError - =<< createConversation g (userId alice) [] toByteString' t)) !!! do @@ -302,7 +304,7 @@ testNginzMultipleCookies :: Opts.Opts -> Brig -> Nginz -> Http () testNginzMultipleCookies o b n = do u <- randomUser b let Just email = userEmail u - dologin :: HasCallStack => Http ResponseLBS + dologin :: (HasCallStack) => Http ResponseLBS dologin = login n (defEmailLogin email) PersistentCookie c {cookie_value = "ThisIsNotAZauthCookie"}) . decodeCookie <$> dologin badCookie1 <- (\c -> c {cookie_value = "SKsjKQbiqxuEugGMWVbq02fNEA7QFdNmTiSa1Y0YMgaEP5tWl3nYHWlIrM5F8Tt7Cfn2Of738C7oeiY8xzPHAB==.v=1.k=1.d=1.t=u.l=.u=13da31b4-c6bb-4561-8fed-07e728fa6cc5.r=f844b420"}) . decodeCookie <$> dologin @@ -357,8 +359,9 @@ testPhoneLogin :: Brig -> Http () testPhoneLogin brig = do p <- randomPhone let newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p ] @@ -396,8 +399,9 @@ testSendLoginCode :: Brig -> Http () testSendLoginCode brig = do p <- randomPhone let newUser = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= ("Alice" :: Text), "phone" .= fromPhone p, "password" .= ("topsecretdefaultpassword" :: Text) @@ -478,11 +482,11 @@ testThrottleLogins conf b = do -- successfully log in again. Furthermore, the test asserts that another -- unrelated user can successfully log-in in parallel to the failed attempts of -- the aforementioned user. -testLimitRetries :: HasCallStack => Opts.Opts -> Brig -> Http () +testLimitRetries :: (HasCallStack) => Opts.Opts -> Brig -> Http () testLimitRetries conf brig = do let Just opts = Opts.setLimitFailedLogins . Opts.optSettings $ conf - unless (Opts.timeout opts <= 30) $ - error "`loginRetryTimeout` is the number of seconds this test is running. Please pick a value < 30." + unless (Opts.timeout opts <= 30) + $ error "`loginRetryTimeout` is the number of seconds this test is running. Please pick a value < 30." usr <- randomUser brig let Just email = userEmail usr usr' <- randomUser brig @@ -507,8 +511,11 @@ testLimitRetries conf brig = do assertBool ("throttle delay (1): " <> show (retryTimeout, Opts.timeout opts)) -- (this accounts for slow CI systems that lose up to 2 secs) - ( retryTimeout >= Opts.timeout opts - 2 - && retryTimeout <= Opts.timeout opts + ( retryTimeout + >= Opts.timeout opts + - 2 + && retryTimeout + <= Opts.timeout opts ) threadDelay (1000000 * (retryAfterSecs - 2)) -- wait almost long enough. @@ -535,7 +542,7 @@ testRegularUserLegalHoldLogin brig = do legalHoldLogin brig (LegalHoldLogin uid (Just defPassword) Nothing) PersistentCookie !!! do const 403 === statusCode -testTeamUserLegalHoldLogin :: HasCallStack => Brig -> Galley -> Http () +testTeamUserLegalHoldLogin :: (HasCallStack) => Brig -> Galley -> Http () testTeamUserLegalHoldLogin brig galley = do -- create team user Alice (alice, tid) <- createUserWithTeam brig @@ -652,7 +659,7 @@ testNoUserSsoLogin brig = do -- The testInvalidCookie test conforms to the following testing standards: -- -- Test that invalid and expired tokens do not work. -testInvalidCookie :: forall u. ZAuth.UserTokenLike u => ZAuth.Env -> Brig -> Http () +testInvalidCookie :: forall u. (ZAuth.UserTokenLike u) => ZAuth.Env -> Brig -> Http () testInvalidCookie z b = do -- Syntactically invalid post (unversioned . b . path "/access" . cookieRaw "zuid" "xxx") !!! do @@ -682,7 +689,7 @@ testInvalidToken z b = do const 403 === statusCode const (Just "Invalid access token") =~= responseBody -testMissingCookie :: forall u a. ZAuth.TokenPair u a => ZAuth.Env -> Brig -> Http () +testMissingCookie :: forall u a. (ZAuth.TokenPair u a) => ZAuth.Env -> Brig -> Http () testMissingCookie z b = do -- Missing cookie, i.e. token refresh mandates a cookie. post (unversioned . b . path "/access") @@ -698,7 +705,7 @@ testMissingCookie z b = do const (Just "Missing cookie") =~= responseBody const (Just "invalid-credentials") =~= responseBody -testUnknownCookie :: forall u. ZAuth.UserTokenLike u => ZAuth.Env -> Brig -> Http () +testUnknownCookie :: forall u. (ZAuth.UserTokenLike u) => ZAuth.Env -> Brig -> Http () testUnknownCookie z b = do -- Valid cookie but unknown to the server. t <- toByteString' <$> runZAuth z (randomUserToken @u) @@ -874,7 +881,7 @@ testAccessWithClientId brig = do brig (userId u) (defNewClient PermanentClientType [] (Imports.head someLastPrekeys)) - Opts.Opts -> Brig -> CookieType -> String -> Http () +testSuspendInactiveUsers :: (HasCallStack) => Opts.Opts -> Brig -> CookieType -> String -> Http () testSuspendInactiveUsers config brig cookieType endPoint = do -- (context information: cookies are stored by user, not by device; so if there is a -- cookie that is old, it means none of the devices of the user has used it for a request.) let Just suspendAge = Opts.suspendTimeout <$> Opts.setSuspendInactiveUsers (Opts.optSettings config) - unless (suspendAge <= 30) $ - error "`suspendCookiesOlderThanSecs` is the number of seconds this test is running. Please pick a value < 30." + unless (suspendAge <= 30) + $ error "`suspendCookiesOlderThanSecs` is the number of seconds this test is running. Please pick a value < 30." user <- randomUser brig let Just email = userEmail user @@ -1193,8 +1200,8 @@ testTooManyCookies config b = do carry = 2 pwlP = emailLogin e defPassword (Just "persistent") pwlS = emailLogin e defPassword (Just "session") - void $ - concurrently + void + $ concurrently -- Persistent logins ( do tcs <- replicateM (l + carry) $ loginWhenAllowed pwlP PersistentCookie @@ -1278,10 +1285,10 @@ getCookieId c = (CookieId . ZAuth.userTokenRand @u) (fromByteString (cookie_value c)) -listCookies :: HasCallStack => Brig -> UserId -> Http [Auth.Cookie ()] +listCookies :: (HasCallStack) => Brig -> UserId -> Http [Auth.Cookie ()] listCookies b u = listCookiesWithLabel b u [] -listCookiesWithLabel :: HasCallStack => Brig -> UserId -> [CookieLabel] -> Http [Auth.Cookie ()] +listCookiesWithLabel :: (HasCallStack) => Brig -> UserId -> [CookieLabel] -> Http [Auth.Cookie ()] listCookiesWithLabel b u l = do rs <- get @@ -1299,7 +1306,7 @@ listCookiesWithLabel b u l = do -- | Check that the cookie returned after login is sane. -- -- Doesn't check everything, just some basic properties. -assertSanePersistentCookie :: forall u. ZAuth.UserTokenLike u => Http.Cookie -> Assertion +assertSanePersistentCookie :: forall u. (ZAuth.UserTokenLike u) => Http.Cookie -> Assertion assertSanePersistentCookie ck = do assertBool "type" (cookie_persistent ck) assertBool "http-only" (cookie_http_only ck) @@ -1312,7 +1319,7 @@ assertSanePersistentCookie ck = do -- | Check that the access token returned after login is sane. assertSaneAccessToken :: - ZAuth.AccessTokenLike a => + (ZAuth.AccessTokenLike a) => -- | Some moment in time before the user was created UTCTime -> UserId -> @@ -1334,5 +1341,5 @@ remJson p l ids = "ids" .= ids ] -wait :: MonadIO m => m () +wait :: (MonadIO m) => m () wait = liftIO $ threadDelay 1000000 diff --git a/services/brig/test/integration/API/User/Client.hs b/services/brig/test/integration/API/User/Client.hs index b7bbd4c2cd1..f3dce21cff8 100644 --- a/services/brig/test/integration/API/User/Client.hs +++ b/services/brig/test/integration/API/User/Client.hs @@ -153,9 +153,9 @@ testAddGetClientVerificationCode db brig galley = do Util.generateVerificationCode brig (Public.SendVerificationCode Public.Login email) k <- Code.mkKey (Code.ForEmail email) codeValue <- Code.codeValue <$$> lookupCode db k Code.AccountLogin - checkLoginSucceeds $ - PasswordLogin $ - PasswordLoginData (LoginByEmail email) defPassword (Just defCookieLabel) codeValue + checkLoginSucceeds + $ PasswordLogin + $ PasswordLoginData (LoginByEmail email) defPassword (Just defCookieLabel) codeValue c <- addClient' codeValue getClient brig uid (clientId c) !!! do const 200 === statusCode @@ -209,9 +209,9 @@ testAddGetClientCodeExpired db opts brig galley = do Util.generateVerificationCode brig (Public.SendVerificationCode Public.Login email) k <- Code.mkKey (Code.ForEmail email) codeValue <- Code.codeValue <$$> lookupCode db k Code.AccountLogin - checkLoginSucceeds $ - PasswordLogin $ - PasswordLoginData (LoginByEmail email) defPassword (Just defCookieLabel) codeValue + checkLoginSucceeds + $ PasswordLogin + $ PasswordLoginData (LoginByEmail email) defPassword (Just defCookieLabel) codeValue let verificationTimeout = round (Opt.setVerificationTimeout (Opt.optSettings opts)) threadDelay $ ((verificationTimeout + 1) * 1000_000) addClient' codeValue !!! do @@ -392,11 +392,11 @@ testListClientsBulk opts brig = do uid3 <- userId <$> randomUser brig let mkPubClient cl = PubClient (clientId cl) (clientClass cl) let expectedResponse :: QualifiedUserMap (Set PubClient) = - QualifiedUserMap $ - Map.singleton + QualifiedUserMap + $ Map.singleton domain - ( UserMap $ - Map.fromList + ( UserMap + $ Map.fromList [ (uid1, Set.fromList $ mkPubClient <$> [c11, c12, c13]), (uid2, Set.fromList $ mkPubClient <$> [c21, c22]) ] @@ -425,19 +425,19 @@ testClientsWithoutPrekeys brig cannon db opts = do -- logic prevents this from happening) let removeClientKeys :: DB.PrepQuery DB.W (UserId, ClientId) () removeClientKeys = "DELETE FROM prekeys where user = ? and client = ?" - liftIO $ - DB.runClient db $ - DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) + liftIO + $ DB.runClient db + $ DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) uid2 <- userId <$> randomUser brig let domain = opts ^. Opt.optionSettings & Opt.setFederationDomain let userClients = - QualifiedUserClients $ - Map.singleton domain $ - Map.singleton uid1 $ - Set.fromList [clientId c11, clientId c12] + QualifiedUserClients + $ Map.singleton domain + $ Map.singleton uid1 + $ Set.fromList [clientId c11, clientId c12] WS.bracketR cannon uid1 $ \ws -> do getClient brig uid1 (clientId c11) !!! do @@ -454,8 +454,8 @@ testClientsWithoutPrekeys brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - expectedClientMap + ( Right + $ expectedClientMap domain uid1 [ (clientId c11, Nothing), @@ -471,7 +471,8 @@ testClientsWithoutPrekeys brig cannon db opts = do let ob = Object $ List1.head (ntfPayload n) ob ^? key "type" . _String @?= Just "user.client-remove" - ( fromByteString . T.encodeUtf8 + ( fromByteString + . T.encodeUtf8 =<< (ob ^? key "client" . key "id" . _String) ) @?= Just (clientId c11) @@ -487,8 +488,8 @@ testClientsWithoutPrekeys brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - expectedClientMap + ( Right + $ expectedClientMap domain uid1 [ (clientId c11, Nothing), @@ -499,11 +500,11 @@ testClientsWithoutPrekeys brig cannon db opts = do where expectedClientMap :: Domain -> UserId -> [(ClientId, Maybe Prekey)] -> QualifiedUserClientPrekeyMap expectedClientMap domain u xs = - mkQualifiedUserClientPrekeyMap $ - Map.singleton domain $ - mkUserClientPrekeyMap $ - Map.singleton u $ - Map.fromList xs + mkQualifiedUserClientPrekeyMap + $ Map.singleton domain + $ mkUserClientPrekeyMap + $ Map.singleton u + $ Map.fromList xs testClientsWithoutPrekeysV4 :: Brig -> Cannon -> DB.ClientState -> Opt.Opts -> Http () testClientsWithoutPrekeysV4 brig cannon db opts = do @@ -517,19 +518,19 @@ testClientsWithoutPrekeysV4 brig cannon db opts = do -- logic prevents this from happening) let removeClientKeys :: DB.PrepQuery DB.W (UserId, ClientId) () removeClientKeys = "DELETE FROM prekeys where user = ? and client = ?" - liftIO $ - DB.runClient db $ - DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) + liftIO + $ DB.runClient db + $ DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) uid2 <- userId <$> randomUser brig let domain = opts ^. Opt.optionSettings & Opt.setFederationDomain let userClients = - QualifiedUserClients $ - Map.singleton domain $ - Map.singleton uid1 $ - Set.fromList [clientId c11, clientId c12] + QualifiedUserClients + $ Map.singleton domain + $ Map.singleton uid1 + $ Set.fromList [clientId c11, clientId c12] WS.bracketR cannon uid1 $ \ws -> do getClient brig uid1 (clientId c11) !!! do @@ -545,8 +546,8 @@ testClientsWithoutPrekeysV4 brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - expectedClientMapClientsWithoutPrekeys + ( Right + $ expectedClientMapClientsWithoutPrekeys domain uid1 [ (clientId c11, Nothing), @@ -576,8 +577,8 @@ testClientsWithoutPrekeysV4 brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - expectedClientMapClientsWithoutPrekeys + ( Right + $ expectedClientMapClientsWithoutPrekeys domain uid1 [ (clientId c11, Nothing), @@ -591,12 +592,12 @@ expectedClientMapClientsWithoutPrekeys :: Domain -> UserId -> [(ClientId, Maybe expectedClientMapClientsWithoutPrekeys domain u xs failed = QualifiedUserClientPrekeyMapV4 { qualifiedUserClientPrekeys = - coerce $ - mkQualifiedUserClientPrekeyMap $ - Map.singleton domain $ - mkUserClientPrekeyMap $ - Map.singleton u $ - Map.fromList xs, + coerce + $ mkQualifiedUserClientPrekeyMap + $ Map.singleton domain + $ mkUserClientPrekeyMap + $ Map.singleton u + $ Map.fromList xs, failedToList = failed } @@ -612,22 +613,22 @@ testClientsWithoutPrekeysFailToListV4 brig cannon db opts = do -- logic prevents this from happening) let removeClientKeys :: DB.PrepQuery DB.W (UserId, ClientId) () removeClientKeys = "DELETE FROM prekeys where user = ? and client = ?" - liftIO $ - DB.runClient db $ - DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) + liftIO + $ DB.runClient db + $ DB.write removeClientKeys (DB.params DB.LocalQuorum (uid1, clientId c11)) uid2 <- fakeRemoteUser let domain = opts ^. Opt.optionSettings & Opt.setFederationDomain let userClients1 = - QualifiedUserClients $ - Map.singleton domain $ - Map.singleton uid1 $ - Set.fromList [clientId c11, clientId c12] + QualifiedUserClients + $ Map.singleton domain + $ Map.singleton uid1 + $ Set.fromList [clientId c11, clientId c12] userClients2 = - QualifiedUserClients $ - Map.fromList + QualifiedUserClients + $ Map.fromList [ ( qDomain uid2, Map.singleton (qUnqualified uid2) mempty ) @@ -647,8 +648,8 @@ testClientsWithoutPrekeysFailToListV4 brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - expectedClientMapClientsWithoutPrekeys + ( Right + $ expectedClientMapClientsWithoutPrekeys domain uid1 [ (clientId c11, Nothing), @@ -678,8 +679,8 @@ testClientsWithoutPrekeysFailToListV4 brig cannon db opts = do !!! do const 200 === statusCode const - ( Right $ - QualifiedUserClientPrekeyMapV4 + ( Right + $ QualifiedUserClientPrekeyMapV4 { qualifiedUserClientPrekeys = QualifiedUserClientMap Map.empty, failedToList = pure [uid2] } @@ -706,11 +707,12 @@ testListClientsBulkV2 opts brig = do uid3 <- userId <$> randomUser brig let mkPubClient cl = PubClient (clientId cl) (clientClass cl) let expectedResponse :: WrappedQualifiedUserMap (Set PubClient) = - Wrapped . QualifiedUserMap $ - Map.singleton + Wrapped + . QualifiedUserMap + $ Map.singleton domain - ( UserMap $ - Map.fromList + ( UserMap + $ Map.fromList [ (uid1, Set.fromList $ mkPubClient <$> [c11, c12, c13]), (uid2, Set.fromList $ mkPubClient <$> [c21, c22]) ] @@ -759,8 +761,9 @@ testGetUserPrekeys brig = do const 200 === statusCode const (Just $ PrekeyBundle uid [cpk]) === responseJsonMaybe -- prekeys are deleted when retrieved, except the last one - replicateM_ 2 $ - get (apiVersion "v1" . brig . paths ["users", toByteString' uid, "prekeys"] . zUser uid) !!! do + replicateM_ 2 + $ get (apiVersion "v1" . brig . paths ["users", toByteString' uid, "prekeys"] . zUser uid) + !!! do const 200 === statusCode const (Just $ PrekeyBundle uid [lpk]) === responseJsonMaybe @@ -797,16 +800,18 @@ testMultiUserGetPrekeys :: Brig -> Http () testMultiUserGetPrekeys brig = do xs <- generateClients 3 brig let userClients = - UserClients $ - Map.fromList $ - xs <&> \(uid, c, _lpk, _cpk) -> - (uid, Set.fromList [clientId c]) + UserClients + $ Map.fromList + $ xs + <&> \(uid, c, _lpk, _cpk) -> + (uid, Set.fromList [clientId c]) let expectedUserClientMap = - mkUserClientPrekeyMap $ - Map.fromList $ - xs <&> \(uid, c, _lpk, cpk) -> - (uid, Map.singleton (clientId c) (Just (prekeyData cpk))) + mkUserClientPrekeyMap + $ Map.fromList + $ xs + <&> \(uid, c, _lpk, cpk) -> + (uid, Map.singleton (clientId c) (Just (prekeyData cpk))) uid <- userId <$> randomUser brig @@ -828,21 +833,23 @@ testMultiUserGetPrekeysQualified brig opts = do xs <- generateClients 3 brig let userClients = - QualifiedUserClients $ - Map.singleton domain $ - Map.fromList $ - xs <&> \(uid, c, _lpk, _cpk) -> - (uid, Set.fromList [clientId c]) + QualifiedUserClients + $ Map.singleton domain + $ Map.fromList + $ xs + <&> \(uid, c, _lpk, _cpk) -> + (uid, Set.fromList [clientId c]) uid <- userId <$> randomUser brig let expectedUserClientMap = - mkQualifiedUserClientPrekeyMap $ - Map.singleton domain $ - mkUserClientPrekeyMap $ - Map.fromList $ - xs <&> \(uid', c, _lpk, cpk) -> - (uid', Map.singleton (clientId c) (Just (prekeyData cpk))) + mkQualifiedUserClientPrekeyMap + $ Map.singleton domain + $ mkUserClientPrekeyMap + $ Map.fromList + $ xs + <&> \(uid', c, _lpk, cpk) -> + (uid', Map.singleton (clientId c) (Just (prekeyData cpk))) post ( apiVersion "v2" @@ -862,24 +869,26 @@ testMultiUserGetPrekeysQualifiedV4 brig opts = do xs <- generateClients 3 brig let userClients = - QualifiedUserClients $ - Map.singleton domain $ - Map.fromList $ - xs <&> \(uid, c, _lpk, _cpk) -> - (uid, Set.fromList [clientId c]) + QualifiedUserClients + $ Map.singleton domain + $ Map.fromList + $ xs + <&> \(uid, c, _lpk, _cpk) -> + (uid, Set.fromList [clientId c]) uid <- userId <$> randomUser brig let expectedUserClientMap = QualifiedUserClientPrekeyMapV4 { qualifiedUserClientPrekeys = - coerce $ - mkQualifiedUserClientPrekeyMap $ - Map.singleton domain $ - mkUserClientPrekeyMap $ - Map.fromList $ - xs <&> \(uid', c, _lpk, cpk) -> - (uid', Map.singleton (clientId c) (Just (prekeyData cpk))), + coerce + $ mkQualifiedUserClientPrekeyMap + $ Map.singleton domain + $ mkUserClientPrekeyMap + $ Map.fromList + $ xs + <&> \(uid', c, _lpk, cpk) -> + (uid', Map.singleton (clientId c) (Just (prekeyData cpk))), failedToList = Nothing } @@ -1165,7 +1174,7 @@ testUpdateClient opts brig = do const (Just "label") === (clientLabel <=< responseJsonMaybe) -- update supported client capabilities work - let checkUpdate :: HasCallStack => Maybe [ClientCapability] -> Bool -> [ClientCapability] -> Http () + let checkUpdate :: (HasCallStack) => Maybe [ClientCapability] -> Bool -> [ClientCapability] -> Http () checkUpdate capsIn respStatusOk capsOut = do let update'' = defUpdateClient {updateClientCapabilities = Set.fromList <$> capsIn} put @@ -1193,13 +1202,13 @@ testUpdateClient opts brig = do -- update supported client capabilities don't break prekeys or label do - let checkClientLabel :: HasCallStack => Http () + let checkClientLabel :: (HasCallStack) => Http () checkClientLabel = do getClient brig uid (clientId c) !!! do const 200 === statusCode const (Just label) === (clientLabel <=< responseJsonMaybe) - flushClientPrekey :: HasCallStack => Http (Maybe ClientPrekey) + flushClientPrekey :: (HasCallStack) => Http (Maybe ClientPrekey) flushClientPrekey = do responseJsonMaybe <$> ( get @@ -1208,7 +1217,7 @@ testUpdateClient opts brig = do === statusCode ) - checkClientPrekeys :: HasCallStack => Prekey -> Http () + checkClientPrekeys :: (HasCallStack) => Prekey -> Http () checkClientPrekeys expectedPrekey = do flushClientPrekey >>= \case Nothing -> error "unexpected." @@ -1285,7 +1294,7 @@ testMissingClient brig = do -- brig) have registered it. Add second temporary client, check -- again. (NB: temp clients replace each other, there can always be -- at most one per account.) -testAddMultipleTemporary :: HasCallStack => Brig -> Galley -> Cannon -> Http () +testAddMultipleTemporary :: (HasCallStack) => Brig -> Galley -> Cannon -> Http () testAddMultipleTemporary brig galley cannon = do uid <- userId <$> randomUser brig let clt1 = @@ -1323,17 +1332,17 @@ testAddMultipleTemporary brig galley cannon = do where numOfBrigClients u = do r <- - get $ - brig - . path "clients" - . zUser u + get + $ brig + . path "clients" + . zUser u pure $ Vec.length <$> (preview _Array =<< responseJsonMaybe @Value r) numOfGalleyClients u = do r <- - get $ - galley - . path "i/test/clients" - . zUser u + get + $ galley + . path "i/test/clients" + . zUser u pure $ Vec.length <$> (preview _Array =<< responseJsonMaybe @Value r) testPreKeyRace :: Brig -> Http () @@ -1386,13 +1395,20 @@ instance A.FromJSON DPoPClaimsSet where parseJSON = A.withObject "OAuthClaimsSet" $ \o -> DPoPClaimsSet <$> A.parseJSON (A.Object o) - <*> o A..: "nonce" - <*> o A..: "htm" - <*> o A..: "htu" - <*> o A..: "chal" - <*> o A..: "handle" - <*> o A..: "name" - <*> o A..: "team" + <*> o + A..: "nonce" + <*> o + A..: "htm" + <*> o + A..: "htu" + <*> o + A..: "chal" + <*> o + A..: "handle" + <*> o + A..: "name" + <*> o + A..: "team" instance A.ToJSON DPoPClaimsSet where toJSON s = @@ -1480,23 +1496,27 @@ testCreateAccessToken opts n brig = do jwkKey :: JWK jwkKey = do - fromMaybe (error "invalid jwk") . A.decode $ - "{\"kty\":\"OKP\",\"d\":\"9RVey-A7ENCO5e9fDiPf8An1gkVBmAhFgu4WZMVwS-A\",\"crv\":\"Ed25519\",\"x\":\"nLJGN-Oa6Jsq3KclZggLl7UvAVdmB0Q6C3N5BCgphHw\"}" + fromMaybe (error "invalid jwk") + . A.decode + $ "{\"kty\":\"OKP\",\"d\":\"9RVey-A7ENCO5e9fDiPf8An1gkVBmAhFgu4WZMVwS-A\",\"crv\":\"Ed25519\",\"x\":\"nLJGN-Oa6Jsq3KclZggLl7UvAVdmB0Q6C3N5BCgphHw\"}" jwkPubKey :: JWK jwkPubKey = do - fromMaybe (error "invalid jwk") . A.decode $ - "{\"kty\":\"OKP\",\"crv\":\"Ed25519\",\"x\":\"nLJGN-Oa6Jsq3KclZggLl7UvAVdmB0Q6C3N5BCgphHw\"}" + fromMaybe (error "invalid jwk") + . A.decode + $ "{\"kty\":\"OKP\",\"crv\":\"Ed25519\",\"x\":\"nLJGN-Oa6Jsq3KclZggLl7UvAVdmB0Q6C3N5BCgphHw\"}" jwkKeyBundleEcdsaP256 :: JWK jwkKeyBundleEcdsaP256 = do - fromMaybe (error "invalid jwk") . A.decode $ - "{\"kty\":\"EC\",\"alg\":\"ES256\",\"crv\":\"P-256\",\"x\":\"hcYjloNodyCLF_rQd_HIszSpa2J-vzrgntneAJW5pA8\",\"y\":\"6MXxnHq1FmAWCc6A7YValxvekicBv53ARTQO35mRKJ8\",\"d\":\"yz1weEXJbJao6wLiml8fahLt3BnJxdHWfbpUB0i8GLo\"}" + fromMaybe (error "invalid jwk") + . A.decode + $ "{\"kty\":\"EC\",\"alg\":\"ES256\",\"crv\":\"P-256\",\"x\":\"hcYjloNodyCLF_rQd_HIszSpa2J-vzrgntneAJW5pA8\",\"y\":\"6MXxnHq1FmAWCc6A7YValxvekicBv53ARTQO35mRKJ8\",\"d\":\"yz1weEXJbJao6wLiml8fahLt3BnJxdHWfbpUB0i8GLo\"}" jwkPublicKeyEcdsaP256 :: JWK jwkPublicKeyEcdsaP256 = do - fromMaybe (error "invalid jwk") . A.decode $ - "{\"kty\":\"EC\",\"alg\":\"ES256\",\"crv\":\"P-256\",\"x\":\"hcYjloNodyCLF_rQd_HIszSpa2J-vzrgntneAJW5pA8\",\"y\":\"6MXxnHq1FmAWCc6A7YValxvekicBv53ARTQO35mRKJ8\"}" + fromMaybe (error "invalid jwk") + . A.decode + $ "{\"kty\":\"EC\",\"alg\":\"ES256\",\"crv\":\"P-256\",\"x\":\"hcYjloNodyCLF_rQd_HIszSpa2J-vzrgntneAJW5pA8\",\"y\":\"6MXxnHq1FmAWCc6A7YValxvekicBv53ARTQO35mRKJ8\"}" testCreateAccessTokenMissingProof :: Brig -> Http () testCreateAccessTokenMissingProof brig = do diff --git a/services/brig/test/integration/API/User/Connection.hs b/services/brig/test/integration/API/User/Connection.hs index 7dbb61f7bcb..59891957a84 100644 --- a/services/brig/test/integration/API/User/Connection.hs +++ b/services/brig/test/integration/API/User/Connection.hs @@ -651,12 +651,13 @@ testAllConnectionsPaging b db = do createRemoteConnection self now = do qOther <- (`Qualified` remoteDomain) <$> randomId qConv <- (`Qualified` remoteDomain) <$> randomId - liftIO . DB.runClient db $ - DB.retry DB.x5 $ - DB.write remoteConnectionInsert $ - DB.params - DB.LocalQuorum - (self, remoteDomain, qUnqualified qOther, SentWithHistory, now, qDomain qConv, qUnqualified qConv) + liftIO + . DB.runClient db + $ DB.retry DB.x5 + $ DB.write remoteConnectionInsert + $ DB.params + DB.LocalQuorum + (self, remoteDomain, qUnqualified qOther, SentWithHistory, now, qDomain qConv, qUnqualified qConv) testConnectionLimit :: Brig -> ConnectionLimit -> Http () testConnectionLimit brig (ConnectionLimit l) = do @@ -727,10 +728,10 @@ testConnectWithAnon brig fedBrigClient = do fromUser <- randomId toUser <- User.userId <$> createAnonUser "anon1234" brig res <- - runFedClient @"send-connection-action" fedBrigClient (Domain "far-away.example.com") $ - NewConnectionRequest fromUser Nothing toUser RemoteConnect - liftIO $ - assertEqual "The response should specify that the user is not activated" NewConnectionResponseUserNotActivated res + runFedClient @"send-connection-action" fedBrigClient (Domain "far-away.example.com") + $ NewConnectionRequest fromUser Nothing toUser RemoteConnect + liftIO + $ assertEqual "The response should specify that the user is not activated" NewConnectionResponseUserNotActivated res testConnectFromAnon :: Brig -> Http () testConnectFromAnon brig = do diff --git a/services/brig/test/integration/API/User/Handles.hs b/services/brig/test/integration/API/User/Handles.hs index db34f2f9277..135cde55a7d 100644 --- a/services/brig/test/integration/API/User/Handles.hs +++ b/services/brig/test/integration/API/User/Handles.hs @@ -194,8 +194,8 @@ testHandleQuery opts brig = do assertCanFind brig user3 user4 -- Usually, you can search outside your team but not if this config option is set let newOpts = opts & ((Opt.optionSettings . Opt.searchSameTeamOnly) ?~ True) - withSettingsOverrides newOpts $ - assertCannotFind brig user3 user4 + withSettingsOverrides newOpts + $ assertCannotFind brig user3 user4 testHandleQuerySearchVisibilityStandard :: Opt.Opts -> Brig -> Http () testHandleQuerySearchVisibilityStandard _opts brig = do @@ -277,16 +277,16 @@ testGetUserByQualifiedHandle brig = do . zUser (userId unconnectedUser) . expect2xx ) - liftIO $ - assertEqual + liftIO + $ assertEqual "Id should match" (userQualifiedId user) (profileQualifiedId profileForUnconnectedUser) -- N.B. Internally this endpoint uses same implementation as getting a user -- profile by id. So, it is not necessary to test rest of the cases. - liftIO $ - assertEqual + liftIO + $ assertEqual "Email shouldn't be shown to unconnected user" Nothing (profileEmail profileForUnconnectedUser) @@ -314,17 +314,17 @@ testGetUserByQualifiedHandleNoFederation :: Opt.Opts -> Brig -> Http () testGetUserByQualifiedHandleNoFederation opt brig = do let newOpts = opt {Opt.federatorInternal = Nothing, Opt.rabbitmq = Nothing} someUser <- randomUser brig - withSettingsOverrides newOpts $ - get + withSettingsOverrides newOpts + $ get ( apiVersion "v1" . brig . paths ["users", "by-handle", "non-existant.example.com", "oh-a-handle"] . zUser (userId someUser) ) - !!! do - const 400 === statusCode - const "Bad Request" === statusMessage - const (Right "federation-not-enabled") === fmap Wai.label . responseJsonEither + !!! do + const 400 === statusCode + const "Bad Request" === statusMessage + const (Right "federation-not-enabled") === fmap Wai.label . responseJsonEither assertCanFind :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> User -> User -> m () assertCanFind brig from target = do diff --git a/services/brig/test/integration/API/User/PasswordReset.hs b/services/brig/test/integration/API/User/PasswordReset.hs index 55f19b34c28..9a5c69987ec 100644 --- a/services/brig/test/integration/API/User/PasswordReset.hs +++ b/services/brig/test/integration/API/User/PasswordReset.hs @@ -111,7 +111,7 @@ testPasswordResetInvalidPasswordLength brig cs = do addJsonKey key val (Object xs) = KeyMap.insert key val xs addJsonKey _ _ _ = error "invalid JSON object" - postCompletePasswordReset :: Object -> MonadHttp m => m ResponseLBS + postCompletePasswordReset :: Object -> (MonadHttp m) => m ResponseLBS postCompletePasswordReset bdy = post ( brig diff --git a/services/brig/test/integration/API/User/Property.hs b/services/brig/test/integration/API/User/Property.hs index fd16f35793f..071ea2d356d 100644 --- a/services/brig/test/integration/API/User/Property.hs +++ b/services/brig/test/integration/API/User/Property.hs @@ -149,7 +149,7 @@ testPropertyLimits opts brig = do const 403 === statusCode const (Just "too-many-properties") === fmap Error.label . responseJsonMaybe -testSizeLimits :: HasCallStack => Opt.Opts -> Brig -> Http () +testSizeLimits :: (HasCallStack) => Opt.Opts -> Brig -> Http () testSizeLimits opts brig = do let maxKeyLen = fromIntegral $ fromMaybe defMaxKeyLen . setPropertyMaxKeyLen $ optSettings opts maxValueLen = fromIntegral $ fromMaybe defMaxValueLen . setPropertyMaxValueLen $ optSettings opts diff --git a/services/brig/test/integration/API/User/RichInfo.hs b/services/brig/test/integration/API/User/RichInfo.hs index 49d4957246b..c3eee70c648 100644 --- a/services/brig/test/integration/API/User/RichInfo.hs +++ b/services/brig/test/integration/API/User/RichInfo.hs @@ -60,8 +60,8 @@ testDefaultRichInfo brig galley = do member2 <- userId <$> createTeamMember brig galley owner tid noPermissions -- The first user should see the second user's rich info and it should be empty richInfo <- getRichInfo brig member1 member2 - liftIO $ - assertEqual + liftIO + $ assertEqual "rich info is not empty, or not present" (Right (mkRichInfoAssocList mempty)) richInfo @@ -114,7 +114,7 @@ testDedupeDuplicateFieldNames brig = do ri <- getRichInfo brig owner owner liftIO $ assertEqual "duplicate rich info fields" (Right deduped) ri -testRichInfoSizeLimit :: HasCallStack => Brig -> Opt.Opts -> Http () +testRichInfoSizeLimit :: (HasCallStack) => Brig -> Opt.Opts -> Http () testRichInfoSizeLimit brig conf = do let maxSize :: Int = setRichInfoLimit $ optSettings conf (owner, _) <- createUserWithTeam brig @@ -123,9 +123,9 @@ testRichInfoSizeLimit brig conf = do [ RichField "department" (Text.replicate (fromIntegral maxSize) "#") ] bad2 = - mkRichInfoAssocList $ - [0 .. (maxSize `div` 2)] - <&> \i -> RichField (CI.mk $ Text.pack $ show i) "#" + mkRichInfoAssocList + $ [0 .. (maxSize `div` 2)] + <&> \i -> RichField (CI.mk $ Text.pack $ show i) "#" putRichInfo brig owner bad1 !!! const 413 === statusCode putRichInfo brig owner bad2 !!! const 413 === statusCode diff --git a/services/brig/test/integration/API/User/Util.hs b/services/brig/test/integration/API/User/Util.hs index da62d9d228f..ed1a766929a 100644 --- a/services/brig/test/integration/API/User/Util.hs +++ b/services/brig/test/integration/API/User/Util.hs @@ -128,8 +128,9 @@ registerUser :: (MonadIO m, MonadHttp m) => Text -> Brig -> m ResponseLBS registerUser name brig = do e <- randomEmail let p = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= name, "email" .= fromEmail e, "password" .= defPassword @@ -156,7 +157,7 @@ createRandomPhoneUser brig = do const (Just phn) === (userPhone <=< responseJsonMaybe) pure (uid, phn) -initiatePasswordReset :: Brig -> Email -> MonadHttp m => m ResponseLBS +initiatePasswordReset :: Brig -> Email -> (MonadHttp m) => m ResponseLBS initiatePasswordReset brig email = post ( brig @@ -190,18 +191,18 @@ initiateEmailUpdateLogin brig email loginCreds uid = do pure (decodeCookie rsp, decodeToken rsp) initiateEmailUpdateCreds brig email (cky, tok) uid -initiateEmailUpdateCreds :: Brig -> Email -> (Bilge.Cookie, Brig.ZAuth.Token ZAuth.Access) -> UserId -> MonadHttp m => m ResponseLBS +initiateEmailUpdateCreds :: Brig -> Email -> (Bilge.Cookie, Brig.ZAuth.Token ZAuth.Access) -> UserId -> (MonadHttp m) => m ResponseLBS initiateEmailUpdateCreds brig email (cky, tok) uid = do - put $ - unversioned - . brig - . path "/access/self/email" - . cookie cky - . header "Authorization" ("Bearer " <> toByteString' tok) - . zUser uid - . Bilge.json (EmailUpdate email) - -initiateEmailUpdateNoSend :: Brig -> Email -> UserId -> MonadHttp m => m ResponseLBS + put + $ unversioned + . brig + . path "/access/self/email" + . cookie cky + . header "Authorization" ("Bearer " <> toByteString' tok) + . zUser uid + . Bilge.json (EmailUpdate email) + +initiateEmailUpdateNoSend :: Brig -> Email -> UserId -> (MonadHttp m) => m ResponseLBS initiateEmailUpdateNoSend brig email uid = let emailUpdate = RequestBodyLBS . encode $ EmailUpdate email in put (brig . path "/i/self/email" . contentJson . zUser uid . body emailUpdate) @@ -225,7 +226,7 @@ preparePasswordReset brig cState email uid newpw = do where runSem = liftIO . runFinal @IO . interpretClientToIO cState . codeStoreToCassandra @DB.Client -completePasswordReset :: Brig -> CompletePasswordReset -> MonadHttp m => m ResponseLBS +completePasswordReset :: Brig -> CompletePasswordReset -> (MonadHttp m) => m ResponseLBS completePasswordReset brig passwordResetData = post ( brig @@ -238,12 +239,12 @@ removeBlacklist :: Brig -> Email -> (MonadIO m, MonadHttp m) => m () removeBlacklist brig email = void $ delete (brig . path "/i/users/blacklist" . queryItem "email" (toByteString' email)) -getClient :: Brig -> UserId -> ClientId -> MonadHttp m => m ResponseLBS +getClient :: Brig -> UserId -> ClientId -> (MonadHttp m) => m ResponseLBS getClient brig u c = - get $ - brig - . paths ["clients", toByteString' c] - . zUser u + get + $ brig + . paths ["clients", toByteString' c] + . zUser u putClient :: (MonadHttp m, HasCallStack) => @@ -253,104 +254,107 @@ putClient :: MLSPublicKeys -> m ResponseLBS putClient brig uid c keys = - put $ - brig - . paths ["clients", toByteString' c] - . zUser uid - . json (UpdateClient [] Nothing Nothing Nothing keys) + put + $ brig + . paths ["clients", toByteString' c] + . zUser uid + . json (UpdateClient [] Nothing Nothing Nothing keys) -getClientCapabilities :: Brig -> UserId -> ClientId -> MonadHttp m => m ResponseLBS +getClientCapabilities :: Brig -> UserId -> ClientId -> (MonadHttp m) => m ResponseLBS getClientCapabilities brig u c = - get $ - brig - . paths ["clients", toByteString' c, "capabilities"] - . zUser u + get + $ brig + . paths ["clients", toByteString' c, "capabilities"] + . zUser u -getUserClientsUnqualified :: Brig -> UserId -> MonadHttp m => m ResponseLBS +getUserClientsUnqualified :: Brig -> UserId -> (MonadHttp m) => m ResponseLBS getUserClientsUnqualified brig uid = - get $ - apiVersion "v1" - . brig - . paths ["users", toByteString' uid, "clients"] - . zUser uid + get + $ apiVersion "v1" + . brig + . paths ["users", toByteString' uid, "clients"] + . zUser uid -getUserClientsQualified :: Brig -> UserId -> Domain -> UserId -> MonadHttp m => m ResponseLBS +getUserClientsQualified :: Brig -> UserId -> Domain -> UserId -> (MonadHttp m) => m ResponseLBS getUserClientsQualified brig zusr domain uid = - get $ - brig - . paths ["users", toByteString' domain, toByteString' uid, "clients"] - . zUser zusr + get + $ brig + . paths ["users", toByteString' domain, toByteString' uid, "clients"] + . zUser zusr -deleteClient :: Brig -> UserId -> ClientId -> Maybe Text -> MonadHttp m => m ResponseLBS +deleteClient :: Brig -> UserId -> ClientId -> Maybe Text -> (MonadHttp m) => m ResponseLBS deleteClient brig u c pw = - delete $ - brig - . paths ["clients", toByteString' c] - . zUser u - . zConn "conn" - . contentJson - . body payload + delete + $ brig + . paths ["clients", toByteString' c] + . zUser u + . zConn "conn" + . contentJson + . body payload where payload = - RequestBodyLBS . encode . object . maybeToList $ - fmap ("password" .=) pw + RequestBodyLBS + . encode + . object + . maybeToList + $ fmap ("password" .=) pw -listConnections :: HasCallStack => Brig -> UserId -> MonadHttp m => m ResponseLBS +listConnections :: (HasCallStack) => Brig -> UserId -> (MonadHttp m) => m ResponseLBS listConnections brig u = - get $ - apiVersion "v1" - . brig - . path "connections" - . zUser u + get + $ apiVersion "v1" + . brig + . path "connections" + . zUser u listAllConnections :: (MonadHttp m, HasCallStack) => Brig -> UserId -> Maybe Int -> Maybe (MultiTablePagingState "Connections" LocalOrRemoteTable) -> m ResponseLBS listAllConnections brig u size state = - post $ - brig - . path "list-connections" - . zUser u - . expect2xx - . contentJson - . body - ( RequestBodyLBS $ - encode $ - object - [ "size" .= size, - "paging_state" .= state - ] - ) - -getConnectionQualified :: MonadHttp m => Brig -> UserId -> Qualified UserId -> m ResponseLBS + post + $ brig + . path "list-connections" + . zUser u + . expect2xx + . contentJson + . body + ( RequestBodyLBS + $ encode + $ object + [ "size" .= size, + "paging_state" .= state + ] + ) + +getConnectionQualified :: (MonadHttp m) => Brig -> UserId -> Qualified UserId -> m ResponseLBS getConnectionQualified brig from (Qualified toUser toDomain) = - get $ - brig - . paths ["connections", toByteString' toDomain, toByteString' toUser] - . zUser from + get + $ brig + . paths ["connections", toByteString' toDomain, toByteString' toUser] + . zUser from -setProperty :: Brig -> UserId -> ByteString -> Value -> MonadHttp m => m ResponseLBS +setProperty :: Brig -> UserId -> ByteString -> Value -> (MonadHttp m) => m ResponseLBS setProperty brig u k v = - put $ - brig - . paths ["/properties", k] - . zUser u - . zConn "conn" - . contentJson - . body (RequestBodyLBS $ encode v) - -getProperty :: Brig -> UserId -> ByteString -> MonadHttp m => m ResponseLBS + put + $ brig + . paths ["/properties", k] + . zUser u + . zConn "conn" + . contentJson + . body (RequestBodyLBS $ encode v) + +getProperty :: Brig -> UserId -> ByteString -> (MonadHttp m) => m ResponseLBS getProperty brig u k = - get $ - brig - . paths ["/properties", k] - . zUser u + get + $ brig + . paths ["/properties", k] + . zUser u -deleteProperty :: Brig -> UserId -> ByteString -> MonadHttp m => m ResponseLBS +deleteProperty :: Brig -> UserId -> ByteString -> (MonadHttp m) => m ResponseLBS deleteProperty brig u k = - delete $ - brig - . paths ["/properties", k] - . zConn "conn" - . zUser u + delete + $ brig + . paths ["/properties", k] + . zConn "conn" + . zUser u countCookies :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> UserId -> CookieLabel -> m (Maybe Int) countCookies brig u label = do @@ -381,7 +385,7 @@ assertConnectionQualified brig u1 qu2 rel = const (Right rel) === fmap ucStatus . responseJsonEither receiveConnectionAction :: - HasCallStack => + (HasCallStack) => Brig -> FedClient 'Brig -> UserId -> @@ -392,14 +396,14 @@ receiveConnectionAction :: Http () receiveConnectionAction brig fedBrigClient uid1 quid2 action expectedReaction expectedRel = do res <- - runFedClient @"send-connection-action" fedBrigClient (qDomain quid2) $ - F.NewConnectionRequest (qUnqualified quid2) Nothing uid1 action + runFedClient @"send-connection-action" fedBrigClient (qDomain quid2) + $ F.NewConnectionRequest (qUnqualified quid2) Nothing uid1 action liftIO $ do res @?= F.NewConnectionResponseOk expectedReaction assertConnectionQualified brig uid1 quid2 expectedRel sendConnectionAction :: - HasCallStack => + (HasCallStack) => Brig -> Opts -> UserId -> @@ -411,8 +415,9 @@ sendConnectionAction brig opts uid1 quid2 reaction expectedRel = do let mockConnectionResponse = F.NewConnectionResponseOk reaction mockResponse = encode mockConnectionResponse (res, reqs) <- - liftIO . withTempMockFederator opts mockResponse $ - postConnectionQualified brig uid1 quid2 + liftIO + . withTempMockFederator opts mockResponse + $ postConnectionQualified brig uid1 quid2 liftIO $ do req <- assertOne reqs @@ -426,7 +431,7 @@ sendConnectionAction brig opts uid1 quid2 reaction expectedRel = do assertConnectionQualified brig uid1 quid2 expectedRel sendConnectionUpdateAction :: - HasCallStack => + (HasCallStack) => Brig -> Opts -> UserId -> @@ -437,9 +442,11 @@ sendConnectionUpdateAction :: sendConnectionUpdateAction brig opts uid1 quid2 reaction expectedRel = do let mockConnectionResponse = F.NewConnectionResponseOk reaction mockResponse = encode mockConnectionResponse - void $ - liftIO . withTempMockFederator opts mockResponse $ - putConnectionQualified brig uid1 quid2 expectedRel !!! const 200 === statusCode + void + $ liftIO + . withTempMockFederator opts mockResponse + $ putConnectionQualified brig uid1 quid2 expectedRel + !!! const 200 === statusCode assertConnectionQualified brig uid1 quid2 expectedRel assertEmailVisibility :: (MonadCatch m, MonadIO m, MonadHttp m, HasCallStack) => Brig -> User -> User -> Bool -> m () @@ -472,7 +479,7 @@ uploadAsset c usr sts dat = do === statusCode downloadAsset :: - MonadHttp m => + (MonadHttp m) => CargoHold -> UserId -> Qualified AssetKey -> @@ -485,24 +492,25 @@ downloadAsset c usr ast = . zConn "conn" ) -requestLegalHoldDevice :: Brig -> UserId -> UserId -> LastPrekey -> MonadHttp m => m ResponseLBS +requestLegalHoldDevice :: Brig -> UserId -> UserId -> LastPrekey -> (MonadHttp m) => m ResponseLBS requestLegalHoldDevice brig requesterId targetUserId lastPrekey' = - post $ - brig - . paths ["i", "clients", "legalhold", toByteString' targetUserId, "request"] - . contentJson - . body payload + post + $ brig + . paths ["i", "clients", "legalhold", toByteString' targetUserId, "request"] + . contentJson + . body payload where payload = - RequestBodyLBS . encode $ - LegalHoldClientRequest requesterId lastPrekey' + RequestBodyLBS + . encode + $ LegalHoldClientRequest requesterId lastPrekey' -deleteLegalHoldDevice :: Brig -> UserId -> MonadHttp m => m ResponseLBS +deleteLegalHoldDevice :: Brig -> UserId -> (MonadHttp m) => m ResponseLBS deleteLegalHoldDevice brig uid = - delete $ - brig - . paths ["i", "clients", "legalhold", toByteString' uid] - . contentJson + delete + $ brig + . paths ["i", "clients", "legalhold", toByteString' uid] + . contentJson matchDeleteUserNotification :: Qualified UserId -> Notification -> Assertion matchDeleteUserNotification quid n = do @@ -558,11 +566,11 @@ setTeamFeatureLockStatus :: setTeamFeatureLockStatus galley tid status = put (galley . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg, toByteString' status]) !!! const 200 === statusCode -lookupCode :: MonadIO m => DB.ClientState -> Code.Key -> Code.Scope -> m (Maybe Code.Code) +lookupCode :: (MonadIO m) => DB.ClientState -> Code.Key -> Code.Scope -> m (Maybe Code.Code) lookupCode db k = liftIO . DB.runClient db . Code.lookup k getNonce :: - MonadHttp m => + (MonadHttp m) => Brig -> UserId -> ClientId -> @@ -570,7 +578,7 @@ getNonce :: getNonce = nonce get headNonce :: - MonadHttp m => + (MonadHttp m) => Brig -> UserId -> ClientId -> @@ -586,7 +594,7 @@ nonce m brig uid cid = ) headNonceNginz :: - MonadHttp m => + (MonadHttp m) => Nginz -> ZAuth.Token ZAuth.Access -> ClientId -> @@ -600,18 +608,18 @@ headNonceNginz nginz t cid = createAccessToken :: (MonadHttp m, HasCallStack) => Brig -> UserId -> Text -> ClientId -> Maybe Proof -> m ResponseLBS createAccessToken brig uid h cid mProof = - post $ - brig - . paths ["clients", toByteString' cid, "access-token"] - . zUser uid - . header "Z-Host" (cs h) - . maybe id (header "DPoP" . toByteString') mProof + post + $ brig + . paths ["clients", toByteString' cid, "access-token"] + . zUser uid + . header "Z-Host" (cs h) + . maybe id (header "DPoP" . toByteString') mProof createAccessTokenNginz :: (MonadHttp m, HasCallStack) => Nginz -> ZAuth.Token ZAuth.Access -> ClientId -> Maybe Proof -> m ResponseLBS createAccessTokenNginz n t cid mProof = - post $ - unversioned - . n - . paths ["clients", toByteString' cid, "access-token"] - . header "Authorization" ("Bearer " <> toByteString' t) - . maybe id (header "DPoP" . toByteString') mProof + post + $ unversioned + . n + . paths ["clients", toByteString' cid, "access-token"] + . header "Authorization" ("Bearer " <> toByteString' t) + . maybe id (header "DPoP" . toByteString') mProof diff --git a/services/brig/test/integration/Federation/End2end.hs b/services/brig/test/integration/Federation/End2end.hs index cf1beffc23c..414f9cdc3cc 100644 --- a/services/brig/test/integration/Federation/End2end.hs +++ b/services/brig/test/integration/Federation/End2end.hs @@ -89,8 +89,8 @@ spec :: Cannon -> IO TestTree spec _brigOpts mg brig galley cargohold cannon _federator brigTwo galleyTwo cargoholdTwo cannonTwo = - pure $ - testGroup + pure + $ testGroup "federation-end2end-user" [ test mg "get users by ids on multiple backends" $ testGetUsersById brig brigTwo, test mg "claim client prekey" $ testClaimPrekeySuccess brig brigTwo, @@ -106,8 +106,8 @@ spec _brigOpts mg brig galley cargohold cannon _federator brigTwo galleyTwo carg test mg "delete user connected to remotes and in conversation with remotes" $ testDeleteUser brig brigTwo galley galleyTwo cannon, test mg "download remote asset" $ testRemoteAsset brig brigTwo cargohold cargoholdTwo, test mg "claim remote key packages" $ claimRemoteKeyPackages brig brigTwo, - test mg "remote typing indicator" $ - testRemoteTypingIndicator brig brigTwo galley galleyTwo cannon cannonTwo + test mg "remote typing indicator" + $ testRemoteTypingIndicator brig brigTwo galley galleyTwo cannon cannonTwo ] -- | Path covered by this test: @@ -191,16 +191,19 @@ testClaimMultiPrekeyBundleSuccess brig1 brig2 = do mkClients = Set.fromList . map prekeyClient mkClientMap :: [ClientPrekey] -> Map ClientId (Maybe Prekey) mkClientMap = Map.fromList . map (prekeyClient &&& Just . prekeyData) - qmap :: Ord a => [(Qualified a, b)] -> Map Domain (Map a b) + qmap :: (Ord a) => [(Qualified a, b)] -> Map Domain (Map a b) qmap = fmap Map.fromList . indexQualified . map (sequenceAOf _1) c1 <- generateClientPrekeys brig1 prekeys1 c2 <- generateClientPrekeys brig2 prekeys2 let uc = - QualifiedUserClients . qmap $ - [mkClients <$> c1, mkClients <$> c2] + QualifiedUserClients + . qmap + $ [mkClients <$> c1, mkClients <$> c2] ucm = - mkQualifiedUserClientPrekeyMap . fmap mkUserClientPrekeyMap . qmap $ - [mkClientMap <$> c1, mkClientMap <$> c2] + mkQualifiedUserClientPrekeyMap + . fmap mkUserClientPrekeyMap + . qmap + $ [mkClientMap <$> c1, mkClientMap <$> c2] post ( apiVersion "v3" . brig1 @@ -225,9 +228,10 @@ testRemoveRemoteUserFromLocalConv brig1 galley1 brig2 galley2 = do connectUsersEnd2End brig1 brig2 aliceId bobId convId <- - fmap cnvQualifiedId . responseJsonError + fmap cnvQualifiedId + . responseJsonError =<< createConversation galley1 (userId alice) [bobId] - getConversationQualified galley1 (userId alice) convId liftIO $ map omQualifiedId (cmOthers (cnvMembers aliceConvBeforeDelete)) @?= [bobId] @@ -267,9 +271,10 @@ leaveRemoteConversation brig1 galley1 brig2 galley2 = do connectUsersEnd2End brig1 brig2 aliceId bobId convId <- - fmap cnvQualifiedId . responseJsonError + fmap cnvQualifiedId + . responseJsonError =<< createConversation galley1 (userId alice) [bobId] - getConversationQualified galley1 (userId alice) convId liftIO $ map omQualifiedId (cmOthers (cnvMembers aliceConvBeforeDelete)) @?= [bobId] @@ -308,9 +313,10 @@ testRemoteUsersInNewConv brig1 galley1 brig2 galley2 = do connectUsersEnd2End brig1 brig2 (userQualifiedId alice) (userQualifiedId bob) convId <- - fmap cnvQualifiedId . responseJsonError + fmap cnvQualifiedId + . responseJsonError =<< createConversation galley1 (userId alice) [userQualifiedId bob] - pure r (cs :: [Conversation]) <- (fmap crFound . responseJsonError) - =<< listConvs galley1 (userId alice) cids do @@ -406,7 +413,8 @@ testSendMessage brig1 brig2 galley2 cannon1 = do -- create alice user and client on domain 1 alice <- randomUser brig1 aliceClient <- - clientId . responseJsonUnsafe + clientId + . responseJsonUnsafe <$> addClient brig1 (userId alice) @@ -415,7 +423,8 @@ testSendMessage brig1 brig2 galley2 cannon1 = do -- create bob user and client on domain 2 bob <- randomUser brig2 bobClient <- - clientId . responseJsonUnsafe + clientId + . responseJsonUnsafe <$> addClient brig2 (userId bob) @@ -425,9 +434,10 @@ testSendMessage brig1 brig2 galley2 cannon1 = do -- create conversation on domain 2 convId <- - fmap (qUnqualified . cnvQualifiedId) . responseJsonError + fmap (qUnqualified . cnvQualifiedId) + . responseJsonError =<< createConversation galley2 (userId bob) [userQualifiedId alice] - do deleteUser (qUnqualified bobDel) (Just defPassword) brig2 !!! const 200 === statusCode @@ -586,14 +601,14 @@ claimRemoteKeyPackages brig1 brig2 = do . paths ["mls", "key-packages", "claim", toByteString' (qDomain bob), toByteString' (qUnqualified bob)] . zUser (qUnqualified alice) ) - (e.user, e.client)) bundle.entries - @?= Set.fromList [(bob, c) | c <- bobClients] + liftIO + $ Set.map (\e -> (e.user, e.client)) bundle.entries + @?= Set.fromList [(bob, c) | c <- bobClients] testRemoteTypingIndicator :: - HasCallStack => + (HasCallStack) => Brig -> Brig -> Galley -> @@ -610,7 +625,7 @@ testRemoteTypingIndicator brig1 brig2 galley1 galley2 cannon1 cannon2 = do cnv <- responseJsonError =<< createConversation galley1 (userId alice) [userQualifiedId bob] - UserId -> Qualified ConvId -> Http ResponseLBS getConvQualified g u (Qualified cnvId domain) = - get $ - g - . paths ["conversations", toByteString' domain, toByteString' cnvId] - . zUser u - . zConn "conn" - . header "Z-Type" "access" + get + $ g + . paths ["conversations", toByteString' domain, toByteString' cnvId] + . zUser u + . zConn "conn" + . header "Z-Type" "access" connectUsersEnd2End :: Brig -> Brig -> Qualified UserId -> Qualified UserId -> Http () connectUsersEnd2End brig1 brig2 quid1 quid2 = do @@ -117,7 +117,7 @@ connectUsersEnd2End brig1 brig2 quid1 quid2 = do putConnectionQualified brig2 (qUnqualified quid2) quid1 Accepted !!! const 200 === statusCode -sendCommitBundle :: HasCallStack => FilePath -> FilePath -> Maybe FilePath -> Galley -> UserId -> ClientId -> ByteString -> Http () +sendCommitBundle :: (HasCallStack) => FilePath -> FilePath -> Maybe FilePath -> Galley -> UserId -> ClientId -> ByteString -> Http () sendCommitBundle tmp subGroupStateFn welcomeFn galley uid cid commit = do subGroupStateRaw <- liftIO $ BS.readFile $ tmp subGroupStateFn subGroupState <- either (liftIO . assertFailure . T.unpack) pure . decodeMLS' $ subGroupStateRaw diff --git a/services/brig/test/integration/Index/Create.hs b/services/brig/test/integration/Index/Create.hs index 51961e9533d..c08e4a8390d 100644 --- a/services/brig/test/integration/Index/Create.hs +++ b/services/brig/test/integration/Index/Create.hs @@ -40,8 +40,8 @@ import URI.ByteString -- already exists, the existing mapping is not updated. spec :: BrigOpts.Opts -> IO TestTree spec brigOpts = - pure $ - testGroup + pure + $ testGroup "brig-index create" [ testCase "should create an index when it is not present" $ testCreateIndexWhenNotPresent brigOpts, testCase "should not update anything when index already exists" $ testCreateIndexWhenPresent brigOpts @@ -67,18 +67,22 @@ testCreateIndexWhenNotPresent brigOpts = do } let esSettings = IndexOpts.localElasticSettings - & IndexOpts.esConnection .~ connSettings - & IndexOpts.esIndexReplicas .~ ES.ReplicaCount replicas - & IndexOpts.esIndexShardCount .~ shards - & IndexOpts.esIndexRefreshInterval .~ refreshInterval + & IndexOpts.esConnection + .~ connSettings + & IndexOpts.esIndexReplicas + .~ ES.ReplicaCount replicas + & IndexOpts.esIndexShardCount + .~ shards + & IndexOpts.esIndexRefreshInterval + .~ refreshInterval devNullLogger <- Log.create (Log.Path "/dev/null") IndexEval.runCommand devNullLogger (IndexOpts.Create esSettings (galley brigOpts)) mgr <- liftIO $ initHttpManagerWithTLSConfig connSettings.esInsecureSkipVerifyTls connSettings.esCaCert let bEnv = (mkBHEnv esURL mgr) {ES.bhRequestHook = ES.basicAuthHook (ES.EsUsername "elastic") (ES.EsPassword "changeme")} ES.runBH bEnv $ do indexExists <- ES.indexExists indexName - lift $ - assertBool "Index should exist" indexExists + lift + $ assertBool "Index should exist" indexExists eitherIndexSettings <- ES.getIndexSettings indexName lift $ do case eitherIndexSettings of @@ -108,23 +112,27 @@ testCreateIndexWhenPresent brigOpts = do } esSettings = IndexOpts.localElasticSettings - & IndexOpts.esConnection .~ connSettings - & IndexOpts.esIndexReplicas .~ ES.ReplicaCount replicas - & IndexOpts.esIndexShardCount .~ shards - & IndexOpts.esIndexRefreshInterval .~ refreshInterval + & IndexOpts.esConnection + .~ connSettings + & IndexOpts.esIndexReplicas + .~ ES.ReplicaCount replicas + & IndexOpts.esIndexShardCount + .~ shards + & IndexOpts.esIndexRefreshInterval + .~ refreshInterval mgr <- liftIO $ initHttpManagerWithTLSConfig connSettings.esInsecureSkipVerifyTls connSettings.esCaCert let bEnv = (mkBHEnv esURL mgr) {ES.bhRequestHook = ES.basicAuthHook (ES.EsUsername "elastic") (ES.EsPassword "changeme")} ES.runBH bEnv $ do _ <- ES.createIndex (ES.IndexSettings (ES.ShardCount 1) (ES.ReplicaCount 1)) indexName indexExists <- ES.indexExists indexName - lift $ - assertBool "Index should exist" indexExists + lift + $ assertBool "Index should exist" indexExists devNullLogger <- Log.create (Log.Path "/dev/null") IndexEval.runCommand devNullLogger (IndexOpts.Create esSettings (galley brigOpts)) ES.runBH bEnv $ do indexExists <- ES.indexExists indexName - lift $ - assertBool "Index should still exist" indexExists + lift + $ assertBool "Index should still exist" indexExists eitherIndexSettings <- ES.getIndexSettings indexName lift $ do case eitherIndexSettings of diff --git a/services/brig/test/integration/Run.hs b/services/brig/test/integration/Run.hs index 1b3e0cd563d..a3326c1440f 100644 --- a/services/brig/test/integration/Run.hs +++ b/services/brig/test/integration/Run.hs @@ -79,12 +79,18 @@ data BackendConf = BackendConf instance FromJSON BackendConf where parseJSON = withObject "BackendConf" $ \o -> BackendConf - <$> o .: "brig" - <*> o .: "galley" - <*> o .: "cargohold" - <*> o .: "cannon" - <*> o .: "federatorInternal" - <*> o .: "federatorExternal" + <$> o + .: "brig" + <*> o + .: "galley" + <*> o + .: "cargohold" + <*> o + .: "cannon" + <*> o + .: "federatorInternal" + <*> o + .: "federatorExternal" data Config = Config -- internal endpoints @@ -150,7 +156,8 @@ runTests iConf brigOpts otherArgs = do let smtp = SMTP.tests mg lg oauthAPI = API.OAuth.tests mg db b n brigOpts - withArgs otherArgs . defaultMainWithIngredients (listingTests : (composeReporters antXMLRunner consoleTestReporter) : defaultIngredients) + withArgs otherArgs + . defaultMainWithIngredients (listingTests : (composeReporters antXMLRunner consoleTestReporter) : defaultIngredients) $ testGroup "Brig API Integration" $ [ userApi, diff --git a/services/brig/test/integration/SMTP.hs b/services/brig/test/integration/SMTP.hs index 6acc1288230..a79956d6e59 100644 --- a/services/brig/test/integration/SMTP.hs +++ b/services/brig/test/integration/SMTP.hs @@ -44,8 +44,8 @@ testSendMail lg = do liftIO . withRandomPortAndSocket $ \(port, sock) -> - withMailServer sock (mailStoringApp receivedMailRef) $ - do + withMailServer sock (mailStoringApp receivedMailRef) + $ do conPool <- initSMTP lg "localhost" (Just port) Nothing Plain sendMail lg conPool someTestMail mbMail <- @@ -76,8 +76,8 @@ testSendMailNoReceiver lg = do liftIO . withRandomPortAndSocket $ \(port, sock) -> - withMailServer sock (mailStoringApp receivedMailRef) $ - do + withMailServer sock (mailStoringApp receivedMailRef) + $ do traceIO "before initSMTP" conPool <- initSMTP lg "localhost" (Just port) Nothing Plain traceIO "finished initSMTP" @@ -92,8 +92,8 @@ testSendMailTransactionFailed lg = do liftIO . withRandomPortAndSocket $ \(port, sock) -> - withMailServer sock mailRejectingApp $ - do + withMailServer sock mailRejectingApp + $ do conPool <- initSMTP lg "localhost" (Just port) Nothing Plain caughtException <- handle @SomeException @@ -106,8 +106,8 @@ testSendMailFailingConnectionOnStartup lg = do (port, sock) <- liftIO $ openRandomPortAndSocket liftIO $ gracefulClose sock 1000 caughtError <- - liftIO $ - handle @ErrorCall + liftIO + $ handle @ErrorCall (const (pure True)) (initSMTP lg "localhost" (Just port) Nothing Plain >> pure False) liftIO $ caughtError @? "Expected error (SMTP server unreachable.)" @@ -116,16 +116,16 @@ testSendMailFailingConnectionOnSend :: Logger.Logger -> Bilge.Http () testSendMailFailingConnectionOnSend lg = do receivedMailRef <- liftIO $ newIORef Nothing conPool <- - liftIO $ - withRandomPortAndSocket $ - \(port, sock) -> - withMailServer - sock - (mailStoringApp receivedMailRef) - (initSMTP lg "localhost" (Just port) Nothing Plain) + liftIO + $ withRandomPortAndSocket + $ \(port, sock) -> + withMailServer + sock + (mailStoringApp receivedMailRef) + (initSMTP lg "localhost" (Just port) Nothing Plain) caughtException <- - liftIO $ - handle @SomeException + liftIO + $ handle @SomeException (const (pure True)) (sendMail lg conPool someTestMail >> pure False) liftIO $ caughtException @? "Expected exception (SMTP server unreachable.)" @@ -135,28 +135,28 @@ testSendMailFailingConnectionOnSend lg = do testSendMailTimeout :: Logger.Logger -> Bilge.Http () testSendMailTimeout lg = do mbException <- - liftIO $ - withRandomPortAndSocket $ - \(port, sock) -> - withMailServer sock (delayingApp (3 :: Second)) $ - do - conPool <- initSMTP lg "localhost" (Just port) Nothing Plain - handle @SMTPPoolException - (\e -> pure (Just e)) - (sendMail' (500 :: Millisecond) lg conPool someTestMail >> pure Nothing) + liftIO + $ withRandomPortAndSocket + $ \(port, sock) -> + withMailServer sock (delayingApp (3 :: Second)) + $ do + conPool <- initSMTP lg "localhost" (Just port) Nothing Plain + handle @SMTPPoolException + (\e -> pure (Just e)) + (sendMail' (500 :: Millisecond) lg conPool someTestMail >> pure Nothing) liftIO $ isJust mbException @? "Expected exception (SMTP server action timed out.)" liftIO $ mbException @?= Just SMTPConnectionTimeout testSendMailTimeoutOnStartup :: Logger.Logger -> Bilge.Http () testSendMailTimeoutOnStartup lg = do mbException <- - liftIO $ - withRandomPortAndSocket $ - \(port, sock) -> - everDelayingTCPServer sock $ - handle @ErrorCall - (\e -> pure (Just e)) - (initSMTP' (500 :: Millisecond) lg "localhost" (Just port) Nothing Plain >> pure Nothing) + liftIO + $ withRandomPortAndSocket + $ \(port, sock) -> + everDelayingTCPServer sock + $ handle @ErrorCall + (\e -> pure (Just e)) + (initSMTP' (500 :: Millisecond) lg "localhost" (Just port) Nothing Plain >> pure Nothing) liftIO $ isJust mbException @? "Expected exception (SMTP server action timed out.)" someTestReceiver :: Address @@ -224,13 +224,13 @@ delayingApp delay = $> Postie.Accepted ) -everDelayingTCPServer :: HasCallStack => Socket -> IO a -> IO a +everDelayingTCPServer :: (HasCallStack) => Socket -> IO a -> IO a everDelayingTCPServer sock action = listen sock 1024 >> action -withRandomPortAndSocket :: MonadIO m => ((PortNumber, Socket) -> IO a) -> m a +withRandomPortAndSocket :: (MonadIO m) => ((PortNumber, Socket) -> IO a) -> m a withRandomPortAndSocket action = - liftIO $ - bracket + liftIO + $ bracket (liftIO $ openRandomPortAndSocket) (\(_, s) -> liftIO $ close s) (\(p, s) -> action (p, s)) diff --git a/services/brig/test/integration/Util/AWS.hs b/services/brig/test/integration/Util/AWS.hs index b7cb46fb0f5..c06681ee3fe 100644 --- a/services/brig/test/integration/Util/AWS.hs +++ b/services/brig/test/integration/Util/AWS.hs @@ -58,8 +58,11 @@ assertUserActivateJournaled userJournalWatcher u label = where userActivateMatcher :: PU.UserEvent -> Bool userActivateMatcher ev = - ev ^. PU.eventType == PU.UserEvent'USER_ACTIVATE - && decodeIdFromBS (ev ^. PU.userId) == userId u + ev + ^. PU.eventType + == PU.UserEvent'USER_ACTIVATE + && decodeIdFromBS (ev ^. PU.userId) + == userId u -- | Check for user update event in journal queue. nameUpdateJournaled :: (HasCallStack, MonadIO m) => UserId -> Name -> String -> Maybe PU.UserEvent -> m () @@ -75,8 +78,11 @@ assertNameUpdateJournaled userJournalWatcher uid name label = userUpdateMatcher :: UserId -> PU.UserEvent -> Bool userUpdateMatcher uid ev = - ev ^. PU.eventType == PU.UserEvent'USER_UPDATE - && decodeIdFromBS (ev ^. PU.userId) == uid + ev + ^. PU.eventType + == PU.UserEvent'USER_UPDATE + && decodeIdFromBS (ev ^. PU.userId) + == uid userLocaleUpdateJournaled :: (HasCallStack, MonadIO m) => UserId -> Locale -> String -> Maybe PU.UserEvent -> m () userLocaleUpdateJournaled uid loc l (Just ev) = liftIO $ do @@ -113,13 +119,16 @@ assertDeleteJournaled userJournalWatcher uid label = userDeleteMatcher :: UserId -> PU.UserEvent -> Bool userDeleteMatcher uid ev = - ev ^. PU.eventType == PU.UserEvent'USER_DELETE - && decodeIdFromBS (ev ^. PU.userId) == uid + ev + ^. PU.eventType + == PU.UserEvent'USER_DELETE + && decodeIdFromBS (ev ^. PU.userId) + == uid assertEventType :: String -> PU.UserEvent'EventType -> PU.UserEvent -> IO () assertEventType l et ev = assertEqual (l <> "eventType") et (ev ^. PU.eventType) -assertUserId :: HasCallStack => String -> UserId -> PU.UserEvent -> IO () +assertUserId :: (HasCallStack) => String -> UserId -> PU.UserEvent -> IO () assertUserId l uid ev = assertEqual (l <> "userId") uid (decodeIdFromBS (ev ^. PU.userId)) assertTeamId :: String -> Maybe TeamId -> PU.UserEvent -> IO () diff --git a/services/brig/test/unit/Run.hs b/services/brig/test/unit/Run.hs index 64092fef3b5..0740def4dc1 100644 --- a/services/brig/test/unit/Run.hs +++ b/services/brig/test/unit/Run.hs @@ -31,8 +31,8 @@ import Test.Tasty main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Test.Brig.User.Search.Index.Types.tests, Test.Brig.Calling.tests, diff --git a/services/brig/test/unit/Test/Brig/Calling.hs b/services/brig/test/unit/Test/Brig/Calling.hs index 007a2041743..b25bae42ba3 100644 --- a/services/brig/test/unit/Test/Brig/Calling.hs +++ b/services/brig/test/unit/Test/Brig/Calling.hs @@ -64,9 +64,9 @@ newFakeDNSEnv :: (Domain -> SrvResponse) -> IO FakeDNSEnv newFakeDNSEnv lookupSrvFn = FakeDNSEnv lookupSrvFn <$> newIORef [] -runFakeDNSLookup :: Member (Embed IO) r => FakeDNSEnv -> Sem (DNSLookup ': r) a -> Sem r a -runFakeDNSLookup FakeDNSEnv {..} = interpret $ - \(LookupSRV domain) -> do +runFakeDNSLookup :: (Member (Embed IO) r) => FakeDNSEnv -> Sem (DNSLookup ': r) a -> Sem r a +runFakeDNSLookup FakeDNSEnv {..} = interpret + $ \(LookupSRV domain) -> do modifyIORef' fakeLookupSrvCalls (++ [domain]) pure $ fakeLookupSrv domain @@ -78,35 +78,35 @@ tests :: TestTree tests = testGroup "Calling" - [ testGroup "mkSFTDomain" $ - [ testCase "when service name is provided" $ - assertEqual - "should use the service name to form domain" - "_foo._tcp.example.com." - (mkSFTDomain (SFTOptions "example.com" (Just "foo") Nothing Nothing Nothing)), - testCase "when service name is not provided" $ - assertEqual - "should assume service name to be 'sft'" - "_sft._tcp.example.com." - (mkSFTDomain (SFTOptions "example.com" Nothing Nothing Nothing Nothing)) - ], - testGroup "sftDiscoveryLoop" $ - [ testCase "when service can be discovered" $ void testSFTDiscoveryLoopWhenSuccessful - ], - testGroup "srvDiscoveryLoop" $ - [ testCase "when service can be discovered" $ testSRVDiscoveryLoopWhenSuccessful, - testCase "when service cannot be discovered" $ testSRVDiscoveryLoopWhenUnsuccessful - ], - testGroup "discoverSRVRecords" $ - [ testCase "when service is available" testSRVDiscoverWhenAvailable, - testCase "when service is not available" testSRVDiscoverWhenNotAvailable, - testCase "when dns lookup fails" testSRVDiscoverWhenDNSFails - ], - testGroup "Get Random SFT Servers" $ - [ testCase "more servers in SRV than limit" testSFTManyServers, - testCase "fewer servers in SRV than limit" testSFTFewerServers - -- the randomization part is not (yet?) tested here. - ], + [ testGroup "mkSFTDomain" + $ [ testCase "when service name is provided" + $ assertEqual + "should use the service name to form domain" + "_foo._tcp.example.com." + (mkSFTDomain (SFTOptions "example.com" (Just "foo") Nothing Nothing Nothing)), + testCase "when service name is not provided" + $ assertEqual + "should assume service name to be 'sft'" + "_sft._tcp.example.com." + (mkSFTDomain (SFTOptions "example.com" Nothing Nothing Nothing Nothing)) + ], + testGroup "sftDiscoveryLoop" + $ [ testCase "when service can be discovered" $ void testSFTDiscoveryLoopWhenSuccessful + ], + testGroup "srvDiscoveryLoop" + $ [ testCase "when service can be discovered" $ testSRVDiscoveryLoopWhenSuccessful, + testCase "when service cannot be discovered" $ testSRVDiscoveryLoopWhenUnsuccessful + ], + testGroup "discoverSRVRecords" + $ [ testCase "when service is available" testSRVDiscoverWhenAvailable, + testCase "when service is not available" testSRVDiscoverWhenNotAvailable, + testCase "when dns lookup fails" testSRVDiscoverWhenDNSFails + ], + testGroup "Get Random SFT Servers" + $ [ testCase "more servers in SRV than limit" testSFTManyServers, + testCase "fewer servers in SRV than limit" testSFTFewerServers + -- the randomization part is not (yet?) tested here. + ], testGroup "SFT static URL" [ testCase "deprecated endpoint" testSFTStaticDeprecatedEndpoint, @@ -209,8 +209,10 @@ testSRVDiscoverWhenAvailable = do fakeDNSEnv <- newFakeDNSEnv (\_ -> SrvAvailable returnedEntries) assertEqual "discovered servers should be returned" (Just returnedEntries) - =<< ( runM . recordLogs logRecorder . runFakeDNSLookup fakeDNSEnv $ - discoverSRVRecords "_sft._tcp.foo.example.com" + =<< ( runM + . recordLogs logRecorder + . runFakeDNSLookup fakeDNSEnv + $ discoverSRVRecords "_sft._tcp.foo.example.com" ) assertEqual "nothing should be logged" [] =<< readIORef (recordedLogs logRecorder) @@ -221,8 +223,10 @@ testSRVDiscoverWhenNotAvailable = do fakeDNSEnv <- newFakeDNSEnv (const SrvNotAvailable) assertEqual "discovered servers should be returned" Nothing - =<< ( runM . recordLogs logRecorder . runFakeDNSLookup fakeDNSEnv $ - discoverSRVRecords "_sft._tcp.foo.example.com" + =<< ( runM + . recordLogs logRecorder + . runFakeDNSLookup fakeDNSEnv + $ discoverSRVRecords "_sft._tcp.foo.example.com" ) assertEqual "should warn about it in the logs" [(Warn, "SRV Records not available, domain=_sft._tcp.foo.example.com\n")] =<< readIORef (recordedLogs logRecorder) @@ -233,8 +237,10 @@ testSRVDiscoverWhenDNSFails = do fakeDNSEnv <- newFakeDNSEnv (const $ SrvResponseError IllegalDomain) assertEqual "no servers should be returned" Nothing - =<< ( runM . recordLogs logRecorder . runFakeDNSLookup fakeDNSEnv $ - discoverSRVRecords "_sft._tcp.foo.example.com" + =<< ( runM + . recordLogs logRecorder + . runFakeDNSLookup fakeDNSEnv + $ discoverSRVRecords "_sft._tcp.foo.example.com" ) assertEqual "should warn about it in the logs" [(Error, "SRV Lookup failed, Error=IllegalDomain, domain=_sft._tcp.foo.example.com\n")] =<< readIORef (recordedLogs logRecorder) diff --git a/services/brig/test/unit/Test/Brig/Calling/Internal.hs b/services/brig/test/unit/Test/Brig/Calling/Internal.hs index 1967f708268..77b6b70e456 100644 --- a/services/brig/test/unit/Test/Brig/Calling/Internal.hs +++ b/services/brig/test/unit/Test/Brig/Calling/Internal.hs @@ -30,19 +30,19 @@ import Wire.Network.DNS.SRV (SrvTarget (SrvTarget)) tests :: TestTree tests = - testGroup "Calling.API" $ - [ testGroup "sftServerFromSrvTarget" $ - [ testCase "when srvTarget ends with a dot" $ do - let Right expectedServer = sftServer <$> mkHttpsUrl [URI.uri|https://sft1.env.example.com:9364|] - assertEqual - "the dot should be stripped from sft server" - expectedServer - (sftServerFromSrvTarget $ SrvTarget "sft1.env.example.com." 9364), - testCase "when srvTarget doesn't end with a dot" $ do - let Right expectedServer = sftServer <$> mkHttpsUrl [URI.uri|https://sft2.env.example.com:443|] - assertEqual - "the dot should be stripped from sft server" - expectedServer - (sftServerFromSrvTarget $ SrvTarget "sft2.env.example.com" 443) - ] - ] + testGroup "Calling.API" + $ [ testGroup "sftServerFromSrvTarget" + $ [ testCase "when srvTarget ends with a dot" $ do + let Right expectedServer = sftServer <$> mkHttpsUrl [URI.uri|https://sft1.env.example.com:9364|] + assertEqual + "the dot should be stripped from sft server" + expectedServer + (sftServerFromSrvTarget $ SrvTarget "sft1.env.example.com." 9364), + testCase "when srvTarget doesn't end with a dot" $ do + let Right expectedServer = sftServer <$> mkHttpsUrl [URI.uri|https://sft2.env.example.com:443|] + assertEqual + "the dot should be stripped from sft server" + expectedServer + (sftServerFromSrvTarget $ SrvTarget "sft2.env.example.com" 443) + ] + ] diff --git a/services/brig/test/unit/Test/Brig/Effects/Delay.hs b/services/brig/test/unit/Test/Brig/Effects/Delay.hs index 55109f712e3..9b11ad5bfec 100644 --- a/services/brig/test/unit/Test/Brig/Effects/Delay.hs +++ b/services/brig/test/unit/Test/Brig/Effects/Delay.hs @@ -21,7 +21,7 @@ import Wire.Sem.Delay -- > delay 100 -- > takeMVar tick -- This blocks until doStuff is done -- > assertStuffDone -runDelayWithTick :: Member (Embed IO) r => MVar () -> TVar [Int] -> Sem (Delay ': r) a -> Sem r a +runDelayWithTick :: (Member (Embed IO) r) => MVar () -> TVar [Int] -> Sem (Delay ': r) a -> Sem r a runDelayWithTick tick calls = interpret $ \case Delay i -> do atomically $ modifyTVar calls (<> [i]) diff --git a/services/brig/test/unit/Test/Brig/MLS.hs b/services/brig/test/unit/Test/Brig/MLS.hs index 92e2b5eb526..8dcd5cdab98 100644 --- a/services/brig/test/unit/Test/Brig/MLS.hs +++ b/services/brig/test/unit/Test/Brig/MLS.hs @@ -60,14 +60,14 @@ tests = [ testGroup "Lifetime" [ testProperty "not_before in the future" $ \lt -> - isLeft $ - validateLifetime' + isLeft + $ validateLifetime' (secondsToNominalDiffTime (fromIntegral (timestampSeconds (ltNotBefore lt) - 86400))) Nothing lt, testProperty "not_after in the past" $ \lt -> - isLeft $ - validateLifetime' + isLeft + $ validateLifetime' (secondsToNominalDiffTime (fromIntegral (timestampSeconds (ltNotAfter lt) + 86400))) Nothing lt, diff --git a/services/brig/test/unit/Test/Brig/Roundtrip.hs b/services/brig/test/unit/Test/Brig/Roundtrip.hs index d878178bec8..87dbb48567d 100644 --- a/services/brig/test/unit/Test/Brig/Roundtrip.hs +++ b/services/brig/test/unit/Test/Brig/Roundtrip.hs @@ -27,9 +27,10 @@ import Type.Reflection (typeRep) tests :: T.TestTree tests = - T.localOption (T.Timeout (60 * 1000000) "60s") . T.testGroup "JSON roundtrip tests" $ - [ testRoundTrip @Options.AccountFeatureConfigs - ] + T.localOption (T.Timeout (60 * 1000000) "60s") + . T.testGroup "JSON roundtrip tests" + $ [ testRoundTrip @Options.AccountFeatureConfigs + ] testRoundTrip :: forall a. @@ -39,5 +40,6 @@ testRoundTrip = testProperty msg trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toJSON v) $ - Right v === (parseEither parseJSON . toJSON) v + counterexample (show $ toJSON v) + $ Right v + === (parseEither parseJSON . toJSON) v diff --git a/services/brig/test/unit/Test/Brig/User/Search/Index/Types.hs b/services/brig/test/unit/Test/Brig/User/Search/Index/Types.hs index 74c7b92c732..79934282b63 100644 --- a/services/brig/test/unit/Test/Brig/User/Search/Index/Types.hs +++ b/services/brig/test/unit/Test/Brig/User/Search/Index/Types.hs @@ -38,15 +38,15 @@ tests :: TestTree tests = testGroup "UserDoc, IndexUser: conversion, serialization" - [ testCase "aeson roundtrip: UserDoc" $ - assertEqual + [ testCase "aeson roundtrip: UserDoc" + $ assertEqual "failed" (eitherDecode' (encode userDoc1)) (Right userDoc1), - testCase "backwards comptibility test: UserDoc" $ - assertBool "failed" (isRight (eitherDecode' userDoc1ByteString :: Either String UserDoc)), - testCase "IndexUser to UserDoc" $ - assertEqual + testCase "backwards comptibility test: UserDoc" + $ assertBool "failed" (isRight (eitherDecode' userDoc1ByteString :: Either String UserDoc)), + testCase "IndexUser to UserDoc" + $ assertEqual "failed" (indexToDoc indexUser1) userDoc1 diff --git a/services/cannon/bench/Bench.hs b/services/cannon/bench/Bench.hs index 9d6c51b6224..1761c1f2fba 100644 --- a/services/cannon/bench/Bench.hs +++ b/services/cannon/bench/Bench.hs @@ -46,14 +46,14 @@ slices s n = do d <- D.empty s mapM_ wait =<< replicateM nthreads (async $ action d) x <- D.size d - unless (x == nthreads) $ - error (show x) + unless (x == nthreads) + $ error (show x) where action d = do uid <- toByteString <$> nextRandom dat <- toByteString <$> nextRandom - replicateM_ n $ - D.insert uid dat d + replicateM_ n + $ D.insert uid dat d tad <- D.lookup uid d - unless (Just dat == tad) $ - error "Ooops." + unless (Just dat == tad) + $ error "Ooops." diff --git a/services/cannon/src/Cannon/App.hs b/services/cannon/src/Cannon/App.hs index 83a6a86e44f..838b935425b 100644 --- a/services/cannon/src/Cannon/App.hs +++ b/services/cannon/src/Cannon/App.hs @@ -46,11 +46,11 @@ data State = State !Int !Timeout -- | The lifetime of a websocket. newtype TTL = TTL Word64 -counter :: Functor f => LensLike' f State Int +counter :: (Functor f) => LensLike' f State Int counter f (State c p) = (\x -> State x p) `fmap` f c {-# INLINE counter #-} -pingFreq :: Functor f => LensLike' f State Timeout +pingFreq :: (Functor f) => LensLike' f State Timeout pingFreq f (State c p) = (\x -> State c x) `fmap` f p {-# INLINE pingFreq #-} @@ -98,8 +98,9 @@ terminate :: Key -> Websocket -> WS () terminate k ws = do success <- unregisterLocal k ws debug $ client (key2bytes k) ~~ "websocket" .= connIdent ws ~~ "removed" .= success - when success $ - close k ws `catchAll` const (pure ()) + when success + $ close k ws + `catchAll` const (pure ()) writeLoop :: Websocket -> Clock -> TTL -> IORef State -> IO () writeLoop ws clock (TTL ttl) st = loop @@ -107,16 +108,16 @@ writeLoop ws clock (TTL ttl) st = loop loop = do s <- readIORef st if - | s ^. counter == 0 -> do - set counter st succ - threadDelay $ s ^. pingFreq - keepAlive - | s ^. counter < 3 -> do - set counter st succ - send (connection ws) ping - threadDelay $ (10 # Second) `min` (s ^. pingFreq) - keepAlive - | otherwise -> pure () + | s ^. counter == 0 -> do + set counter st succ + threadDelay $ s ^. pingFreq + keepAlive + | s ^. counter < 3 -> do + set counter st succ + send (connection ws) ping + threadDelay $ (10 # Second) `min` (s ^. pingFreq) + keepAlive + | otherwise -> pure () keepAlive = do time <- getTime clock unless (time > ttl) loop @@ -161,7 +162,7 @@ rejectOnError p x = do _ -> pure () throwM x -ioErrors :: MonadLogger m => Key -> [Handler m ()] +ioErrors :: (MonadLogger m) => Key -> [Handler m ()] ioErrors k = let f s = Logger.err $ client (key2bytes k) . msg s in [ Handler $ \(x :: HandshakeException) -> f (show x), diff --git a/services/cannon/src/Cannon/Dict.hs b/services/cannon/src/Cannon/Dict.hs index 066a91ccefe..6c00f83e5d6 100644 --- a/services/cannon/src/Cannon/Dict.hs +++ b/services/cannon/src/Cannon/Dict.hs @@ -39,13 +39,13 @@ newtype Dict a b = Dict { _map :: Vector (IORef (SizedHashMap a b)) } -size :: MonadIO m => Dict a b -> m Int +size :: (MonadIO m) => Dict a b -> m Int size d = liftIO $ sum <$> mapM (fmap SHM.size . readIORef) (_map d) -empty :: MonadIO m => Int -> m (Dict a b) +empty :: (MonadIO m) => Int -> m (Dict a b) empty w = - liftIO $ - if w > 0 && w < 8192 + liftIO + $ if w > 0 && w < 8192 then Dict <$> V.generateM w (const $ newIORef SHM.empty) else error "Dict.empty: slice number out of range [1, 8191]" @@ -70,7 +70,7 @@ removeIf f k d = liftIO . atomicModifyIORef' (getSlice k d) $ \m -> lookup :: (Hashable a, MonadIO m) => a -> Dict a b -> m (Maybe b) lookup k = liftIO . fmap (SHM.lookup k) . readIORef . getSlice k -toList :: MonadIO m => Dict a b -> m [(a, b)] +toList :: (MonadIO m) => Dict a b -> m [(a, b)] toList = fmap (mconcat . V.toList) . V.mapM (fmap SHM.toList . readIORef) @@ -80,11 +80,11 @@ toList = -- Internal mutDict :: - MonadIO m => + (MonadIO m) => (SizedHashMap a b -> SizedHashMap a b) -> IORef (SizedHashMap a b) -> m () mutDict f d = liftIO . atomicModifyIORef' d $ \m -> (f m, ()) -getSlice :: Hashable a => a -> Dict a b -> IORef (SizedHashMap a b) +getSlice :: (Hashable a) => a -> Dict a b -> IORef (SizedHashMap a b) getSlice k (Dict m) = m ! (hash k `mod` V.length m) diff --git a/services/cannon/src/Cannon/Run.hs b/services/cannon/src/Cannon/Run.hs index ba8256cb62b..0106ebb09f9 100644 --- a/services/cannon/src/Cannon/Run.hs +++ b/services/cannon/src/Cannon/Run.hs @@ -62,10 +62,10 @@ type CombinedAPI = CannonAPI :<|> Internal.API run :: Opts -> IO () run o = do - when (o ^. drainOpts . millisecondsBetweenBatches == 0) $ - error "drainOpts.millisecondsBetweenBatches must not be set to 0." - when (o ^. drainOpts . gracePeriodSeconds == 0) $ - error "drainOpts.gracePeriodSeconds must not be set to 0." + when (o ^. drainOpts . millisecondsBetweenBatches == 0) + $ error "drainOpts.millisecondsBetweenBatches must not be set to 0." + when (o ^. drainOpts . gracePeriodSeconds == 0) + $ error "drainOpts.gracePeriodSeconds must not be set to 0." ext <- loadExternal g <- L.mkLogger (o ^. logLevel) (o ^. logNetStrings) (o ^. logFormat) e <- @@ -140,16 +140,17 @@ refreshMetrics = do where safeForever :: (MonadIO m, LC.MonadLogger m, MonadCatch m) => m () -> m () safeForever action = - forever $ - action `catchAny` \exc -> do + forever + $ action + `catchAny` \exc -> do LC.err $ "error" LC..= show exc LC.~~ LC.msg (LC.val "refreshMetrics failed") liftIO $ threadDelay 60000000 -- pause to keep worst-case noise in logs manageable {-# NOINLINE websocketClientsGauge #-} websocketClientsGauge :: Prom.Gauge websocketClientsGauge = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "net.websocket.clients", Prom.metricHelp = "Number of connected websocket clients" diff --git a/services/cannon/src/Cannon/Types.hs b/services/cannon/src/Cannon/Types.hs index f9d34c5e788..87c2ec4a89a 100644 --- a/services/cannon/src/Cannon/Types.hs +++ b/services/cannon/src/Cannon/Types.hs @@ -81,10 +81,11 @@ newtype Cannon a = Cannon MonadMonitor ) -mapConcurrentlyCannon :: Traversable t => (a -> Cannon b) -> t a -> Cannon (t b) +mapConcurrentlyCannon :: (Traversable t) => (a -> Cannon b) -> t a -> Cannon (t b) mapConcurrentlyCannon action inputs = - Cannon $ - ask >>= \e -> + Cannon + $ ask + >>= \e -> liftIO $ mapConcurrently ((`runReaderT` e) . unCannon . action) inputs instance MonadLogger Cannon where @@ -106,8 +107,8 @@ mkEnv :: Clock -> Env mkEnv external o l d p g t = - Env o l d (RequestId "N/A") $ - WS.env external (o ^. cannon . port) (encodeUtf8 $ o ^. gundeck . host) (o ^. gundeck . port) l p d g t (o ^. drainOpts) + Env o l d (RequestId "N/A") + $ WS.env external (o ^. cannon . port) (encodeUtf8 $ o ^. gundeck . host) (o ^. gundeck . port) l p d g t (o ^. drainOpts) runCannon :: Env -> Cannon a -> Request -> IO a runCannon e c r = do diff --git a/services/cannon/src/Cannon/WS.hs b/services/cannon/src/Cannon/WS.hs index 6837457b636..cafb8aefd36 100644 --- a/services/cannon/src/Cannon/WS.hs +++ b/services/cannon/src/Cannon/WS.hs @@ -194,7 +194,7 @@ env :: Env env leh lp gh gp = Env leh lp (host gh . port gp $ empty) (RequestId "N/A") -runWS :: MonadIO m => Env -> WS a -> m a +runWS :: (MonadIO m) => Env -> WS a -> m a runWS e m = liftIO $ runReaderT (_conn m) e registerLocal :: Key -> Websocket -> WS () @@ -215,19 +215,19 @@ registerRemote k c = do debug $ client kb . msg (val "register-remote") e <- WS ask i <- regInfo k c - void $ - recovering retry3x rpcHandlers $ - const $ - rpc' "gundeck" (upstream e) (method POST . path "/i/presences" . i . expect2xx) + void + $ recovering retry3x rpcHandlers + $ const + $ rpc' "gundeck" (upstream e) (method POST . path "/i/presences" . i . expect2xx) debug $ client kb . msg (val "registered") isRemoteRegistered :: UserId -> ConnId -> WS Bool isRemoteRegistered u c = do e <- WS ask rs <- - recovering retry3x rpcHandlers $ - const $ - rpc' "gundeck" (upstream e) (method GET . paths ["/i/presences", toByteString' u] . expect2xx) + recovering retry3x rpcHandlers + $ const + $ rpc' "gundeck" (upstream e) (method GET . paths ["/i/presences", toByteString' u] . expect2xx) cs <- map connId <$> parseResponse (mkError status502 "server-error") rs pure $ c `elem` cs @@ -294,13 +294,13 @@ drain = do computedBatchSize = numberOfConns `div` maxNumberOfBatches batchSize = max (opts ^. minBatchSize) computedBatchSize conns <- D.toList websockets - info $ - msg (val "draining all websockets") - . field "numberOfConns" numberOfConns - . field "computedBatchSize" computedBatchSize - . field "minBatchSize" (opts ^. minBatchSize) - . field "batchSize" batchSize - . field "maxNumberOfBatches" maxNumberOfBatches + info + $ msg (val "draining all websockets") + . field "numberOfConns" numberOfConns + . field "computedBatchSize" computedBatchSize + . field "minBatchSize" (opts ^. minBatchSize) + . field "batchSize" batchSize + . field "maxNumberOfBatches" maxNumberOfBatches -- Sleeps for the grace period + 1 second. If the sleep completes, it means -- that draining didn't finish, and we should log that. @@ -329,12 +329,15 @@ regInfo k c = do let h = externalHostname e p = portnum e r = "http://" <> h <> ":" <> pack (show p) <> "/i/push/" - pure . lbytes . encode . object $ - [ "user_id" .= decodeUtf8 (keyUserBytes k), - "device_id" .= decodeUtf8 (keyConnBytes k), - "resource" .= decodeUtf8 (r <> keyUserBytes k <> "/" <> keyConnBytes k), - "client_id" .= c - ] + pure + . lbytes + . encode + . object + $ [ "user_id" .= decodeUtf8 (keyUserBytes k), + "device_id" .= decodeUtf8 (keyConnBytes k), + "resource" .= decodeUtf8 (r <> keyUserBytes k <> "/" <> keyConnBytes k), + "client_id" .= c + ] client :: ByteString -> Msg -> Msg client = field "client" diff --git a/services/cannon/test/Main.hs b/services/cannon/test/Main.hs index 8a75bb5aab3..3043970b8a7 100644 --- a/services/cannon/test/Main.hs +++ b/services/cannon/test/Main.hs @@ -27,11 +27,11 @@ import Wire.API.Routes.Internal.Cannon qualified as Internal main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" - [ testCase "sitemap" $ - assertEqual + [ testCase "sitemap" + $ assertEqual "inconcistent sitemap" mempty (pathsConsistencyCheck $ routesToPaths @Internal.API), diff --git a/services/cannon/test/Test/Cannon/Dict.hs b/services/cannon/test/Test/Cannon/Dict.hs index 114edea4a9b..42e18711648 100644 --- a/services/cannon/test/Test/Cannon/Dict.hs +++ b/services/cannon/test/Test/Cannon/Dict.hs @@ -97,8 +97,9 @@ insertLookup = do action d k = do v <- toByteString <$> nextRandom added <- D.add k v d - when added $ - replicateM_ 361 $ do + when added + $ replicateM_ 361 + $ do threadDelay 3571 x <- D.lookup k d Just v @=? x @@ -107,8 +108,13 @@ assertEq :: (Show a, Eq a, Monad m) => String -> a -> a -> PropertyM m () assertEq m a b | a == b = pure () | otherwise = - fail $ - "assertEq: " ++ m ++ ": " ++ show a ++ " =/= " ++ show b + fail + $ "assertEq: " + ++ m + ++ ": " + ++ show a + ++ " =/= " + ++ show b samples :: Int -> Gen a -> IO [a] samples n (MkGen f) = do diff --git a/services/cargohold/exec/Main.hs b/services/cargohold/exec/Main.hs index 83da6acc4fe..032fdd904e6 100644 --- a/services/cargohold/exec/Main.hs +++ b/services/cargohold/exec/Main.hs @@ -27,8 +27,9 @@ import Util.Options main :: IO () main = - withOpenSSL $ - getOptions desc Nothing defaultPath >>= run + withOpenSSL + $ getOptions desc Nothing defaultPath + >>= run where desc = "Cargohold - Asset Storage" defaultPath = "/etc/wire/cargohold/conf/cargohold.yaml" diff --git a/services/cargohold/src/CargoHold/API/Federation.hs b/services/cargohold/src/CargoHold/API/Federation.hs index f5cbf4b3f62..3f67b69f5ee 100644 --- a/services/cargohold/src/CargoHold/API/Federation.hs +++ b/services/cargohold/src/CargoHold/API/Federation.hs @@ -44,8 +44,9 @@ federationSitemap = checkAsset :: F.GetAsset -> Handler Bool checkAsset ga = - fmap isJust . runMaybeT $ - checkMetadata Nothing (F.key ga) (F.token ga) + fmap isJust + . runMaybeT + $ checkMetadata Nothing (F.key ga) (F.token ga) streamAsset :: Domain -> F.GetAsset -> Handler AssetSource streamAsset _ ga = do diff --git a/services/cargohold/src/CargoHold/API/Public.hs b/services/cargohold/src/CargoHold/API/Public.hs index 794e4ae0318..3291bc0aa17 100644 --- a/services/cargohold/src/CargoHold/API/Public.hs +++ b/services/cargohold/src/CargoHold/API/Public.hs @@ -60,11 +60,11 @@ servantSitemap = :<|> legacyAPI :<|> mainAPI where - userAPI :: forall tag. tag ~ 'UserPrincipalTag => ServerT (BaseAPIv3 tag) Handler + userAPI :: forall tag. (tag ~ 'UserPrincipalTag) => ServerT (BaseAPIv3 tag) Handler userAPI = uploadAssetV3 @tag :<|> downloadAssetV3 @tag :<|> deleteAssetV3 @tag - botAPI :: forall tag. tag ~ 'BotPrincipalTag => ServerT (BaseAPIv3 tag) Handler + botAPI :: forall tag. (tag ~ 'BotPrincipalTag) => ServerT (BaseAPIv3 tag) Handler botAPI = uploadAssetV3 @tag :<|> downloadAssetV3 @tag :<|> deleteAssetV3 @tag - providerAPI :: forall tag. tag ~ 'ProviderPrincipalTag => ServerT (BaseAPIv3 tag) Handler + providerAPI :: forall tag. (tag ~ 'ProviderPrincipalTag) => ServerT (BaseAPIv3 tag) Handler providerAPI = uploadAssetV3 @tag :<|> downloadAssetV3 @tag :<|> deleteAssetV3 @tag legacyAPI = legacyDownloadPlain :<|> legacyDownloadPlain :<|> legacyDownloadOtr qualifiedAPI :: ServerT QualifiedAPI Handler @@ -121,7 +121,7 @@ instance HasLocation 'ProviderPrincipalTag where assetKeyToText (tUnqualified key) ] -class HasLocation tag => MakePrincipal (tag :: PrincipalTag) (id :: Type) | id -> tag, tag -> id where +class (HasLocation tag) => MakePrincipal (tag :: PrincipalTag) (id :: Type) | id -> tag, tag -> id where mkPrincipal :: id -> V3.Principal instance MakePrincipal 'UserPrincipalTag (Local UserId) where @@ -135,7 +135,7 @@ instance MakePrincipal 'ProviderPrincipalTag ProviderId where mkAssetLocation :: forall (tag :: PrincipalTag). - HasLocation tag => + (HasLocation tag) => Local AssetKey -> AssetLocation Relative mkAssetLocation key = @@ -155,7 +155,7 @@ mkAssetLocation key = uploadAssetV3 :: forall tag id. - MakePrincipal tag id => + (MakePrincipal tag id) => id -> AssetSource -> Handler (Asset, AssetLocation Relative) @@ -174,7 +174,7 @@ uploadAssetV3 pid req = do pure (fmap tUntagged asset, mkAssetLocation @tag (asset ^. assetKey)) downloadAssetV3 :: - MakePrincipal tag id => + (MakePrincipal tag id) => id -> AssetKey -> Maybe AssetToken -> @@ -197,7 +197,8 @@ downloadAssetV4 usr qkey tok1 tok2 mbHostHeader = in foldQualified usr ( \lkey -> - LocalAsset . AssetLocation + LocalAsset + . AssetLocation <$$> V3.download (mkPrincipal usr) (tUnqualified lkey) tok mbHostHeader ) ( \rkey -> @@ -206,7 +207,7 @@ downloadAssetV4 usr qkey tok1 tok2 mbHostHeader = ) qkey -deleteAssetV3 :: MakePrincipal tag id => id -> AssetKey -> Handler () +deleteAssetV3 :: (MakePrincipal tag id) => id -> AssetKey -> Handler () deleteAssetV3 usr = V3.delete (mkPrincipal usr) deleteAssetV4 :: Local UserId -> Qualified AssetKey -> Handler () diff --git a/services/cargohold/src/CargoHold/API/V3.hs b/services/cargohold/src/CargoHold/API/V3.hs index 4b4c58f374a..dbecbddb182 100644 --- a/services/cargohold/src/CargoHold/API/V3.hs +++ b/services/cargohold/src/CargoHold/API/V3.hs @@ -68,11 +68,11 @@ upload own bdy = do (rsrc, sets) <- parseMetadata bdy assetSettings (src, hdrs) <- parseHeaders rsrc assetHeaders let cl = fromIntegral $ hdrLength hdrs - when (cl <= 0) $ - throwE invalidLength + when (cl <= 0) + $ throwE invalidLength maxBytes <- view (CargoHold.App.settings . maxTotalBytes) - when (cl > maxBytes) $ - throwE assetTooLarge + when (cl > maxBytes) + $ throwE assetTooLarge ast <- liftIO $ Id <$> nextRandom tok <- if sets ^. V3.setAssetPublic then pure Nothing else Just <$> randToken let ret = fromMaybe V3.AssetPersistent (sets ^. V3.setAssetRetention) @@ -83,10 +83,10 @@ upload own bdy = do expires <- case V3.assetRetentionSeconds ret of Just n -> Just . addUTCTime n <$> liftIO getCurrentTime Nothing -> pure Nothing - pure $! - V3.mkAsset key - & set V3.assetExpires expires - & set V3.assetToken tok + pure + $! V3.mkAsset key + & set V3.assetExpires expires + & set V3.assetToken tok renewToken :: V3.Principal -> V3.AssetKey -> Handler V3.AssetToken renewToken own key = do @@ -100,12 +100,12 @@ deleteToken own key = updateToken own key Nothing updateToken :: V3.Principal -> V3.AssetKey -> Maybe V3.AssetToken -> Handler () updateToken own key tok = do m <- S3.getMetadataV3 key >>= maybe (throwE assetNotFound) pure - unless (S3.v3AssetOwner m == own) $ - throwE unauthorised + unless (S3.v3AssetOwner m == own) + $ throwE unauthorised let m' = m {S3.v3AssetToken = tok} S3.updateMetadataV3 key m' -randToken :: MonadIO m => m V3.AssetToken +randToken :: (MonadIO m) => m V3.AssetToken randToken = liftIO $ V3.AssetToken . Ascii.encodeBase64Url <$> getRandomBytes 16 download :: V3.Principal -> V3.AssetKey -> Maybe V3.AssetToken -> Maybe Text -> Handler (Maybe URI) @@ -124,8 +124,8 @@ checkMetadata mown key tok = do delete :: V3.Principal -> V3.AssetKey -> Handler () delete own key = do m <- S3.getMetadataV3 key >>= maybe (throwE assetNotFound) pure - unless (S3.v3AssetOwner m == own) $ - throwE unauthorised + unless (S3.v3AssetOwner m == own) + $ throwE unauthorised S3.deleteV3 key ----------------------------------------------------------------------------- @@ -159,8 +159,8 @@ sinkParser p = fmapL mkError <$> Conduit.sinkParserEither p assetSettings :: Parser V3.AssetSettings assetSettings = do (ct, cl) <- metadataHeaders - unless (MIME.mimeType ct == MIME.Application "json") $ - fail "Invalid metadata Content-Type. Expected 'application/json'." + unless (MIME.mimeType ct == MIME.Application "json") + $ fail "Invalid metadata Content-Type. Expected 'application/json'." bs <- take (fromIntegral cl) either fail pure (eitherDecodeStrict' bs) diff --git a/services/cargohold/src/CargoHold/AWS.hs b/services/cargohold/src/CargoHold/AWS.hs index 38b8ecc260f..10bacfbc689 100644 --- a/services/cargohold/src/CargoHold/AWS.hs +++ b/services/cargohold/src/CargoHold/AWS.hs @@ -122,8 +122,8 @@ mkEnv lgr s3End s3AddrStyle s3Download bucket cfOpts mgr = do baseEnv <- AWS.newEnv AWS.discover <&> AWS.configureService s3 - pure $ - baseEnv + pure + $ baseEnv { AWS.logger = awsLogger g, AWS.manager = mgr } @@ -142,7 +142,7 @@ mkEnv lgr s3End s3AddrStyle s3Download bucket cfOpts mgr = do -- they are still revealed on debug level. mapLevel AWS.Error = Logger.Debug -execute :: MonadIO m => Env -> Amazon a -> m a +execute :: (MonadIO m) => Env -> Amazon a -> m a execute e m = liftIO $ runResourceT (runReaderT (unAmazon m) e) data Error where @@ -191,10 +191,10 @@ exec env request = do resp <- execute env (sendCatch (env ^. amazonkaEnv) req) case resp of Left err -> do - Logger.info (view logger env) $ - Log.field "remote" (Log.val "S3") - ~~ Log.msg (show err) - ~~ Log.msg (show req) + Logger.info (view logger env) + $ Log.field "remote" (Log.val "S3") + ~~ Log.msg (show err) + ~~ Log.msg (show req) -- We just re-throw the error, but logging it here also gives us the request -- that caused it. throwM (GeneralError err) @@ -214,10 +214,10 @@ execStream env request = do resp <- sendCatch (env ^. amazonkaEnv) req case resp of Left err -> do - Logger.info (view logger env) $ - Log.field "remote" (Log.val "S3") - ~~ Log.msg (show err) - ~~ Log.msg (show req) + Logger.info (view logger env) + $ Log.field "remote" (Log.val "S3") + ~~ Log.msg (show err) + ~~ Log.msg (show req) -- We just re-throw the error, but logging it here also gives us the request -- that caused it. throwM (GeneralError err) @@ -239,14 +239,14 @@ execCatch env request = do resp <- execute env (retrying retry5x (const canRetry) (const (sendCatch (env ^. amazonkaEnv) req))) case resp of Left err -> do - Log.info $ - Log.field "remote" (Log.val "S3") - ~~ Log.msg (show err) - ~~ Log.msg (show req) + Log.info + $ Log.field "remote" (Log.val "S3") + ~~ Log.msg (show err) + ~~ Log.msg (show req) pure Nothing Right r -> pure $ Just r -canRetry :: MonadIO m => Either AWS.Error a -> m Bool +canRetry :: (MonadIO m) => Either AWS.Error a -> m Bool canRetry (Right _) = pure False canRetry (Left e) = case e of AWS.TransportError (HttpExceptionRequest _ ResponseTimeout) -> pure True diff --git a/services/cargohold/src/CargoHold/App.hs b/services/cargohold/src/CargoHold/App.hs index 1f334acb8c2..6de76e89de4 100644 --- a/services/cargohold/src/CargoHold/App.hs +++ b/services/cargohold/src/CargoHold/App.hs @@ -182,8 +182,8 @@ initSSLContext = do SSL.contextAddOption ctx SSL_OP_NO_SSLv3 SSL.contextSetCiphers ctx "HIGH" SSL.contextSetDefaultVerifyPaths ctx - SSL.contextSetVerificationMode ctx $ - SSL.VerifyPeer True True Nothing + SSL.contextSetVerificationMode ctx + $ SSL.VerifyPeer True True Nothing pure ctx closeEnv :: Env -> IO () @@ -233,7 +233,7 @@ instance HasRequestId (ExceptT e App) where runAppT :: Env -> AppT m a -> m a runAppT e (AppT a) = runReaderT a e -runAppResourceT :: MonadIO m => Env -> ResourceT App a -> m a +runAppResourceT :: (MonadIO m) => Env -> ResourceT App a -> m a runAppResourceT e rma = liftIO . runResourceT $ transResourceT (runAppT e) rma executeBrigInteral :: BrigInternalClient a -> App (Either Servant.ClientError a) diff --git a/services/cargohold/src/CargoHold/CloudFront.hs b/services/cargohold/src/CargoHold/CloudFront.hs index 9b379e9bcc2..610a2694c81 100644 --- a/services/cargohold/src/CargoHold/CloudFront.hs +++ b/services/cargohold/src/CargoHold/CloudFront.hs @@ -56,10 +56,12 @@ data CloudFront = CloudFront _func :: ByteString -> IO ByteString } -initCloudFront :: MonadIO m => FilePath -> KeyPairId -> Word -> Domain -> m CloudFront +initCloudFront :: (MonadIO m) => FilePath -> KeyPairId -> Word -> Domain -> m CloudFront initCloudFront kfp kid ttl (Domain dom) = - liftIO $ - CloudFront baseUrl kid ttl <$> mkPOSIXClock <*> sha1Rsa kfp + liftIO + $ CloudFront baseUrl kid ttl + <$> mkPOSIXClock + <*> sha1Rsa kfp where baseUrl = URI @@ -74,8 +76,8 @@ signedURL :: (MonadIO m, ToByteString p) => CloudFront -> p -> m URI signedURL (CloudFront base kid ttl clock sign) path = liftIO $ do time <- (+ ttl) . round <$> clock sig <- sign (toStrict (toLazyByteString (policy url time))) - pure $! - url + pure + $! url { uriQuery = Query [ ("Expires", toByteString' time), @@ -104,9 +106,9 @@ signedURL (CloudFront base kid ttl clock sign) path = liftIO $ do sha1Rsa :: FilePath -> IO (ByteString -> IO ByteString) sha1Rsa fp = do sha1 <- - liftIO $ - getDigestByName "SHA1" - >>= maybe (error "OpenSSL: SHA1 not found") pure + liftIO + $ getDigestByName "SHA1" + >>= maybe (error "OpenSSL: SHA1 not found") pure kbs <- readFile fp key <- readPrivateKey kbs PwNone pure (SSL.signBS sha1 key) diff --git a/services/cargohold/src/CargoHold/Federation.hs b/services/cargohold/src/CargoHold/Federation.hs index 7ce7d4aae6b..abf47bd937c 100644 --- a/services/cargohold/src/CargoHold/Federation.hs +++ b/services/cargohold/src/CargoHold/Federation.hs @@ -61,8 +61,9 @@ downloadRemoteAsset usr rkey tok = do token = tok } exists <- - fmap available . executeFederated rkey $ - fedClient @'Cargohold @"get-asset" ga + fmap available + . executeFederated rkey + $ fedClient @'Cargohold @"get-asset" ga if exists then Just @@ -111,8 +112,9 @@ executeFederatedStreaming remote c = do -- sees at least one chunk, so by throwing the exception in IO and having a -- catch middleware in place, we make sure that the correct error response -- ends up being generated. - pure $ - SourceT $ \k -> + pure + $ SourceT + $ \k -> runCodensity (runFederatorClientToCodensity @'Cargohold env c) (either (throw . federationErrorToWai . FederationCallFailure) (flip unSourceT k)) diff --git a/services/cargohold/src/CargoHold/Metrics.hs b/services/cargohold/src/CargoHold/Metrics.hs index 34d0c08fca4..91e7cd17889 100644 --- a/services/cargohold/src/CargoHold/Metrics.hs +++ b/services/cargohold/src/CargoHold/Metrics.hs @@ -20,14 +20,14 @@ module CargoHold.Metrics where import Imports import qualified Prometheus as Prom -s3UploadOk :: Prom.MonadMonitor m => m () +s3UploadOk :: (Prom.MonadMonitor m) => m () s3UploadOk = Prom.incCounter netS3UploadOk {-# NOINLINE netS3UploadOk #-} netS3UploadOk :: Prom.Counter netS3UploadOk = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "net.s3.upload_ok", Prom.metricHelp = "Number of successful S3 Uploads" @@ -40,8 +40,8 @@ s3UploadSize n = {-# NOINLINE netS3UploadSize #-} netS3UploadSize :: Prom.Counter netS3UploadSize = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "net.s3.upload_size", Prom.metricHelp = "Number of bytes uploaded successfully uploaded to S3" diff --git a/services/cargohold/src/CargoHold/Options.hs b/services/cargohold/src/CargoHold/Options.hs index 7a3f5cd08fa..2f35418fa7e 100644 --- a/services/cargohold/src/CargoHold/Options.hs +++ b/services/cargohold/src/CargoHold/Options.hs @@ -54,8 +54,9 @@ newtype OptS3AddressingStyle = OptS3AddressingStyle instance FromJSON OptS3AddressingStyle where parseJSON = - withText "S3AddressingStyle" $ - fmap OptS3AddressingStyle . \case + withText "S3AddressingStyle" + $ fmap OptS3AddressingStyle + . \case "auto" -> pure S3AddressingStyleAuto "path" -> pure S3AddressingStylePath "virtual" -> pure S3AddressingStyleVirtual diff --git a/services/cargohold/src/CargoHold/Run.hs b/services/cargohold/src/CargoHold/Run.hs index 6106a4c68e9..bdbb317782a 100644 --- a/services/cargohold/src/CargoHold/Run.hs +++ b/services/cargohold/src/CargoHold/Run.hs @@ -61,8 +61,8 @@ run o = lowerCodensity $ do void $ Codensity $ Async.withAsync (collectAuthMetrics (e ^. aws . amazonkaEnv)) liftIO $ do s <- - Server.newSettings $ - defaultServer + Server.newSettings + $ defaultServer (unpack $ o ^. cargohold . host) (o ^. cargohold . port) (e ^. appLogger) @@ -97,10 +97,11 @@ mkApp o = Codensity $ \k -> toServantHandler :: Env -> Handler a -> Servant.Handler a toServantHandler env = liftIO . runHandler env -collectAuthMetrics :: MonadIO m => AWS.Env -> m () +collectAuthMetrics :: (MonadIO m) => AWS.Env -> m () collectAuthMetrics env = do - liftIO $ - forever $ do + liftIO + $ forever + $ do mbRemaining <- readAuthExpiration env gaugeTokenRemaing mbRemaining threadDelay 1_000_000 diff --git a/services/cargohold/src/CargoHold/S3.hs b/services/cargohold/src/CargoHold/S3.hs index 181b2f9255c..023c5e84b5c 100644 --- a/services/cargohold/src/CargoHold/S3.hs +++ b/services/cargohold/src/CargoHold/S3.hs @@ -100,14 +100,15 @@ uploadV3 :: ConduitM () ByteString (ResourceT IO) () -> ExceptT Error App () uploadV3 prc (s3Key . mkKey -> key) originalHeaders@(V3.AssetHeaders _ cl) tok src = do - Log.info $ - "remote" .= val "S3" - ~~ "asset.owner" .= toByteString prc - ~~ "asset.key" .= key - ~~ "asset.type_from_request_ignored" .= MIME.showType (V3.hdrType originalHeaders) - ~~ "asset.type" .= MIME.showType ct - ~~ "asset.size" .= cl - ~~ msg (val "Uploading asset") + Log.info + $ "remote" + .= val "S3" + ~~ "asset.owner" .= toByteString prc + ~~ "asset.key" .= key + ~~ "asset.type_from_request_ignored" .= MIME.showType (V3.hdrType originalHeaders) + ~~ "asset.type" .= MIME.showType ct + ~~ "asset.size" .= cl + ~~ msg (val "Uploading asset") void $ exec req where ct :: MIME.Type @@ -154,11 +155,12 @@ downloadV3 (s3Key . mkKey -> key) = do getMetadataV3 :: V3.AssetKey -> ExceptT Error App (Maybe S3AssetMeta) getMetadataV3 (s3Key . mkKey -> key) = do - Log.debug $ - "remote" .= val "S3" - ~~ "asset.key" .= key - ~~ msg - (val "Getting asset metadata") + Log.debug + $ "remote" + .= val "S3" + ~~ "asset.key" .= key + ~~ msg + (val "Getting asset metadata") maybe (pure Nothing) handle =<< execCatch req where req b = newHeadObject (BucketName b) (ObjectKey key) @@ -174,33 +176,38 @@ getMetadataV3 (s3Key . mkKey -> key) = do deleteV3 :: V3.AssetKey -> ExceptT Error App () deleteV3 (s3Key . mkKey -> key) = do - Log.debug $ - "remote" .= val "S3" - ~~ "asset.key" .= key - ~~ msg (val "Deleting asset") - Log.debug $ - "remote" .= val "S3" - ~~ "asset.key" .= key - ~~ msg (val "Deleting asset") + Log.debug + $ "remote" + .= val "S3" + ~~ "asset.key" .= key + ~~ msg (val "Deleting asset") + Log.debug + $ "remote" + .= val "S3" + ~~ "asset.key" .= key + ~~ msg (val "Deleting asset") void $ exec req where req b = newDeleteObject (BucketName b) (ObjectKey key) updateMetadataV3 :: V3.AssetKey -> S3AssetMeta -> ExceptT Error App () updateMetadataV3 (s3Key . mkKey -> key) (S3AssetMeta prc tok _) = do - Log.debug $ - "remote" .= val "S3" - ~~ "asset.owner" .= show prc - ~~ "asset.key" .= key - ~~ msg (val "Updating asset metadata") + Log.debug + $ "remote" + .= val "S3" + ~~ "asset.owner" .= show prc + ~~ "asset.key" .= key + ~~ msg (val "Updating asset metadata") void $ exec req where ct :: MIME.Type ct = octets -- See note on overrideMimeTypeAsOctetStream copySrc b = - decodeLatin1 . LBS.toStrict . toLazyByteString $ - urlEncode [] $ - Text.encodeUtf8 (b <> "/" <> key) + decodeLatin1 + . LBS.toStrict + . toLazyByteString + $ urlEncode [] + $ Text.encodeUtf8 (b <> "/" <> key) req b = newCopyObject (BucketName b) (copySrc b) (ObjectKey key) & copyObject_contentType ?~ MIME.showType ct @@ -226,10 +233,11 @@ signedURL path mbHost = do where toUri x = case parseURI strictURIParserOptions x of Left e -> do - Log.err $ - "remote" .= val "S3" - ~~ "error" .= show e - ~~ msg (val "Failed to generate a signed URI") + Log.err + $ "remote" + .= val "S3" + ~~ "error" .= show e + ~~ msg (val "Failed to generate a signed URI") throwE serverError Right u -> pure u @@ -242,28 +250,28 @@ signedURL path mbHost = do where awsEnvForHost' :: Maybe Text -> Map String AWS.Env -> ExceptT Error App AWS.Env awsEnvForHost' Nothing _ = do - Log.debug $ - msg (val "awsEnvForHost - multiIngress configured, but no Z-Host header provided.") + Log.debug + $ msg (val "awsEnvForHost - multiIngress configured, but no Z-Host header provided.") throwE noMatchingAssetEndpoint awsEnvForHost' (Just host) multiIngressConf = do - Log.debug $ - "host" - .= host - ~~ msg (val "awsEnvForHost - Looking up multiIngress config.") + Log.debug + $ "host" + .= host + ~~ msg (val "awsEnvForHost - Looking up multiIngress config.") case multiIngressConf ^. at (Text.unpack host) of Nothing -> do - Log.debug $ - "host" - .= host - ~~ msg (val "awsEnvForHost - multiIngress lookup failed, no config for provided Z-Host header.") + Log.debug + $ "host" + .= host + ~~ msg (val "awsEnvForHost - multiIngress lookup failed, no config for provided Z-Host header.") throwE noMatchingAssetEndpoint Just hostAwsEnv -> do - Log.debug $ - "host" - .= host - ~~ "s3DownloadEndpoint" - .= show (hostAwsEnv ^. AWS.amazonkaDownloadEndpoint) - ~~ msg (val "awsEnvForHost - multiIngress lookup succeed, using specific AWS env.") + Log.debug + $ "host" + .= host + ~~ "s3DownloadEndpoint" + .= show (hostAwsEnv ^. AWS.amazonkaDownloadEndpoint) + ~~ msg (val "awsEnvForHost - multiIngress lookup succeed, using specific AWS env.") pure hostAwsEnv mkKey :: V3.AssetKey -> S3AssetKey @@ -274,8 +282,8 @@ mkKey (V3.AssetKeyV3 i r) = S3AssetKey $ "v3/" <> retention <> "/" <> key metaHeaders :: Maybe V3.AssetToken -> V3.Principal -> HML.HashMap Text Text metaHeaders tok prc = - HML.fromList $ - catMaybes + HML.fromList + $ catMaybes [ setAmzMetaToken <$> tok, Just (setAmzMetaPrincipal prc) ] @@ -338,10 +346,11 @@ getAmzMetaProvider = parseAmzMeta hAmzMetaProvider getAmzMetaToken :: [(Text, Text)] -> Maybe V3.AssetToken getAmzMetaToken h = - V3.AssetToken . Ascii.unsafeFromText + V3.AssetToken + . Ascii.unsafeFromText <$> lookupCI hAmzMetaToken h -parseAmzMeta :: FromByteString a => Text -> [(Text, Text)] -> Maybe a +parseAmzMeta :: (FromByteString a) => Text -> [(Text, Text)] -> Maybe a parseAmzMeta k h = lookupCI k h >>= fromByteString . encodeUtf8 ------------------------------------------------------------------------------- diff --git a/services/cargohold/test/integration/API.hs b/services/cargohold/test/integration/API.hs index 4c9f8b65b4c..12d3bc5168b 100644 --- a/services/cargohold/test/integration/API.hs +++ b/services/cargohold/test/integration/API.hs @@ -67,7 +67,8 @@ testRemoteDownloadFederationFailure = do (resp, _) <- withMockFederator respond $ do responseJsonError - =<< downloadAsset uid qkey () Maybe MIME.Type getContentType = MIME.parseContentType . decodeLatin1 . getHeader' "Content-Type" @@ -142,14 +142,14 @@ deleteAssetV3 u k = do deleteAsset :: UserId -> Qualified AssetKey -> TestM (Response (Maybe Lazy.ByteString)) deleteAsset u k = do c <- viewCargohold - delete $ - c - . zUser u - . paths - [ "assets", - toByteString' (qDomain k), - toByteString' (qUnqualified k) - ] + delete + $ c + . zUser u + . paths + [ "assets", + toByteString' (qDomain k), + toByteString' (qUnqualified k) + ] class IsAssetLocation key where locationPath :: key -> Request -> Request @@ -188,13 +188,13 @@ downloadAssetWith :: TestM (Response (Maybe LByteString)) downloadAssetWith r uid loc tok = do c <- viewUnversionedCargohold - get $ - c - . r - . zUser uid - . locationPath loc - . tokenParam tok - . noRedirect + get + $ c + . r + . zUser uid + . locationPath loc + . tokenParam tok + . noRedirect downloadAsset :: (IsAssetLocation loc, IsAssetToken tok) => diff --git a/services/cargohold/test/integration/App.hs b/services/cargohold/test/integration/App.hs index b5ba0132d88..22912a35e66 100644 --- a/services/cargohold/test/integration/App.hs +++ b/services/cargohold/test/integration/App.hs @@ -34,12 +34,12 @@ testMultiIngressCloudFrontFails = do & (Opts.aws . Opts.cloudFront) ?~ cloudFrontOptions & (Opts.aws . Opts.multiIngress) ?~ multiIngressMap msg <- - liftIO $ - catch + liftIO + $ catch (newEnv opts >> pure "No exception") (\(SomeException e) -> pure $ displayException e) - liftIO $ - assertBool + liftIO + $ assertBool "Check error message" (containsString "Invalid configuration: multiIngress and cloudFront cannot be combined!" msg) where @@ -68,12 +68,12 @@ testMultiIngressS3DownloadEndpointFails = do & (Opts.aws . Opts.s3DownloadEndpoint) ?~ toAWSEndpoint "http://fake-s3:4570" & (Opts.aws . Opts.multiIngress) ?~ multiIngressMap msg <- - liftIO $ - catch + liftIO + $ catch (newEnv opts >> pure "No exception") (\(SomeException e) -> pure $ displayException e) - liftIO $ - assertBool + liftIO + $ assertBool "Check error message" (containsString "Invalid configuration: multiIngress and s3DownloadEndpoint cannot be combined!" msg) diff --git a/services/cargohold/test/integration/Main.hs b/services/cargohold/test/integration/Main.hs index f5997aebda0..007d1bc05a8 100644 --- a/services/cargohold/test/integration/Main.hs +++ b/services/cargohold/test/integration/Main.hs @@ -43,17 +43,18 @@ instance IsOption ServiceConfigFile where optionName = pure "service-config" optionHelp = pure "Service config file to read from" optionCLParser = - fmap ServiceConfigFile $ - strOption $ - ( short (untag (pure 's' :: Tagged ServiceConfigFile Char)) + fmap ServiceConfigFile + $ strOption + $ ( short (untag (pure 's' :: Tagged ServiceConfigFile Char)) <> long (untag (optionName :: Tagged ServiceConfigFile String)) <> help (untag (optionHelp :: Tagged ServiceConfigFile String)) ) main :: IO () main = do - defaultMainWithIngredients ings $ - askOption $ \(IntegrationConfigFile configPath) -> + defaultMainWithIngredients ings + $ askOption + $ \(IntegrationConfigFile configPath) -> askOption $ \(ServiceConfigFile optsPath) -> -- we treat the configuration file as a tasty "resource", so that we can -- read it once before all tests diff --git a/services/federator/src/Federator/ExternalServer.hs b/services/federator/src/Federator/ExternalServer.hs index 238fc493c35..6e723e22d0a 100644 --- a/services/federator/src/Federator/ExternalServer.hs +++ b/services/federator/src/Federator/ExternalServer.hs @@ -138,18 +138,18 @@ callInward :: callInward component (RPC rpc) originDomain (CertHeader cert) wreq cont = do incomingCounterIncr originDomain -- only POST is supported - when (Wai.requestMethod wreq /= HTTP.methodPost) $ - throw InvalidRoute + when (Wai.requestMethod wreq /= HTTP.methodPost) + $ throw InvalidRoute -- No query parameters are allowed - unless (BS.null . Wai.rawQueryString $ wreq) $ - throw InvalidRoute + unless (BS.null . Wai.rawQueryString $ wreq) + $ throw InvalidRoute ensureCanFederateWith originDomain - Log.debug $ - Log.msg ("Inward Request" :: ByteString) - . Log.field "originDomain" (domainText originDomain) - . Log.field "component" (show component) - . Log.field "rpc" rpc + Log.debug + $ Log.msg ("Inward Request" :: ByteString) + . Log.field "originDomain" (domainText originDomain) + . Log.field "component" (show component) + . Log.field "rpc" rpc validatedDomain <- validateDomain cert originDomain @@ -158,11 +158,12 @@ callInward component (RPC rpc) originDomain (CertHeader cert) wreq cont = do body <- embed $ Wai.lazyRequestBody wreq let headers = filter ((== versionHeader) . fst) (Wai.requestHeaders wreq) resp <- serviceCall component path headers body validatedDomain - Log.debug $ - Log.msg ("Inward Request response" :: ByteString) - . Log.field "status" (show (responseStatusCode resp)) - embed . cont $ - streamingResponseToWai + Log.debug + $ Log.msg ("Inward Request response" :: ByteString) + . Log.field "status" (show (responseStatusCode resp)) + embed + . cont + $ streamingResponseToWai resp { responseHeaders = Seq.filter diff --git a/services/federator/src/Federator/InternalServer.hs b/services/federator/src/Federator/InternalServer.hs index e7caef5fd45..a17edd2d56f 100644 --- a/services/federator/src/Federator/InternalServer.hs +++ b/services/federator/src/Federator/InternalServer.hs @@ -107,20 +107,20 @@ callOutward :: Sem r Wai.ResponseReceived callOutward targetDomain component (RPC path) req cont = do -- only POST is supported - when (Wai.requestMethod req /= HTTP.methodPost) $ - throw InvalidRoute + when (Wai.requestMethod req /= HTTP.methodPost) + $ throw InvalidRoute -- No query parameters are allowed - unless (BS.null . Wai.rawQueryString $ req) $ - throw InvalidRoute + unless (BS.null . Wai.rawQueryString $ req) + $ throw InvalidRoute ensureCanFederateWith targetDomain outgoingCounterIncr targetDomain body <- embed $ Wai.lazyRequestBody req - debug $ - Log.msg (Log.val "Federator outward call") - . Log.field "domain" targetDomain._domainText - . Log.field "component" (show component) - . Log.field "path" path - . Log.field "body" body + debug + $ Log.msg (Log.val "Federator outward call") + . Log.field "domain" targetDomain._domainText + . Log.field "component" (show component) + . Log.field "path" path + . Log.field "body" body resp <- discoverAndCall targetDomain diff --git a/services/federator/src/Federator/MockServer.hs b/services/federator/src/Federator/MockServer.hs index a5dd6ae38e1..d7706119998 100644 --- a/services/federator/src/Federator/MockServer.hs +++ b/services/federator/src/Federator/MockServer.hs @@ -234,7 +234,7 @@ getRequestRPC :: Mock Text getRequestRPC = frRPC <$> getRequest -- | Retrieve and deserialise the body of the current request. -getRequestBody :: Aeson.FromJSON a => Mock a +getRequestBody :: (Aeson.FromJSON a) => Mock a getRequestBody = do b <- frBody <$> getRequest case Aeson.eitherDecode b of @@ -257,7 +257,7 @@ guardComponent c = do guard (c == c') -- | Serialise and return a response. -mockReply :: Aeson.ToJSON a => a -> Mock LByteString +mockReply :: (Aeson.ToJSON a) => a -> Mock LByteString mockReply = pure . Aeson.encode -- | Provide a mock reply simulating an unreachable backend. @@ -275,5 +275,5 @@ infixl 5 ~> -- | Expect a given RPC and simply return a pure response when the current -- request matches. -(~>) :: Aeson.ToJSON a => Text -> a -> Mock LByteString +(~>) :: (Aeson.ToJSON a) => Text -> a -> Mock LByteString (~>) rpc x = guardRPC rpc *> mockReply x diff --git a/services/federator/src/Federator/Monitor/Internal.hs b/services/federator/src/Federator/Monitor/Internal.hs index d731858cacc..6cbadfc5f16 100644 --- a/services/federator/src/Federator/Monitor/Internal.hs +++ b/services/federator/src/Federator/Monitor/Internal.hs @@ -115,7 +115,7 @@ delMonitor monitor = Polysemy.resourceToIOFinal $ Polysemy.bracket (takeMVar (monLock monitor)) (putMVar (monLock monitor)) - . const + . const $ do watches <- readIORef (monWatches monitor) traverse_ stop watches @@ -123,9 +123,9 @@ delMonitor monitor = Polysemy.resourceToIOFinal stop (wd, _) = do -- ignore exceptions when removing watches embed . void . try @IOException $ removeWatch wd - Log.trace $ - Log.msg ("stopped watching file" :: Text) - . Log.field "descriptor" (show wd) + Log.trace + $ Log.msg ("stopped watching file" :: Text) + . Log.field "descriptor" (show wd) mkMonitor :: ( Member TinyLog r, @@ -140,9 +140,9 @@ mkMonitor :: Sem r Monitor mkMonitor runSem onNewContext rs = do inotify <- embed initINotify - Log.trace $ - Log.msg ("inotify initialized" :: Text) - . Log.field "inotify" (show inotify) + Log.trace + $ Log.msg ("inotify initialized" :: Text) + . Log.field "inotify" (show inotify) lock <- embed @IO $ newMVar () watchesVar <- embed @IO $ newIORef mempty @@ -179,9 +179,11 @@ handleEvent runSem monitor wpath e = do -- only use runSem when there are some actions -- this makes it possible to use a special runSem in the tests that is able -- to detect when some action has taken place - unless (null actions) $ + unless (null actions) + $ -- we take the lock here, so that handlers never execute concurrently - withMVar (monLock monitor) $ \_ -> + withMVar (monLock monitor) + $ \_ -> runSem $ traverse_ (applyAction monitor) actions -- Note: it is important that the watch is replaced *before* settings are @@ -229,8 +231,9 @@ addWatchedFile :: Sem r () addWatchedFile monitor wpath = do r <- - embed . try @SomeException $ - addWatchAndSave + embed + . try @SomeException + $ addWatchAndSave (monINotify monitor) (watchPathEvents wpath) (monWatches monitor) @@ -239,15 +242,15 @@ addWatchedFile monitor wpath = do let pathText = Text.decodeUtf8With Text.lenientDecode (watchedPath wpath) case r of Right w -> - Log.trace $ - Log.msg ("watching file" :: Text) - . Log.field "descriptor" (show w) - . Log.field "path" pathText + Log.trace + $ Log.msg ("watching file" :: Text) + . Log.field "descriptor" (show w) + . Log.field "path" pathText Left e -> do - Log.err $ - Log.msg ("error while try to add file watch" :: Text) - . Log.field "path" pathText - . Log.field "error" (displayException e) + Log.err + $ Log.msg ("error while try to add file watch" :: Text) + . Log.field "path" pathText + . Log.field "error" (displayException e) addWatchAndSave :: INotify -> @@ -262,8 +265,9 @@ addWatchAndSave inotify events watchesVar wpath handler = do w' <- addWatch inotify events path handler -- atomically save it in the map, and return the old one mw <- - atomicModifyIORef watchesVar $ - swap . Map.alterF (,Just (w', wpath)) path + atomicModifyIORef watchesVar + $ swap + . Map.alterF (,Just (w', wpath)) path -- remove the old watch case mw of Nothing -> pure () @@ -290,8 +294,9 @@ resolveSymlink path' = do if isSymbolicLink status then do target <- readSymbolicLink path - pure . Just $ - if isRelative target + pure + . Just + $ if isRelative target then takeDirectory path target else target else pure Nothing @@ -343,11 +348,11 @@ mkSSLContext :: mkSSLContext settings = do ctx <- mkSSLContextWithoutCert settings - Polysemy.fromExceptionVia @SomeException (InvalidClientCertificate . displayException) $ - SSL.contextSetCertificateChainFile ctx (clientCertificate settings) + Polysemy.fromExceptionVia @SomeException (InvalidClientCertificate . displayException) + $ SSL.contextSetCertificateChainFile ctx (clientCertificate settings) - Polysemy.fromExceptionVia @SomeException (InvalidClientPrivateKey . displayException) $ - SSL.contextSetPrivateKeyFile ctx (clientPrivateKey settings) + Polysemy.fromExceptionVia @SomeException (InvalidClientPrivateKey . displayException) + $ SSL.contextSetPrivateKeyFile ctx (clientPrivateKey settings) privateKeyCheck <- Polysemy.fromExceptionVia @SSL.SomeSSLException SSLException $ SSL.contextCheckPrivateKey ctx unless privateKeyCheck $ do @@ -355,7 +360,7 @@ mkSSLContext settings = do pure ctx -mkSSLContextWithoutCert :: Members '[Embed IO, Polysemy.Error FederationSetupError] r => RunSettings -> Sem r SSLContext +mkSSLContextWithoutCert :: (Members '[Embed IO, Polysemy.Error FederationSetupError] r) => RunSettings -> Sem r SSLContext mkSSLContextWithoutCert settings = do ctx <- embed $ SSL.context embed $ do @@ -370,19 +375,19 @@ mkSSLContextWithoutCert settings = do SSL.contextSetALPNProtos ctx ["h2"] - SSL.contextSetVerificationMode ctx $ - SSL.VerifyPeer + SSL.contextSetVerificationMode ctx + $ SSL.VerifyPeer { -- vpFailIfNoPeerCert and vpClientOnce are only relevant for servers SSL.vpFailIfNoPeerCert = False, SSL.vpClientOnce = False, SSL.vpCallback = Nothing } forM_ (remoteCAStore settings) $ \caStorePath -> - Polysemy.fromExceptionVia @SomeException (InvalidCAStore caStorePath . displayException) $ - SSL.contextSetCAFile ctx caStorePath + Polysemy.fromExceptionVia @SomeException (InvalidCAStore caStorePath . displayException) + $ SSL.contextSetCAFile ctx caStorePath - when (useSystemCAStore settings) $ - embed (SSL.contextSetDefaultVerifyPaths ctx) + when (useSystemCAStore settings) + $ embed (SSL.contextSetDefaultVerifyPaths ctx) pure ctx diff --git a/services/federator/src/Federator/RPC.hs b/services/federator/src/Federator/RPC.hs index 779e3ee9a29..6a6ac5f42b8 100644 --- a/services/federator/src/Federator/RPC.hs +++ b/services/federator/src/Federator/RPC.hs @@ -9,11 +9,11 @@ newtype RPC = RPC Text instance FromHttpApiData RPC where parseUrlPiece :: Text -> Either Text RPC parseUrlPiece rpcPath = do - unless (Text.all isAllowedRPCChar rpcPath) $ - Left "invalid-endpoint" + unless (Text.all isAllowedRPCChar rpcPath) + $ Left "invalid-endpoint" - when (Text.null rpcPath) $ - Left "invalid-endpoint" + when (Text.null rpcPath) + $ Left "invalid-endpoint" pure $ RPC rpcPath isAllowedRPCChar :: Char -> Bool diff --git a/services/federator/src/Federator/Remote.hs b/services/federator/src/Federator/Remote.hs index 06d2246bb58..66eb5682f56 100644 --- a/services/federator/src/Federator/Remote.hs +++ b/services/federator/src/Federator/Remote.hs @@ -94,8 +94,9 @@ interpretRemote = interpret $ \case target@(SrvTarget hostname port) <- discoverFederatorWithError domain RequestId rid <- input let path = - LBS.toStrict . toLazyByteString $ - HTTP.encodePathSegments ["federation", componentName component, rpc] + LBS.toStrict + . toLazyByteString + $ HTTP.encodePathSegments ["federation", componentName component, rpc] pathT = decodeUtf8 path -- filter out Host header, because the HTTP2 client adds it back headers' = @@ -104,8 +105,11 @@ interpretRemote = interpret $ \case req' = HTTP2.requestBuilder HTTP.methodPost path headers' body mgr <- input - resp <- mapError (RemoteError target pathT) . (fromEither @FederatorClientHTTP2Error =<<) . embed $ - Codensity $ \k -> + resp <- mapError (RemoteError target pathT) + . (fromEither @FederatorClientHTTP2Error =<<) + . embed + $ Codensity + $ \k -> E.catches (H2Manager.withHTTP2RequestOnSingleUseConn mgr (True, hostname, fromIntegral port) req' (consumeStreamingResponseWith $ k . Right)) [ E.Handler $ k . Left, @@ -116,8 +120,8 @@ interpretRemote = interpret $ \case unless (HTTP.statusIsSuccessful (responseStatusCode resp)) $ do bdy <- embed @(Codensity IO) . liftIO $ streamingResponseStrictBody resp - throw $ - RemoteErrorResponse + throw + $ RemoteErrorResponse target pathT (responseStatusCode resp) diff --git a/services/federator/src/Federator/Run.hs b/services/federator/src/Federator/Run.hs index c02d9f25f7d..3b709e666f5 100644 --- a/services/federator/src/Federator/Run.hs +++ b/services/federator/src/Federator/Run.hs @@ -109,18 +109,18 @@ mkFederatorMetrics :: IO FederatorMetrics mkFederatorMetrics = FederatorMetrics <$> register - ( vector "target_domain" $ - counter $ - Prometheus.Info - "com_wire_federator_outgoing_requests" - "Number of outgoing requests" + ( vector "target_domain" + $ counter + $ Prometheus.Info + "com_wire_federator_outgoing_requests" + "Number of outgoing requests" ) <*> register - ( vector "origin_domain" $ - counter $ - Prometheus.Info - "com_wire_federator_incoming_requests" - "Number of incoming requests" + ( vector "origin_domain" + $ counter + $ Prometheus.Info + "com_wire_federator_incoming_requests" + "Number of incoming requests" ) closeEnv :: Env -> IO () diff --git a/services/federator/src/Federator/Service.hs b/services/federator/src/Federator/Service.hs index d76718b7dc6..e6d2987e19f 100644 --- a/services/federator/src/Federator/Service.hs +++ b/services/federator/src/Federator/Service.hs @@ -57,13 +57,13 @@ data Service body m a where makeSem ''Service -bodyReaderToStreamT :: Monad m => m ByteString -> SourceT m ByteString +bodyReaderToStreamT :: (Monad m) => m ByteString -> SourceT m ByteString bodyReaderToStreamT action = fromStepT go where go = Effect $ do chunk <- action - pure $ - if BS.null chunk + pure + $ if BS.null chunk then Stop else Yield chunk go @@ -102,11 +102,12 @@ interpretServiceHTTP = interpret $ \case <> headers } - embed $ - Codensity $ \k -> + embed + $ Codensity + $ \k -> bracket (responseOpen req manager) responseClose $ \resp -> - k $ - Servant.Response + k + $ Servant.Response { Servant.responseStatusCode = responseStatus resp, Servant.responseHeaders = Seq.fromList (responseHeaders resp), Servant.responseHttpVersion = HTTP.http11, diff --git a/services/federator/src/Federator/Validation.hs b/services/federator/src/Federator/Validation.hs index 38c315a6498..6a14248ea5f 100644 --- a/services/federator/src/Federator/Validation.hs +++ b/services/federator/src/Federator/Validation.hs @@ -104,8 +104,8 @@ ensureCanFederateWith targetDomain = do AllowNone -> throw (FederationDenied targetDomain) AllowAll -> pure () AllowDynamic -> do - unless (targetDomain `elem` fmap domain domains) $ - throw (FederationDenied targetDomain) + unless (targetDomain `elem` fmap domain domains) + $ throw (FederationDenied targetDomain) decodeCertificate :: ByteString -> @@ -124,8 +124,8 @@ decodeCertificate = parseDomain :: (Member (Error ValidationError) r) => ByteString -> Sem r Domain parseDomain domain = - note (DomainParseError (Text.decodeUtf8With Text.lenientDecode domain)) $ - fromByteString domain + note (DomainParseError (Text.decodeUtf8With Text.lenientDecode domain)) + $ fromByteString domain parseDomainText :: (Member (Error ValidationError) r) => Text -> Sem r Domain parseDomainText domain = @@ -152,9 +152,9 @@ validateDomain certificate targetDomain = do -- run discovery to find the hostname of the client federator hostnames <- srvTargetDomain <$$> discoverAllFederatorsWithError targetDomain let validationErrors = (\h -> validateDomainName (B8.unpack h) certificate) <$> hostnames - unless (any null validationErrors) $ - throw $ - AuthenticationFailure validationErrors + unless (any null validationErrors) + $ throw + $ AuthenticationFailure validationErrors pure targetDomain diff --git a/services/federator/test/integration/Main.hs b/services/federator/test/integration/Main.hs index d63572adf78..13b08260761 100644 --- a/services/federator/test/integration/Main.hs +++ b/services/federator/test/integration/Main.hs @@ -45,8 +45,8 @@ main = withOpenSSL $ do hspecConfig :: IO Config hspecConfig = do junitConfig <- envJUnitConfig - pure $ - defaultConfig + pure + $ defaultConfig { configAvailableFormatters = ("junit", checksAndJUnitFormatter junitConfig) : configAvailableFormatters defaultConfig diff --git a/services/federator/test/integration/Test/Federator/IngressSpec.hs b/services/federator/test/integration/Test/Federator/IngressSpec.hs index 93a6d7fc720..25efd84a2a7 100644 --- a/services/federator/test/integration/Test/Federator/IngressSpec.hs +++ b/services/federator/test/integration/Test/Federator/IngressSpec.hs @@ -54,8 +54,9 @@ import Wire.Network.DNS.SRV spec :: TestEnv -> Spec spec env = do describe "Ingress" $ do - it "should be accessible using http2 and forward to the local brig" $ - runTestFederator env $ do + it "should be accessible using http2 and forward to the local brig" + $ runTestFederator env + $ do brig <- view teBrig <$> ask user <- randomUser brig @@ -94,13 +95,13 @@ testRejectRequestsWithoutClientCertIngress env = runTestFederator env $ do sslCtxWithoutCert <- either (throwM @_ @FederationSetupError) pure <=< runM - . runEmbedded (liftIO @(TestFederator IO)) - . runError + . runEmbedded (liftIO @(TestFederator IO)) + . runError $ mkSSLContextWithoutCert settings runTestSem $ do r <- - runError @RemoteError $ - inwardBrigCallViaIngressWithSettings + runError @RemoteError + $ inwardBrigCallViaIngressWithSettings sslCtxWithoutCert "get-user-by-handle" (Aeson.fromEncoding (Aeson.toEncoding hdl)) @@ -110,7 +111,7 @@ testRejectRequestsWithoutClientCertIngress env = runTestFederator env $ do expectationFailure "Expected client certificate error, got remote error" Left (RemoteErrorResponse _ _ status _) -> status `shouldBe` HTTP.status400 -liftToCodensity :: Member (Embed (Codensity IO)) r => Sem (Embed IO ': r) a -> Sem r a +liftToCodensity :: (Member (Embed (Codensity IO)) r) => Sem (Embed IO ': r) a -> Sem r a liftToCodensity = runEmbedded @IO @(Codensity IO) lift runTestSem :: Sem '[Input TestEnv, Embed (Codensity IO)] a -> TestFederator IO a @@ -124,7 +125,7 @@ discoverConst target = interpret $ \case DiscoverAllFederators _ -> pure (Right (pure target)) inwardBrigCallViaIngress :: - Members [Input TestEnv, Embed (Codensity IO), Error RemoteError] r => + (Members [Input TestEnv, Embed (Codensity IO), Error RemoteError] r) => Text -> Builder -> Sem r StreamingResponse @@ -133,7 +134,7 @@ inwardBrigCallViaIngress path payload = do inwardBrigCallViaIngressWithSettings sslCtx path payload inwardBrigCallViaIngressWithSettings :: - Members [Input TestEnv, Embed (Codensity IO), Error RemoteError] r => + (Members [Input TestEnv, Embed (Codensity IO), Error RemoteError] r) => SSLContext -> Text -> Builder -> diff --git a/services/federator/test/integration/Test/Federator/InwardSpec.hs b/services/federator/test/integration/Test/Federator/InwardSpec.hs index 85980f8948c..de8cad8424d 100644 --- a/services/federator/test/integration/Test/Federator/InwardSpec.hs +++ b/services/federator/test/integration/Test/Federator/InwardSpec.hs @@ -65,8 +65,9 @@ import Wire.API.User spec :: TestEnv -> Spec spec env = describe "Inward" $ do - it "should be able to call brig" $ - runTestFederator env $ do + it "should be able to call brig" + $ runTestFederator env + $ do brig <- view teBrig <$> ask user <- randomUser brig @@ -74,23 +75,25 @@ spec env = bdy <- responseJsonError =<< inwardCall "/federation/brig/get-users-by-ids" (encode [userId user]) - MonadRandom (TestFederator m) where +instance (MonadRandom m) => MonadRandom (TestFederator m) where getRandomBytes = lift . getRandomBytes -instance MonadIO m => MonadHttp (TestFederator m) where +instance (MonadIO m) => MonadHttp (TestFederator m) where handleRequestWithCont req handler = do manager <- _teMgr <$> ask liftIO $ withResponse req manager handler @@ -149,7 +149,7 @@ cliOptsParser = defaultFederatorPath = "/etc/wire/federator/conf/federator.yaml" -- | Create an environment for integration tests from integration and federator config files. -mkEnv :: HasCallStack => IntegrationConfig -> Opts -> IO TestEnv +mkEnv :: (HasCallStack) => IntegrationConfig -> Opts -> IO TestEnv mkEnv _teTstOpts _teOpts = do let managerSettings = mkManagerSettings (Network.Connection.TLSSettingsSimple True False False) Nothing _teMgr :: Manager <- newManager managerSettings @@ -160,7 +160,7 @@ mkEnv _teTstOpts _teOpts = do let _teSettings = optSettings _teOpts pure TestEnv {..} -destroyEnv :: HasCallStack => TestEnv -> IO () +destroyEnv :: (HasCallStack) => TestEnv -> IO () destroyEnv _ = pure () endpointToReq :: Endpoint -> (Bilge.Request -> Bilge.Request) @@ -241,15 +241,15 @@ postUserWithEmail hasPassword validateBody name email havePhone ssoid teamid bri then Just <$> randomPhone else pure Nothing let o = - object $ - [ "name" .= name, - "email" .= (fromEmail <$> email), - "phone" .= phone, - "cookie" .= defCookieLabel, - "sso_id" .= ssoid, - "team_id" .= teamid - ] - <> ["password" .= defPassword | hasPassword] + object + $ [ "name" .= name, + "email" .= (fromEmail <$> email), + "phone" .= phone, + "cookie" .= defCookieLabel, + "sso_id" .= ssoid, + "team_id" .= teamid + ] + <> ["password" .= defPassword | hasPassword] p = case Aeson.parse parseJSON o of Aeson.Success (p_ :: NewUser) -> p_ bad -> error $ show (bad, o) @@ -263,17 +263,17 @@ putHandle :: Text -> m ResponseLBS putHandle brig usr h = - put $ - brig - . path "/self/handle" - . contentJson - . body payload - . zUser usr - . zConn "conn" + put + $ brig + . path "/self/handle" + . contentJson + . body payload + . zUser usr + . zConn "conn" where payload = RequestBodyLBS . encode $ object ["handle" .= h] -randomName :: MonadIO m => m Name +randomName :: (MonadIO m) => m Name randomName = randomNameWithMaxLen 128 -- | For testing purposes we restrict ourselves to code points in the @@ -285,7 +285,7 @@ randomName = randomNameWithMaxLen 128 -- the standard tokenizer considers as word boundaries (or which are -- simply unassigned code points), yielding no tokens to match and thus -- no results in search queries. -randomNameWithMaxLen :: MonadIO m => Word -> m Name +randomNameWithMaxLen :: (MonadIO m) => Word -> m Name randomNameWithMaxLen maxLen = liftIO $ do len <- randomRIO (2, maxLen) chars <- fill len [] @@ -305,7 +305,7 @@ randomNameWithMaxLen maxLen = liftIO $ do then pure c else randLetter -randomPhone :: MonadIO m => m Phone +randomPhone :: (MonadIO m) => m Phone randomPhone = liftIO $ do nrs <- map show <$> replicateM 14 (randomRIO (0, 9) :: IO Int) let phone = parsePhone . Text.pack $ "+0" ++ concat nrs @@ -319,13 +319,13 @@ defCookieLabel = CookieLabel "auth" -- | Generate emails that are in the trusted whitelist of domains whose @+@ suffices count for email -- disambiguation. See also: 'Brig.Email.mkEmailKey'. -randomEmail :: MonadIO m => m Email +randomEmail :: (MonadIO m) => m Email randomEmail = mkSimulatorEmail "success" -mkSimulatorEmail :: MonadIO m => Text -> m Email +mkSimulatorEmail :: (MonadIO m) => Text -> m Email mkSimulatorEmail loc = mkEmailRandomLocalSuffix (loc <> "@simulator.amazonses.com") -mkEmailRandomLocalSuffix :: MonadIO m => Text -> m Email +mkEmailRandomLocalSuffix :: (MonadIO m) => Text -> m Email mkEmailRandomLocalSuffix e = do uid <- liftIO UUID.nextRandom case parseEmail e of @@ -338,7 +338,7 @@ zUser = header "Z-User" . C8.pack . show zConn :: ByteString -> Bilge.Request -> Bilge.Request zConn = header "Z-Connection" -randomHandle :: MonadIO m => m Text +randomHandle :: (MonadIO m) => m Text randomHandle = liftIO $ do nrs <- replicateM 21 (randomRIO (97, 122)) -- a-z pure (Text.pack (map chr nrs)) diff --git a/services/federator/test/unit/Main.hs b/services/federator/test/unit/Main.hs index 1936df48d0d..93ebe523f00 100644 --- a/services/federator/test/unit/Main.hs +++ b/services/federator/test/unit/Main.hs @@ -33,15 +33,15 @@ import Test.Tasty main :: IO () main = - withOpenSSL $ - defaultMain $ - testGroup - "Tests" - [ Test.Federator.Options.tests, - Test.Federator.Validation.tests, - Test.Federator.Client.tests, - Test.Federator.InternalServer.tests, - Test.Federator.ExternalServer.tests, - Test.Federator.Monitor.tests, - Test.Federator.Remote.tests - ] + withOpenSSL + $ defaultMain + $ testGroup + "Tests" + [ Test.Federator.Options.tests, + Test.Federator.Validation.tests, + Test.Federator.Client.tests, + Test.Federator.InternalServer.tests, + Test.Federator.ExternalServer.tests, + Test.Federator.Monitor.tests, + Test.Federator.Remote.tests + ] diff --git a/services/federator/test/unit/Test/Federator/Client.hs b/services/federator/test/unit/Test/Federator/Client.hs index a816f7710c9..4464ce0ef26 100644 --- a/services/federator/test/unit/Test/Federator/Client.hs +++ b/services/federator/test/unit/Test/Federator/Client.hs @@ -185,8 +185,8 @@ testClientExceptions = do handle <- generate arbitrary (response, _) <- - withMockFederatorClient def {handler = const (evaluate (error "unhandled exception"))} $ - fedClient @'Brig @"get-user-by-handle" handle + withMockFederatorClient def {handler = const (evaluate (error "unhandled exception"))} + $ fedClient @'Brig @"get-user-by-handle" handle case response of Right _ -> assertFailure "unexpected success" @@ -228,8 +228,9 @@ testResponseHeaders = do performHTTP2Request mgr (False, "127.0.0.1", port) req case r of Left err -> - assertFailure $ - "Unexpected error while connecting to mock federator: " <> show err + assertFailure + $ "Unexpected error while connecting to mock federator: " + <> show err Right resp -> do responseStatusCode resp @?= HTTP.status200 lookup "X-Foo" (toList (responseHeaders resp)) @?= Just "bar" @@ -246,8 +247,9 @@ testStreaming = withInfiniteMockServer $ \port -> do withInfiniteMockServer :: (Int -> IO a) -> IO a withInfiniteMockServer k = bracket (startMockServer Nothing app) fst (k . snd) where - app _ respond = respond $ - Wai.responseStream HTTP.ok200 mempty $ \write flush -> + app _ respond = respond + $ Wai.responseStream HTTP.ok200 mempty + $ \write flush -> let go n = do when (n == 0) flush write (byteString "Hello\n") *> go (if n == 0 then 100 else n - 1) diff --git a/services/federator/test/unit/Test/Federator/ExternalServer.hs b/services/federator/test/unit/Test/Federator/ExternalServer.hs index a0b4effee60..56a46f2a46f 100644 --- a/services/federator/test/unit/Test/Federator/ExternalServer.hs +++ b/services/federator/test/unit/Test/Federator/ExternalServer.hs @@ -100,7 +100,7 @@ data Call = Call deriving (Eq, Show) mockService :: - Members [Output Call, Embed IO] r => + (Members [Output Call, Embed IO] r) => HTTP.Status -> Sem (ServiceStreaming ': r) a -> Sem r a @@ -131,7 +131,7 @@ requestBrigSuccess = } Right cert <- decodeCertificate <$> BS.readFile "test/resources/unit/localhost.example.com.pem" - let assertMetrics :: Member (Embed IO) r => Sem (Metrics ': r) a -> Sem r a + let assertMetrics :: (Member (Embed IO) r) => Sem (Metrics ': r) a -> Sem r a assertMetrics = interpret $ \case OutgoingCounterIncr _ -> embed @IO $ assertFailure "Should not increment outgoing counter" IncomingCounterIncr od -> embed @IO $ od @?= aValidDomain @@ -304,8 +304,8 @@ testInvalidPaths = do ("/federation/brig/%c0%ae%c0%ae/i/users", status404), -- weird-encoded '../' ("/federation/mast/get-users", status400) -- invalid component ] - testGroup "should not forward requests with invalid paths to services" $ - map invalidPathTest invalidPaths + testGroup "should not forward requests with invalid paths to services" + $ map invalidPathTest invalidPaths where invalidPathTest :: (ByteString, Status) -> TestTree invalidPathTest (invalidPath, expectedStatus) = @@ -325,25 +325,25 @@ testInvalidPaths = do testMethod :: TestTree testMethod = - testGroup "only POST should be supported" $ - let invalidMethodTest method = testCase (cs method) $ do - cert <- BS.readFile "test/resources/unit/localhost.example.com.pem" - let tr = - def - { trPath = "/federation/galley/send-message", - trDomainHeader = Just (Text.encodeUtf8 exampleDomain), - trCertificateHeader = Just cert, - trBody = "\"hello\"" - } - request <- testRequest tr {trMethod = method} - serviceCallsRef <- newIORef [] - let serverApp = genericServeT (testInterpreter serviceCallsRef) $ server undefined undefined - void . serverApp request $ \res -> do - serviceCalls <- readIORef serviceCallsRef - assertEqual "Expected response to have status 403" status403 (Wai.responseStatus res) - assertEqual "no calls to any service should be made" [] serviceCalls - pure Wai.ResponseReceived - in map invalidMethodTest [HTTP.methodGet, HTTP.methodDelete, HTTP.methodPut, HTTP.methodPatch] + testGroup "only POST should be supported" + $ let invalidMethodTest method = testCase (cs method) $ do + cert <- BS.readFile "test/resources/unit/localhost.example.com.pem" + let tr = + def + { trPath = "/federation/galley/send-message", + trDomainHeader = Just (Text.encodeUtf8 exampleDomain), + trCertificateHeader = Just cert, + trBody = "\"hello\"" + } + request <- testRequest tr {trMethod = method} + serviceCallsRef <- newIORef [] + let serverApp = genericServeT (testInterpreter serviceCallsRef) $ server undefined undefined + void . serverApp request $ \res -> do + serviceCalls <- readIORef serviceCallsRef + assertEqual "Expected response to have status 403" status403 (Wai.responseStatus res) + assertEqual "no calls to any service should be made" [] serviceCalls + pure Wai.ResponseReceived + in map invalidMethodTest [HTTP.methodGet, HTTP.methodDelete, HTTP.methodPut, HTTP.methodPatch] testInterpreter :: IORef [Call] -> diff --git a/services/federator/test/unit/Test/Federator/InternalServer.hs b/services/federator/test/unit/Test/Federator/InternalServer.hs index 27029c50b13..66706b74f68 100644 --- a/services/federator/test/unit/Test/Federator/InternalServer.hs +++ b/services/federator/test/unit/Test/Federator/InternalServer.hs @@ -74,7 +74,7 @@ federatedRequestSuccess = trBody = "\"foo\"", trExtraHeaders = requestHeaders } - let verifyCallAndRespond :: Member (Embed IO) r => Sem (Remote ': r) a -> Sem r a + let verifyCallAndRespond :: (Member (Embed IO) r) => Sem (Remote ': r) a -> Sem r a verifyCallAndRespond = interpret $ \case DiscoverAndCall domain component rpc headers body -> embed @IO $ do domain @?= targetDomain @@ -90,7 +90,7 @@ federatedRequestSuccess = responseBody = source ["\"bar\""] } - let assertMetrics :: Member (Embed IO) r => Sem (Metrics ': r) a -> Sem r a + let assertMetrics :: (Member (Embed IO) r) => Sem (Metrics ': r) a -> Sem r a assertMetrics = interpret $ \case OutgoingCounterIncr td -> embed @IO $ td @?= targetDomain IncomingCounterIncr _ -> embed @IO $ assertFailure "Should not increment incoming counter" diff --git a/services/federator/test/unit/Test/Federator/Monitor.hs b/services/federator/test/unit/Test/Federator/Monitor.hs index 6630080f29a..389c28ef766 100644 --- a/services/federator/test/unit/Test/Federator/Monitor.hs +++ b/services/federator/test/unit/Test/Federator/Monitor.hs @@ -78,8 +78,8 @@ withSymlinkSettings = do dir <- ContT $ withSystemTempDirectory "conf" liftIO $ createSymbolicLink (clientCertificate settings) (dir "cert.pem") liftIO $ createSymbolicLink (clientPrivateKey settings) (dir "key.pem") - pure $ - settings + pure + $ settings { clientCertificate = dir "cert.pem", clientPrivateKey = dir "key.pem" } @@ -117,8 +117,9 @@ withSilentMonitor :: ContT r IO (IORef SSLContext) withSilentMonitor reloads settings = do tlsVar <- liftIO $ newIORef (error "TLSSettings not updated before being read") - void . ContT $ - bracket + void + . ContT + $ bracket (runSem (mkMonitor runSemE (atomicWriteIORef tlsVar) settings)) (runSem . delMonitor) pure tlsVar @@ -395,7 +396,8 @@ instance Show Path where instance Arbitrary Path where arbitrary = - Path . B8.intercalate "/" + Path + . B8.intercalate "/" <$> listOf (BS.pack <$> listOf1 ch) where ch :: Gen Word8 @@ -408,26 +410,27 @@ testDirectoryTraversal :: TestTree testDirectoryTraversal = testGroup "directory traversal" - [ testProperty "the number of entries is the same as the number of path components" $ - \(path' :: Path) -> ioProperty $ do + [ testProperty "the number of entries is the same as the number of path components" + $ \(path' :: Path) -> ioProperty $ do path <- getAbsolutePath path' wpaths <- watchedPaths trivialResolve path pure (length wpaths == length (splitPath path)), - testProperty "relative paths are resolved correctly" $ - \(path' :: Path) -> ioProperty $ do + testProperty "relative paths are resolved correctly" + $ \(path' :: Path) -> ioProperty $ do dir <- getWorkingDirectory path <- getPath path' wpaths <- watchedPaths trivialResolve path wpaths' <- watchedPaths trivialResolve (dir path) pure $ wpaths == wpaths', - testCase "symlinked paths are resolved" $ - evalContT $ do + testCase "symlinked paths are resolved" + $ evalContT + $ do settings <- withKubernetesSettings liftIO $ do rroot <- rawPath $ takeDirectory (clientCertificate settings) wpaths <- mergePaths <$> watchedPaths resolveSymlink (clientCertificate settings) - assertBool "symlink targets should be watched" $ - Set.member + assertBool "symlink targets should be watched" + $ Set.member (WatchedDir rroot (Set.fromList ["cert.pem", "..data", "..foo"])) wpaths ] diff --git a/services/federator/test/unit/Test/Federator/Options.hs b/services/federator/test/unit/Test/Federator/Options.hs index bece8365ab0..dec92c6d681 100644 --- a/services/federator/test/unit/Test/Federator/Options.hs +++ b/services/federator/test/unit/Test/Federator/Options.hs @@ -75,8 +75,9 @@ testSettings = (defRunSettings "client.pem" "client-key.pem") { useSystemCAStore = False } - assertParsesAs settings . B8.pack $ - [QQ.i| + assertParsesAs settings + . B8.pack + $ [QQ.i| federationStrategy: allowedDomains: - server2.example.com @@ -89,8 +90,9 @@ testSettings = defRunSettings "test/resources/unit/localhost.pem" "test/resources/unit/localhost-key.pem" - assertParsesAs settings . B8.pack $ - [QQ.i| + assertParsesAs settings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: @@ -98,24 +100,27 @@ testSettings = clientCertificate: test/resources/unit/localhost.pem clientPrivateKey: test/resources/unit/localhost-key.pem|] void (mkTLSSettingsOrThrow settings), - testCase "fail on missing client credentials" $ - assertParseFailure @RunSettings . B8.pack $ - [QQ.i| + testCase "fail on missing client credentials" + $ assertParseFailure @RunSettings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: allowAll: null|], testCase "fail on missing client private key" $ do - assertParseFailure @RunSettings . B8.pack $ - [QQ.i| + assertParseFailure @RunSettings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: allowAll: null clientCertificate: test/resources/unit/localhost.pem|], testCase "fail on missing certificate" $ do - assertParseFailure @RunSettings . B8.pack $ - [QQ.i| + assertParseFailure @RunSettings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: @@ -123,8 +128,9 @@ testSettings = clientPrivateKey: test/resources/unit/localhost-key.pem|], testCase "fail on non-existent certificate" $ do let settings = defRunSettings "non-existent" "non-existent" - assertParsesAs settings . B8.pack $ - [QQ.i| + assertParsesAs settings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: @@ -134,9 +140,9 @@ testSettings = try @FederationSetupError (mkTLSSettingsOrThrow settings) >>= \case Left (InvalidClientCertificate _) -> pure () Left e -> - assertFailure $ - "expected invalid client certificate exception, got: " - <> show e + assertFailure + $ "expected invalid client certificate exception, got: " + <> show e Right _ -> assertFailure "expected failure for non-existing client certificate, got success", testCase "failToStartWithInvalidServerCredentials" failToStartWithInvalidServerCredentials, @@ -145,8 +151,9 @@ testSettings = defRunSettings "test/resources/unit/localhost.pem" "test/resources/unit/invalid.pem" - assertParsesAs settings . B8.pack $ - [QQ.i| + assertParsesAs settings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: @@ -156,9 +163,9 @@ testSettings = try @FederationSetupError (mkTLSSettingsOrThrow settings) >>= \case Left (InvalidClientPrivateKey _) -> pure () Left e -> - assertFailure $ - "expected invalid client certificate exception, got: " - <> show e + assertFailure + $ "expected invalid client certificate exception, got: " + <> show e Right _ -> assertFailure "expected failure for invalid private key, got success" ] @@ -169,8 +176,9 @@ failToStartWithInvalidServerCredentials = do defRunSettings "test/resources/unit/invalid.pem" "test/resources/unit/localhost-key.pem" - assertParsesAs settings . B8.pack $ - [QQ.i| + assertParsesAs settings + . B8.pack + $ [QQ.i| useSystemCAStore: true tcpConnectionTimeout: 1000 federationStrategy: @@ -180,16 +188,16 @@ failToStartWithInvalidServerCredentials = do try @FederationSetupError (mkTLSSettingsOrThrow settings) >>= \case Left (InvalidClientCertificate _) -> pure () Left e -> - assertFailure $ - "expected invalid client certificate exception, got: " - <> show e + assertFailure + $ "expected invalid client certificate exception, got: " + <> show e Right _ -> assertFailure "expected failure for invalid client certificate, got success" assertParsesAs :: (HasCallStack, Eq a, FromJSON a, Show a) => a -> ByteString -> Assertion assertParsesAs v bs = - assertEqual "YAML parsing" (Right v) $ - either (Left . show) Right (Yaml.decodeEither' bs) + assertEqual "YAML parsing" (Right v) + $ either (Left . show) Right (Yaml.decodeEither' bs) assertParseFailure :: forall a. (FromJSON a, Show a) => ByteString -> Assertion assertParseFailure bs = case Yaml.decodeEither' bs of diff --git a/services/federator/test/unit/Test/Federator/Remote.hs b/services/federator/test/unit/Test/Federator/Remote.hs index 0a8b92e432a..c89ef4d3845 100644 --- a/services/federator/test/unit/Test/Federator/Remote.hs +++ b/services/federator/test/unit/Test/Federator/Remote.hs @@ -106,12 +106,14 @@ testValidatesCertificateSuccess :: TestTree testValidatesCertificateSuccess = testGroup "can get response with valid certificate" - [ flakyTestCase "when hostname=localhost and certificate-for=localhost" $ - withMockServer certForLocalhost $ \port -> do + [ flakyTestCase "when hostname=localhost and certificate-for=localhost" + $ withMockServer certForLocalhost + $ \port -> do tlsSettings <- mkTLSSettingsOrThrow settings runCodensity (mkTestCall tlsSettings "localhost" port) assertNoRemoteError, - flakyTestCase "when hostname=localhost. and certificate-for=localhost" $ - withMockServer certForLocalhost $ \port -> do + flakyTestCase "when hostname=localhost. and certificate-for=localhost" + $ withMockServer certForLocalhost + $ \port -> do tlsSettings <- mkTLSSettingsOrThrow settings runCodensity (mkTestCall tlsSettings "localhost." port) assertNoRemoteError, -- It is not very clear how to handle this, this test just exists to @@ -122,8 +124,9 @@ testValidatesCertificateSuccess = -- Perhaps it is also not possible to get a publically verifiable -- certificate like this from any of the CAs: -- https://github.com/certbot/certbot/issues/3718 - testCase "when hostname=localhost. and certificate-for=localhost." $ - withMockServer certForLocalhostDot $ \port -> do + testCase "when hostname=localhost. and certificate-for=localhost." + $ withMockServer certForLocalhostDot + $ \port -> do tlsSettings <- mkTLSSettingsOrThrow settings runCodensity (mkTestCall tlsSettings "localhost." port) $ \case Left _ -> pure () @@ -139,15 +142,17 @@ testValidatesCertificateWrongHostname :: TestTree testValidatesCertificateWrongHostname = testGroup "testValidatesCertificateWrongHostname - refuses to connect with server" - [ testCase "when the server's certificate doesn't match the hostname" $ - withMockServer certForWrongDomain $ \port -> do + [ testCase "when the server's certificate doesn't match the hostname" + $ withMockServer certForWrongDomain + $ \port -> do tlsSettings <- mkTLSSettingsOrThrow settings runCodensity (mkTestCall tlsSettings "localhost" port) $ \case Left (RemoteError _ _ (FederatorClientTLSException _)) -> pure () Left x -> assertFailure $ "Expected TLS failure, got: " <> show x Right _ -> assertFailure "Expected connection with the server to fail", - testCase "when the server's certificate does not have the server key usage flag" $ - withMockServer certWithoutServerKeyUsage $ \port -> do + testCase "when the server's certificate does not have the server key usage flag" + $ withMockServer certWithoutServerKeyUsage + $ \port -> do tlsSettings <- mkTLSSettingsOrThrow settings runCodensity (mkTestCall tlsSettings "localhost" port) $ \case Left (RemoteError _ _ (FederatorClientTLSException _)) -> pure () diff --git a/services/federator/test/unit/Test/Federator/Util.hs b/services/federator/test/unit/Test/Federator/Util.hs index 6af804a1d67..a734685310e 100644 --- a/services/federator/test/unit/Test/Federator/Util.hs +++ b/services/federator/test/unit/Test/Federator/Util.hs @@ -60,8 +60,9 @@ instance Default TestRequest where testRequest :: TestRequest -> IO Wai.Request testRequest tr = do refChunks <- liftIO $ newIORef $ LBS.toChunks (trBody tr) - pure . flip Wai.setPath (trPath tr) $ - Wai.defaultRequest + pure + . flip Wai.setPath (trPath tr) + $ Wai.defaultRequest { Wai.requestMethod = trMethod tr, Wai.requestBody = atomicModifyIORef refChunks $ \case [] -> ([], mempty) diff --git a/services/federator/test/unit/Test/Federator/Validation.hs b/services/federator/test/unit/Test/Federator/Validation.hs index 24879f15aae..9bd97212029 100644 --- a/services/federator/test/unit/Test/Federator/Validation.hs +++ b/services/federator/test/unit/Test/Federator/Validation.hs @@ -44,16 +44,16 @@ mockDiscoveryTrivial = Polysemy.interpret $ \case DiscoverFederator dom -> pure . Right $ SrvTarget (Text.encodeUtf8 (domainText dom)) 443 DiscoverAllFederators dom -> pure . Right $ SrvTarget (Text.encodeUtf8 (domainText dom)) 443 :| [] -mockDiscoveryMapping :: HasCallStack => Domain -> NonEmpty ByteString -> Sem (DiscoverFederator ': r) x -> Sem r x +mockDiscoveryMapping :: (HasCallStack) => Domain -> NonEmpty ByteString -> Sem (DiscoverFederator ': r) x -> Sem r x mockDiscoveryMapping origin targets = Polysemy.interpret $ \case DiscoverFederator _ -> error "Not mocked" DiscoverAllFederators dom -> - pure $ - if dom == origin + pure + $ if dom == origin then Right $ fmap (`SrvTarget` 443) targets else Left $ DiscoveryFailureSrvNotAvailable "invalid origin domain" -mockDiscoveryFailure :: HasCallStack => Sem (DiscoverFederator ': r) x -> Sem r x +mockDiscoveryFailure :: (HasCallStack) => Sem (DiscoverFederator ': r) x -> Sem r x mockDiscoveryFailure = Polysemy.interpret $ \case DiscoverFederator _ -> error "Not mocked" DiscoverAllFederators _ -> pure . Left $ DiscoveryFailureDNSError "mock DNS error" @@ -209,12 +209,12 @@ validateDomainMultipleFederators = . runInputConst scaffoldingFederationDomainConfigs domain = Domain "foo.example.com" resFirst <- - runValidation $ - validateDomain localhostExampleCert domain + runValidation + $ validateDomain localhostExampleCert domain resFirst @?= domain resSecond <- - runValidation $ - validateDomain secondExampleCert domain + runValidation + $ validateDomain secondExampleCert domain resSecond @?= domain -- FUTUREWORK: is this test really necessary? diff --git a/services/galley/migrate-data/src/Galley/DataMigration.hs b/services/galley/migrate-data/src/Galley/DataMigration.hs index ac79bcc0fcd..c48d8704f28 100644 --- a/services/galley/migrate-data/src/Galley/DataMigration.hs +++ b/services/galley/migrate-data/src/Galley/DataMigration.hs @@ -76,8 +76,8 @@ migrate l cas ms = do finally (go env) (cleanup env) where go env = - runMigrationAction env $ - runMigrations ms + runMigrationAction env + $ runMigrations ms mkEnv :: Logger -> CassandraSettings -> IO Env mkEnv l cas = @@ -116,5 +116,5 @@ persistVersion (MigrationVersion v) desc time = C.write cql (C.params C.LocalQuo cql :: C.QueryString C.W (Int32, Text, UTCTime) () cql = "insert into data_migration (id, version, descr, date) values (1,?,?,?)" -info :: Log.MonadLogger m => String -> m () +info :: (Log.MonadLogger m) => String -> m () info = Log.info . Log.msg diff --git a/services/galley/migrate-data/src/Galley/DataMigration/Types.hs b/services/galley/migrate-data/src/Galley/DataMigration/Types.hs index 6d92bb0a399..489ac309271 100644 --- a/services/galley/migrate-data/src/Galley/DataMigration/Types.hs +++ b/services/galley/migrate-data/src/Galley/DataMigration/Types.hs @@ -53,7 +53,7 @@ instance (MonadIO m, MonadThrow m) => C.MonadClient (MigrationActionT m) where liftClient = liftCassandra localState f = local (\env -> env {cassandraClientState = f $ cassandraClientState env}) -instance MonadIO m => MonadLogger (MigrationActionT m) where +instance (MonadIO m) => MonadLogger (MigrationActionT m) where log level f = do env <- ask Logger.log (logger env) level f @@ -67,7 +67,7 @@ runMigrationAction :: Env -> MigrationActionT m a -> m a runMigrationAction env action = runReaderT (unMigrationAction action) env -liftCassandra :: MonadIO m => C.Client a -> MigrationActionT m a +liftCassandra :: (MonadIO m) => C.Client a -> MigrationActionT m a liftCassandra m = do env <- ask lift $ C.runClient (cassandraClientState env) m diff --git a/services/galley/migrate-data/src/V1_BackfillBillingTeamMembers.hs b/services/galley/migrate-data/src/V1_BackfillBillingTeamMembers.hs index aa060022e5a..13e4629f1a7 100644 --- a/services/galley/migrate-data/src/V1_BackfillBillingTeamMembers.hs +++ b/services/galley/migrate-data/src/V1_BackfillBillingTeamMembers.hs @@ -35,18 +35,18 @@ migration = { version = MigrationVersion 1, text = "Backfill billing_team_member", action = - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) getTeamMembers - .| C.mapM - ( \(i, p) -> - Log.info (Log.field "team members" (show (i * pageSize))) - >> pure p - ) - .| C.concatMap (filter isOwner) - .| C.map (\(t, u, _) -> (t, u)) - .| C.mapM_ createBillingTeamMembers + .| C.mapM + ( \(i, p) -> + Log.info (Log.field "team members" (show (i * pageSize))) + >> pure p + ) + .| C.concatMap (filter isOwner) + .| C.map (\(t, u, _) -> (t, u)) + .| C.mapM_ createBillingTeamMembers } pageSize :: Int32 @@ -56,13 +56,13 @@ pageSize = 1000 -- Queries -- | Get team members from Galley -getTeamMembers :: MonadClient m => ConduitM () [(TeamId, UserId, Maybe Permissions)] m () +getTeamMembers :: (MonadClient m) => ConduitM () [(TeamId, UserId, Maybe Permissions)] m () getTeamMembers = paginateC cql (paramsP LocalQuorum () pageSize) x5 where cql :: PrepQuery R () (TeamId, UserId, Maybe Permissions) cql = "SELECT team, user, perms FROM team_member" -createBillingTeamMembers :: MonadClient m => (TeamId, UserId) -> m () +createBillingTeamMembers :: (MonadClient m) => (TeamId, UserId) -> m () createBillingTeamMembers pair = retry x5 $ write cql (params LocalQuorum pair) where diff --git a/services/galley/migrate-data/src/V3_BackfillTeamAdmins.hs b/services/galley/migrate-data/src/V3_BackfillTeamAdmins.hs index 6578b4e9631..6ecc7b23de5 100644 --- a/services/galley/migrate-data/src/V3_BackfillTeamAdmins.hs +++ b/services/galley/migrate-data/src/V3_BackfillTeamAdmins.hs @@ -35,18 +35,18 @@ migration = { version = MigrationVersion 3, text = "Backfill team_admin", action = - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) getTeamMembers - .| C.mapM - ( \(i, p) -> - Log.info (Log.field "team members" (show (i * pageSize))) - >> pure p - ) - .| C.concatMap (filter isAdmin) - .| C.map (\(t, u, _) -> (t, u)) - .| C.mapM_ createTeamAdmins + .| C.mapM + ( \(i, p) -> + Log.info (Log.field "team members" (show (i * pageSize))) + >> pure p + ) + .| C.concatMap (filter isAdmin) + .| C.map (\(t, u, _) -> (t, u)) + .| C.mapM_ createTeamAdmins } pageSize :: Int32 @@ -56,13 +56,13 @@ pageSize = 1000 -- Queries -- | Get team members from Galley -getTeamMembers :: MonadClient m => ConduitM () [(TeamId, UserId, Maybe Permissions)] m () +getTeamMembers :: (MonadClient m) => ConduitM () [(TeamId, UserId, Maybe Permissions)] m () getTeamMembers = paginateC cql (paramsP LocalQuorum () pageSize) x5 where cql :: PrepQuery R () (TeamId, UserId, Maybe Permissions) cql = "SELECT team, user, perms FROM team_member" -createTeamAdmins :: MonadClient m => (TeamId, UserId) -> m () +createTeamAdmins :: (MonadClient m) => (TeamId, UserId) -> m () createTeamAdmins pair = retry x5 $ write cql (params LocalQuorum pair) where diff --git a/services/galley/src/Galley/API/Action.hs b/services/galley/src/Galley/API/Action.hs index 23a3ecb106c..2d6c7241401 100644 --- a/services/galley/src/Galley/API/Action.hs +++ b/services/galley/src/Galley/API/Action.hs @@ -390,8 +390,8 @@ ensureAllowed :: ensureAllowed tag loc action conv origUser = do case tag of SConversationJoinTag -> - mapErrorS @'InvalidAction @('ActionDenied 'AddConversationMember) $ - ensureConvRoleNotElevated origUser (cjRole action) + mapErrorS @'InvalidAction @('ActionDenied 'AddConversationMember) + $ ensureConvRoleNotElevated origUser (cjRole action) SConversationDeleteTag -> for_ (convTeam conv) $ \tid -> do lusr <- ensureLocal loc (convMemberId loc origUser) @@ -400,8 +400,8 @@ ensureAllowed tag loc action conv origUser = do -- 'PrivateAccessRole' is for self-conversations, 1:1 conversations and -- so on; users not supposed to be able to make other conversations -- have 'PrivateAccessRole' - when (PrivateAccess `elem` cupAccess action || Set.null (cupAccessRoles action)) $ - throwS @'InvalidTargetAccess + when (PrivateAccess `elem` cupAccess action || Set.null (cupAccessRoles action)) + $ throwS @'InvalidTargetAccess -- Team conversations incur another round of checks case convTeam conv of Just _ -> do @@ -410,8 +410,8 @@ ensureAllowed tag loc action conv origUser = do ensureActionAllowed SRemoveConversationMember origUser Nothing -> -- not a team conv, so one of the other access roles has to allow this. - when (Set.null $ cupAccessRoles action Set.\\ Set.fromList [TeamMemberAccessRole]) $ - throwS @'InvalidTargetAccess + when (Set.null $ cupAccessRoles action Set.\\ Set.fromList [TeamMemberAccessRole]) + $ throwS @'InvalidTargetAccess _ -> pure () -- | Returns additional members that resulted from the action (e.g. ConversationJoin) @@ -543,8 +543,10 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do if not allInvitedAlreadyInConversation then checkFederationStatus (RemoteDomains (invitedRemoteDomains <> existingRemoteDomains)) else -- even if there are no new remotes, we still need to check they are reachable - void . (ensureNoUnreachableBackends =<<) $ - E.runFederatedConcurrentlyEither @_ @'Brig invitedRemoteUsers $ \_ -> + void + . (ensureNoUnreachableBackends =<<) + $ E.runFederatedConcurrentlyEither @_ @'Brig invitedRemoteUsers + $ \_ -> pure () conv :: Data.Conversation @@ -557,7 +559,8 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do Sem r () checkLocals lusr (Just tid) newUsers = do tms <- - Map.fromList . map (view Wire.API.Team.Member.userId &&& Imports.id) + Map.fromList + . map (view Wire.API.Team.Member.userId &&& Imports.id) <$> E.selectTeamMembers tid newUsers let userMembershipMap = map (Imports.id &&& flip Map.lookup tms) newUsers ensureAccessRole (convAccessRoles conv) userMembershipMap @@ -573,9 +576,9 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do checkRemotes lusr remotes = do -- if federator is not configured, we fail early, so we avoid adding -- remote members to the database - unless (null remotes) $ - unlessM E.isFederationConfigured $ - throw FederationNotConfigured + unless (null remotes) + $ unlessM E.isFederationConfigured + $ throw FederationNotConfigured ensureConnectedToRemotes lusr remotes checkLHPolicyConflictsLocal :: @@ -586,13 +589,13 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do allNewUsersGaveConsent <- allLegalholdConsentGiven newUsers - whenM (anyLegalholdActivated (lmId <$> convUsers)) $ - unless allNewUsersGaveConsent $ - throwS @'MissingLegalholdConsent + whenM (anyLegalholdActivated (lmId <$> convUsers)) + $ unless allNewUsersGaveConsent + $ throwS @'MissingLegalholdConsent whenM (anyLegalholdActivated newUsers) $ do - unless allNewUsersGaveConsent $ - throwS @'MissingLegalholdConsent + unless allNewUsersGaveConsent + $ throwS @'MissingLegalholdConsent convUsersLHStatus <- do uidsStatus <- getLHStatusForUsers (lmId <$> convUsers) @@ -600,8 +603,10 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do if any ( \(mem, status) -> - lmConvRoleName mem == roleNameWireAdmin - && consentGiven status == ConsentGiven + lmConvRoleName mem + == roleNameWireAdmin + && consentGiven status + == ConsentGiven ) convUsersLHStatus then do @@ -623,7 +628,7 @@ performConversationJoin qusr lconv (ConversationJoin invited role) = do checkTeamMemberAddPermissions lusr = forM (cnvmTeam (convMetadata conv)) (flip E.getTeamMember (tUnqualified lusr)) >>= (maybe (pure ()) (\tm -> unless (tm `hasPermission` AddRemoveConvMember) $ throwS @'InvalidOperation)) - . join + . join performConversationAccessData :: ( HasConversationActionEffects 'ConversationAccessDataTag r, @@ -638,8 +643,10 @@ performConversationAccessData qusr lconv action = do when (convAccessData conv == action) noChanges -- Remove conversation codes if CodeAccess is revoked when - ( CodeAccess `elem` convAccess conv - && CodeAccess `notElem` cupAccess action + ( CodeAccess + `elem` convAccess conv + && CodeAccess + `notElem` cupAccess action ) $ do key <- E.makeKey (tUnqualified lcnv) @@ -663,8 +670,8 @@ performConversationAccessData qusr lconv action = do let bmToNotify = current {bmBots = bmBots desired} -- Remove users and notify everyone - for_ (bmQualifiedMembers lcnv toRemove) $ - kickMember qusr lconv bmToNotify + for_ (bmQualifiedMembers lcnv toRemove) + $ kickMember qusr lconv bmToNotify pure (mempty, action) where @@ -738,8 +745,8 @@ updateLocalConversation lcnv qusr con action = do conv <- getConversationWithError lcnv -- check that the action does not bypass the underlying protocol - unless (protocolValidAction (convProtocol conv) (fromSing tag)) $ - throwS @'InvalidOperation + unless (protocolValidAction (convProtocol conv) (fromSing tag)) + $ throwS @'InvalidOperation -- perform all authorisation checks and, if successful, then update itself updateLocalConversationUnchecked @tag (qualifyAs lcnv conv) qusr con action @@ -836,8 +843,8 @@ ensureConversationActionAllowed tag loc action conv self = do ensureActionAllowed (sConversationActionPermission tag) self -- check if it is a group conversation (except for rename actions) - when (fromSing tag /= ConversationRenameTag) $ - ensureGroupConversation conv + when (fromSing tag /= ConversationRenameTag) + $ ensureGroupConversation conv -- extra action-specific checks ensureAllowed tag loc action conv self @@ -886,18 +893,18 @@ notifyConversationAction tag quid notifyOrigDomain con lconv targets action = do uids (SomeConversationAction tag action) update <- - fmap (fromMaybe (mkUpdate []) . asum . map tUnqualified) $ - enqueueNotificationsConcurrently Q.Persistent (toList (bmRemotes targets)) $ - \ruids -> do - let update = mkUpdate (tUnqualified ruids) - -- if notifyOrigDomain is false, filter out user from quid's domain, - -- because quid's backend will update local state and notify its users - -- itself using the ConversationUpdate returned by this function - if notifyOrigDomain || tDomain ruids /= qDomain quid - then do - makeConversationUpdateBundle update >>= sendBundle - pure Nothing - else pure (Just update) + fmap (fromMaybe (mkUpdate []) . asum . map tUnqualified) + $ enqueueNotificationsConcurrently Q.Persistent (toList (bmRemotes targets)) + $ \ruids -> do + let update = mkUpdate (tUnqualified ruids) + -- if notifyOrigDomain is false, filter out user from quid's domain, + -- because quid's backend will update local state and notify its users + -- itself using the ConversationUpdate returned by this function + if notifyOrigDomain || tDomain ruids /= qDomain quid + then do + makeConversationUpdateBundle update >>= sendBundle + pure Nothing + else pure (Just update) -- notify local participants and bots pushConversationEvent con e (qualifyAs lcnv (bmLocals targets)) (bmBots targets) @@ -947,12 +954,12 @@ updateLocalStateOfRemoteConv rcu con = do let (localUsers, remoteUsers) = partitionQualified loc toAdd addedLocalUsers <- Set.toList <$> addLocalUsersToRemoteConv rconvId cu.origUserId localUsers let allAddedUsers = map (tUntagged . qualifyAs loc) addedLocalUsers <> map tUntagged remoteUsers - pure $ - ( fmap - (\users -> SomeConversationAction SConversationJoinTag (ConversationJoin users role)) - (nonEmpty allAddedUsers), - addedLocalUsers - ) + pure + $ ( fmap + (\users -> SomeConversationAction SConversationJoinTag (ConversationJoin users role)) + (nonEmpty allAddedUsers), + addedLocalUsers + ) SConversationLeaveTag -> do let users = foldQualified loc (pure . tUnqualified) (const []) cu.origUserId E.deleteMembersInRemoteConversation rconvId users @@ -972,15 +979,15 @@ updateLocalStateOfRemoteConv rcu con = do SConversationAccessDataTag -> pure (Just sca, []) SConversationUpdateProtocolTag -> pure (Just sca, []) - unless allUsersArePresent $ - P.warn $ - Log.field "conversation" (toByteString' cu.convId) - . Log.field "domain" (toByteString' (tDomain rcu)) - . Log.msg - ( "Attempt to send notification about conversation update \ - \to users not in the conversation" :: - ByteString - ) + unless allUsersArePresent + $ P.warn + $ Log.field "conversation" (toByteString' cu.convId) + . Log.field "domain" (toByteString' (tDomain rcu)) + . Log.msg + ( "Attempt to send notification about conversation update \ + \to users not in the conversation" :: + ByteString + ) -- Send notifications for mActualAction $ \(SomeConversationAction tag action) -> do @@ -1015,11 +1022,11 @@ addLocalUsersToRemoteConv remoteConvId qAdder localUsers = do -- FUTUREWORK: Consider handling the discrepancy between the views of the -- conversation-owning backend and the local backend - unless (Set.null unconnected) $ - P.warn $ - Log.msg ("A remote user is trying to add unconnected local users to a remote conversation" :: Text) - . Log.field "remote_user" (show qAdder) - . Log.field "local_unconnected_users" (show unconnected) + unless (Set.null unconnected) + $ P.warn + $ Log.msg ("A remote user is trying to add unconnected local users to a remote conversation" :: Text) + . Log.field "remote_user" (show qAdder) + . Log.field "local_unconnected_users" (show unconnected) -- Update the local view of the remote conversation by adding only those local -- users that are connected to the adder diff --git a/services/galley/src/Galley/API/Create.hs b/services/galley/src/Galley/API/Create.hs index b998a108339..98d7fa918ff 100644 --- a/services/galley/src/Galley/API/Create.hs +++ b/services/galley/src/Galley/API/Create.hs @@ -118,8 +118,8 @@ createGroupConversationUpToV3 :: Maybe ConnId -> NewConv -> Sem r (ConversationResponse Public.Conversation) -createGroupConversationUpToV3 lusr conn newConv = mapError UnreachableBackendsLegacy $ - do +createGroupConversationUpToV3 lusr conn newConv = mapError UnreachableBackendsLegacy + $ do conv <- createGroupConversationGeneric lusr @@ -167,8 +167,9 @@ createGroupConversation lusr conn newConv = do conn newConv conv <- conversationView lusr cnv - pure . GroupConversationCreated $ - CreateGroupConversation conv mempty + pure + . GroupConversationCreated + $ CreateGroupConversation conv mempty createGroupConversationGeneric :: ( Member BackendNotificationQueueAccess r, @@ -227,9 +228,9 @@ ensureNoLegalholdConflicts :: Sem r () ensureNoLegalholdConflicts (UserList locals remotes) = do let FutureWork _remotes = FutureWork @'LegalholdPlusFederationNotImplemented remotes - whenM (anyLegalholdActivated locals) $ - unlessM (allLegalholdConsentGiven locals) $ - throwS @'MissingLegalholdConsent + whenM (anyLegalholdActivated locals) + $ unlessM (allLegalholdConsentGiven locals) + $ throwS @'MissingLegalholdConsent checkCreateConvPermissions :: ( Member BrigAccess r, @@ -249,8 +250,9 @@ checkCreateConvPermissions lusr _newConv Nothing allUsers = do void $ noteS @OperationDenied activated -- an external partner is not allowed to create group conversations (except 1:1 team conversations that are handled below) tm <- getTeamMember (tUnqualified lusr) Nothing - for_ tm $ - permissionCheck AddRemoveConvMember . Just + for_ tm + $ permissionCheck AddRemoveConvMember + . Just ensureConnected lusr allUsers checkCreateConvPermissions lusr newConv (Just tinfo) allUsers = do let convTeam = cnvTeamId tinfo @@ -278,7 +280,7 @@ checkCreateConvPermissions lusr newConv (Just tinfo) allUsers = do ensureConnectedToLocals (tUnqualified lusr) (notTeamMember (ulLocals allUsers) (catMaybes convLocalMemberships)) ensureConnectedToRemotes lusr (ulRemotes allUsers) -getTeamMember :: Member TeamStore r => UserId -> Maybe TeamId -> Sem r (Maybe TeamMember) +getTeamMember :: (Member TeamStore r) => UserId -> Maybe TeamId -> Sem r (Maybe TeamMember) getTeamMember uid (Just tid) = E.getTeamMember tid uid getTeamMember uid Nothing = E.getUserTeams uid >>= maybe (pure Nothing) (flip E.getTeamMember uid) . headMay @@ -338,8 +340,8 @@ createOne2OneConversation lusr zcon j = mapError @UnreachableBackends @UnreachableBackendsLegacy UnreachableBackendsLegacy $ do let allUsers = newConvMembers lusr j other <- ensureOne (ulAll lusr allUsers) - when (tUntagged lusr == other) $ - throwS @'InvalidOperation + when (tUntagged lusr == other) + $ throwS @'InvalidOperation mtid <- case newConvTeam j of Just ti -> do foldQualified @@ -363,8 +365,8 @@ createOne2OneConversation lusr zcon j = Sem r () verifyMembership tid u = do membership <- E.getTeamMember tid u - when (isNothing membership) $ - throwS @'NoBindingTeamMembers + when (isNothing membership) + $ throwS @'NoBindingTeamMembers checkBindingTeamPermissions :: ( Member (ErrorS 'NoBindingTeamMembers) r, Member (ErrorS 'NonBindingTeam) r, @@ -426,8 +428,9 @@ createLegacyOne2OneConversationUnchecked self zcon name mtid other = do runError @UnreachableBackends (notifyCreatedConversation self (Just zcon) c) >>= \case Left _ -> do - throw . InternalErrorWithDescription $ - "A one-to-one conversation on one backend cannot involve unreachable backends" + throw + . InternalErrorWithDescription + $ "A one-to-one conversation on one backend cannot involve unreachable backends" Right () -> conversationCreated self c createOne2OneConversationUnchecked :: @@ -495,7 +498,7 @@ createOne2OneConversationLocally lcnv self zcon name mtid other = do conversationCreated self c createOne2OneConversationRemotely :: - Member (Error FederationError) r => + (Member (Error FederationError) r) => Remote ConvId -> Local UserId -> ConnId -> @@ -673,9 +676,9 @@ notifyCreatedConversation lusr conn c = do -- Ask remote servers to store conversation membership and notify remote users -- of being added to a conversation registerRemoteConversationMemberships now lusr (qualifyAs lusr c) - unless (null (Data.convRemoteMembers c)) $ - unlessM E.isFederationConfigured $ - throw FederationNotConfigured + unless (null (Data.convRemoteMembers c)) + $ unlessM E.isFederationConfigured + $ throw FederationNotConfigured -- Notify local users pushNotifications =<< mapM (toPush now) (Data.convLocalMembers c) @@ -689,13 +692,13 @@ notifyCreatedConversation lusr conn c = do lconv = qualifyAs lusr (Data.convId c) c' <- conversationViewWithCachedOthers remoteOthers localOthers c (qualifyAs lusr (lmId m)) let e = Event (tUntagged lconv) Nothing (tUntagged lusr) t (EdConversation c') - pure $ - newPushLocal1 (tUnqualified lusr) (toJSONObject e) (NonEmpty.singleton (localMemberToRecipient m)) - & pushConn .~ conn - & pushRoute .~ route + pure + $ newPushLocal1 (tUnqualified lusr) (toJSONObject e) (NonEmpty.singleton (localMemberToRecipient m)) + & pushConn .~ conn + & pushRoute .~ route localOne2OneConvId :: - Member (Error InvalidInput) r => + (Member (Error InvalidInput) r) => Local UserId -> Local UserId -> Sem r (Local ConvId) @@ -704,7 +707,7 @@ localOne2OneConvId self other = do pure . qualifyAs self $ Data.localOne2OneConvId x y toUUIDs :: - Member (Error InvalidInput) r => + (Member (Error InvalidInput) r) => UserId -> UserId -> Sem r (U.UUID U.V4, U.UUID U.V4) @@ -726,6 +729,6 @@ newConvMembers loc body = UserList (newConvUsers body) [] <> toUserList loc (newConvQualifiedUsers body) -ensureOne :: Member (Error InvalidInput) r => [a] -> Sem r a +ensureOne :: (Member (Error InvalidInput) r) => [a] -> Sem r a ensureOne [x] = pure x ensureOne _ = throw (InvalidRange "One-to-one conversations can only have a single invited member") diff --git a/services/galley/src/Galley/API/Error.hs b/services/galley/src/Galley/API/Error.hs index 6a1c4d7c97c..3cb8fa8bdf8 100644 --- a/services/galley/src/Galley/API/Error.hs +++ b/services/galley/src/Galley/API/Error.hs @@ -95,11 +95,11 @@ invalidRange = Wai.mkError status400 "client-error" badConvState :: ConvId -> Wai.Error badConvState cid = - Wai.mkError status500 "bad-state" $ - "Connect conversation with more than 2 members: " - <> LT.pack (show cid) + Wai.mkError status500 "bad-state" + $ "Connect conversation with more than 2 members: " + <> LT.pack (show cid) -legalHoldServiceUnavailable :: Show a => a -> Wai.Error +legalHoldServiceUnavailable :: (Show a) => a -> Wai.Error legalHoldServiceUnavailable e = Wai.mkError status412 "legalhold-unavailable" ("legal hold service unavailable with underlying error: " <> (LT.pack . show $ e)) invalidTeamNotificationId :: Wai.Error diff --git a/services/galley/src/Galley/API/Federation.hs b/services/galley/src/Galley/API/Federation.hs index 7bbc9c8bd8d..8f5affeb71e 100644 --- a/services/galley/src/Galley/API/Federation.hs +++ b/services/galley/src/Galley/API/Federation.hs @@ -277,14 +277,14 @@ leaveConversation requestingDomain lc = do $ do (conv, _self) <- getConversationAndMemberWithError @'ConvNotFound leaver lcnv outcome <- - runError @FederationError $ - lcuUpdate - <$> updateLocalConversation - @'ConversationLeaveTag - lcnv - leaver - Nothing - () + runError @FederationError + $ lcuUpdate + <$> updateLocalConversation + @'ConversationLeaveTag + lcnv + leaver + Nothing + () case outcome of Left e -> do logFederationError lcnv e @@ -298,8 +298,8 @@ leaveConversation requestingDomain lc = do let botsAndMembers = BotsAndMembers mempty (Set.fromList remotes) mempty do outcome <- - runError @FederationError $ - notifyConversationAction + runError @FederationError + $ notifyConversationAction SConversationLeaveTag leaver False @@ -345,18 +345,18 @@ onMessageSent domain rmUnqualified = do (members, allMembers) <- first Set.fromList <$> E.selectRemoteMembers (Map.keys recipientMap) rm.conversation - unless allMembers $ - P.warn $ - Log.field "conversation" (toByteString' (qUnqualified convId)) - Log.~~ Log.field "domain" (toByteString' (qDomain convId)) - Log.~~ Log.msg - ( "Attempt to send remote message to local\ - \ users not in the conversation" :: - ByteString - ) + unless allMembers + $ P.warn + $ Log.field "conversation" (toByteString' (qUnqualified convId)) + Log.~~ Log.field "domain" (toByteString' (qDomain convId)) + Log.~~ Log.msg + ( "Attempt to send remote message to local\ + \ users not in the conversation" :: + ByteString + ) loc <- qualifyLocal () - void $ - sendLocalMessages + void + $ sendLocalMessages loc rm.time rm.sender @@ -418,14 +418,15 @@ onUserDeleted origDomain udcn = do untaggedDeletedUser = tUntagged deletedUser convIds = conversations udcn - E.spawnMany $ - fromRange convIds <&> \c -> do + E.spawnMany + $ fromRange convIds + <&> \c -> do lc <- qualifyLocal c mconv <- E.getConversation c E.deleteMembers c (UserList [] [deletedUser]) for_ mconv $ \conv -> do - when (isRemoteMember deletedUser (Data.convRemoteMembers conv)) $ - case Data.convType conv of + when (isRemoteMember deletedUser (Data.convRemoteMembers conv)) + $ case Data.convType conv of -- No need for a notification on One2One conv as the user is being -- deleted and that notification should suffice. Public.One2OneConv -> pure () @@ -438,8 +439,8 @@ onUserDeleted origDomain udcn = do let botsAndMembers = convBotsAndMembers conv removeUser (qualifyAs lc conv) RemoveUserIncludeMain (tUntagged deletedUser) outcome <- - runError @FederationError $ - notifyConversationAction + runError @FederationError + $ notifyConversationAction (sing @'ConversationLeaveTag) untaggedDeletedUser False @@ -606,13 +607,14 @@ sendMLSCommitBundle remoteDomain msr = handleMLSMessageErrors $ do loc <- qualifyLocal () let sender = toRemoteUnsafe remoteDomain msr.sender bundle <- - either (throw . mlsProtocolError) pure $ - decodeMLS' (fromBase64ByteString msr.rawMessage) + either (throw . mlsProtocolError) pure + $ decodeMLS' (fromBase64ByteString msr.rawMessage) ibundle <- noteS @'MLSUnsupportedMessage $ mkIncomingBundle bundle (ctype, qConvOrSub) <- getConvFromGroupId ibundle.groupId when (qUnqualified qConvOrSub /= msr.convOrSubId) $ throwS @'MLSGroupConversationMismatch - MLSMessageResponseUpdates . map lcuUpdate + MLSMessageResponseUpdates + . map lcuUpdate <$> postMLSCommitBundle loc (tUntagged sender) @@ -653,7 +655,8 @@ sendMLSMessage remoteDomain msr = handleMLSMessageErrors $ do msg <- noteS @'MLSUnsupportedMessage $ mkIncomingMessage raw (ctype, qConvOrSub) <- getConvFromGroupId msg.groupId when (qUnqualified qConvOrSub /= msr.convOrSubId) $ throwS @'MLSGroupConversationMismatch - MLSMessageResponseUpdates . map lcuUpdate + MLSMessageResponseUpdates + . map lcuUpdate <$> postMLSMessage loc (tUntagged sender) @@ -664,14 +667,15 @@ sendMLSMessage remoteDomain msr = handleMLSMessageErrors $ do msg getSubConversationForRemoteUser :: - Members - '[ SubConversationStore, - ConversationStore, - Input (Local ()), - Error InternalError, - P.TinyLog - ] - r => + ( Members + '[ SubConversationStore, + ConversationStore, + Input (Local ()), + Error InternalError, + P.TinyLog + ] + r + ) => Domain -> GetSubConversationsRequest -> Sem r GetSubConversationsResponse @@ -703,7 +707,7 @@ leaveSubConversation domain lscr = do . runError @GalleyError . mapToGalleyError @LeaveSubConversationStaticErrors $ leaveLocalSubConversation cid lcnv (lscrSubConv lscr) - $> LeaveSubConversationResponseOk + $> LeaveSubConversationResponseOk deleteSubConversationForRemoteUser :: ( Members @@ -769,7 +773,7 @@ getOne2OneConversation domain (GetOne2OneConversationRequest self other) = class ToGalleyRuntimeError (effs :: EffectRow) r where mapToGalleyError :: - Member (Error GalleyError) r => + (Member (Error GalleyError) r) => Sem (Append effs r) a -> Sem r a @@ -785,8 +789,9 @@ instance ToGalleyRuntimeError (ErrorS err ': effs) r where mapToGalleyError act = - mapToGalleyError @effs @r $ - runError act >>= \case + mapToGalleyError @effs @r + $ runError act + >>= \case Left _ -> throw (demote @err) Right res -> pure res @@ -813,15 +818,15 @@ onMLSMessageSent domain rmm = (members, allMembers) <- first Set.fromList <$> E.selectRemoteMembers (toList users) rcnv - unless allMembers $ - P.warn $ - Log.field "conversation" (toByteString' (tUnqualified rcnv)) - Log.~~ Log.field "domain" (toByteString' (tDomain rcnv)) - Log.~~ Log.msg - ( "Attempt to send remote message to local\ - \ users not in the conversation" :: - ByteString - ) + unless allMembers + $ P.warn + $ Log.field "conversation" (toByteString' (tUnqualified rcnv)) + Log.~~ Log.field "domain" (toByteString' (tDomain rcnv)) + Log.~~ Log.msg + ( "Attempt to send remote message to local\ + \ users not in the conversation" :: + ByteString + ) let recipients = filter (\r -> Set.member (_recipientUserId r) members) . map (\(u, clts) -> Recipient u (RecipientClientsSome (List1 clts))) @@ -829,19 +834,19 @@ onMLSMessageSent domain rmm = $ rmm.recipients -- FUTUREWORK: support local bots let e = - Event (tUntagged rcnv) rmm.subConversation rmm.sender rmm.time $ - EdMLSMessage (fromBase64ByteString rmm.message) + Event (tUntagged rcnv) rmm.subConversation rmm.sender rmm.time + $ EdMLSMessage (fromBase64ByteString rmm.message) - runMessagePush loc (Just (tUntagged rcnv)) $ - newMessagePush mempty Nothing rmm.metadata recipients e + runMessagePush loc (Just (tUntagged rcnv)) + $ newMessagePush mempty Nothing rmm.metadata recipients e where - logError :: Member P.TinyLog r => Either (Tagged 'MLSNotEnabled ()) () -> Sem r () + logError :: (Member P.TinyLog r) => Either (Tagged 'MLSNotEnabled ()) () -> Sem r () logError (Left _) = - P.warn $ - Log.field "conversation" (toByteString' rmm.conversation) - Log.~~ Log.field "domain" (toByteString' domain) - Log.~~ Log.msg - ("Cannot process remote MLS message because MLS is disabled on this backend" :: ByteString) + P.warn + $ Log.field "conversation" (toByteString' rmm.conversation) + Log.~~ Log.field "domain" (toByteString' domain) + Log.~~ Log.msg + ("Cannot process remote MLS message because MLS is disabled on this backend" :: ByteString) logError _ = pure () mlsSendWelcome :: @@ -864,8 +869,8 @@ mlsSendWelcome origDomain req = do loc <- qualifyLocal () now <- input welcome <- - either (throw . InternalErrorWithDescription . LT.fromStrict) pure $ - decodeMLS' (fromBase64ByteString req.welcomeMessage) + either (throw . InternalErrorWithDescription . LT.fromStrict) pure + $ decodeMLS' (fromBase64ByteString req.welcomeMessage) sendLocalWelcomes req.qualifiedConvId (Qualified req.originatingUser origDomain) Nothing now welcome (qualifyAs loc req.recipients) queryGroupInfo :: @@ -937,16 +942,16 @@ onTypingIndicatorUpdated origDomain TypingDataUpdated {..} = do -- | Log a federation error that is impossible in processing a remote request -- for a local conversation. logFederationError :: - Member P.TinyLog r => + (Member P.TinyLog r) => Local ConvId -> FederationError -> Sem r () logFederationError lc e = - P.warn $ - Log.field "conversation" (toByteString' (tUnqualified lc)) - Log.~~ Log.field "domain" (toByteString' (tDomain lc)) - Log.~~ Log.msg - ( "An impossible federation error occurred when deleting\ - \ a user from a local conversation: " - <> displayException e - ) + P.warn + $ Log.field "conversation" (toByteString' (tUnqualified lc)) + Log.~~ Log.field "domain" (toByteString' (tDomain lc)) + Log.~~ Log.msg + ( "An impossible federation error occurred when deleting\ + \ a user from a local conversation: " + <> displayException e + ) diff --git a/services/galley/src/Galley/API/Internal.hs b/services/galley/src/Galley/API/Internal.hs index 142c6df66b7..cf09a108477 100644 --- a/services/galley/src/Galley/API/Internal.hs +++ b/services/galley/src/Galley/API/Internal.hs @@ -98,20 +98,20 @@ import Wire.Sem.Paging.Cassandra internalAPI :: API InternalAPI GalleyEffects internalAPI = - hoistAPI @InternalAPIBase Imports.id $ - mkNamedAPI @"status" (pure ()) - <@> mkNamedAPI @"delete-user" (callsFed (exposeAnnotations rmUser)) - <@> mkNamedAPI @"connect" (callsFed (exposeAnnotations Create.createConnectConversation)) - <@> mkNamedAPI @"get-conversation-clients" iGetMLSClientListForConv - <@> mkNamedAPI @"guard-legalhold-policy-conflicts" guardLegalholdPolicyConflictsH - <@> legalholdWhitelistedTeamsAPI - <@> iTeamsAPI - <@> miscAPI - <@> mkNamedAPI @"upsert-one2one" iUpsertOne2OneConversation - <@> featureAPI - <@> federationAPI - <@> conversationAPI - <@> iEJPDAPI + hoistAPI @InternalAPIBase Imports.id + $ mkNamedAPI @"status" (pure ()) + <@> mkNamedAPI @"delete-user" (callsFed (exposeAnnotations rmUser)) + <@> mkNamedAPI @"connect" (callsFed (exposeAnnotations Create.createConnectConversation)) + <@> mkNamedAPI @"get-conversation-clients" iGetMLSClientListForConv + <@> mkNamedAPI @"guard-legalhold-policy-conflicts" guardLegalholdPolicyConflictsH + <@> legalholdWhitelistedTeamsAPI + <@> iTeamsAPI + <@> miscAPI + <@> mkNamedAPI @"upsert-one2one" iUpsertOne2OneConversation + <@> featureAPI + <@> federationAPI + <@> conversationAPI + <@> iEJPDAPI iEJPDAPI :: API IEJPDAPI GalleyEffects iEJPDAPI = mkNamedAPI @"get-conversations-by-user" (callsFed (exposeAnnotations ejpdGetConvInfo)) @@ -357,13 +357,13 @@ rmUser lusr conn = do leaveTeams page = for_ (pageItems page) $ \tid -> do toNotify <- - handleImpossibleErrors $ - getFeatureStatus @LimitedEventFanoutConfig DontDoAuth tid - >>= ( \case - FeatureStatusEnabled -> Left <$> E.getTeamAdmins tid - FeatureStatusDisabled -> Right <$> getTeamMembersForFanout tid - ) - . wsStatus + handleImpossibleErrors + $ getFeatureStatus @LimitedEventFanoutConfig DontDoAuth tid + >>= ( \case + FeatureStatusEnabled -> Left <$> E.getTeamAdmins tid + FeatureStatusDisabled -> Right <$> getTeamMembersForFanout tid + ) + . wsStatus uncheckedDeleteTeamMember lusr conn tid (tUnqualified lusr) toNotify page' <- listTeams @p2 (tUnqualified lusr) (Just (pageState page)) maxBound leaveTeams page' @@ -407,10 +407,10 @@ rmUser lusr conn = do now (EdMembersLeave EdReasonDeleted (QualifiedUserIdList [qUser])) for_ (bucketRemote (fmap rmId (Data.convRemoteMembers c))) $ notifyRemoteMembers now qUser (Data.convId c) - pure $ - newPushLocal (tUnqualified lusr) (toJSONObject e) (localMemberToRecipient <$> Data.convLocalMembers c) - <&> set pushConn conn - . set pushRoute PushV2.RouteDirect + pure + $ newPushLocal (tUnqualified lusr) (toJSONObject e) (localMemberToRecipient <$> Data.convLocalMembers c) + <&> set pushConn conn + . set pushRoute PushV2.RouteDirect | otherwise -> pure Nothing pushNotifications (catMaybes pp) @@ -452,8 +452,8 @@ deleteLoop = do someError q i x = do err $ "error" .= show x ~~ msg (val "failed to delete") ok <- Q.tryPush q i - unless ok $ - err (msg (val "delete queue is full, dropping item") ~~ "item" .= show i) + unless ok + $ err (msg (val "delete queue is full, dropping item") ~~ "item" .= show i) liftIO $ threadDelay 1000000 doDelete usr con tid = do @@ -462,8 +462,9 @@ deleteLoop = do safeForever :: String -> App () -> App () safeForever funName action = - forever $ - action `catchAny` \exc -> do + forever + $ action + `catchAny` \exc -> do err $ "error" .= show exc ~~ msg (val $ UTF8.fromString funName <> " failed") threadDelay 60000000 -- pause to keep worst-case noise in logs manageable @@ -478,18 +479,19 @@ guardLegalholdPolicyConflictsH :: GuardLegalholdPolicyConflicts -> Sem r () guardLegalholdPolicyConflictsH glh = do - mapError @LegalholdConflicts (const $ Tagged @'MissingLegalholdConsent ()) $ - mapError @LegalholdConflictsOldClients (const $ Tagged @'MissingLegalholdConsentOldClients ()) $ - guardLegalholdPolicyConflicts (glhProtectee glh) (glhUserClients glh) + mapError @LegalholdConflicts (const $ Tagged @'MissingLegalholdConsent ()) + $ mapError @LegalholdConflictsOldClients (const $ Tagged @'MissingLegalholdConsentOldClients ()) + $ guardLegalholdPolicyConflicts (glhProtectee glh) (glhUserClients glh) -- | Get an MLS conversation client list iGetMLSClientListForConv :: forall r. - Members - '[ MemberStore, - ErrorS 'ConvNotFound - ] - r => + ( Members + '[ MemberStore, + ErrorS 'ConvNotFound + ] + r + ) => GroupId -> Sem r ClientList iGetMLSClientListForConv gid = do diff --git a/services/galley/src/Galley/API/LegalHold.hs b/services/galley/src/Galley/API/LegalHold.hs index bc6d94f7161..edc95cd6736 100644 --- a/services/galley/src/Galley/API/LegalHold.hs +++ b/services/galley/src/Galley/API/LegalHold.hs @@ -279,9 +279,9 @@ removeSettings' tid = action membs = do let zothers = map (view userId) membs let lhMembers = filter ((== UserLegalHoldEnabled) . view legalHoldStatus) membs - P.debug $ - Log.field "targets" (toByteString . show $ toByteString <$> zothers) - . Log.field "action" (Log.val "LegalHold.removeSettings'") + P.debug + $ Log.field "targets" (toByteString . show $ toByteString <$> zothers) + . Log.field "action" (Log.val "LegalHold.removeSettings'") spawnMany (map removeLHForUser lhMembers) removeLHForUser :: TeamMember -> Sem r () removeLHForUser member = do @@ -319,10 +319,11 @@ getUserStatus _lzusr tid uid = do mLastKey <- fmap snd <$> LegalHoldData.selectPendingPrekeys uid lastKey <- case mLastKey of Nothing -> do - P.err . Log.msg $ - "expected to find a prekey for user: " - <> toByteString' uid - <> " but none was found" + P.err + . Log.msg + $ "expected to find a prekey for user: " + <> toByteString' uid + <> " but none was found" throw NoPrekeyForUser Just lstKey -> pure lstKey let clientId = clientIdFromPrekey . unpackLastPrekey $ lastKey @@ -361,7 +362,8 @@ grantConsent :: grantConsent lusr tid = do userLHStatus <- noteS @'TeamMemberNotFound - =<< fmap (view legalHoldStatus) <$> getTeamMember tid (tUnqualified lusr) + =<< fmap (view legalHoldStatus) + <$> getTeamMember tid (tUnqualified lusr) case userLHStatus of lhs@UserLegalHoldNoConsent -> changeLegalholdStatusAndHandlePolicyConflicts tid lusr lhs UserLegalHoldDisabled $> GrantConsentSuccess @@ -412,9 +414,9 @@ requestDevice lzusr tid uid = do let zusr = tUnqualified lzusr luid <- qualifyLocal uid assertLegalHoldEnabledForTeam tid - P.debug $ - Log.field "targets" (toByteString (tUnqualified luid)) - . Log.field "action" (Log.val "LegalHold.requestDevice") + P.debug + $ Log.field "targets" (toByteString (tUnqualified luid)) + . Log.field "action" (Log.val "LegalHold.requestDevice") zusrMembership <- getTeamMember tid zusr void $ permissionCheck ChangeLegalHoldUserSettings zusrMembership member <- noteS @'TeamMemberNotFound =<< getTeamMember tid uid @@ -500,9 +502,9 @@ approveDevice lzusr connId tid uid (Public.ApproveLegalHoldForUserRequest mPassw let zusr = tUnqualified lzusr luid <- qualifyLocal uid assertLegalHoldEnabledForTeam tid - P.debug $ - Log.field "targets" (toByteString (tUnqualified luid)) - . Log.field "action" (Log.val "LegalHold.approveDevice") + P.debug + $ Log.field "targets" (toByteString (tUnqualified luid)) + . Log.field "action" (Log.val "LegalHold.approveDevice") unless (zusr == tUnqualified luid) $ throwS @'AccessDenied assertOnTeam (tUnqualified luid) tid ensureReAuthorised zusr mPassword Nothing Nothing @@ -573,9 +575,9 @@ disableForUser :: Sem r DisableLegalHoldForUserResponse disableForUser lzusr tid uid (Public.DisableLegalHoldForUserRequest mPassword) = do luid <- qualifyLocal uid - P.debug $ - Log.field "targets" (toByteString (tUnqualified luid)) - . Log.field "action" (Log.val "LegalHold.disableForUser") + P.debug + $ Log.field "targets" (toByteString (tUnqualified luid)) + . Log.field "action" (Log.val "LegalHold.disableForUser") zusrMembership <- getTeamMember tid (tUnqualified lzusr) void $ permissionCheck ChangeLegalHoldUserSettings zusrMembership @@ -695,7 +697,7 @@ blockNonConsentingConnections uid = do status <- putConnectionInternal (BlockForMissingLHConsent userLegalhold othersToBlock) pure $ ["blocking users failed: " <> show (status, othersToBlock) | status /= status200] -unsetTeamLegalholdWhitelistedH :: Member LegalHoldStore r => TeamId -> Sem r () +unsetTeamLegalholdWhitelistedH :: (Member LegalHoldStore r) => TeamId -> Sem r () unsetTeamLegalholdWhitelistedH tid = do () <- error @@ -741,19 +743,20 @@ handleGroupConvPolicyConflicts :: UserLegalHoldStatus -> Sem r () handleGroupConvPolicyConflicts luid hypotheticalLHStatus = do - void $ - iterateConversations luid (toRange (Proxy @500)) $ \convs -> do + void + $ iterateConversations luid (toRange (Proxy @500)) + $ \convs -> do for_ (filter ((== RegularConv) . Data.convType) convs) $ \conv -> do let FutureWork _convRemoteMembers' = FutureWork @'LegalholdPlusFederationNotImplemented Data.convRemoteMembers membersAndLHStatus :: [(LocalMember, UserLegalHoldStatus)] <- do let mems = Data.convLocalMembers conv uidsLHStatus <- getLHStatusForUsers (lmId <$> mems) - pure $ - zipWith + pure + $ zipWith ( \mem (mid, status) -> - assert (lmId mem == mid) $ - if lmId mem == tUnqualified luid + assert (lmId mem == mid) + $ if lmId mem == tUnqualified luid then (mem, hypotheticalLHStatus) else (mem, status) ) diff --git a/services/galley/src/Galley/API/LegalHold/Conflicts.hs b/services/galley/src/Galley/API/LegalHold/Conflicts.hs index e70ffff0f3d..38e3d9e0b47 100644 --- a/services/galley/src/Galley/API/LegalHold/Conflicts.hs +++ b/services/galley/src/Galley/API/LegalHold/Conflicts.hs @@ -145,12 +145,12 @@ guardLegalholdPolicyConflictsUid self (Map.keys . userClients -> otherUids) = do pure True -- personal users can not give consent or <$> checkUserConsentMissing `mapM` users - P.debug $ - Log.field "self" (toByteString' self) - Log.~~ Log.field "allClients" (toByteString' $ show allClients) - Log.~~ Log.field "allClientsMetadata" (toByteString' $ show allClientsMetadata) - Log.~~ Log.field "anyClientHasLH" (toByteString' anyClientHasLH) - Log.~~ Log.msg ("guardLegalholdPolicyConflicts[1]" :: Text) + P.debug + $ Log.field "self" (toByteString' self) + Log.~~ Log.field "allClients" (toByteString' $ show allClients) + Log.~~ Log.field "allClientsMetadata" (toByteString' $ show allClientsMetadata) + Log.~~ Log.field "anyClientHasLH" (toByteString' anyClientHasLH) + Log.~~ Log.msg ("guardLegalholdPolicyConflicts[1]" :: Text) -- when no other client is under LH, then we're good and can leave this function. but... when anyClientHasLH $ do diff --git a/services/galley/src/Galley/API/LegalHold/Team.hs b/services/galley/src/Galley/API/LegalHold/Team.hs index 6345f8fdb30..db42023b19e 100644 --- a/services/galley/src/Galley/API/LegalHold/Team.hs +++ b/services/galley/src/Galley/API/LegalHold/Team.hs @@ -48,8 +48,8 @@ assertLegalHoldEnabledForTeam :: TeamId -> Sem r () assertLegalHoldEnabledForTeam tid = - unlessM (isLegalHoldEnabledForTeam tid) $ - throwS @'LegalHoldNotEnabled + unlessM (isLegalHoldEnabledForTeam tid) + $ throwS @'LegalHoldNotEnabled isLegalHoldEnabledForTeam :: forall r. @@ -82,10 +82,10 @@ ensureNotTooLargeToActivateLegalHold :: Sem r () ensureNotTooLargeToActivateLegalHold tid = do (TeamSize teamSize) <- getSize tid - unlessM (teamSizeBelowLimit (fromIntegral teamSize)) $ - throwS @'CannotEnableLegalHoldServiceLargeTeam + unlessM (teamSizeBelowLimit (fromIntegral teamSize)) + $ throwS @'CannotEnableLegalHoldServiceLargeTeam -teamSizeBelowLimit :: Member TeamStore r => Int -> Sem r Bool +teamSizeBelowLimit :: (Member TeamStore r) => Int -> Sem r Bool teamSizeBelowLimit teamSize = do limit <- fromIntegral . fromRange <$> fanoutLimit let withinLimit = teamSize <= limit diff --git a/services/galley/src/Galley/API/MLS/Commit/Core.hs b/services/galley/src/Galley/API/MLS/Commit/Core.hs index 1c7b97f6b89..5854b771e0a 100644 --- a/services/galley/src/Galley/API/MLS/Commit/Core.hs +++ b/services/galley/src/Galley/API/MLS/Commit/Core.hs @@ -163,9 +163,9 @@ getRemoteMLSClients rusr suite = do { userId = tUnqualified rusr, cipherSuite = tagCipherSuite suite } - runFederatedEither rusr $ - fedClient @'Brig @"get-mls-clients" mcr - <|> fedClient @'Brig @(Versioned 'V0 "get-mls-clients") (mlsClientsRequestToV0 mcr) + runFederatedEither rusr + $ fedClient @'Brig @"get-mls-clients" mcr + <|> fedClient @'Brig @(Versioned 'V0 "get-mls-clients") (mlsClientsRequestToV0 mcr) -------------------------------------------------------------------------------- -- Error handling of proposal execution diff --git a/services/galley/src/Galley/API/MLS/Commit/ExternalCommit.hs b/services/galley/src/Galley/API/MLS/Commit/ExternalCommit.hs index 52b5a447ca8..a0a566fb6c6 100644 --- a/services/galley/src/Galley/API/MLS/Commit/ExternalCommit.hs +++ b/services/galley/src/Galley/API/MLS/Commit/ExternalCommit.hs @@ -73,13 +73,13 @@ getExternalCommitData senderIdentity lConvOrSub epoch commit = do let convOrSub = tUnqualified lConvOrSub groupId = cnvmlsGroupId convOrSub.mlsMeta activeData <- - note (mlsProtocolError "The first commit in a group cannot be external") $ - cnvmlsActiveData convOrSub.mlsMeta + note (mlsProtocolError "The first commit in a group cannot be external") + $ cnvmlsActiveData convOrSub.mlsMeta let curEpoch = activeData.epoch when (epoch /= curEpoch) $ throwS @'MLSStaleMessage - when (epoch == Epoch 0) $ - throw $ - mlsProtocolError "The first commit in a group cannot be external" + when (epoch == Epoch 0) + $ throw + $ mlsProtocolError "The first commit in a group cannot be external" proposals <- traverse getInlineProposal commit.proposals -- According to the spec, an external commit must contain: @@ -92,10 +92,10 @@ getExternalCommitData senderIdentity lConvOrSub epoch commit = do -- > No other proposals. let counts = foldr (\x -> Map.insertWith (+) x.tag (1 :: Int)) mempty proposals - unless (Map.lookup ExternalInitProposalTag counts == Just 1) $ - throw (mlsProtocolError "External commits must contain exactly one ExternalInit proposal") - unless (null (Map.keys counts \\ allowedProposals)) $ - throw (mlsProtocolError "Invalid proposal type in an external commit") + unless (Map.lookup ExternalInitProposalTag counts == Just 1) + $ throw (mlsProtocolError "External commits must contain exactly one ExternalInit proposal") + unless (null (Map.keys counts \\ allowedProposals)) + $ throw (mlsProtocolError "Invalid proposal type in an external commit") evalState convOrSub.indexMap $ do -- process optional removal @@ -144,8 +144,8 @@ processExternalCommit senderIdentity lConvOrSub ciphersuite epoch action updateP -- only members can join a subconversation forOf_ _SubConv convOrSub $ \(mlsConv, _) -> - unless (isClientMember senderIdentity (mcMembers mlsConv)) $ - throwS @'MLSSubConvClientNotInParent + unless (isClientMember senderIdentity (mcMembers mlsConv)) + $ throwS @'MLSSubConvClientNotInParent -- extract leaf node from update path and validate it leafNode <- @@ -157,8 +157,8 @@ processExternalCommit senderIdentity lConvOrSub ciphersuite epoch action updateP let extra = LeafNodeTBSExtraCommit groupId action.add case validateLeafNode ciphersuite (Just senderIdentity) extra leafNode.value of Left errMsg -> - throw $ - mlsProtocolError ("Tried to add invalid LeafNode: " <> errMsg) + throw + $ mlsProtocolError ("Tried to add invalid LeafNode: " <> errMsg) Right _ -> pure () withCommitLock (fmap (.id) lConvOrSub) groupId epoch $ do @@ -182,7 +182,7 @@ processExternalCommit senderIdentity lConvOrSub ciphersuite epoch action updateP executeExternalCommitAction :: forall r. - HasProposalActionEffects r => + (HasProposalActionEffects r) => Local ConvOrSubConv -> ClientIdentity -> ExternalCommitAction -> diff --git a/services/galley/src/Galley/API/MLS/Commit/InternalCommit.hs b/services/galley/src/Galley/API/MLS/Commit/InternalCommit.hs index 4e7974de17d..9c860bafe5c 100644 --- a/services/galley/src/Galley/API/MLS/Commit/InternalCommit.hs +++ b/services/galley/src/Galley/API/MLS/Commit/InternalCommit.hs @@ -91,13 +91,13 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com -- check all pending proposals are referenced in the commit allPendingProposals <- getAllPendingProposalRefs (cnvmlsGroupId convOrSub.mlsMeta) epoch let referencedProposals = Set.fromList $ mapMaybe (\x -> preview Proposal._Ref x) commit.proposals - unless (all (`Set.member` referencedProposals) allPendingProposals) $ - throwS @'MLSCommitMissingReferences + unless (all (`Set.member` referencedProposals) allPendingProposals) + $ throwS @'MLSCommitMissingReferences withCommitLock (fmap (.id) lConvOrSub) (cnvmlsGroupId convOrSub.mlsMeta) epoch $ do -- no client can be directly added to a subconversation - when (is _SubConv convOrSub && any ((senderIdentity /=) . fst) (cmAssocs (paAdd action))) $ - throw (mlsProtocolError "Add proposals in subconversations are not supported") + when (is _SubConv convOrSub && any ((senderIdentity /=) . fst) (cmAssocs (paAdd action))) + $ throw (mlsProtocolError "Add proposals in subconversations are not supported") events <- if convOrSub.migrationState == MLSMigrationMLS @@ -117,8 +117,9 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com -- subconversation case, an empty list is returned. membersToRemove <- case convOrSub of SubConv _ _ -> pure [] - Conv _ -> mapMaybe hush <$$> for (Map.assocs (paRemove action)) $ - \(qtarget, Map.keysSet -> clients) -> runError @() $ do + Conv _ -> mapMaybe hush + <$$> for (Map.assocs (paRemove action)) + $ \(qtarget, Map.keysSet -> clients) -> runError @() $ do let clientsInConv = Map.keysSet (Map.findWithDefault mempty qtarget cm) let removedClients = Set.intersection clients clientsInConv @@ -126,8 +127,8 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com when (Set.null removedClients) $ throw () -- return error if the user is trying to remove themself - when (cidQualifiedUser senderIdentity == qtarget) $ - throwS @'MLSSelfRemovalNotAllowed + when (cidQualifiedUser senderIdentity == qtarget) + $ throwS @'MLSSelfRemovalNotAllowed -- FUTUREWORK: add tests against this situation for conv v subconv when (removedClients /= clientsInConv) $ do @@ -145,8 +146,9 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com failedAddFetching <- case convOrSub.id of SubConv _ _ -> pure [] Conv _ -> - fmap catMaybes . forM newUserClients $ - \(qtarget, newclients) -> case Map.lookup qtarget cm of + fmap catMaybes + . forM newUserClients + $ \(qtarget, newclients) -> case Map.lookup qtarget cm of -- user is already present, skip check in this case Just _ -> do -- new user @@ -188,16 +190,18 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com SubConv cnv sub | epoch == Epoch 0 -> do -- create subconversation if it doesn't exist msub' <- getSubConversation cnv sub - when (isNothing msub') $ - void $ - createSubConversation - cnv - sub - convOrSub.mlsMeta.cnvmlsGroupId + when (isNothing msub') + $ void + $ createSubConversation + cnv + sub + convOrSub.mlsMeta.cnvmlsGroupId pure [] Conv _ - | convOrSub.meta.cnvmType == One2OneConv - && epoch == Epoch 0 -> do + | convOrSub.meta.cnvmType + == One2OneConv + && epoch + == Epoch 0 -> do -- create 1-1 conversation with the users as members, set -- epoch to 0 for now, it will be incremented later let senderUser = cidQualifiedUser senderIdentity @@ -267,7 +271,7 @@ processInternalCommit senderIdentity con lConvOrSub ciphersuite epoch action com pure events addMembers :: - HasProposalActionEffects r => + (HasProposalActionEffects r) => Qualified UserId -> Maybe ConnId -> Local ConvOrSubConv -> @@ -291,7 +295,7 @@ addMembers qusr con lConvOrSub users = case tUnqualified lConvOrSub of SubConv _ _ -> pure [] removeMembers :: - HasProposalActionEffects r => + (HasProposalActionEffects r) => Qualified UserId -> Maybe ConnId -> Local ConvOrSubConv -> @@ -313,7 +317,7 @@ removeMembers qusr con lConvOrSub users = case tUnqualified lConvOrSub of $ users SubConv _ _ -> pure [] -handleNoChanges :: Monoid a => Sem (Error NoChanges ': r) a -> Sem r a +handleNoChanges :: (Monoid a) => Sem (Error NoChanges ': r) a -> Sem r a handleNoChanges = fmap fold . runError existingLocalMembers :: Local Data.Conversation -> Set (Qualified UserId) @@ -322,8 +326,11 @@ existingLocalMembers lconv = existingRemoteMembers :: Local Data.Conversation -> Set (Qualified UserId) existingRemoteMembers lconv = - Set.fromList . map (tUntagged . rmId) . convRemoteMembers . tUnqualified $ - lconv + Set.fromList + . map (tUntagged . rmId) + . convRemoteMembers + . tUnqualified + $ lconv existingMembers :: Local Data.Conversation -> Set (Qualified UserId) existingMembers lconv = existingLocalMembers lconv <> existingRemoteMembers lconv diff --git a/services/galley/src/Galley/API/MLS/Conversation.hs b/services/galley/src/Galley/API/MLS/Conversation.hs index 1a7ed3d62bc..09e66ff52c7 100644 --- a/services/galley/src/Galley/API/MLS/Conversation.hs +++ b/services/galley/src/Galley/API/MLS/Conversation.hs @@ -33,7 +33,7 @@ import Wire.API.Conversation hiding (Member) import Wire.API.Conversation.Protocol mkMLSConversation :: - Member MemberStore r => + (Member MemberStore r) => Data.Conversation -> Sem r (Maybe MLSConversation) mkMLSConversation conv = diff --git a/services/galley/src/Galley/API/MLS/Enabled.hs b/services/galley/src/Galley/API/MLS/Enabled.hs index d8106726f0f..ec1bd099baa 100644 --- a/services/galley/src/Galley/API/MLS/Enabled.hs +++ b/services/galley/src/Galley/API/MLS/Enabled.hs @@ -26,7 +26,7 @@ import Wire.API.Error import Wire.API.Error.Galley import Wire.API.MLS.Keys -isMLSEnabled :: Member (Input Env) r => Sem r Bool +isMLSEnabled :: (Member (Input Env) r) => Sem r Bool isMLSEnabled = inputs (isJust . view mlsKeys) -- | Fail if MLS is not enabled. Only use this function at the beginning of an diff --git a/services/galley/src/Galley/API/MLS/GroupInfo.hs b/services/galley/src/Galley/API/MLS/GroupInfo.hs index 692b9524a5d..252551100f2 100644 --- a/services/galley/src/Galley/API/MLS/GroupInfo.hs +++ b/services/galley/src/Galley/API/MLS/GroupInfo.hs @@ -52,7 +52,7 @@ getGroupInfo :: Member (Input Env) r, Member MemberStore r ) => - Members MLSGroupInfoStaticErrors r => + (Members MLSGroupInfoStaticErrors r) => Local UserId -> Qualified ConvId -> Sem r GroupInfoData @@ -68,7 +68,7 @@ getGroupInfoFromLocalConv :: ( Member ConversationStore r, Member MemberStore r ) => - Members MLSGroupInfoStaticErrors r => + (Members MLSGroupInfoStaticErrors r) => Qualified UserId -> Local ConvId -> Sem r GroupInfoData @@ -81,7 +81,7 @@ getGroupInfoFromRemoteConv :: ( Member (Error FederationError) r, Member FederatorAccess r ) => - Members MLSGroupInfoStaticErrors r => + (Members MLSGroupInfoStaticErrors r) => Local UserId -> Remote ConvOrSubConvId -> Sem r GroupInfoData diff --git a/services/galley/src/Galley/API/MLS/Keys.hs b/services/galley/src/Galley/API/MLS/Keys.hs index f8bfe8e458b..61f635c9f29 100644 --- a/services/galley/src/Galley/API/MLS/Keys.hs +++ b/services/galley/src/Galley/API/MLS/Keys.hs @@ -29,10 +29,10 @@ import Wire.API.MLS.CipherSuite import Wire.API.MLS.Keys data SomeKeyPair where - SomeKeyPair :: forall ss. IsSignatureScheme ss => Proxy ss -> KeyPair ss -> SomeKeyPair + SomeKeyPair :: forall ss. (IsSignatureScheme ss) => Proxy ss -> KeyPair ss -> SomeKeyPair getMLSRemovalKey :: - Member (Input Env) r => + (Member (Input Env) r) => SignatureSchemeTag -> Sem r (Maybe SomeKeyPair) getMLSRemovalKey ss = fmap hush . runError @() $ do @@ -41,17 +41,17 @@ getMLSRemovalKey ss = fmap hush . runError @() $ do case ss of Ed25519 -> pure $ SomeKeyPair (Proxy @Ed25519) (mlsKeyPair_ed25519 keys) Ecdsa_secp256r1_sha256 -> - pure $ - SomeKeyPair + pure + $ SomeKeyPair (Proxy @Ecdsa_secp256r1_sha256) (mlsKeyPair_ecdsa_secp256r1_sha256 keys) Ecdsa_secp384r1_sha384 -> - pure $ - SomeKeyPair + pure + $ SomeKeyPair (Proxy @Ecdsa_secp384r1_sha384) (mlsKeyPair_ecdsa_secp384r1_sha384 keys) Ecdsa_secp521r1_sha512 -> - pure $ - SomeKeyPair + pure + $ SomeKeyPair (Proxy @Ecdsa_secp521r1_sha512) (mlsKeyPair_ecdsa_secp521r1_sha512 keys) diff --git a/services/galley/src/Galley/API/MLS/Message.hs b/services/galley/src/Galley/API/MLS/Message.hs index a4add447b06..fa55df0c632 100644 --- a/services/galley/src/Galley/API/MLS/Message.hs +++ b/services/galley/src/Galley/API/MLS/Message.hs @@ -208,8 +208,8 @@ postMLSCommitBundleToLocalConv qusr c conn bundle ctype lConvOrSubId = do let convOrSub = tUnqualified lConvOrSub ciphersuite <- - note (mlsProtocolError "Unsupported ciphersuite") $ - cipherSuiteTag bundle.groupInfo.value.groupContext.cipherSuite + note (mlsProtocolError "Unsupported ciphersuite") + $ cipherSuiteTag bundle.groupInfo.value.groupContext.cipherSuite case convOrSub.mlsMeta.cnvmlsActiveData of -- if this is the first commit of the conversation, update ciphersuite @@ -219,9 +219,9 @@ postMLSCommitBundleToLocalConv qusr c conn bundle ctype lConvOrSubId = do SubConv cid sub -> setSubConversationCipherSuite cid sub ciphersuite -- otherwise, make sure the ciphersuite matches Just activeData -> do - unless (ciphersuite == activeData.ciphersuite) $ - throw $ - mlsProtocolError "GroupInfo ciphersuite does not match conversation" + unless (ciphersuite == activeData.ciphersuite) + $ throw + $ mlsProtocolError "GroupInfo ciphersuite does not match conversation" unless (bundle.epoch == activeData.epoch) $ throwS @'MLSStaleMessage senderIdentity <- getSenderIdentity qusr c bundle.sender lConvOrSub @@ -293,27 +293,32 @@ postMLSCommitBundleToRemoteConv loc qusr c con bundle ctype rConvOrSubId = do -- only local users can send messages to remote conversations lusr <- foldQualified loc pure (\_ -> throwS @'ConvAccessDenied) qusr - unless (bundle.epoch == Epoch 0 && ctype == One2OneConv) $ + unless (bundle.epoch == Epoch 0 && ctype == One2OneConv) + $ -- only members may send commit bundles to a remote conversation - flip unless (throwS @'ConvMemberNotFound) =<< checkLocalMemberRemoteConv (tUnqualified lusr) ((.conv) <$> rConvOrSubId) + flip unless (throwS @'ConvMemberNotFound) + =<< checkLocalMemberRemoteConv (tUnqualified lusr) ((.conv) <$> rConvOrSubId) resp <- - runFederated rConvOrSubId $ - fedClient @'Galley @"send-mls-commit-bundle" $ - MLSMessageSendRequest - { convOrSubId = tUnqualified rConvOrSubId, - sender = tUnqualified lusr, - senderClient = c, - rawMessage = Base64ByteString bundle.serialized - } + runFederated rConvOrSubId + $ fedClient @'Galley @"send-mls-commit-bundle" + $ MLSMessageSendRequest + { convOrSubId = tUnqualified rConvOrSubId, + sender = tUnqualified lusr, + senderClient = c, + rawMessage = Base64ByteString bundle.serialized + } case resp of MLSMessageResponseError e -> rethrowErrors @MLSBundleStaticErrors e MLSMessageResponseProtocolError e -> throw (mlsProtocolError e) MLSMessageResponseProposalFailure e -> throw (MLSProposalFailure e) MLSMessageResponseUnreachableBackends ds -> throw (UnreachableBackends (toList ds)) MLSMessageResponseUpdates updates -> do - fmap fst . runOutputList . runInputConst (void loc) $ - for_ updates $ \update -> do + fmap fst + . runOutputList + . runInputConst (void loc) + $ for_ updates + $ \update -> do me <- updateLocalStateOfRemoteConv (qualifyAs rConvOrSubId update) con for_ me $ \e -> output (LocalConversationUpdate e update) MLSMessageResponseNonFederatingBackends e -> throw e @@ -403,8 +408,8 @@ postMLSMessageToLocalConv qusr c con msg ctype convOrSubId = do -- application message: -- reject all application messages if the conv is in mixed state - when (convOrSub.migrationState == MLSMigrationMixed) $ - throwS @'MLSUnsupportedMessage + when (convOrSub.migrationState == MLSMigrationMixed) + $ throwS @'MLSUnsupportedMessage -- reject application messages older than 2 epochs -- FUTUREWORK: consider rejecting this message if the conversation epoch is 0 @@ -438,28 +443,31 @@ postMLSMessageToRemoteConv loc qusr senderClient con msg rConvOrSubId = do flip unless (throwS @'ConvMemberNotFound) =<< checkLocalMemberRemoteConv (tUnqualified lusr) ((.conv) <$> rConvOrSubId) resp <- - runFederated rConvOrSubId $ - fedClient @'Galley @"send-mls-message" $ - MLSMessageSendRequest - { convOrSubId = tUnqualified rConvOrSubId, - sender = tUnqualified lusr, - senderClient = senderClient, - rawMessage = Base64ByteString msg.rawMessage.raw - } + runFederated rConvOrSubId + $ fedClient @'Galley @"send-mls-message" + $ MLSMessageSendRequest + { convOrSubId = tUnqualified rConvOrSubId, + sender = tUnqualified lusr, + senderClient = senderClient, + rawMessage = Base64ByteString msg.rawMessage.raw + } case resp of MLSMessageResponseError e -> rethrowErrors @MLSMessageStaticErrors e MLSMessageResponseProtocolError e -> throw (mlsProtocolError e) MLSMessageResponseProposalFailure e -> throw (MLSProposalFailure e) MLSMessageResponseUnreachableBackends ds -> - throw . InternalErrorWithDescription $ - "An application or proposal message to a remote conversation should \ - \not ever return a non-empty list of domains a commit could not be \ - \sent to. The remote end returned: " - <> LT.pack (intercalate ", " (show <$> Set.toList (Set.map domainText ds))) + throw + . InternalErrorWithDescription + $ "An application or proposal message to a remote conversation should \ + \not ever return a non-empty list of domains a commit could not be \ + \sent to. The remote end returned: " + <> LT.pack (intercalate ", " (show <$> Set.toList (Set.map domainText ds))) MLSMessageResponseUpdates updates -> do - fmap fst . runOutputList $ - for_ updates $ \update -> do + fmap fst + . runOutputList + $ for_ updates + $ \update -> do me <- updateLocalStateOfRemoteConv (qualifyAs rConvOrSubId update) con for_ me $ \e -> output (LocalConversationUpdate e update) MLSMessageResponseNonFederatingBackends e -> throw e @@ -497,8 +505,8 @@ fetchConvOrSub qusr groupId ctype convOrSubId = for convOrSubId $ \case subconv <- case msubconv of Nothing -> pure $ newSubConversationFromParent lconv sconvId Just subconv -> do - when (groupId /= subconv.scMLSData.cnvmlsGroupId) $ - throw (mlsProtocolError "The message group ID does not match the subconversation") + when (groupId /= subconv.scMLSData.cnvmlsGroupId) + $ throw (mlsProtocolError "The message group ID does not match the subconversation") pure subconv pure (SubConv c subconv) @@ -528,6 +536,6 @@ getMLSConv u mGroupId ctype lcnv = do >>= noteS @'ConvNotFound -- check that the group ID in the message matches that of the conversation for_ mGroupId $ \groupId -> - when (groupId /= mlsConv.mcMLSData.cnvmlsGroupId) $ - throw (mlsProtocolError "The message group ID does not match the conversation") + when (groupId /= mlsConv.mcMLSData.cnvmlsGroupId) + $ throw (mlsProtocolError "The message group ID does not match the conversation") pure mlsConv diff --git a/services/galley/src/Galley/API/MLS/Migration.hs b/services/galley/src/Galley/API/MLS/Migration.hs index b59fa410655..747de458cd4 100644 --- a/services/galley/src/Galley/API/MLS/Migration.hs +++ b/services/galley/src/Galley/API/MLS/Migration.hs @@ -40,10 +40,10 @@ import Wire.API.User -- does not print anything. newtype ApAll f = ApAll {unApAll :: f Bool} -instance Monad f => Semigroup (ApAll f) where +instance (Monad f) => Semigroup (ApAll f) where ApAll a <> ApAll b = ApAll $ a >>= \x -> if x then b else pure False -instance Monad f => Monoid (ApAll f) where +instance (Monad f) => Monoid (ApAll f) where mempty = ApAll (pure True) checkMigrationCriteria :: diff --git a/services/galley/src/Galley/API/MLS/One2One.hs b/services/galley/src/Galley/API/MLS/One2One.hs index 462c0beb66f..00dd1a534de 100644 --- a/services/galley/src/Galley/API/MLS/One2One.hs +++ b/services/galley/src/Galley/API/MLS/One2One.hs @@ -118,7 +118,7 @@ remoteMLSOne2OneConversation lself rother rc = -- | Create a new record for an MLS 1-1 conversation in the database and add -- the two members to it. createMLSOne2OneConversation :: - Member ConversationStore r => + (Member ConversationStore r) => Qualified UserId -> Qualified UserId -> Local MLSConversation -> diff --git a/services/galley/src/Galley/API/MLS/Propagate.hs b/services/galley/src/Galley/API/MLS/Propagate.hs index b0fe16e6c8c..bc6783bc581 100644 --- a/services/galley/src/Galley/API/MLS/Propagate.hs +++ b/services/galley/src/Galley/API/MLS/Propagate.hs @@ -85,27 +85,28 @@ propagateMessage qusr mSenderClient lConvOrSub con msg cm = do sconv = snd (qUnqualified qt) e = Event qcnv sconv qusr now $ EdMLSMessage msg.raw - runMessagePush lConvOrSub (Just qcnv) $ - newMessagePush botMap con mm (lmems >>= toList . localMemberRecipient mlsConv) e + runMessagePush lConvOrSub (Just qcnv) + $ newMessagePush botMap con mm (lmems >>= toList . localMemberRecipient mlsConv) e -- send to remotes - void $ - enqueueNotificationsConcurrently Q.Persistent (map remoteMemberQualify rmems) $ - \rs -> - fedQueueClient - @'OnMLSMessageSentTag - RemoteMLSMessage - { time = now, - sender = qusr, - metadata = mm, - conversation = qUnqualified qcnv, - subConversation = sconv, - recipients = - Map.fromList $ - tUnqualified rs - >>= toList . remoteMemberMLSClients, - message = Base64ByteString msg.raw - } + void + $ enqueueNotificationsConcurrently Q.Persistent (map remoteMemberQualify rmems) + $ \rs -> + fedQueueClient + @'OnMLSMessageSentTag + RemoteMLSMessage + { time = now, + sender = qusr, + metadata = mm, + conversation = qUnqualified qcnv, + subConversation = sconv, + recipients = + Map.fromList + $ tUnqualified rs + >>= toList + . remoteMemberMLSClients, + message = Base64ByteString msg.raw + } where cmWithoutSender = maybe cm (flip cmRemoveClient cm . mkClientIdentity qusr) mSenderClient @@ -121,6 +122,7 @@ propagateMessage qusr mSenderClient lConvOrSub con msg cm = do let remoteUserQId = tUntagged (rmId rm) remoteUserId = qUnqualified remoteUserQId clients <- - nonEmpty . map fst $ - Map.assocs (Map.findWithDefault mempty remoteUserQId cmWithoutSender) + nonEmpty + . map fst + $ Map.assocs (Map.findWithDefault mempty remoteUserQId cmWithoutSender) pure (remoteUserId, clients) diff --git a/services/galley/src/Galley/API/MLS/Proposal.hs b/services/galley/src/Galley/API/MLS/Proposal.hs index cbaba7f43db..74c94b4f792 100644 --- a/services/galley/src/Galley/API/MLS/Proposal.hs +++ b/services/galley/src/Galley/API/MLS/Proposal.hs @@ -176,13 +176,13 @@ checkProposal ciphersuite im p = case p of pure $ validateKeyPackage Nothing kp.value -- we are not checking lifetime constraints here - unless (ciphersuite == cs) $ - throw (mlsProtocolError "Key package ciphersuite does not match conversation") + unless (ciphersuite == cs) + $ throw (mlsProtocolError "Key package ciphersuite does not match conversation") RemoveProposal idx -> do void $ noteS @'MLSInvalidLeafNodeIndex $ imLookup im idx _ -> pure () -addProposedClient :: Member (State IndexMap) r => ClientIdentity -> Sem r ProposalAction +addProposedClient :: (Member (State IndexMap) r) => ClientIdentity -> Sem r ProposalAction addProposedClient cid = do im <- get let (idx, im') = imAddClient im cid @@ -220,8 +220,8 @@ applyProposal ciphersuite _groupId (AddProposal kp) = do (\msg -> throw (mlsProtocolError ("Invalid key package in Add proposal: " <> msg))) pure $ validateKeyPackage Nothing kp.value - unless (ciphersuite == cs) $ - throw (mlsProtocolError "Key package ciphersuite does not match conversation") + unless (ciphersuite == cs) + $ throw (mlsProtocolError "Key package ciphersuite does not match conversation") -- we are not checking lifetime constraints here cid <- getKeyPackageIdentity kp.value addProposedClient cid @@ -233,7 +233,7 @@ applyProposal _ciphersuite _groupId (RemoveProposal idx) = do applyProposal _activeData _groupId _ = pure mempty processProposal :: - HasProposalEffects r => + (HasProposalEffects r) => ( Member (ErrorS 'ConvNotFound) r, Member (ErrorS 'MLSStaleMessage) r ) => @@ -265,7 +265,7 @@ processProposal qusr lConvOrSub groupId epoch pub prop = do storeProposal groupId epoch propRef ProposalOriginClient prop getKeyPackageIdentity :: - Member (ErrorS 'MLSUnsupportedProposal) r => + (Member (ErrorS 'MLSUnsupportedProposal) r) => KeyPackage -> Sem r ClientIdentity getKeyPackageIdentity = @@ -299,7 +299,8 @@ checkExternalProposalUser qusr prop = do maybe (throwS @'MLSUnsupportedProposal) (flip when (throwS @'MLSUnsupportedProposal) . Set.null . Set.filter (== ciClient)) - $ userClients Map.!? ciUser + $ userClients + Map.!? ciUser _ -> throwS @'MLSUnsupportedProposal ) (const $ pure ()) -- FUTUREWORK: check external proposals from remote backends diff --git a/services/galley/src/Galley/API/MLS/Removal.hs b/services/galley/src/Galley/API/MLS/Removal.hs index 53c9a4f2a97..c689f630731 100644 --- a/services/galley/src/Galley/API/MLS/Removal.hs +++ b/services/galley/src/Galley/API/MLS/Removal.hs @@ -99,8 +99,8 @@ createAndSendRemoveProposals lConvOrSubConv indices qusr cm = void . runError @( for_ indices $ \idx -> do let proposal = mkRawMLS (RemoveProposal idx) pmsg <- - liftRandom $ - mkSignedPublicMessage @ss + liftRandom + $ mkSignedPublicMessage @ss kp (cnvmlsGroupId meta) (cnvmlsEpoch meta) @@ -263,7 +263,7 @@ removeUser lc includeMain qusr = do -- | Convert cassandra subconv maps into SubConversations listSubConversations' :: - Member SubConversationStore r => + (Member SubConversationStore r) => ConvId -> Sem r [SubConversation] listSubConversations' cid = do @@ -293,9 +293,9 @@ removeExtraneousClients qusr lconv = do mMlsConv <- mkMLSConversation (tUnqualified lconv) for_ mMlsConv $ \mlsConv -> do let allMembers = - Set.fromList $ - map (tUntagged . qualifyAs lconv . lmId) (mcLocalMembers mlsConv) - <> map (tUntagged . rmId) (mcRemoteMembers mlsConv) + Set.fromList + $ map (tUntagged . qualifyAs lconv . lmId) (mcLocalMembers mlsConv) + <> map (tUntagged . rmId) (mcRemoteMembers mlsConv) let getClients c = filter (\(cid, _) -> cidQualifiedUser cid `Set.notMember` allMembers) diff --git a/services/galley/src/Galley/API/MLS/SubConversation.hs b/services/galley/src/Galley/API/MLS/SubConversation.hs index af4df8a7482..ddfbeb054a3 100644 --- a/services/galley/src/Galley/API/MLS/SubConversation.hs +++ b/services/galley/src/Galley/API/MLS/SubConversation.hs @@ -99,14 +99,15 @@ getSubConversation lusr qconv sconv = do qconv getLocalSubConversation :: - Members - '[ SubConversationStore, - ConversationStore, - ErrorS 'ConvNotFound, - ErrorS 'ConvAccessDenied, - ErrorS 'MLSSubConvUnsupportedConvType - ] - r => + ( Members + '[ SubConversationStore, + ConversationStore, + ErrorS 'ConvNotFound, + ErrorS 'ConvAccessDenied, + ErrorS 'MLSSubConvUnsupportedConvType + ] + r + ) => Qualified UserId -> Local ConvId -> SubConvId -> @@ -114,8 +115,8 @@ getLocalSubConversation :: getLocalSubConversation qusr lconv sconv = do c <- getConversationAndCheckMembership qusr lconv - unless (Data.convType c == RegularConv) $ - throwS @'MLSSubConvUnsupportedConvType + unless (Data.convType c == RegularConv) + $ throwS @'MLSSubConvUnsupportedConvType msub <- Eff.getSubConversation (tUnqualified lconv) sconv sub <- case msub of @@ -149,8 +150,8 @@ getRemoteSubConversation :: Sem r PublicSubConversation getRemoteSubConversation lusr rcnv sconv = do res <- runFederated rcnv $ do - fedClient @'Galley @"get-sub-conversation" $ - GetSubConversationsRequest + fedClient @'Galley @"get-sub-conversation" + $ GetSubConversationsRequest { gsreqUser = tUnqualified lusr, gsreqConv = tUnqualified rcnv, gsreqSubConv = sconv @@ -186,13 +187,14 @@ getSubConversationGroupInfo lusr qcnvId subconv = do qcnvId getSubConversationGroupInfoFromLocalConv :: - Members - '[ ConversationStore, - SubConversationStore, - MemberStore - ] - r => - Members MLSGroupInfoStaticErrors r => + ( Members + '[ ConversationStore, + SubConversationStore, + MemberStore + ] + r + ) => + (Members MLSGroupInfoStaticErrors r) => Qualified UserId -> SubConvId -> Local ConvId -> @@ -275,8 +277,8 @@ deleteLocalSubConversation qusr lcnvId scnvId dsc = do -- swallowing the error and starting with GroupIdGen 0 if nextGenGroupId let newGid = fromRight - ( convToGroupId $ - groupIdParts + ( convToGroupId + $ groupIdParts (Data.convType cnv) (flip SubConv scnvId <$> tUntagged lcnvId) ) @@ -390,8 +392,8 @@ leaveLocalSubConversation cid lcnv sub = do noteS @'ConvNotFound =<< Eff.getSubConversation (tUnqualified lcnv) sub idx <- - note (mlsProtocolError "Client is not a member of the subconversation") $ - cmLookupIndex cid (scMembers subConv) + note (mlsProtocolError "Client is not a member of the subconversation") + $ cmLookupIndex cid (scMembers subConv) let (gid, epoch) = (cnvmlsGroupId &&& cnvmlsEpoch) (scMLSData subConv) -- plan to remove the leaver from the member list Eff.planClientRemoval gid (Identity cid) @@ -426,14 +428,14 @@ leaveRemoteSubConversation :: Sem r () leaveRemoteSubConversation cid rcnv sub = do res <- - runFederated rcnv $ - fedClient @'Galley @"leave-sub-conversation" $ - LeaveSubConversationRequest - { lscrUser = ciUser cid, - lscrClient = ciClient cid, - lscrConv = tUnqualified rcnv, - lscrSubConv = sub - } + runFederated rcnv + $ fedClient @'Galley @"leave-sub-conversation" + $ LeaveSubConversationRequest + { lscrUser = ciUser cid, + lscrClient = ciClient cid, + lscrConv = tUnqualified rcnv, + lscrSubConv = sub + } case res of LeaveSubConversationResponseError e -> rethrowErrors @'[ErrorS 'ConvNotFound, ErrorS 'ConvAccessDenied] e diff --git a/services/galley/src/Galley/API/MLS/Types.hs b/services/galley/src/Galley/API/MLS/Types.hs index 3274956f1bd..2c1a7d9563f 100644 --- a/services/galley/src/Galley/API/MLS/Types.hs +++ b/services/galley/src/Galley/API/MLS/Types.hs @@ -59,8 +59,9 @@ imLookup m i = IntMap.lookup (fromIntegral i) (unIndexMap m) imNextIndex :: IndexMap -> LeafIndex imNextIndex im = - fromIntegral . fromJust $ - find (\n -> not $ IntMap.member n (unIndexMap im)) [0 ..] + fromIntegral + . fromJust + $ find (\n -> not $ IntMap.member n (unIndexMap im)) [0 ..] imAddClient :: IndexMap -> ClientIdentity -> (LeafIndex, IndexMap) imAddClient im cid = let idx = imNextIndex im in (idx, IndexMap $ IntMap.insert (fromIntegral idx) cid $ unIndexMap im) @@ -169,7 +170,8 @@ newSubConversationFromParent lconv sconv = let groupId = convToGroupId . groupIdParts RegularConv - $ flip SubConv sconv <$> tUntagged lconv + $ flip SubConv sconv + <$> tUntagged lconv in newSubConversation (tUnqualified lconv) sconv groupId toPublicSubConv :: Qualified SubConversation -> PublicSubConversation diff --git a/services/galley/src/Galley/API/MLS/Util.hs b/services/galley/src/Galley/API/MLS/Util.hs index cc77d6f3dfa..ccd893655fd 100644 --- a/services/galley/src/Galley/API/MLS/Util.hs +++ b/services/galley/src/Galley/API/MLS/Util.hs @@ -111,8 +111,8 @@ withCommitLock :: withCommitLock lConvOrSubId gid epoch action = bracket ( acquireCommitLock gid epoch ttl >>= \lockAcquired -> - when (lockAcquired == NotAcquired) $ - throwS @'MLSStaleMessage + when (lockAcquired == NotAcquired) + $ throwS @'MLSStaleMessage ) (const $ releaseCommitLock gid epoch) $ \_ -> do @@ -126,7 +126,7 @@ withCommitLock lConvOrSubId gid epoch action = ttl = fromIntegral (600 :: Int) -- 10 minutes getConvFromGroupId :: - Member (Error MLSProtocolError) r => + (Member (Error MLSProtocolError) r) => GroupId -> Sem r (ConvType, Qualified ConvOrSubConvId) getConvFromGroupId gid = case groupIdToConv gid of diff --git a/services/galley/src/Galley/API/MLS/Welcome.hs b/services/galley/src/Galley/API/MLS/Welcome.hs index 6f051263247..c5c1230d07f 100644 --- a/services/galley/src/Galley/API/MLS/Welcome.hs +++ b/services/galley/src/Galley/API/MLS/Welcome.hs @@ -100,8 +100,8 @@ sendLocalWelcomes qcnv qusr con now welcome lclients = do mempty $ tUnqualified lclients let e = Event qcnv Nothing qusr now $ EdMLSWelcome welcome.raw - runMessagePush lclients (Just qcnv) $ - newMessagePush mempty con defMessageMetadata rcpts e + runMessagePush lclients (Just qcnv) + $ newMessagePush mempty con defMessageMetadata rcpts e sendRemoteWelcomes :: ( Member FederatorAccess r, @@ -124,7 +124,7 @@ sendRemoteWelcomes qcnv qusr welcome clients = do } where handleError :: - Member P.TinyLog r => + (Member P.TinyLog r) => Either (Remote [a], FederationError) (Remote MLSWelcomeResponse) -> Sem r () handleError (Right x) = case tUnqualified x of @@ -132,9 +132,9 @@ sendRemoteWelcomes qcnv qusr welcome clients = do MLSWelcomeMLSNotEnabled -> logFedError x (errorToResponse @'MLSNotEnabled) handleError (Left (r, e)) = logFedError r (toResponse e) - logFedError :: Member P.TinyLog r => Remote x -> JSONResponse -> Sem r () + logFedError :: (Member P.TinyLog r) => Remote x -> JSONResponse -> Sem r () logFedError r e = - P.warn $ - Logger.msg ("A welcome message could not be delivered to a remote backend" :: ByteString) - . Logger.field "remote_domain" (domainText (tDomain r)) - . Logger.field "error" (A.encode e.value) + P.warn + $ Logger.msg ("A welcome message could not be delivered to a remote backend" :: ByteString) + . Logger.field "remote_domain" (domainText (tDomain r)) + . Logger.field "error" (A.encode e.value) diff --git a/services/galley/src/Galley/API/Mapping.hs b/services/galley/src/Galley/API/Mapping.hs index ec6f0993e12..078e7c8b423 100644 --- a/services/galley/src/Galley/API/Mapping.hs +++ b/services/galley/src/Galley/API/Mapping.hs @@ -71,11 +71,12 @@ conversationViewWithCachedOthers remoteOthers localOthers conv luid = do maybe memberNotFound pure mbConv where memberNotFound = do - P.err . msg $ - val "User " - +++ idToText (tUnqualified luid) - +++ val " is not a member of conv " - +++ idToText (Data.convId conv) + P.err + . msg + $ val "User " + +++ idToText (tUnqualified luid) + +++ val " is not a member of conv " + +++ idToText (Data.convId conv) throw BadMemberState -- | View for a given user of a stored conversation. @@ -86,8 +87,8 @@ conversationViewMaybe luid remoteOthers localOthers conv = do let selfs = filter ((tUnqualified luid ==) . lmId) (Data.convLocalMembers conv) self <- localMemberToSelf luid <$> listToMaybe selfs let others = filter (\oth -> tUntagged luid /= omQualifiedId oth) localOthers <> remoteOthers - pure $ - Conversation + pure + $ Conversation (tUntagged . qualifyAs luid . Data.convId $ conv) (Data.convMetadata conv) (ConvMembers self others) @@ -133,8 +134,8 @@ conversationToRemote localDomain ruid conv = do let others' = map (localMemberToOther localDomain) lothers <> map remoteMemberToOther rothers - pure $ - RemoteConversation + pure + $ RemoteConversation { id = Data.convId conv, metadata = Data.convMetadata conv, members = diff --git a/services/galley/src/Galley/API/Message.hs b/services/galley/src/Galley/API/Message.hs index 8d0d8dba25c..22122788d15 100644 --- a/services/galley/src/Galley/API/Message.hs +++ b/services/galley/src/Galley/API/Message.hs @@ -229,7 +229,9 @@ getRemoteClients remoteMembers = where getRemoteClientsFromDomain :: Remote [UserId] -> FederatorClient 'Brig (Map (Domain, UserId) (Set ClientId)) getRemoteClientsFromDomain (tUntagged -> Qualified uids domain) = - Map.mapKeys (domain,) . fmap (Set.map pubClientId) . userMap + Map.mapKeys (domain,) + . fmap (Set.map pubClientId) + . userMap <$> fedClient @'Brig @"get-user-clients" (GetUserClients uids) postRemoteOtrMessage :: @@ -280,8 +282,8 @@ postBroadcast lusr con msg = runError $ do tid <- lookupBindingTeam senderUser limit <- fromIntegral . fromRange <$> fanoutLimit -- If we are going to fan this out to more than limit, we want to fail early - unless (Map.size rcps <= limit) $ - throwS @'BroadcastLimitExceeded + unless (Map.size rcps <= limit) + $ throwS @'BroadcastLimitExceeded -- In large teams, we may still use the broadcast endpoint but only if `report_missing` -- is used and length `report_missing` < limit since we cannot fetch larger teams than -- that. @@ -341,8 +343,8 @@ postBroadcast lusr con msg = runError $ do maybeFetchLimitedTeamMemberList limit tid localUserIdsInFilter rcps = do let localUserIdsInRcps = Map.keys rcps let localUserIdsToLookup = Set.toList $ Set.union (Set.fromList localUserIdsInFilter) (Set.fromList localUserIdsInRcps) - unless (length localUserIdsToLookup <= limit) $ - throwS @'BroadcastLimitExceeded + unless (length localUserIdsToLookup <= limit) + $ throwS @'BroadcastLimitExceeded selectTeamMembers tid localUserIdsToLookup maybeFetchAllMembersInTeam :: @@ -353,8 +355,8 @@ postBroadcast lusr con msg = runError $ do Sem r [TeamMember] maybeFetchAllMembersInTeam tid = do mems <- getTeamMembersForFanout tid - when (mems ^. teamMemberListType == ListTruncated) $ - throwS @'BroadcastLimitExceeded + when (mems ^. teamMemberListType == ListTruncated) + $ throwS @'BroadcastLimitExceeded pure (mems ^. teamMembers) postQualifiedOtrMessage :: @@ -389,8 +391,8 @@ postQualifiedOtrMessage senderType sender mconn lcnv msg = let senderClient = qualifiedNewOtrSender msg conv <- getConversation (tUnqualified lcnv) >>= noteS @'ConvNotFound - unless (protocolTag (convProtocol conv) `elem` [ProtocolProteusTag, ProtocolMixedTag]) $ - throwS @'InvalidOperation + unless (protocolTag (convProtocol conv) `elem` [ProtocolProteusTag, ProtocolMixedTag]) + $ throwS @'InvalidOperation let localMemberIds = lmId <$> convLocalMembers conv botMap :: BotMap @@ -400,14 +402,14 @@ postQualifiedOtrMessage senderType sender mconn lcnv msg = pure (lmId mem, b) members :: Set (Qualified UserId) members = - Set.fromList $ - map (tUntagged . qualifyAs lcnv) localMemberIds - <> map (tUntagged . rmId) (convRemoteMembers conv) + Set.fromList + $ map (tUntagged . qualifyAs lcnv) localMemberIds + <> map (tUntagged . rmId) (convRemoteMembers conv) isInternal <- view (settings . intraListing) <$> input -- check if the sender is part of the conversation - unless (Set.member sender members) $ - throwS @'ConvNotFound + unless (Set.member sender members) + $ throwS @'ConvNotFound -- get local clients localClients <- @@ -514,13 +516,13 @@ postQualifiedOtrMessage senderType sender mconn lcnv msg = tryFindClientIds :: Domain -> UserId -> Set ClientId tryFindClientIds domain uid = do - Set.fromList $ - Map.keys $ - Map.findWithDefault mempty uid $ - Map.findWithDefault mempty domain $ - qualifiedUserClientMap $ - qualifiedOtrRecipientsMap $ - qualifiedNewOtrRecipients msg + Set.fromList + $ Map.keys + $ Map.findWithDefault mempty uid + $ Map.findWithDefault mempty domain + $ qualifiedUserClientMap + $ qualifiedOtrRecipientsMap + $ qualifiedNewOtrRecipients msg guardQualifiedLegalholdPolicyConflictsWrapper :: ( Member BrigAccess r, @@ -566,7 +568,7 @@ guardQualifiedLegalholdPolicyConflictsWrapper senderType sender localClients qua -- FUTUREWORK: This is just a workaround and would not be needed if we had a proper monoid/semigroup instance for Map where the values have a monoid instance. collectFailedToSend :: - Foldable f => + (Foldable f) => f (Map Domain (Map UserId (Set ClientId))) -> Map Domain (Map UserId (Set ClientId)) collectFailedToSend = foldr (Map.unionWith (Map.unionWith Set.union)) mempty @@ -702,11 +704,11 @@ sendRemoteMessages domain now sender senderClient lcnv metadata messages = handle :: Either FederationError a -> Sem r (Set (UserId, ClientId)) handle (Right _) = pure mempty handle (Left e) = do - P.warn $ - Log.field "conversation" (toByteString' (tUnqualified lcnv)) - Log.~~ Log.field "domain" (toByteString' (tDomain domain)) - Log.~~ Log.field "exception" (encode (federationErrorToWai e)) - Log.~~ Log.msg ("Remote message sending failed" :: Text) + P.warn + $ Log.field "conversation" (toByteString' (tUnqualified lcnv)) + Log.~~ Log.field "domain" (toByteString' (tDomain domain)) + Log.~~ Log.field "exception" (encode (federationErrorToWai e)) + Log.~~ Log.msg ("Remote message sending failed" :: Text) pure (Map.keysSet messages) flattenMap :: QualifiedOtrRecipients -> Map (Domain, UserId, ClientId) ByteString @@ -724,8 +726,9 @@ newMessageEvent :: Event newMessageEvent mconvId sender senderClient dat time (receiver, receiverClient) cipherText = let convId = fromMaybe (tUntagged (fmap selfConv receiver)) mconvId - in Event convId Nothing sender time . EdOtrMessage $ - OtrMessage + in Event convId Nothing sender time + . EdOtrMessage + $ OtrMessage { otrSender = senderClient, otrRecipient = receiverClient, otrCiphertext = cipherText, @@ -766,6 +769,6 @@ instance Unqualify QualifiedUserClients UserClients where . Map.findWithDefault mempty domain . qualifiedUserClients -instance Unqualify a b => Unqualify (PostOtrResponse a) (PostOtrResponse b) where +instance (Unqualify a b) => Unqualify (PostOtrResponse a) (PostOtrResponse b) where unqualify domain (Left a) = Left (unqualify domain <$> a) unqualify domain (Right a) = Right (unqualify domain a) diff --git a/services/galley/src/Galley/API/One2One.hs b/services/galley/src/Galley/API/One2One.hs index 05b1d16b9c4..9a9e8293416 100644 --- a/services/galley/src/Galley/API/One2One.hs +++ b/services/galley/src/Galley/API/One2One.hs @@ -71,24 +71,25 @@ iUpsertOne2OneConversation UpsertOne2OneConversationRequest {..} = do (LocalActor, Excluded) -> mempty (RemoteActor, Included) -> ulFromRemotes [uooRemoteUser] (RemoteActor, Excluded) -> mempty - unless (null members) . void $ - createConversation + unless (null members) + . void + $ createConversation lconvId (newConnectConversationWithRemote uooLocalUser members) Just conv -> do case (uooActor, uooActorDesiredMembership) of (LocalActor, Included) -> do void $ createMember lconvId uooLocalUser - unless (null (convRemoteMembers conv)) $ - acceptConnectConversation (tUnqualified lconvId) + unless (null (convRemoteMembers conv)) + $ acceptConnectConversation (tUnqualified lconvId) (LocalActor, Excluded) -> do deleteMembers (tUnqualified lconvId) (UserList [tUnqualified uooLocalUser] []) (RemoteActor, Included) -> do void $ createMembers (tUnqualified lconvId) (UserList [] [uooRemoteUser]) - unless (null (convLocalMembers conv)) $ - acceptConnectConversation (tUnqualified lconvId) + unless (null (convLocalMembers conv)) + $ acceptConnectConversation (tUnqualified lconvId) (RemoteActor, Excluded) -> deleteMembers (tUnqualified lconvId) diff --git a/services/galley/src/Galley/API/Public/Bot.hs b/services/galley/src/Galley/API/Public/Bot.hs index 6a7dc0bd138..f7b0376439c 100644 --- a/services/galley/src/Galley/API/Public/Bot.hs +++ b/services/galley/src/Galley/API/Public/Bot.hs @@ -59,5 +59,5 @@ getBotConversation :: ConvId -> Sem r BotConvView getBotConversation bid cnv = - Features.guardSecondFactorDisabled (botUserId bid) cnv $ - Query.getBotConversation bid cnv + Features.guardSecondFactorDisabled (botUserId bid) cnv + $ Query.getBotConversation bid cnv diff --git a/services/galley/src/Galley/API/Public/TeamNotification.hs b/services/galley/src/Galley/API/Public/TeamNotification.hs index f8e5a828096..85e4c00358e 100644 --- a/services/galley/src/Galley/API/Public/TeamNotification.hs +++ b/services/galley/src/Galley/API/Public/TeamNotification.hs @@ -41,7 +41,7 @@ getTeamNotifications uid since size = do (fromMaybe defaultSize size) where checkSince :: - Member (ErrorS 'InvalidTeamNotificationId) r => + (Member (ErrorS 'InvalidTeamNotificationId) r) => Maybe NotificationId -> Sem r (Maybe NotificationId) checkSince Nothing = pure Nothing diff --git a/services/galley/src/Galley/API/Push.hs b/services/galley/src/Galley/API/Push.hs index b501c804009..c66a8ae73a4 100644 --- a/services/galley/src/Galley/API/Push.hs +++ b/services/galley/src/Galley/API/Push.hs @@ -61,7 +61,7 @@ instance ToRecipient Recipient where toRecipient = id newMessagePush :: - ToRecipient r => + (ToRecipient r) => BotMap -> Maybe ConnId -> MessageMetadata -> @@ -98,6 +98,6 @@ toPush (MessagePush mconn mm rs _ event) = let usr = qUnqualified (evtFrom event) in newPush (Just usr) (toJSONObject event) rs <&> set pushConn mconn - . set pushNativePriority (mmNativePriority mm) - . set pushRoute (bool RouteDirect RouteAny (mmNativePush mm)) - . set pushTransient (mmTransient mm) + . set pushNativePriority (mmNativePriority mm) + . set pushRoute (bool RouteDirect RouteAny (mmNativePush mm)) + . set pushTransient (mmTransient mm) diff --git a/services/galley/src/Galley/API/Query.hs b/services/galley/src/Galley/API/Query.hs index 5f0e76809ed..7d7fa051636 100644 --- a/services/galley/src/Galley/API/Query.hs +++ b/services/galley/src/Galley/API/Query.hs @@ -263,13 +263,13 @@ getRemoteConversationsWithFailures lusr convs = do <$> traverse handleFailure resp where handleFailure :: - Member P.TinyLog r => + (Member P.TinyLog r) => Either (Remote [ConvId], FederationError) (Remote GetConversationsResponse) -> Sem r (Either FailedGetConversation [Remote RemoteConversation]) handleFailure (Left (rcids, e)) = do - P.warn $ - Logger.msg ("Error occurred while fetching remote conversations" :: ByteString) - . Logger.field "error" (show e) + P.warn + $ Logger.msg ("Error occurred while fetching remote conversations" :: ByteString) + . Logger.field "error" (show e) pure . Left $ failedGetConversationRemotely (sequenceA rcids) e handleFailure (Right c) = pure . Right . traverse (.convs) $ c @@ -288,7 +288,7 @@ getConversationRoles lusr cnv = do pure $ Public.ConversationRolesList wireConvRoles conversationIdsPageFromUnqualified :: - Member (ListItems LegacyPaging ConvId) r => + (Member (ListItems LegacyPaging ConvId) r) => Local UserId -> Maybe ConvId -> Maybe (Range 1 1000 Int32) -> @@ -296,8 +296,8 @@ conversationIdsPageFromUnqualified :: conversationIdsPageFromUnqualified lusr start msize = do let size = fromMaybe (toRange (Proxy @1000)) msize ids <- E.listItems (tUnqualified lusr) start size - pure $ - Public.ConversationList + pure + $ Public.ConversationList (resultSetResult ids) (resultSetType ids == ResultSetTruncated) @@ -351,8 +351,8 @@ conversationIdsPageFromV2 listGlobalSelf lusr Public.GetMultiTablePageRequest {. else do -- remainingSize <= size and remainingSize >= 1, so it is safe to convert to Range remotePage <- remotesOnly Nothing (unsafeRange remainingSize) - pure $ - remotePage + pure + $ remotePage { Public.mtpResults = Public.mtpResults (filterOut localPage) <> Public.mtpResults remotePage @@ -488,7 +488,7 @@ getConversationsInternal luser mids mstart msize = do pure (hasMore, resultSetResult r) removeDeleted :: - Member ConversationStore r => + (Member ConversationStore r) => Data.Conversation -> Sem r Bool removeDeleted c @@ -520,17 +520,18 @@ listConversations luser (Public.ListConversations ids) = do failedConvs = failedConvsLocally <> failedConvsRemotely fetchedOrFailedRemoteIds = Set.fromList $ map Public.cnvQualifiedId remoteConversations <> failedConvs remoteNotFoundRemoteIds = filter (`Set.notMember` fetchedOrFailedRemoteIds) $ map tUntagged remoteIds - unless (null remoteNotFoundRemoteIds) $ + unless (null remoteNotFoundRemoteIds) + $ -- FUTUREWORK: This implies that the backends are out of sync. Maybe the -- current user should be considered removed from this conversation at this -- point. - P.warn $ - Logger.msg ("Some locally found conversation ids were not returned by remotes" :: ByteString) - . Logger.field "convIds" (show remoteNotFoundRemoteIds) + P.warn + $ Logger.msg ("Some locally found conversation ids were not returned by remotes" :: ByteString) + . Logger.field "convIds" (show remoteNotFoundRemoteIds) let allConvs = localConversations <> remoteConversations - pure $ - Public.ConversationsResponse + pure + $ Public.ConversationsResponse { crFound = allConvs, crNotFound = failedConvsLocally @@ -540,7 +541,7 @@ listConversations luser (Public.ListConversations ids) = do } where removeDeleted :: - Member ConversationStore r => + (Member ConversationStore r) => Data.Conversation -> Sem r Bool removeDeleted c @@ -792,9 +793,9 @@ getRemoteMLSOne2OneConversation lself qother rconv = do else throw (InternalErrorWithDescription "Unexpected 1-1 conversation domain") resp <- - E.runFederated rconv $ - fedClient @'Galley @"get-one2one-conversation" $ - GetOne2OneConversationRequest (tUnqualified lself) (tUnqualified rother) + E.runFederated rconv + $ fedClient @'Galley @"get-one2one-conversation" + $ GetOne2OneConversationRequest (tUnqualified lself) (tUnqualified rother) case resp of GetOne2OneConversationOk rc -> pure (remoteMLSOne2OneConversation lself rother rc) @@ -832,7 +833,7 @@ isMLSOne2OneEstablished lself qother = do convId isLocalMLSOne2OneEstablished :: - Member ConversationStore r => + (Member ConversationStore r) => Local ConvId -> Sem r Bool isLocalMLSOne2OneEstablished lconv = do diff --git a/services/galley/src/Galley/API/Teams.hs b/services/galley/src/Galley/API/Teams.hs index d92aa3b2097..154c0e8455f 100644 --- a/services/galley/src/Galley/API/Teams.hs +++ b/services/galley/src/Galley/API/Teams.hs @@ -182,7 +182,7 @@ getTeamNameInternalH :: getTeamNameInternalH tid = getTeamNameInternal tid >>= noteS @'TeamNotFound -getTeamNameInternal :: Member TeamStore r => TeamId -> Sem r (Maybe TeamName) +getTeamNameInternal :: (Member TeamStore r) => TeamId -> Sem r (Maybe TeamName) getTeamNameInternal = fmap (fmap TeamName) . E.getTeamName -- | DEPRECATED. @@ -246,13 +246,14 @@ createNonBindingTeamH zusr zcon (Public.NonBindingNewTeam body) = do let others = filter ((zusr /=) . view userId) . maybe [] fromRange - $ body ^. newTeamMembers + $ body + ^. newTeamMembers let zothers = map (view userId) others ensureUnboundUsers (zusr : zothers) ensureConnectedToLocals zusr zothers - P.debug $ - Log.field "targets" (toByteString . show $ toByteString <$> zothers) - . Log.field "action" (Log.val "Teams.createNonBindingTeam") + P.debug + $ Log.field "targets" (toByteString . show $ toByteString <$> zothers) + . Log.field "action" (Log.val "Teams.createNonBindingTeam") team <- E.createTeam Nothing @@ -310,7 +311,7 @@ updateTeamStatus tid (TeamStatusUpdate newStatus cur) = do else possiblyStaleSize Journal.teamActivate tid size c teamCreationTime runJournal _ _ = throwS @'InvalidTeamStatusUpdate - validateTransition :: Member (ErrorS 'InvalidTeamStatusUpdate) r => (TeamStatus, TeamStatus) -> Sem r Bool + validateTransition :: (Member (ErrorS 'InvalidTeamStatusUpdate) r) => (TeamStatus, TeamStatus) -> Sem r Bool validateTransition = \case (PendingActive, Active) -> pure True (Active, Active) -> pure False @@ -513,13 +514,13 @@ getTeamMembers lzusr tid mbMaxResults mbPagingState = do toTeamMembersPage :: TeamMember -> C.PageWithState TeamMember -> TeamMembersPage toTeamMembersPage member p = let withPerms = (member `canSeePermsOf`) - in TeamMembersPage $ - MultiTablePage + in TeamMembersPage + $ MultiTablePage (map (setOptionalPerms withPerms) $ pwsResults p) (pwsHasMore p) (teamMemberPagingState p) -outputToStreamingBody :: Member (Final IO) r => Sem (Output LByteString ': r) () -> Sem r StreamingBody +outputToStreamingBody :: (Member (Final IO) r) => Sem (Output LByteString ': r) () -> Sem r StreamingBody outputToStreamingBody action = withWeavingToFinal @IO $ \state weave _inspect -> pure . (<$ state) $ \write flush -> do let writeChunk c = embedFinal $ do @@ -549,8 +550,8 @@ getTeamMembersCSV lusr tid = do -- reaches the middleware and is being tracked in logging and metrics. outputToStreamingBody $ do output headerLine - E.withChunks (\mps -> E.listTeamMembers @InternalPaging tid mps maxBound) $ - \members -> do + E.withChunks (\mps -> E.listTeamMembers @InternalPaging tid mps maxBound) + $ \members -> do let uids = fmap (view userId) members teamExportUser <- mkTeamExportUser @@ -588,8 +589,8 @@ getTeamMembersCSV lusr tid = do mkTeamExportUser users inviters richInfos numClients scimUserInfo member = do let uid = member ^. userId user <- users uid - pure $ - TeamExportUser + pure + $ TeamExportUser { tExportDisplayName = U.userDisplayName user, tExportHandle = U.userHandle user, tExportEmail = U.userIdentity user >>= U.emailIdentity, @@ -605,7 +606,7 @@ getTeamMembersCSV lusr tid = do tExportNumDevices = numClients uid } - lookupInviterHandle :: Member BrigAccess r => [TeamMember] -> Sem r (UserId -> Maybe Handle.Handle) + lookupInviterHandle :: (Member BrigAccess r) => [TeamMember] -> Sem r (UserId -> Maybe Handle.Handle) lookupInviterHandle members = do let inviterIds :: [UserId] inviterIds = nub $ mapMaybe (fmap fst . view invitation) members @@ -655,8 +656,8 @@ bulkGetTeamMembers :: UserIdList -> Sem r TeamMemberListOptPerms bulkGetTeamMembers lzusr tid mbMaxResults uids = do - unless (length (U.mUsers uids) <= fromIntegral (fromRange (fromMaybe (unsafeRange Public.hardTruncationLimit) mbMaxResults))) $ - throwS @'BulkGetMemberLimitExceeded + unless (length (U.mUsers uids) <= fromIntegral (fromRange (fromMaybe (unsafeRange Public.hardTruncationLimit) mbMaxResults))) + $ throwS @'BulkGetMemberLimitExceeded m <- E.getTeamMember tid (tUnqualified lzusr) >>= noteS @'NotATeamMember mems <- E.selectTeamMembers tid (U.mUsers uids) let withPerms = (m `canSeePermsOf`) @@ -691,7 +692,7 @@ uncheckedGetTeamMember tid uid = E.getTeamMember tid uid >>= noteS @'TeamMemberNotFound uncheckedGetTeamMembersH :: - Member TeamStore r => + (Member TeamStore r) => TeamId -> Maybe (Range 1 HardTruncationLimit Int32) -> Sem r TeamMemberList @@ -699,7 +700,7 @@ uncheckedGetTeamMembersH tid mMaxResults = uncheckedGetTeamMembers tid (fromMaybe (unsafeRange hardTruncationLimit) mMaxResults) uncheckedGetTeamMembers :: - Member TeamStore r => + (Member TeamStore r) => TeamId -> Range 1 HardTruncationLimit Int32 -> Sem r TeamMemberList @@ -735,9 +736,9 @@ addTeamMember :: addTeamMember lzusr zcon tid nmem = do let zusr = tUnqualified lzusr let uid = nmem ^. nUserId - P.debug $ - Log.field "targets" (toByteString uid) - . Log.field "action" (Log.val "Teams.addTeamMember") + P.debug + $ Log.field "targets" (toByteString uid) + . Log.field "action" (Log.val "Teams.addTeamMember") -- verify permissions zusrMembership <- E.getTeamMember tid zusr @@ -798,9 +799,9 @@ uncheckedUpdateTeamMember mlzusr mZcon tid newMember = do let targetMember = ntmNewTeamMember newMember let targetId = targetMember ^. userId targetPermissions = targetMember ^. permissions - P.debug $ - Log.field "targets" (toByteString targetId) - . Log.field "action" (Log.val "Teams.updateTeamMember") + P.debug + $ Log.field "targets" (toByteString targetId) + . Log.field "action" (Log.val "Teams.updateTeamMember") team <- fmap tdTeam $ E.getTeam tid >>= noteS @'TeamNotFound @@ -849,9 +850,9 @@ updateTeamMember lzusr zcon tid newMember = do let targetMember = ntmNewTeamMember newMember let targetId = targetMember ^. userId targetPermissions = targetMember ^. permissions - P.debug $ - Log.field "targets" (toByteString targetId) - . Log.field "action" (Log.val "Teams.updateTeamMember") + P.debug + $ Log.field "targets" (toByteString targetId) + . Log.field "action" (Log.val "Teams.updateTeamMember") -- get the team and verify permissions user <- @@ -874,8 +875,10 @@ updateTeamMember lzusr zcon tid newMember = do downgradesOwner :: TeamMember -> Permissions -> Bool downgradesOwner previousMember targetPermissions = - permissionsRole (previousMember ^. permissions) == Just RoleOwner - && permissionsRole targetPermissions /= Just RoleOwner + permissionsRole (previousMember ^. permissions) + == Just RoleOwner + && permissionsRole targetPermissions + /= Just RoleOwner deleteTeamMember :: ( Member BackendNotificationQueueAccess r, @@ -963,9 +966,9 @@ deleteTeamMember' :: Maybe Public.TeamMemberDeleteData -> Sem r TeamMemberDeleteResult deleteTeamMember' lusr zcon tid remove mBody = do - P.debug $ - Log.field "targets" (toByteString remove) - . Log.field "action" (Log.val "Teams.deleteTeamMember") + P.debug + $ Log.field "targets" (toByteString remove) + . Log.field "action" (Log.val "Teams.deleteTeamMember") zusrMember <- E.getTeamMember tid (tUnqualified lusr) targetMember <- E.getTeamMember tid remove void $ permissionCheck RemoveTeamMember zusrMember @@ -1000,7 +1003,7 @@ deleteTeamMember' lusr zcon tid remove mBody = do mems <- getTeamMembersForFanout tid uncheckedDeleteTeamMember lusr (Just zcon) tid remove (Right mems) ) - . wsStatus + . wsStatus pure TeamMemberDeleteCompleted -- This function is "unchecked" because it does not validate that the user has the `RemoveTeamMember` permission. @@ -1084,8 +1087,8 @@ removeFromConvsAndPushConvLeaveEvent lusr zcon tid remove = do (Set.fromList $ Conv.lmId <$> allLocUsers) (Set.fromList $ Conv.rmId <$> Data.convRemoteMembers dc) (Set.fromList bots) - void $ - notifyConversationAction + void + $ notifyConversationAction (sing @'ConversationRemoveMembersTag) (tUntagged lusr) True @@ -1109,8 +1112,8 @@ getTeamConversations zusr tid = do tm <- E.getTeamMember tid zusr >>= noteS @'NotATeamMember - unless (tm `hasPermission` GetTeamConversations) $ - throwS @OperationDenied + unless (tm `hasPermission` GetTeamConversations) + $ throwS @OperationDenied Public.newTeamConversationList <$> E.getTeamConversations tid getTeamConversation :: @@ -1127,8 +1130,8 @@ getTeamConversation zusr tid cid = do tm <- E.getTeamMember tid zusr >>= noteS @'NotATeamMember - unless (tm `hasPermission` GetTeamConversations) $ - throwS @OperationDenied + unless (tm `hasPermission` GetTeamConversations) + $ throwS @OperationDenied E.getTeamConversation tid cid >>= noteS @'ConvNotFound @@ -1236,8 +1239,8 @@ ensureUnboundUsers uids = do -- can only be part of one team. teams <- Map.elems <$> E.getUsersTeams uids binds <- E.getTeamsBindings teams - when (Binding `elem` binds) $ - throwS @'UserBindingExists + when (Binding `elem` binds) + $ throwS @'UserBindingExists ensureNonBindingTeam :: ( Member (ErrorS 'TeamNotFound) r, @@ -1248,12 +1251,12 @@ ensureNonBindingTeam :: Sem r () ensureNonBindingTeam tid = do team <- noteS @'TeamNotFound =<< E.getTeam tid - when (tdTeam team ^. teamBinding == Binding) $ - throwS @'NoAddToBinding + when (tdTeam team ^. teamBinding == Binding) + $ throwS @'NoAddToBinding -- ensure that the permissions are not "greater" than the user's copy permissions -- this is used to ensure users cannot "elevate" permissions -ensureNotElevated :: Member (ErrorS 'InvalidPermissions) r => Permissions -> TeamMember -> Sem r () +ensureNotElevated :: (Member (ErrorS 'InvalidPermissions) r) => Permissions -> TeamMember -> Sem r () ensureNotElevated targetPermissions member = unless ( (targetPermissions ^. self) @@ -1271,8 +1274,8 @@ ensureNotTooLarge :: ensureNotTooLarge tid = do o <- input (TeamSize size) <- E.getSize tid - unless (size < fromIntegral (o ^. settings . maxTeamSize)) $ - throwS @'TooManyTeamMembers + unless (size < fromIntegral (o ^. settings . maxTeamSize)) + $ throwS @'TooManyTeamMembers pure $ TeamSize size -- | Ensure that a team doesn't exceed the member count limit for the LegalHold @@ -1295,9 +1298,9 @@ ensureNotTooLargeForLegalHold :: Int -> Sem r () ensureNotTooLargeForLegalHold tid teamSize = - whenM (isLegalHoldEnabledForTeam tid) $ - unlessM (teamSizeBelowLimit teamSize) $ - throwS @'TooManyTeamMembersOnTeamWithLegalhold + whenM (isLegalHoldEnabledForTeam tid) + $ unlessM (teamSizeBelowLimit teamSize) + $ throwS @'TooManyTeamMembersOnTeamWithLegalhold addTeamMemberInternal :: ( Member BrigAccess r, @@ -1316,9 +1319,9 @@ addTeamMemberInternal :: NewTeamMember -> Sem r TeamSize addTeamMemberInternal tid origin originConn (ntmNewTeamMember -> new) = do - P.debug $ - Log.field "targets" (toByteString (new ^. userId)) - . Log.field "action" (Log.val "Teams.addTeamMemberInternal") + P.debug + $ Log.field "targets" (toByteString (new ^. userId)) + . Log.field "action" (Log.val "Teams.addTeamMemberInternal") sizeBeforeAdd <- ensureNotTooLarge tid admins <- E.getTeamAdmins tid @@ -1353,8 +1356,8 @@ finishCreateTeam :: Sem r () finishCreateTeam team owner others zcon = do let zusr = owner ^. userId - for_ (owner : others) $ - E.createTeamMember (team ^. teamId) + for_ (owner : others) + $ E.createTeamMember (team ^. teamId) now <- input let e = newEvent (team ^. teamId) now (EdTeamCreate team) let r = membersToRecipients Nothing others @@ -1405,7 +1408,7 @@ canUserJoinTeam tid = do -- | Modify and get visibility type for a team (internal, no user permission checks) getSearchVisibilityInternal :: - Member SearchVisibilityStore r => + (Member SearchVisibilityStore r) => TeamId -> Sem r TeamSearchVisibilityView getSearchVisibilityInternal = @@ -1422,8 +1425,8 @@ setSearchVisibilityInternal :: TeamSearchVisibilityView -> Sem r () setSearchVisibilityInternal availableForTeam tid (TeamSearchVisibilityView searchVisibility) = do - unlessM (availableForTeam tid) $ - throwS @'TeamSearchVisibilityNotEnabled + unlessM (availableForTeam tid) + $ throwS @'TeamSearchVisibilityNotEnabled SearchVisibilityData.setSearchVisibility tid searchVisibility userIsTeamOwner :: @@ -1454,7 +1457,7 @@ queueTeamDeletion tid zusr zcon = do ok <- E.tryPush (TeamItem tid zusr zcon) unless ok $ throwS @'DeleteQueueFull -checkAdminLimit :: Member (ErrorS 'TooManyTeamAdmins) r => Int -> Sem r () +checkAdminLimit :: (Member (ErrorS 'TooManyTeamAdmins) r) => Int -> Sem r () checkAdminLimit adminCount = - when (adminCount > 2000) $ - throwS @'TooManyTeamAdmins + when (adminCount > 2000) + $ throwS @'TooManyTeamAdmins diff --git a/services/galley/src/Galley/API/Teams/Features.hs b/services/galley/src/Galley/API/Teams/Features.hs index 1542b701b12..22698e841c8 100644 --- a/services/galley/src/Galley/API/Teams/Features.hs +++ b/services/galley/src/Galley/API/Teams/Features.hs @@ -202,16 +202,16 @@ pushFeatureConfigEvent tid event = do memList <- getTeamMembersForFanout tid if ((memList ^. teamMemberListType) == ListTruncated) then do - P.warn $ - Log.field "action" (Log.val "Features.pushFeatureConfigEvent") - . Log.field "feature" (Log.val (toByteString' . Event._eventFeatureName $ event)) - . Log.field "team" (Log.val (UTF8.fromString . show $ tid)) - . Log.msg @Text "Fanout limit exceeded. Events will not be sent." + P.warn + $ Log.field "action" (Log.val "Features.pushFeatureConfigEvent") + . Log.field "feature" (Log.val (toByteString' . Event._eventFeatureName $ event)) + . Log.field "team" (Log.val (UTF8.fromString . show $ tid)) + . Log.msg @Text "Fanout limit exceeded. Events will not be sent." else do let recipients = membersToRecipients Nothing (memList ^. teamMembers) - pushNotifications $ - maybeToList $ - (newPush Nothing (toJSONObject event) recipients) + pushNotifications + $ maybeToList + $ (newPush Nothing (toJSONObject event) recipients) guardLockStatus :: forall r. @@ -226,7 +226,7 @@ guardLockStatus = \case -- SetFeatureConfig instances -- | Don't export methods of this typeclass -class GetFeatureConfig cfg => SetFeatureConfig cfg where +class (GetFeatureConfig cfg) => SetFeatureConfig cfg where type SetConfigForTeamConstraints cfg (r :: EffectRow) :: Constraint type SetConfigForTeamConstraints cfg (r :: EffectRow) = () @@ -349,8 +349,8 @@ instance SetFeatureConfig AppLockConfig where type SetConfigForTeamConstraints AppLockConfig r = Member (Error TeamFeatureError) r setConfigForTeam tid wsnl = do - when ((applockInactivityTimeoutSecs . wssConfig $ wsnl) < 30) $ - throw AppLockInactivityTimeoutTooLow + when ((applockInactivityTimeoutSecs . wssConfig $ wsnl) < 30) + $ throw AppLockInactivityTimeoutTooLow persistAndPushEvent tid wsnl instance SetFeatureConfig ConferenceCallingConfig @@ -373,7 +373,8 @@ instance SetFeatureConfig MLSConfig where mlsMigrationConfig <- getConfigForTeam @MlsMigrationConfig tid unless ( -- default protocol needs to be included in supported protocols - mlsDefaultProtocol (wssConfig wsnl) `elem` mlsSupportedProtocols (wssConfig wsnl) + mlsDefaultProtocol (wssConfig wsnl) + `elem` mlsSupportedProtocols (wssConfig wsnl) -- when MLS migration is enabled, MLS needs to be enabled as well && (wsStatus mlsMigrationConfig == FeatureStatusDisabled || wssStatus wsnl == FeatureStatusEnabled) ) diff --git a/services/galley/src/Galley/API/Teams/Features/Get.hs b/services/galley/src/Galley/API/Teams/Features/Get.hs index 79f1b4e0ba8..685266b3ea1 100644 --- a/services/galley/src/Galley/API/Teams/Features/Get.hs +++ b/services/galley/src/Galley/API/Teams/Features/Get.hs @@ -56,7 +56,7 @@ import Wire.API.Team.Feature data DoAuth = DoAuth UserId | DontDoAuth -- | Don't export methods of this typeclass -class IsFeatureConfig cfg => GetFeatureConfig cfg where +class (IsFeatureConfig cfg) => GetFeatureConfig cfg where type GetConfigForTeamConstraints cfg (r :: EffectRow) :: Constraint type GetConfigForTeamConstraints cfg (r :: EffectRow) = @@ -76,7 +76,7 @@ class IsFeatureConfig cfg => GetFeatureConfig cfg where ) getConfigForServer :: - Member (Input Opts) r => + (Member (Input Opts) r) => Sem r (WithStatus cfg) -- only override if there is additional business logic for getting the feature config -- and/or if the feature flag is configured for the backend in 'FeatureFlags' for galley in 'Galley.Types.Teams' @@ -85,7 +85,7 @@ class IsFeatureConfig cfg => GetFeatureConfig cfg where getConfigForServer = pure defFeatureStatus getConfigForTeam :: - GetConfigForTeamConstraints cfg r => + (GetConfigForTeamConstraints cfg r) => TeamId -> Sem r (WithStatus cfg) default getConfigForTeam :: @@ -97,7 +97,7 @@ class IsFeatureConfig cfg => GetFeatureConfig cfg where getConfigForTeam = genericGetConfigForTeam getConfigForUser :: - GetConfigForUserConstraints cfg r => + (GetConfigForUserConstraints cfg r) => UserId -> Sem r (WithStatus cfg) default getConfigForUser :: @@ -213,7 +213,7 @@ getAllFeatureConfigsForTeam luid tid = do getAllFeatureConfigsForServer :: forall r. - Member (Input Opts) r => + (Member (Input Opts) r) => Sem r AllFeatureConfigs getAllFeatureConfigsForServer = AllFeatureConfigs @@ -277,9 +277,9 @@ getAllFeatureConfigsUser uid = -- | Note: this is an internal function which doesn't cover all features, e.g. LegalholdConfig genericGetConfigForTeam :: forall cfg r. - GetFeatureConfig cfg => - Member TeamFeatureStore r => - Member (Input Opts) r => + (GetFeatureConfig cfg) => + (Member TeamFeatureStore r) => + (Member (Input Opts) r) => TeamId -> Sem r (WithStatus cfg) genericGetConfigForTeam tid = do @@ -291,9 +291,9 @@ genericGetConfigForTeam tid = do -- Note: this function assumes the feature cannot be locked genericGetConfigForMultiTeam :: forall cfg r. - GetFeatureConfig cfg => - Member TeamFeatureStore r => - Member (Input Opts) r => + (GetFeatureConfig cfg) => + (Member TeamFeatureStore r) => + (Member (Input Opts) r) => [TeamId] -> Sem r [(TeamId, WithStatus cfg)] genericGetConfigForMultiTeam tids = do diff --git a/services/galley/src/Galley/API/Teams/Notifications.hs b/services/galley/src/Galley/API/Teams/Notifications.hs index 5c5e040ceb4..d915f9f6b19 100644 --- a/services/galley/src/Galley/API/Teams/Notifications.hs +++ b/services/galley/src/Galley/API/Teams/Notifications.hs @@ -67,13 +67,13 @@ getTeamNotifications :: getTeamNotifications zusr since size = do tid <- (noteS @'TeamNotFound =<<) $ (userTeam . accountUser =<<) <$> Intra.getUser zusr page <- E.getTeamNotifications tid since size - pure $ - queuedNotificationList + pure + $ queuedNotificationList (toList (DataTeamQueue.resultSeq page)) (DataTeamQueue.resultHasMore page) Nothing -pushTeamEvent :: Member TeamNotificationStore r => TeamId -> Event -> Sem r () +pushTeamEvent :: (Member TeamNotificationStore r) => TeamId -> Event -> Sem r () pushTeamEvent tid evt = do nid <- E.mkNotificationId E.createTeamNotification tid nid (List1.singleton $ toJSONObject evt) diff --git a/services/galley/src/Galley/API/Update.hs b/services/galley/src/Galley/API/Update.hs index e16a7e8c96e..bf332d41f67 100644 --- a/services/galley/src/Galley/API/Update.hs +++ b/services/galley/src/Galley/API/Update.hs @@ -180,11 +180,11 @@ blockConvUnqualified :: Sem r () blockConvUnqualified zusr cnv = do conv <- E.getConversation cnv >>= noteS @'ConvNotFound - unless (Data.convType conv `elem` [ConnectConv, One2OneConv]) $ - throwS @'InvalidOperation + unless (Data.convType conv `elem` [ConnectConv, One2OneConv]) + $ throwS @'InvalidOperation let mems = Data.convLocalMembers conv - when (zusr `isMember` mems) $ - E.deleteMembers cnv (UserList [zusr] []) + when (zusr `isMember` mems) + $ E.deleteMembers cnv (UserList [zusr] []) blockRemoteConv :: ( Member (ErrorS 'ConvNotFound) r, @@ -234,8 +234,8 @@ unblockConvUnqualified :: unblockConvUnqualified lusr conn cnv = do conv <- E.getConversation cnv >>= noteS @'ConvNotFound - unless (Data.convType conv `elem` [ConnectConv, One2OneConv]) $ - throwS @'InvalidOperation + unless (Data.convType conv `elem` [ConnectConv, One2OneConv]) + $ throwS @'InvalidOperation conv' <- acceptOne2One lusr conv conn conversationView lusr conv' @@ -288,8 +288,9 @@ updateConversationAccess :: Sem r (UpdateResult Event) updateConversationAccess lusr con qcnv update = do lcnv <- ensureLocal lusr qcnv - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationAccessDataTag lcnv (tUntagged lusr) (Just con) update + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationAccessDataTag lcnv (tUntagged lusr) (Just con) update updateConversationAccessUnqualified :: ( Members UpdateConversationAccessEffects r @@ -300,8 +301,9 @@ updateConversationAccessUnqualified :: ConversationAccessData -> Sem r (UpdateResult Event) updateConversationAccessUnqualified lusr con cnv update = - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationAccessDataTag + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationAccessDataTag (qualifyAs lusr cnv) (tUntagged lusr) (Just con) @@ -335,8 +337,9 @@ updateConversationReceiptMode lusr zcon qcnv update = $ foldQualified lusr ( \lcnv -> - getUpdateResult . fmap lcuEvent $ - updateLocalConversation + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationReceiptModeUpdateTag lcnv (tUntagged lusr) @@ -422,8 +425,8 @@ updateConversationMessageTimer :: ConversationMessageTimerUpdate -> Sem r (UpdateResult Event) updateConversationMessageTimer lusr zcon qcnv update = - getUpdateResult $ - foldQualified + getUpdateResult + $ foldQualified lusr ( \lcnv -> lcuEvent @@ -479,8 +482,9 @@ deleteLocalConversation :: Local ConvId -> Sem r (UpdateResult Event) deleteLocalConversation lusr con lcnv = - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationDeleteTag lcnv (tUntagged lusr) (Just con) () + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationDeleteTag lcnv (tUntagged lusr) (Just con) () getUpdateResult :: Sem (Error NoChanges ': r) a -> Sem r (UpdateResult a) getUpdateResult = fmap (either (const Unchanged) Updated) . runError @@ -584,8 +588,10 @@ addCode lusr mbZHost mZcon lcnv mReq = do ensureGuestsOrNonTeamMembersAllowed :: Data.Conversation -> Sem r () ensureGuestsOrNonTeamMembersAllowed conv = unless - ( GuestAccessRole `Set.member` Data.convAccessRoles conv - || NonTeamMemberAccessRole `Set.member` Data.convAccessRoles conv + ( GuestAccessRole + `Set.member` Data.convAccessRoles conv + || NonTeamMemberAccessRole + `Set.member` Data.convAccessRoles conv ) $ throwS @'ConvAccessDenied @@ -674,8 +680,8 @@ checkReusableCode :: checkReusableCode convCode = do code <- verifyReusableCode False Nothing convCode conv <- E.getConversation (codeConversation code) >>= noteS @'ConvNotFound - mapErrorS @'GuestLinksDisabled @'CodeNotFound $ - Query.ensureGuestLinksEnabled (Data.convTeam conv) + mapErrorS @'GuestLinksDisabled @'CodeNotFound + $ Query.ensureGuestLinksEnabled (Data.convTeam conv) updateConversationProtocolWithLocalUser :: forall r. @@ -724,8 +730,8 @@ updateConversationProtocolWithLocalUser lusr conn qcnv (P.ProtocolUpdate newProt $ newProtocol ) ( \rcnv -> - updateRemoteConversation @'ConversationUpdateProtocolTag rcnv lusr conn $ - newProtocol + updateRemoteConversation @'ConversationUpdateProtocolTag rcnv lusr conn + $ newProtocol ) qcnv @@ -870,9 +876,10 @@ addMembers :: Sem r (UpdateResult Event) addMembers lusr zcon qcnv (InviteQualified users role) = do lcnv <- ensureLocal lusr qcnv - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationJoinTag lcnv (tUntagged lusr) (Just zcon) $ - ConversationJoin users role + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationJoinTag lcnv (tUntagged lusr) (Just zcon) + $ ConversationJoin users role addMembersUnqualifiedV2 :: ( Member BackendNotificationQueueAccess r, @@ -912,9 +919,10 @@ addMembersUnqualifiedV2 :: Sem r (UpdateResult Event) addMembersUnqualifiedV2 lusr zcon cnv (InviteQualified users role) = do let lcnv = qualifyAs lusr cnv - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationJoinTag lcnv (tUntagged lusr) (Just zcon) $ - ConversationJoin users role + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationJoinTag lcnv (tUntagged lusr) (Just zcon) + $ ConversationJoin users role addMembersUnqualified :: ( Member BackendNotificationQueueAccess r, @@ -989,7 +997,8 @@ updateSelfMember lusr zcon qcnv update = do Remote ConvId -> Sem r Bool checkRemoteMembership rcnv = - isJust . Map.lookup rcnv + isJust + . Map.lookup rcnv <$> E.getRemoteConversationStatus (tUnqualified lusr) [rcnv] updateData luid = MemberUpdateData @@ -1041,10 +1050,10 @@ updateOtherMemberLocalConv :: OtherMemberUpdate -> Sem r () updateOtherMemberLocalConv lcnv lusr con qvictim update = void . getUpdateResult . fmap lcuEvent $ do - when (tUntagged lusr == qvictim) $ - throwS @'InvalidTarget - updateLocalConversation @'ConversationMemberUpdateTag lcnv (tUntagged lusr) (Just con) $ - ConversationMemberUpdate qvictim update + when (tUntagged lusr == qvictim) + $ throwS @'InvalidTarget + updateLocalConversation @'ConversationMemberUpdateTag lcnv (tUntagged lusr) (Just con) + $ ConversationMemberUpdate qvictim update updateOtherMemberUnqualified :: ( Member BackendNotificationQueueAccess r, @@ -1159,8 +1168,8 @@ removeMemberQualified :: Qualified UserId -> Sem r (Maybe Event) removeMemberQualified lusr con qcnv victim = - mapErrorS @('ActionDenied 'LeaveConversation) @('ActionDenied 'RemoveConversationMember) $ - foldQualified + mapErrorS @('ActionDenied 'LeaveConversation) @('ActionDenied 'RemoveConversationMember) + $ foldQualified lusr (\lcnv -> removeMemberFromLocalConv lcnv lusr (Just con)) (\rcnv -> removeMemberFromRemoteConv rcnv lusr) @@ -1187,7 +1196,9 @@ removeMemberFromRemoteConv cnv lusr victim let lc = LeaveConversationRequest (tUnqualified cnv) (qUnqualified victim) let rpc = fedClient @'Galley @"leave-conversation" lc E.runFederated cnv rpc - >>= either handleError handleSuccess . void . (.response) + >>= either handleError handleSuccess + . void + . (.response) | otherwise = throwS @('ActionDenied 'RemoveConversationMember) where handleError :: @@ -1204,9 +1215,10 @@ removeMemberFromRemoteConv cnv lusr victim handleSuccess :: (Member (Input UTCTime) r) => () -> Sem r (Maybe Event) handleSuccess _ = do t <- input - pure . Just $ - Event (tUntagged cnv) Nothing (tUntagged lusr) t $ - EdMembersLeaveRemoved (QualifiedUserIdList [victim]) + pure + . Just + $ Event (tUntagged cnv) Nothing (tUntagged lusr) t + $ EdMembersLeaveRemoved (QualifiedUserIdList [victim]) -- | Remove a member from a local conversation. removeMemberFromLocalConv :: @@ -1473,8 +1485,9 @@ updateLocalConversationName :: ConversationRename -> Sem r (UpdateResult Event) updateLocalConversationName lusr zcon lcnv rename = - getUpdateResult . fmap lcuEvent $ - updateLocalConversation @'ConversationRenameTag lcnv (tUntagged lusr) (Just zcon) rename + getUpdateResult + . fmap lcuEvent + $ updateLocalConversation @'ConversationRenameTag lcnv (tUntagged lusr) (Just zcon) rename memberTyping :: ( Member NotificationSubsystem r, @@ -1608,8 +1621,8 @@ rmBot lusr zcon b = do c <- E.getConversation (b ^. rmBotConv) >>= noteS @'ConvNotFound let (bots, users) = localBotsAndUsers (Data.convLocalMembers c) - unless (tUnqualified lusr `isMember` Data.convLocalMembers c) $ - throwS @'ConvNotFound + unless (tUnqualified lusr `isMember` Data.convLocalMembers c) + $ throwS @'ConvNotFound -- A bot can remove itself (which will internally be triggered when a service is deleted), -- otherwise we have to check for the correct permissions unless (botUserId (b ^. rmBotId) == tUnqualified lusr) $ do diff --git a/services/galley/src/Galley/API/Util.hs b/services/galley/src/Galley/API/Util.hs index efd53d5af79..ae967074b86 100644 --- a/services/galley/src/Galley/API/Util.hs +++ b/services/galley/src/Galley/API/Util.hs @@ -104,9 +104,9 @@ ensureAccessRole :: Sem r () ensureAccessRole roles users = do when (Set.null roles) $ throwS @'ConvAccessDenied - unless (NonTeamMemberAccessRole `Set.member` roles) $ - when (any (isNothing . snd) users) $ - throwS @'NotATeamMember + unless (NonTeamMemberAccessRole `Set.member` roles) + $ when (any (isNothing . snd) users) + $ throwS @'NotATeamMember unless (Set.fromList [GuestAccessRole, ServiceAccessRole] `Set.isSubsetOf` roles) $ do activated <- lookupActivatedUsers (fst <$> users) let guestsExist = length activated /= length users @@ -178,8 +178,8 @@ ensureConnectedToLocals _ [] = pure () ensureConnectedToLocals u uids = do (connsFrom, connsTo) <- getConnectionsUnqualifiedBidi [u] uids (Just Accepted) (Just Accepted) - unless (length connsFrom == length uids && length connsTo == length uids) $ - throwS @'NotConnected + unless (length connsFrom == length uids && length connsTo == length uids) + $ throwS @'NotConnected ensureConnectedToRemotes :: ( Member BrigAccess r, @@ -191,8 +191,8 @@ ensureConnectedToRemotes :: ensureConnectedToRemotes _ [] = pure () ensureConnectedToRemotes u remotes = do acceptedConns <- getConnections [tUnqualified u] (Just $ map tUntagged remotes) (Just Accepted) - when (length acceptedConns /= length remotes) $ - throwS @'NotConnected + when (length acceptedConns /= length remotes) + $ throwS @'NotConnected ensureReAuthorised :: ( Member BrigAccess r, @@ -222,7 +222,7 @@ ensureActionAllowed action self = case isActionAllowed (fromSing action) (convMe -- fact that there can be no custom roles at the moment Nothing -> throwS @('ActionDenied action) -ensureGroupConversation :: Member (ErrorS 'InvalidOperation) r => Data.Conversation -> Sem r () +ensureGroupConversation :: (Member (ErrorS 'InvalidOperation) r) => Data.Conversation -> Sem r () ensureGroupConversation conv = do let ty = Data.convType conv when (ty /= RegularConv) $ throwS @'InvalidOperation @@ -239,8 +239,8 @@ ensureConvRoleNotElevated :: ensureConvRoleNotElevated origMember targetRole = do case (roleNameToActions targetRole, roleNameToActions (convMemberRole origMember)) of (Just targetActions, Just memberActions) -> - unless (Set.isSubsetOf targetActions memberActions) $ - throwS @'InvalidAction + unless (Set.isSubsetOf targetActions memberActions) + $ throwS @'InvalidAction (_, _) -> -- custom roles not supported throwS @'InvalidAction @@ -338,9 +338,10 @@ acceptOne2One lusr conv conn = do [_, _] | tUnqualified lusr `isMember` mems -> promote [_, _] -> throwS @'ConvNotFound _ -> do - when (length mems > 2) $ - throw . BadConvState $ - cid + when (length mems > 2) + $ throw + . BadConvState + $ cid now <- input mm <- createMember lcid lusr let e = memberJoinEvent lusr (tUntagged lcid) now mm [] @@ -371,14 +372,14 @@ memberJoinEvent :: [RemoteMember] -> Event memberJoinEvent lorig qconv t lmems rmems = - Event qconv Nothing (tUntagged lorig) t $ - EdMembersJoin (SimpleMembers (map localToSimple lmems <> map remoteToSimple rmems)) + Event qconv Nothing (tUntagged lorig) t + $ EdMembersJoin (SimpleMembers (map localToSimple lmems <> map remoteToSimple rmems)) where localToSimple u = SimpleMember (tUntagged (qualifyAs lorig (lmId u))) (lmConvRoleName u) remoteToSimple u = SimpleMember (tUntagged (rmId u)) (rmConvRoleName u) convDeleteMembers :: - Member MemberStore r => + (Member MemberStore r) => UserList UserId -> Data.Conversation -> Sem r Data.Conversation @@ -387,21 +388,21 @@ convDeleteMembers ul conv = do let locals = Set.fromList (ulLocals ul) remotes = Set.fromList (ulRemotes ul) -- update in-memory view of the conversation - pure $ - conv + pure + $ conv { Data.convLocalMembers = filter (\lm -> Set.notMember (lmId lm) locals) (Data.convLocalMembers conv), Data.convRemoteMembers = filter (\rm -> Set.notMember (rmId rm) remotes) (Data.convRemoteMembers conv) } -isMember :: Foldable m => UserId -> m LocalMember -> Bool +isMember :: (Foldable m) => UserId -> m LocalMember -> Bool isMember u = isJust . find ((u ==) . lmId) -isRemoteMember :: Foldable m => Remote UserId -> m RemoteMember -> Bool +isRemoteMember :: (Foldable m) => Remote UserId -> m RemoteMember -> Bool isRemoteMember u = isJust . find ((u ==) . rmId) -class IsConvMember mem => IsConvMemberId uid mem | uid -> mem where +class (IsConvMember mem) => IsConvMemberId uid mem | uid -> mem where getConvMember :: Local x -> Data.Conversation -> uid -> Maybe mem isConvMember :: Local x -> Data.Conversation -> uid -> Bool @@ -410,7 +411,7 @@ class IsConvMember mem => IsConvMemberId uid mem | uid -> mem where notIsConvMember :: Local x -> Data.Conversation -> uid -> Bool notIsConvMember loc conv = not . isConvMember loc conv -isConvMemberL :: IsConvMemberId uid mem => Local Data.Conversation -> uid -> Bool +isConvMemberL :: (IsConvMemberId uid mem) => Local Data.Conversation -> uid -> Bool isConvMemberL lconv = isConvMember lconv (tUnqualified lconv) instance IsConvMemberId UserId LocalMember where @@ -512,7 +513,7 @@ bmFromMembers lmems rusers = case localBotsAndUsers lmems of convBotsAndMembers :: Data.Conversation -> BotsAndMembers convBotsAndMembers conv = bmFromMembers (Data.convLocalMembers conv) (Data.convRemoteMembers conv) -localBotsAndUsers :: Foldable f => f LocalMember -> ([BotMember], [LocalMember]) +localBotsAndUsers :: (Foldable f) => f LocalMember -> ([BotMember], [LocalMember]) localBotsAndUsers = foldMap botOrUser where botOrUser m = case lmService m of @@ -520,7 +521,7 @@ localBotsAndUsers = foldMap botOrUser Just _ -> (toList (newBotMember m), []) Nothing -> ([], [m]) -location :: ToByteString a => a -> Response -> Response +location :: (ToByteString a) => a -> Response -> Response location = Wai.addHeader hLocation . toByteString' nonTeamMembers :: [LocalMember] -> [TeamMember] -> [LocalMember] @@ -544,15 +545,17 @@ getSelfMemberFromLocals = getMember @'ConvNotFound lmId -- | Throw 'ConvMemberNotFound' if the given user is not part of a -- conversation (either locally or remotely). ensureOtherMember :: - Member (ErrorS 'ConvMemberNotFound) r => + (Member (ErrorS 'ConvMemberNotFound) r) => Local a -> Qualified UserId -> Data.Conversation -> Sem r (Either LocalMember RemoteMember) ensureOtherMember loc quid conv = - noteS @'ConvMemberNotFound $ - Left <$> find ((== quid) . tUntagged . qualifyAs loc . lmId) (Data.convLocalMembers conv) - <|> Right <$> find ((== quid) . tUntagged . rmId) (Data.convRemoteMembers conv) + noteS @'ConvMemberNotFound + $ Left + <$> find ((== quid) . tUntagged . qualifyAs loc . lmId) (Data.convLocalMembers conv) + <|> Right + <$> find ((== quid) . tUntagged . rmId) (Data.convRemoteMembers conv) getMember :: forall e mem t userId r. @@ -627,7 +630,8 @@ getConversationAndMemberWithError usr lcnv = do canDeleteMember :: TeamMember -> TeamMember -> Bool canDeleteMember deleter deletee | getRole deletee == RoleOwner = - getRole deleter == RoleOwner -- owners can only be deleted by another owner + getRole deleter + == RoleOwner -- owners can only be deleted by another owner && (deleter ^. Mem.userId /= deletee ^. Mem.userId) -- owner cannot delete itself | otherwise = True @@ -670,8 +674,8 @@ verifyReusableCode checkPw mPtpw convCode = do (c, mPw) <- getCode (conversationKey convCode) DataTypes.ReusableCode >>= noteS @'CodeNotFound - unless (DataTypes.codeValue c == conversationCode convCode) $ - throwS @'CodeNotFound + unless (DataTypes.codeValue c == conversationCode convCode) + $ throwS @'CodeNotFound case (checkPw, mPtpw, mPw) of (True, Just ptpw, Just pw) -> unless (verifyPassword ptpw pw) $ throwS @'InvalidConversationPassword @@ -696,21 +700,21 @@ ensureConversationAccess zusr conv access = do ensureAccessRole (Data.convAccessRoles conv) [(zusr, zusrMembership)] ensureAccess :: - Member (ErrorS 'ConvAccessDenied) r => + (Member (ErrorS 'ConvAccessDenied) r) => Data.Conversation -> Access -> Sem r () ensureAccess conv access = - unless (access `elem` Data.convAccess conv) $ - throwS @'ConvAccessDenied + unless (access `elem` Data.convAccess conv) + $ throwS @'ConvAccessDenied -ensureLocal :: Member (Error FederationError) r => Local x -> Qualified a -> Sem r (Local a) +ensureLocal :: (Member (Error FederationError) r) => Local x -> Qualified a -> Sem r (Local a) ensureLocal loc = foldQualified loc pure (\_ -> throw FederationNotImplemented) -------------------------------------------------------------------------------- -- Federation -qualifyLocal :: Member (Input (Local ())) r => a -> Sem r (Local a) +qualifyLocal :: (Member (Input (Local ())) r) => a -> Sem r (Local a) qualifyLocal a = toLocalUnsafe <$> fmap getDomain input <*> pure a where getDomain :: Local () -> Domain @@ -776,7 +780,7 @@ fromConversationCreated loc rc@ConversationCreated {..} = where inDomain :: OtherMember -> Bool inDomain = (== tDomain loc) . qDomain . Public.omQualifiedId - setHoles :: Ord a => Set a -> [(a, Set a)] + setHoles :: (Ord a) => Set a -> [(a, Set a)] setHoles s = foldMap (\x -> [(x, Set.delete x s)]) s -- Currently this function creates a Member with default conversation attributes -- FUTUREWORK(federation): retrieve member's conversation attributes (muted, archived, etc) here once supported by the database schema. @@ -815,13 +819,13 @@ fromConversationCreated loc rc@ConversationCreated {..} = ProtocolProteus ensureNoUnreachableBackends :: - Member (Error UnreachableBackends) r => + (Member (Error UnreachableBackends) r) => [Either (Remote e, b) a] -> Sem r [a] ensureNoUnreachableBackends results = do let (errors, values) = partitionEithers results - unless (null errors) $ - throw (UnreachableBackends (map (tDomain . fst) errors)) + unless (null errors) + $ throw (UnreachableBackends (map (tDomain . fst) errors)) pure values -- | Notify remote users of being added to a new conversation. @@ -845,20 +849,24 @@ registerRemoteConversationMemberships now lusr lc = deleteOnUnreachable $ do allRemoteBuckets :: [Remote [RemoteMember]] = bucketRemote allRemoteMembersQualified -- ping involved remote backends - void . (ensureNoUnreachableBackends =<<) $ - runFederatedConcurrentlyEither allRemoteMembersQualified $ \_ -> + void + . (ensureNoUnreachableBackends =<<) + $ runFederatedConcurrentlyEither allRemoteMembersQualified + $ \_ -> void $ fedClient @'Brig @"api-version" () - void . (ensureNoUnreachableBackends =<<) $ + void + . (ensureNoUnreachableBackends =<<) + $ -- let remote backends know about a subset of new joiners - runFederatedConcurrentlyEither allRemoteMembersQualified $ - \rrms -> - fedClient @'Galley @"on-conversation-created" - ( rc - { nonCreatorMembers = - toMembers (tUnqualified rrms) - } - ) + runFederatedConcurrentlyEither allRemoteMembersQualified + $ \rrms -> + fedClient @'Galley @"on-conversation-created" + ( rc + { nonCreatorMembers = + toMembers (tUnqualified rrms) + } + ) -- reachable members in buckets per remote domain let joined :: [Remote [RemoteMember]] = allRemoteBuckets @@ -867,8 +875,8 @@ registerRemoteConversationMemberships now lusr lc = deleteOnUnreachable $ do foldMap ( \ruids -> let nj = - foldMap (fmap rmId . tUnqualified) $ - filter (\r -> tDomain r /= tDomain ruids) joined + foldMap (fmap rmId . tUnqualified) + $ filter (\r -> tDomain r /= tDomain ruids) joined in case NE.nonEmpty nj of Nothing -> [] Just v -> [fmap (,v) ruids] @@ -939,7 +947,7 @@ consentGiven = \case UserLegalHoldNoConsent -> ConsentNotGiven checkConsent :: - Member TeamStore r => + (Member TeamStore r) => Map UserId TeamId -> UserId -> Sem r ConsentGiven @@ -949,7 +957,7 @@ checkConsent teamsOfUsers other = do -- Get legalhold status of user. Defaults to 'defUserLegalHoldStatus' if user -- doesn't belong to a team. getLHStatus :: - Member TeamStore r => + (Member TeamStore r) => Maybe TeamId -> UserId -> Sem r UserLegalHoldStatus @@ -1006,7 +1014,7 @@ allLegalholdConsentGiven uids = do -- | Add to every uid the legalhold status getLHStatusForUsers :: - Member TeamStore r => + (Member TeamStore r) => [UserId] -> Sem r [(UserId, UserLegalHoldStatus)] getLHStatusForUsers uids = @@ -1019,7 +1027,7 @@ getLHStatusForUsers uids = (uid,) <$> getLHStatus (Map.lookup uid teamsOfUsers) uid ) -getTeamMembersForFanout :: Member TeamStore r => TeamId -> Sem r TeamMemberList +getTeamMembersForFanout :: (Member TeamStore r) => TeamId -> Sem r TeamMemberList getTeamMembersForFanout tid = do lim <- fanoutLimit getTeamMembersWithLimit tid lim @@ -1038,8 +1046,8 @@ ensureMemberLimit ProtocolMLSTag _ _ = pure () ensureMemberLimit _ old new = do o <- input let maxSize = fromIntegral (o ^. settings . maxConvSize) - when (length old + length new > maxSize) $ - throwS @'TooManyMembers + when (length old + length new > maxSize) + $ throwS @'TooManyMembers conversationExisted :: ( Member (Error InternalError) r, @@ -1094,6 +1102,6 @@ logRemoteNotificationError :: FederationError -> Sem r () logRemoteNotificationError e = - P.warn $ - Log.field "federation call" (symbolVal (Proxy @rpc)) - . Log.msg (displayException e) + P.warn + $ Log.field "federation call" (symbolVal (Proxy @rpc)) + . Log.msg (displayException e) diff --git a/services/galley/src/Galley/App.hs b/services/galley/src/Galley/App.hs index 4242b7f3cf6..effcb3345d5 100644 --- a/services/galley/src/Galley/App.hs +++ b/services/galley/src/Galley/App.hs @@ -138,10 +138,10 @@ validateOptions :: Opts -> IO (Either HttpsUrl (Map Text HttpsUrl)) validateOptions o = do let settings' = view settings o optFanoutLimit = fromIntegral . fromRange $ currentFanoutLimit o - when (settings' ^. maxConvSize > fromIntegral optFanoutLimit) $ - error "setMaxConvSize cannot be > setTruncationLimit" - when (settings' ^. maxTeamSize < optFanoutLimit) $ - error "setMaxTeamSize cannot be < setTruncationLimit" + when (settings' ^. maxConvSize > fromIntegral optFanoutLimit) + $ error "setMaxConvSize cannot be > setTruncationLimit" + when (settings' ^. maxTeamSize < optFanoutLimit) + $ error "setMaxTeamSize cannot be < setTruncationLimit" case (o ^. O.federator, o ^. rabbitmq) of (Nothing, Just _) -> error "RabbitMQ config is specified and federator is not, please specify both or none" (Just _, Nothing) -> error "Federator is specified and RabbitMQ config is not, please specify both or none" @@ -149,10 +149,10 @@ validateOptions o = do let mlsFlag = settings' ^. featureFlags . Teams.flagMLS . Teams.unDefaults mlsConfig = wsConfig mlsFlag migrationStatus = wsStatus $ settings' ^. featureFlags . Teams.flagMlsMigration . Teams.unDefaults - when (migrationStatus == FeatureStatusEnabled && ProtocolMLSTag `notElem` mlsSupportedProtocols mlsConfig) $ - error "For starting MLS migration, MLS must be included in the supportedProtocol list" - unless (mlsDefaultProtocol mlsConfig `elem` mlsSupportedProtocols mlsConfig) $ - error "The list 'settings.featureFlags.mls.supportedProtocols' must include the value in the field 'settings.featureFlags.mls.defaultProtocol'" + when (migrationStatus == FeatureStatusEnabled && ProtocolMLSTag `notElem` mlsSupportedProtocols mlsConfig) + $ error "For starting MLS migration, MLS must be included in the supportedProtocol list" + unless (mlsDefaultProtocol mlsConfig `elem` mlsSupportedProtocols mlsConfig) + $ error "The list 'settings.featureFlags.mls.supportedProtocols' must include the value in the field 'settings.featureFlags.mls.defaultProtocol'" let errMsg = "Either conversationCodeURI or multiIngress needs to be set." case (settings' ^. conversationCodeURI, settings' ^. multiIngress) of (Nothing, Nothing) -> error errMsg @@ -206,13 +206,13 @@ initHttp2Manager = do Ssl.contextAddOption ctx SSL_OP_NO_SSLv3 Ssl.contextAddOption ctx SSL_OP_NO_TLSv1 Ssl.contextSetCiphers ctx rsaCiphers - Ssl.contextSetVerificationMode ctx $ - Ssl.VerifyPeer True True Nothing + Ssl.contextSetVerificationMode ctx + $ Ssl.VerifyPeer True True Nothing Ssl.contextSetDefaultVerifyPaths ctx http2ManagerWithSSLCtx ctx interpretTinyLog :: - Member (Embed IO) r => + (Member (Embed IO) r) => Env -> Sem (P.TinyLog ': r) a -> Sem r a @@ -224,10 +224,10 @@ evalGalleyToIO env action = do r <- -- log IO exceptions runExceptT (evalGalley env action) `UnliftIO.catch` \(e :: SomeException) -> do - Log.err (env ^. applog) $ - Log.msg ("IO Exception occurred" :: ByteString) - . Log.field "message" (displayException e) - . Log.field "request" (unRequestId (env ^. reqId)) + Log.err (env ^. applog) + $ Log.msg ("IO Exception occurred" :: ByteString) + . Log.field "message" (displayException e) + . Log.field "request" (unRequestId (env ^. reqId)) UnliftIO.throwIO e case r of -- throw any errors as IO exceptions without logging them diff --git a/services/galley/src/Galley/Aws.hs b/services/galley/src/Galley/Aws.hs index 2a7050784f6..bc44b6a5fbc 100644 --- a/services/galley/src/Galley/Aws.hs +++ b/services/galley/src/Galley/Aws.hs @@ -110,8 +110,8 @@ mkEnv lgr mgr opts = do baseEnv <- AWS.newEnv AWS.discover <&> AWS.configureService (sqs (opts ^. endpoint)) - pure $ - baseEnv + pure + $ baseEnv { AWS.logger = awsLogger g, AWS.retryCheck = retryCheck, AWS.manager = mgr @@ -148,15 +148,15 @@ mkEnv lgr mgr opts = do getQueueUrl :: AWS.Env -> Text -> IO QueueUrl getQueueUrl e q = do x <- - runResourceT $ - AWS.trying AWS._Error $ - AWS.send e (SQS.newGetQueueUrl q) + runResourceT + $ AWS.trying AWS._Error + $ AWS.send e (SQS.newGetQueueUrl q) either (throwM . GeneralError) (pure . QueueUrl . view SQS.getQueueUrlResponse_queueUrl) x -execute :: MonadIO m => Env -> Amazon a -> m a +execute :: (MonadIO m) => Env -> Amazon a -> m a execute e m = liftIO $ runResourceT (runReaderT (unAmazon m) e) enqueue :: E.TeamEvent -> Amazon () @@ -186,7 +186,7 @@ sendCatch :: Amazon (Either AWS.Error (AWS.AWSResponse r)) sendCatch e = AWS.trying AWS._Error . AWS.send e -canRetry :: MonadIO m => Either AWS.Error a -> m Bool +canRetry :: (MonadIO m) => Either AWS.Error a -> m Bool canRetry (Right _) = pure False canRetry (Left e) = case e of AWS.TransportError (HttpExceptionRequest _ ResponseTimeout) -> pure True diff --git a/services/galley/src/Galley/Cassandra/Client.hs b/services/galley/src/Galley/Cassandra/Client.hs index bc37fece531..da51ed57b7f 100644 --- a/services/galley/src/Galley/Cassandra/Client.hs +++ b/services/galley/src/Galley/Cassandra/Client.hs @@ -49,7 +49,9 @@ updateClient add usr cls = do -- Do, at most, 16 parallel lookups of up to 128 users each lookupClients :: [UserId] -> Client Clients lookupClients users = - Clients.fromList . concat . concat + Clients.fromList + . concat + . concat <$> forM (chunksOf 2048 users) (UnliftIO.mapConcurrently getClients . chunksOf 128) where getClients us = diff --git a/services/galley/src/Galley/Cassandra/Conversation.hs b/services/galley/src/Galley/Cassandra/Conversation.hs index 919b7b21836..980ecba2285 100644 --- a/services/galley/src/Galley/Cassandra/Conversation.hs +++ b/services/galley/src/Galley/Cassandra/Conversation.hs @@ -161,8 +161,8 @@ deleteConversation cid = do localMembers <- members cid remoteMembers <- lookupRemoteMembers cid - removeMembersFromLocalConv cid $ - UserList (lmId <$> localMembers) (rmId <$> remoteMembers) + removeMembersFromLocalConv cid + $ UserList (lmId <$> localMembers) (rmId <$> remoteMembers) retry x5 $ write Cql.deleteConv (params LocalQuorum (Identity cid)) @@ -197,16 +197,16 @@ isConvAlive cid = do updateConvType :: ConvId -> ConvType -> Client () updateConvType cid ty = - retry x5 $ - write Cql.updateConvType (params LocalQuorum (ty, cid)) + retry x5 + $ write Cql.updateConvType (params LocalQuorum (ty, cid)) updateConvName :: ConvId -> Range 1 256 Text -> Client () updateConvName cid name = retry x5 $ write Cql.updateConvName (params LocalQuorum (fromRange name, cid)) updateConvAccess :: ConvId -> ConversationAccessData -> Client () updateConvAccess cid (ConversationAccessData acc role) = - retry x5 $ - write Cql.updateConvAccess (params LocalQuorum (Cql.Set (toList acc), Cql.Set (toList role), cid)) + retry x5 + $ write Cql.updateConvAccess (params LocalQuorum (Cql.Set (toList acc), Cql.Set (toList role), cid)) updateConvReceiptMode :: ConvId -> ReceiptMode -> Client () updateConvReceiptMode cid receiptMode = retry x5 $ write Cql.updateConvReceiptMode (params LocalQuorum (receiptMode, cid)) @@ -226,8 +226,8 @@ updateConvEpoch cid epoch = retry x5 $ write Cql.updateConvEpoch (params LocalQu updateConvCipherSuite :: ConvId -> CipherSuiteTag -> Client () updateConvCipherSuite cid cs = - retry x5 $ - write + retry x5 + $ write Cql.updateConvCipherSuite (params LocalQuorum (cs, cid)) @@ -262,14 +262,14 @@ conversationGC conv = localConversation :: ConvId -> Client (Maybe Conversation) localConversation cid = - UnliftIO.runConcurrently $ - toConv cid - <$> UnliftIO.Concurrently (members cid) - <*> UnliftIO.Concurrently (lookupRemoteMembers cid) - <*> UnliftIO.Concurrently - ( retry x1 $ - query1 Cql.selectConv (params LocalQuorum (Identity cid)) - ) + UnliftIO.runConcurrently + $ toConv cid + <$> UnliftIO.Concurrently (members cid) + <*> UnliftIO.Concurrently (lookupRemoteMembers cid) + <*> UnliftIO.Concurrently + ( retry x1 + $ query1 Cql.selectConv (params LocalQuorum (Identity cid)) + ) localConversations :: ( Member (Embed IO) r, @@ -310,7 +310,8 @@ remoteConversationStatus uid = remoteConversationStatusOnDomain :: UserId -> Remote [ConvId] -> Client (Map (Remote ConvId) MemberStatus) remoteConversationStatusOnDomain uid rconvs = - Map.fromList . map toPair + Map.fromList + . map toPair <$> query Cql.selectRemoteConvMemberStatuses (params LocalQuorum (uid, tDomain rconvs, tUnqualified rconvs)) where toPair (conv, omus, omur, oar, oarr, hid, hidr) = @@ -389,11 +390,12 @@ toConv cid ms remoteMems mconv = do } updateToMixedProtocol :: - Members - '[ Embed IO, - Input ClientState - ] - r => + ( Members + '[ Embed IO, + Input ClientState + ] + r + ) => Local ConvId -> ConvType -> Sem r () @@ -407,16 +409,18 @@ updateToMixedProtocol lcnv ct = do pure () updateToMLSProtocol :: - Members - '[ Embed IO, - Input ClientState - ] - r => + ( Members + '[ Embed IO, + Input ClientState + ] + r + ) => Local ConvId -> Sem r () updateToMLSProtocol lcnv = - embedClient . retry x5 $ - write Cql.updateToMLSConv (params LocalQuorum (tUnqualified lcnv, ProtocolMLSTag)) + embedClient + . retry x5 + $ write Cql.updateToMLSConv (params LocalQuorum (tUnqualified lcnv, ProtocolMLSTag)) interpretConversationStoreToCassandra :: ( Member (Embed IO) r, diff --git a/services/galley/src/Galley/Cassandra/Conversation/MLS.hs b/services/galley/src/Galley/Cassandra/Conversation/MLS.hs index fbc2991247d..537950ce448 100644 --- a/services/galley/src/Galley/Cassandra/Conversation/MLS.hs +++ b/services/galley/src/Galley/Cassandra/Conversation/MLS.hs @@ -37,8 +37,8 @@ import Wire.API.MLS.Group acquireCommitLock :: GroupId -> Epoch -> NominalDiffTime -> Client LockAcquired acquireCommitLock groupId epoch ttl = do rows <- - retry x5 $ - trans + retry x5 + $ trans Cql.acquireCommitLock ( params LocalQuorum @@ -46,15 +46,15 @@ acquireCommitLock groupId epoch ttl = do ) { serialConsistency = Just LocalSerialConsistency } - pure $ - if checkTransSuccess rows + pure + $ if checkTransSuccess rows then Acquired else NotAcquired releaseCommitLock :: GroupId -> Epoch -> Client () releaseCommitLock groupId epoch = - retry x5 $ - write + retry x5 + $ write Cql.releaseCommitLock ( params LocalQuorum diff --git a/services/galley/src/Galley/Cassandra/Conversation/Members.hs b/services/galley/src/Galley/Cassandra/Conversation/Members.hs index 4b0482f712b..547601b7044 100644 --- a/services/galley/src/Galley/Cassandra/Conversation/Members.hs +++ b/services/galley/src/Galley/Cassandra/Conversation/Members.hs @@ -124,13 +124,15 @@ removeRemoteMembersFromLocalConv cnv victims = do members :: ConvId -> Client [LocalMember] members conv = - fmap (mapMaybe toMember) . retry x1 $ - query Cql.selectMembers (params LocalQuorum (Identity conv)) + fmap (mapMaybe toMember) + . retry x1 + $ query Cql.selectMembers (params LocalQuorum (Identity conv)) allMembers :: Client [LocalMember] allMembers = - fmap (mapMaybe toMember) . retry x1 $ - query Cql.selectAllMembers (params LocalQuorum ()) + fmap (mapMaybe toMember) + . retry x1 + $ query Cql.selectAllMembers (params LocalQuorum ()) toMemberStatus :: ( -- otr muted @@ -173,8 +175,8 @@ toMember :: ) -> Maybe LocalMember toMember (usr, srv, prv, Just 0, omus, omur, oar, oarr, hid, hidr, crn) = - Just $ - LocalMember + Just + $ LocalMember { lmId = usr, lmService = newServiceRef <$> srv <*> prv, lmStatus = toMemberStatus (omus, omur, oar, oarr, hid, hidr), @@ -369,7 +371,7 @@ addMLSClients groupId (Qualified usr domain) cs = retry x5 . batch $ do for_ cs $ \(c, idx) -> addPrepQuery Cql.addMLSClient (groupId, domain, usr, c, fromIntegral idx) -planMLSClientRemoval :: Foldable f => GroupId -> f ClientIdentity -> Client () +planMLSClientRemoval :: (Foldable f) => GroupId -> f ClientIdentity -> Client () planMLSClientRemoval groupId cids = retry x5 . batch $ do setType BatchLogged @@ -439,8 +441,8 @@ interpretMemberStoreToCassandra = interpret $ \case embedClient $ removeMembersFromLocalConv cnv ul DeleteMembersInRemoteConversation rcnv uids -> do logEffect "MemberStore.DeleteMembersInRemoteConversation" - embedClient $ - removeLocalMembersFromRemoteConv rcnv uids + embedClient + $ removeLocalMembersFromRemoteConv rcnv uids AddMLSClients lcnv quid cs -> do logEffect "MemberStore.AddMLSClients" embedClient $ addMLSClients lcnv quid cs diff --git a/services/galley/src/Galley/Cassandra/CustomBackend.hs b/services/galley/src/Galley/Cassandra/CustomBackend.hs index f06f8187ac9..df0af160cec 100644 --- a/services/galley/src/Galley/Cassandra/CustomBackend.hs +++ b/services/galley/src/Galley/Cassandra/CustomBackend.hs @@ -50,7 +50,7 @@ interpretCustomBackendStoreToCassandra = interpret $ \case logEffect "CustomBackendStore.DeleteCustomBackend" embedClient $ deleteCustomBackend dom -getCustomBackend :: MonadClient m => Domain -> m (Maybe CustomBackend) +getCustomBackend :: (MonadClient m) => Domain -> m (Maybe CustomBackend) getCustomBackend domain = fmap toCustomBackend <$> do retry x1 $ query1 Cql.selectCustomBackend (params LocalQuorum (Identity domain)) @@ -58,10 +58,10 @@ getCustomBackend domain = toCustomBackend (backendConfigJsonUrl, backendWebappWelcomeUrl) = CustomBackend {..} -setCustomBackend :: MonadClient m => Domain -> CustomBackend -> m () +setCustomBackend :: (MonadClient m) => Domain -> CustomBackend -> m () setCustomBackend domain CustomBackend {..} = do retry x5 $ write Cql.upsertCustomBackend (params LocalQuorum (backendConfigJsonUrl, backendWebappWelcomeUrl, domain)) -deleteCustomBackend :: MonadClient m => Domain -> m () +deleteCustomBackend :: (MonadClient m) => Domain -> m () deleteCustomBackend domain = do retry x5 $ write Cql.deleteCustomBackend (params LocalQuorum (Identity domain)) diff --git a/services/galley/src/Galley/Cassandra/GetAllTeamFeatureConfigs.hs b/services/galley/src/Galley/Cassandra/GetAllTeamFeatureConfigs.hs index 7e35b485851..33040acc911 100644 --- a/services/galley/src/Galley/Cassandra/GetAllTeamFeatureConfigs.hs +++ b/services/galley/src/Galley/Cassandra/GetAllTeamFeatureConfigs.hs @@ -271,8 +271,8 @@ allFeatureConfigsFromRow ourteam allowListForExposeInvitationURLs featureLH hasT computeConfig mDbStatus mDbLock dbTtl mDbCfg serverCfg = let withStatusNoLock = case (mDbStatus, mDbCfg) of (Just dbStatus, Just dbCfg) -> - Just $ - WithStatusNoLock + Just + $ WithStatusNoLock { wssTTL = dbTtl, wssStatus = dbStatus, wssConfig = dbCfg @@ -295,8 +295,8 @@ allFeatureConfigsFromRow ourteam allowListForExposeInvitationURLs featureLH hasT <*> maybe (Just []) (Just . C.fromSet) row.mlsSupportedProtocols mlsE2eidConfig = - Just $ - MlsE2EIdConfig + Just + $ MlsE2EIdConfig (toGracePeriodOrDefault row.mlsE2eidGracePeriod) row.mlsE2eidAcmeDiscoverUrl row.mlsE2eidMaybeCrlProxy @@ -306,8 +306,8 @@ allFeatureConfigsFromRow ourteam allowListForExposeInvitationURLs featureLH hasT toGracePeriodOrDefault = maybe (verificationExpiration $ wsConfig defFeatureStatus) fromIntegral mlsMigrationConfig = - Just $ - MlsMigrationConfig + Just + $ MlsMigrationConfig { startTime = row.mlsMigrationStartTime, finaliseRegardlessAfter = row.mlsMigrationFinalizeRegardlessAfter } @@ -340,7 +340,7 @@ allFeatureConfigsFromRow ourteam allowListForExposeInvitationURLs featureLH hasT FeatureLegalHoldDisabledByDefault -> maybe False ((==) FeatureStatusEnabled) mStatusValue FeatureLegalHoldWhitelistTeamsAndImplicitConsent -> hasTeamImplicitLegalhold -getAllFeatureConfigs :: MonadClient m => Maybe [TeamId] -> FeatureLegalHold -> Bool -> AllFeatureConfigs -> TeamId -> m AllFeatureConfigs +getAllFeatureConfigs :: (MonadClient m) => Maybe [TeamId] -> FeatureLegalHold -> Bool -> AllFeatureConfigs -> TeamId -> m AllFeatureConfigs getAllFeatureConfigs allowListForExposeInvitationURLs featureLH hasTeamImplicitLegalhold serverConfigs tid = do mRow <- retry x1 $ query1 select (params LocalQuorum (Identity tid)) pure diff --git a/services/galley/src/Galley/Cassandra/Instances.hs b/services/galley/src/Galley/Cassandra/Instances.hs index 57ae885b673..cd073e30073 100644 --- a/services/galley/src/Galley/Cassandra/Instances.hs +++ b/services/galley/src/Galley/Cassandra/Instances.hs @@ -179,8 +179,10 @@ instance Cql ProtocolTag where fromCql (CqlInt i) = do let i' = fromIntegral i - if i' < fromEnum @ProtocolTag minBound - || i' > fromEnum @ProtocolTag maxBound + if i' + < fromEnum @ProtocolTag minBound + || i' + > fromEnum @ProtocolTag maxBound then Left $ "unexpected protocol: " ++ show i else Right $ toEnum i' fromCql _ = Left "protocol: int expected" diff --git a/services/galley/src/Galley/Cassandra/LegalHold.hs b/services/galley/src/Galley/Cassandra/LegalHold.hs index ccc4b9c53f5..70ab3bb7ea8 100644 --- a/services/galley/src/Galley/Cassandra/LegalHold.hs +++ b/services/galley/src/Galley/Cassandra/LegalHold.hs @@ -109,33 +109,35 @@ interpretLegalHoldStoreToCassandra lh = interpret $ \case -- | Returns 'False' if legal hold is not enabled for this team -- The Caller is responsible for checking whether legal hold is enabled for this team -createSettings :: MonadClient m => LegalHoldService -> m () +createSettings :: (MonadClient m) => LegalHoldService -> m () createSettings (LegalHoldService tid url fpr tok key) = do retry x1 $ write Q.insertLegalHoldSettings (params LocalQuorum (url, fpr, tok, key, tid)) -- | Returns 'Nothing' if no settings are saved -- The Caller is responsible for checking whether legal hold is enabled for this team -getSettings :: MonadClient m => TeamId -> m (Maybe LegalHoldService) +getSettings :: (MonadClient m) => TeamId -> m (Maybe LegalHoldService) getSettings tid = fmap toLegalHoldService <$> do retry x1 $ query1 Q.selectLegalHoldSettings (params LocalQuorum (Identity tid)) where toLegalHoldService (httpsUrl, fingerprint, tok, key) = LegalHoldService tid httpsUrl fingerprint tok key -removeSettings :: MonadClient m => TeamId -> m () +removeSettings :: (MonadClient m) => TeamId -> m () removeSettings tid = retry x5 (write Q.removeLegalHoldSettings (params LocalQuorum (Identity tid))) -insertPendingPrekeys :: MonadClient m => UserId -> [Prekey] -> m () -insertPendingPrekeys uid keys = retry x5 . batch $ - forM_ keys $ - \key -> - addPrepQuery Q.insertPendingPrekeys (toTuple key) +insertPendingPrekeys :: (MonadClient m) => UserId -> [Prekey] -> m () +insertPendingPrekeys uid keys = retry x5 + . batch + $ forM_ keys + $ \key -> + addPrepQuery Q.insertPendingPrekeys (toTuple key) where toTuple (Prekey keyId key) = (uid, keyId, key) -selectPendingPrekeys :: MonadClient m => UserId -> m (Maybe ([Prekey], LastPrekey)) +selectPendingPrekeys :: (MonadClient m) => UserId -> m (Maybe ([Prekey], LastPrekey)) selectPendingPrekeys uid = - pickLastKey . fmap fromTuple + pickLastKey + . fmap fromTuple <$> retry x1 (query Q.selectPendingPrekeys (params LocalQuorum (Identity uid))) where fromTuple (keyId, key) = Prekey keyId key @@ -144,18 +146,18 @@ selectPendingPrekeys uid = Nothing -> Nothing Just (keys, lst) -> pure (keys, lastPrekey . prekeyKey $ lst) -dropPendingPrekeys :: MonadClient m => UserId -> m () +dropPendingPrekeys :: (MonadClient m) => UserId -> m () dropPendingPrekeys uid = retry x5 (write Q.dropPendingPrekeys (params LocalQuorum (Identity uid))) -setUserLegalHoldStatus :: MonadClient m => TeamId -> UserId -> UserLegalHoldStatus -> m () +setUserLegalHoldStatus :: (MonadClient m) => TeamId -> UserId -> UserLegalHoldStatus -> m () setUserLegalHoldStatus tid uid status = retry x5 (write Q.updateUserLegalHoldStatus (params LocalQuorum (status, tid, uid))) -setTeamLegalholdWhitelisted :: MonadClient m => TeamId -> m () +setTeamLegalholdWhitelisted :: (MonadClient m) => TeamId -> m () setTeamLegalholdWhitelisted tid = retry x5 (write Q.insertLegalHoldWhitelistedTeam (params LocalQuorum (Identity tid))) -unsetTeamLegalholdWhitelisted :: MonadClient m => TeamId -> m () +unsetTeamLegalholdWhitelisted :: (MonadClient m) => TeamId -> m () unsetTeamLegalholdWhitelisted tid = retry x5 (write Q.removeLegalHoldWhitelistedTeam (params LocalQuorum (Identity tid))) @@ -171,10 +173,11 @@ isTeamLegalholdWhitelisted FeatureLegalHoldWhitelistTeamsAndImplicitConsent tid -- -- FUTUREWORK: It would be nice to move (part of) this to ssl-util, but it has types from -- brig-types and types-common. -validateServiceKey :: MonadIO m => ServiceKeyPEM -> m (Maybe (ServiceKey, Fingerprint Rsa)) +validateServiceKey :: (MonadIO m) => ServiceKeyPEM -> m (Maybe (ServiceKey, Fingerprint Rsa)) validateServiceKey pem = - liftIO $ - readPublicKey >>= \pk -> + liftIO + $ readPublicKey + >>= \pk -> case SSL.toPublicKey =<< pk of Nothing -> pure Nothing Just pk' -> do diff --git a/services/galley/src/Galley/Cassandra/Proposal.hs b/services/galley/src/Galley/Cassandra/Proposal.hs index 68aae2e0f07..37cabc40f7c 100644 --- a/services/galley/src/Galley/Cassandra/Proposal.hs +++ b/services/galley/src/Galley/Cassandra/Proposal.hs @@ -50,8 +50,9 @@ interpretProposalStoreToCassandra :: interpretProposalStoreToCassandra = interpret $ \case StoreProposal groupId epoch ref origin raw -> do logEffect "ProposalStore.StoreProposal" - embedClient . retry x5 $ - write (storeQuery defaultTTL) (params LocalQuorum (groupId, epoch, ref, origin, raw)) + embedClient + . retry x5 + $ write (storeQuery defaultTTL) (params LocalQuorum (groupId, epoch, ref, origin, raw)) GetProposal groupId epoch ref -> do logEffect "ProposalStore.GetProposal" embedClient (runIdentity <$$> retry x1 (query1 getQuery (params LocalQuorum (groupId, epoch, ref)))) @@ -67,10 +68,10 @@ interpretProposalStoreToCassandra = interpret $ \case storeQuery :: Timeout -> PrepQuery W (GroupId, Epoch, ProposalRef, ProposalOrigin, RawMLS Proposal) () storeQuery ttl = - fromString $ - "insert into mls_proposal_refs (group_id, epoch, ref, origin, proposal)\ - \ values (?, ?, ?, ?, ?) using ttl " - <> show (ttl #> Second) + fromString + $ "insert into mls_proposal_refs (group_id, epoch, ref, origin, proposal)\ + \ values (?, ?, ?, ?, ?) using ttl " + <> show (ttl #> Second) getQuery :: PrepQuery R (GroupId, Epoch, ProposalRef) (Identity (RawMLS Proposal)) getQuery = "select proposal from mls_proposal_refs where group_id = ? and epoch = ? and ref = ?" diff --git a/services/galley/src/Galley/Cassandra/Queries.hs b/services/galley/src/Galley/Cassandra/Queries.hs index fa8c5c89042..f3823dcc699 100644 --- a/services/galley/src/Galley/Cassandra/Queries.hs +++ b/services/galley/src/Galley/Cassandra/Queries.hs @@ -259,13 +259,13 @@ insertMLSSelfConv :: ) () insertMLSSelfConv = - fromString $ - "insert into conversation (conv, type, creator, access, \ - \ access_roles_v2, name, team, message_timer, receipt_mode,\ - \ protocol, group_id) values \ - \ (?, ?, ?, ?, ?, ?, ?, ?, ?, " - <> show (fromEnum ProtocolMLSTag) - <> ", ?)" + fromString + $ "insert into conversation (conv, type, creator, access, \ + \ access_roles_v2, name, team, message_timer, receipt_mode,\ + \ protocol, group_id) values \ + \ (?, ?, ?, ?, ?, ?, ?, ?, ?, " + <> show (fromEnum ProtocolMLSTag) + <> ", ?)" updateToMixedConv :: PrepQuery W (ConvId, ProtocolTag, GroupId, Epoch) () updateToMixedConv = diff --git a/services/galley/src/Galley/Cassandra/SearchVisibility.hs b/services/galley/src/Galley/Cassandra/SearchVisibility.hs index 84505b5809a..bf656fd8204 100644 --- a/services/galley/src/Galley/Cassandra/SearchVisibility.hs +++ b/services/galley/src/Galley/Cassandra/SearchVisibility.hs @@ -49,7 +49,7 @@ interpretSearchVisibilityStoreToCassandra = interpret $ \case embedClient $ resetSearchVisibility tid -- | Return whether a given team is allowed to enable/disable sso -getSearchVisibility :: MonadClient m => TeamId -> m TeamSearchVisibility +getSearchVisibility :: (MonadClient m) => TeamId -> m TeamSearchVisibility getSearchVisibility tid = toSearchVisibility <$> do retry x1 $ query1 selectSearchVisibility (params LocalQuorum (Identity tid)) @@ -60,10 +60,10 @@ getSearchVisibility tid = toSearchVisibility _ = SearchVisibilityStandard -- | Determines whether a given team is allowed to enable/disable sso -setSearchVisibility :: MonadClient m => TeamId -> TeamSearchVisibility -> m () +setSearchVisibility :: (MonadClient m) => TeamId -> TeamSearchVisibility -> m () setSearchVisibility tid visibilityType = do retry x5 $ write updateSearchVisibility (params LocalQuorum (visibilityType, tid)) -resetSearchVisibility :: MonadClient m => TeamId -> m () +resetSearchVisibility :: (MonadClient m) => TeamId -> m () resetSearchVisibility tid = do retry x5 $ write updateSearchVisibility (params LocalQuorum (SearchVisibilityStandard, tid)) diff --git a/services/galley/src/Galley/Cassandra/Services.hs b/services/galley/src/Galley/Cassandra/Services.hs index 7e8012e2998..0b3e3fa15a7 100644 --- a/services/galley/src/Galley/Cassandra/Services.hs +++ b/services/galley/src/Galley/Cassandra/Services.hs @@ -67,7 +67,7 @@ interpretServiceStoreToCassandra = interpret $ \case logEffect "ServiceStore.DeleteService" embedClient $ deleteService sr -insertService :: MonadClient m => Bot.Service -> m () +insertService :: (MonadClient m) => Bot.Service -> m () insertService s = do let sid = s ^. Bot.serviceRef . serviceRefId let pid = s ^. Bot.serviceRef . serviceRefProvider @@ -77,7 +77,7 @@ insertService s = do let ena = s ^. Bot.serviceEnabled retry x5 $ write insertSrv (params LocalQuorum (pid, sid, url, tok, fps, ena)) -lookupService :: MonadClient m => ServiceRef -> m (Maybe Bot.Service) +lookupService :: (MonadClient m) => ServiceRef -> m (Maybe Bot.Service) lookupService s = fmap toService <$> retry x1 (query1 selectSrv (params LocalQuorum (s ^. serviceRefProvider, s ^. serviceRefId))) @@ -85,5 +85,5 @@ lookupService s = toService (url, tok, Set fps, ena) = Bot.newService s url tok fps & set Bot.serviceEnabled ena -deleteService :: MonadClient m => ServiceRef -> m () +deleteService :: (MonadClient m) => ServiceRef -> m () deleteService s = retry x5 (write rmSrv (params LocalQuorum (s ^. serviceRefProvider, s ^. serviceRefId))) diff --git a/services/galley/src/Galley/Cassandra/Team.hs b/services/galley/src/Galley/Cassandra/Team.hs index 84b5458d115..e164087fb31 100644 --- a/services/galley/src/Galley/Cassandra/Team.hs +++ b/services/galley/src/Galley/Cassandra/Team.hs @@ -304,11 +304,11 @@ addTeamMember t m = ) addPrepQuery Cql.insertUserTeam (m ^. userId, t) - when (m `hasPermission` SetBilling) $ - addPrepQuery Cql.insertBillingTeamMember (t, m ^. userId) + when (m `hasPermission` SetBilling) + $ addPrepQuery Cql.insertBillingTeamMember (t, m ^. userId) - when (isAdminOrOwner (m ^. permissions)) $ - addPrepQuery Cql.insertTeamAdmin (t, m ^. userId) + when (isAdminOrOwner (m ^. permissions)) + $ addPrepQuery Cql.insertTeamAdmin (t, m ^. userId) updateTeamMember :: -- | Old permissions, used for maintaining 'billing_team_member' and 'team_admin' tables @@ -329,20 +329,20 @@ updateTeamMember oldPerms tid uid newPerms = do acquiredPerms = newPerms `permDiff` oldPerms lostPerms = oldPerms `permDiff` newPerms - when (SetBilling `Set.member` acquiredPerms) $ - addPrepQuery Cql.insertBillingTeamMember (tid, uid) - when (SetBilling `Set.member` lostPerms) $ - addPrepQuery Cql.deleteBillingTeamMember (tid, uid) + when (SetBilling `Set.member` acquiredPerms) + $ addPrepQuery Cql.insertBillingTeamMember (tid, uid) + when (SetBilling `Set.member` lostPerms) + $ addPrepQuery Cql.deleteBillingTeamMember (tid, uid) -- update team_admin table let wasAdmin = isAdminOrOwner oldPerms isAdmin = isAdminOrOwner newPerms - when (isAdmin && not wasAdmin) $ - addPrepQuery Cql.insertTeamAdmin (tid, uid) + when (isAdmin && not wasAdmin) + $ addPrepQuery Cql.insertTeamAdmin (tid, uid) - when (not isAdmin && wasAdmin) $ - addPrepQuery Cql.deleteTeamAdmin (tid, uid) + when (not isAdmin && wasAdmin) + $ addPrepQuery Cql.deleteTeamAdmin (tid, uid) removeTeamMember :: TeamId -> UserId -> Client () removeTeamMember t m = @@ -376,8 +376,8 @@ teamMembersWithLimit lh t (fromRange -> limit) = do -- NOTE: We use +1 as size and then trim it due to the semantics of C* when getting a page with the exact same size pageTuple <- retry x1 (paginate Cql.selectTeamMembers (paramsP LocalQuorum (Identity t) (limit + 1))) ms <- mapM (newTeamMember' lh t) . take (fromIntegral limit) $ result pageTuple - pure $ - if hasMore pageTuple + pure + $ if hasMore pageTuple then newTeamMemberList ms ListTruncated else newTeamMemberList ms ListComplete @@ -421,7 +421,8 @@ oneUserTeam u = teamCreationTime :: TeamId -> Client (Maybe TeamCreationTime) teamCreationTime t = - checkCreation . fmap runIdentity + checkCreation + . fmap runIdentity <$> retry x1 (query1 Cql.selectTeamBindingWritetime (params LocalQuorum (Identity t))) where checkCreation (Just (Just ts)) = Just $ TeamCreationTime ts @@ -450,8 +451,9 @@ deleteTeam tid = do removeConvs :: Page TeamConversation -> Client () removeConvs cnvs = do for_ (result cnvs) $ removeTeamConv tid . view conversationId - unless (null $ result cnvs) $ - removeConvs =<< liftClient (nextPage cnvs) + unless (null $ result cnvs) + $ removeConvs + =<< liftClient (nextPage cnvs) removeTeamMembers :: Page @@ -464,8 +466,9 @@ deleteTeam tid = do Client () removeTeamMembers mems = do mapM_ (removeTeamMember tid . view _1) (result mems) - unless (null $ result mems) $ - removeTeamMembers =<< liftClient (nextPage mems) + unless (null $ result mems) + $ removeTeamMembers + =<< liftClient (nextPage mems) removeTeamConv :: TeamId -> ConvId -> Client () removeTeamConv tid cid = liftClient $ do diff --git a/services/galley/src/Galley/Cassandra/TeamFeatures.hs b/services/galley/src/Galley/Cassandra/TeamFeatures.hs index 6df455cf557..a7f148589e3 100644 --- a/services/galley/src/Galley/Cassandra/TeamFeatures.hs +++ b/services/galley/src/Galley/Cassandra/TeamFeatures.hs @@ -77,15 +77,15 @@ interpretTeamFeatureStoreToCassandra = interpret $ \case serverConfigs <- input (allowListForExposeInvitationURLs, featureLH) <- input hasTeamImplicitLegalhold <- LH.isTeamLegalholdWhitelisted tid - embedClient $ - getAllFeatureConfigs + embedClient + $ getAllFeatureConfigs allowListForExposeInvitationURLs featureLH hasTeamImplicitLegalhold serverConfigs tid -getFeatureConfig :: MonadClient m => FeatureSingleton cfg -> TeamId -> m (Maybe (WithStatusNoLock cfg)) +getFeatureConfig :: (MonadClient m) => FeatureSingleton cfg -> TeamId -> m (Maybe (WithStatusNoLock cfg)) getFeatureConfig FeatureSingletonLegalholdConfig tid = getTrivialConfigC "legalhold_status" tid getFeatureConfig FeatureSingletonSSOConfig tid = getTrivialConfigC "sso_status" tid getFeatureConfig FeatureSingletonSearchVisibilityAvailableConfig tid = getTrivialConfigC "search_visibility_status" tid @@ -94,15 +94,16 @@ getFeatureConfig FeatureSingletonClassifiedDomainsConfig _tid = pure Nothing -- getFeatureConfig FeatureSingletonDigitalSignaturesConfig tid = getTrivialConfigC "digital_signatures" tid getFeatureConfig FeatureSingletonAppLockConfig tid = runMaybeT $ do (mStatus, mEnforce, mTimeout) <- - MaybeT . retry x1 $ - query1 select (params LocalQuorum (Identity tid)) - maybe mzero pure $ - WithStatusNoLock - <$> mStatus - <*> (AppLockConfig <$> mEnforce <*> mTimeout) - -- FUTUREWORK: the above line is duplicated in - -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! - <*> Just FeatureTTLUnlimited + MaybeT + . retry x1 + $ query1 select (params LocalQuorum (Identity tid)) + maybe mzero pure + $ WithStatusNoLock + <$> mStatus + <*> (AppLockConfig <$> mEnforce <*> mTimeout) + -- FUTUREWORK: the above line is duplicated in + -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! + <*> Just FeatureTTLUnlimited where select :: PrepQuery R (Identity TeamId) (Maybe FeatureStatus, Maybe EnforceAppLock, Maybe Int32) select = @@ -111,15 +112,16 @@ getFeatureConfig FeatureSingletonAppLockConfig tid = runMaybeT $ do getFeatureConfig FeatureSingletonFileSharingConfig tid = getTrivialConfigC "file_sharing" tid getFeatureConfig FeatureSingletonSelfDeletingMessagesConfig tid = runMaybeT $ do (mEnabled, mTimeout) <- - MaybeT . retry x1 $ - query1 select (params LocalQuorum (Identity tid)) - maybe mzero pure $ - WithStatusNoLock - <$> mEnabled - <*> fmap SelfDeletingMessagesConfig mTimeout - -- FUTUREWORK: the above line is duplicated in - -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! - <*> Just FeatureTTLUnlimited + MaybeT + . retry x1 + $ query1 select (params LocalQuorum (Identity tid)) + maybe mzero pure + $ WithStatusNoLock + <$> mEnabled + <*> fmap SelfDeletingMessagesConfig mTimeout + -- FUTUREWORK: the above line is duplicated in + -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! + <*> Just FeatureTTLUnlimited where select :: PrepQuery R (Identity TeamId) (Maybe FeatureStatus, Maybe Int32) select = @@ -139,8 +141,8 @@ getFeatureConfig FeatureSingletonConferenceCallingConfig tid = do where select :: PrepQuery R (Identity TeamId) (Maybe FeatureStatus, Maybe FeatureTTL) select = - fromString $ - "select conference_calling, ttl(conference_calling) from team_features where team_id = ?" + fromString + $ "select conference_calling, ttl(conference_calling) from team_features where team_id = ?" getFeatureConfig FeatureSingletonGuestLinksConfig tid = getTrivialConfigC "guest_links_status" tid getFeatureConfig FeatureSingletonSndFactorPasswordChallengeConfig tid = getTrivialConfigC "snd_factor_password_challenge_status" tid getFeatureConfig FeatureSingletonSearchVisibilityInboundConfig tid = getTrivialConfigC "search_visibility_status" tid @@ -172,8 +174,8 @@ getFeatureConfig FeatureSingletonMlsE2EIdConfig tid = do Nothing -> Nothing Just (Nothing, _, _, _, _) -> Nothing Just (Just fs, mGracePeriod, mUrl, mCrlProxy, mUseProxyOnMobile) -> - Just $ - WithStatusNoLock + Just + $ WithStatusNoLock fs ( -- FUTUREWORK: this block is duplicated in -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! @@ -186,16 +188,16 @@ getFeatureConfig FeatureSingletonMlsE2EIdConfig tid = do select :: PrepQuery R (Identity TeamId) (Maybe FeatureStatus, Maybe Int32, Maybe HttpsUrl, Maybe HttpsUrl, Maybe Bool) select = - fromString $ - "select mls_e2eid_status, mls_e2eid_grace_period, mls_e2eid_acme_discovery_url, mls_e2eid_crl_proxy, mls_e2eid_use_proxy_on_mobile from team_features where team_id = ?" + fromString + $ "select mls_e2eid_status, mls_e2eid_grace_period, mls_e2eid_acme_discovery_url, mls_e2eid_crl_proxy, mls_e2eid_use_proxy_on_mobile from team_features where team_id = ?" getFeatureConfig FeatureSingletonMlsMigration tid = do let q = query1 select (params LocalQuorum (Identity tid)) retry x1 q <&> \case Nothing -> Nothing Just (Nothing, _, _) -> Nothing Just (Just fs, startTime, finaliseRegardlessAfter) -> - Just $ - WithStatusNoLock + Just + $ WithStatusNoLock fs -- FUTUREWORK: the following expression is duplicated in -- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge! @@ -222,7 +224,7 @@ getFeatureConfig FeatureSingletonEnforceFileDownloadLocationConfig tid = do getFeatureConfig FeatureSingletonLimitedEventFanoutConfig tid = getTrivialConfigC "limited_event_fanout_status" tid -setFeatureConfig :: MonadClient m => FeatureSingleton cfg -> TeamId -> WithStatusNoLock cfg -> m () +setFeatureConfig :: (MonadClient m) => FeatureSingleton cfg -> TeamId -> WithStatusNoLock cfg -> m () setFeatureConfig FeatureSingletonLegalholdConfig tid statusNoLock = setFeatureStatusC "legalhold_status" tid (wssStatus statusNoLock) setFeatureConfig FeatureSingletonSSOConfig tid statusNoLock = setFeatureStatusC "sso_status" tid (wssStatus statusNoLock) setFeatureConfig FeatureSingletonSearchVisibilityAvailableConfig tid statusNoLock = setFeatureStatusC "search_visibility_status" tid (wssStatus statusNoLock) @@ -237,9 +239,9 @@ setFeatureConfig FeatureSingletonAppLockConfig tid status = do where insert :: PrepQuery W (TeamId, FeatureStatus, EnforceAppLock, Int32) () insert = - fromString $ - "insert into team_features (team_id, app_lock_status, app_lock_enforce,\ - \ app_lock_inactivity_timeout_secs) values (?, ?, ?, ?)" + fromString + $ "insert into team_features (team_id, app_lock_status, app_lock_enforce,\ + \ app_lock_inactivity_timeout_secs) values (?, ?, ?, ?)" setFeatureConfig FeatureSingletonFileSharingConfig tid statusNoLock = setFeatureStatusC "file_sharing" tid (wssStatus statusNoLock) setFeatureConfig FeatureSingletonSelfDeletingMessagesConfig tid status = do let statusValue = wssStatus status @@ -259,9 +261,9 @@ setFeatureConfig FeatureSingletonConferenceCallingConfig tid statusNoLock = _ -> " using ttl 0" -- 0 or unlimited (delete a column's existing TTL by setting its value to zero) insert :: PrepQuery W (TeamId, FeatureStatus) () insert = - fromString $ - "insert into team_features (team_id,conference_calling) values (?, ?)" - <> renderFeatureTtl (wssTTL statusNoLock) + fromString + $ "insert into team_features (team_id,conference_calling) values (?, ?)" + <> renderFeatureTtl (wssTTL statusNoLock) setFeatureConfig FeatureSingletonGuestLinksConfig tid statusNoLock = setFeatureStatusC "guest_links_status" tid (wssStatus statusNoLock) setFeatureConfig FeatureSingletonSndFactorPasswordChallengeConfig tid statusNoLock = setFeatureStatusC "snd_factor_password_challenge_status" tid (wssStatus statusNoLock) @@ -269,8 +271,8 @@ setFeatureConfig FeatureSingletonSearchVisibilityInboundConfig tid statusNoLock setFeatureConfig FeatureSingletonMLSConfig tid statusNoLock = do let status = wssStatus statusNoLock let MLSConfig protocolToggleUsers defaultProtocol allowedCipherSuites defaultCipherSuite supportedProtocols = wssConfig statusNoLock - retry x5 $ - write + retry x5 + $ write insert ( params LocalQuorum @@ -322,7 +324,7 @@ setFeatureConfig FeatureSingletonEnforceFileDownloadLocationConfig tid status = setFeatureConfig FeatureSingletonLimitedEventFanoutConfig tid statusNoLock = setFeatureStatusC "limited_event_fanout_status" tid (wssStatus statusNoLock) -getFeatureLockStatus :: MonadClient m => FeatureSingleton cfg -> TeamId -> m (Maybe LockStatus) +getFeatureLockStatus :: (MonadClient m) => FeatureSingleton cfg -> TeamId -> m (Maybe LockStatus) getFeatureLockStatus FeatureSingletonFileSharingConfig tid = getLockStatusC "file_sharing_lock_status" tid getFeatureLockStatus FeatureSingletonSelfDeletingMessagesConfig tid = getLockStatusC "self_deleting_messages_lock_status" tid getFeatureLockStatus FeatureSingletonGuestLinksConfig tid = getLockStatusC "guest_links_lock_status" tid @@ -334,7 +336,7 @@ getFeatureLockStatus FeatureSingletonMLSConfig tid = getLockStatusC "mls_lock_st getFeatureLockStatus FeatureSingletonEnforceFileDownloadLocationConfig tid = getLockStatusC "enforce_file_download_location_lock_status" tid getFeatureLockStatus _ _ = pure Nothing -setFeatureLockStatus :: MonadClient m => FeatureSingleton cfg -> TeamId -> LockStatus -> m () +setFeatureLockStatus :: (MonadClient m) => FeatureSingleton cfg -> TeamId -> LockStatus -> m () setFeatureLockStatus FeatureSingletonFileSharingConfig tid status = setLockStatusC "file_sharing_lock_status" tid status setFeatureLockStatus FeatureSingletonSelfDeletingMessagesConfig tid status = setLockStatusC "self_deleting_messages_lock_status" tid status setFeatureLockStatus FeatureSingletonGuestLinksConfig tid status = setLockStatusC "guest_links_lock_status" tid status @@ -361,10 +363,10 @@ getTrivialConfigC statusCol tid = do where select :: PrepQuery R (Identity TeamId) (Identity (Maybe FeatureStatus)) select = - fromString $ - "select " - <> statusCol - <> " from team_features where team_id = ?" + fromString + $ "select " + <> statusCol + <> " from team_features where team_id = ?" setFeatureStatusC :: forall m. @@ -378,8 +380,10 @@ setFeatureStatusC statusCol tid status = do where insert :: PrepQuery W (TeamId, FeatureStatus) () insert = - fromString $ - "insert into team_features (team_id, " <> statusCol <> ") values (?, ?)" + fromString + $ "insert into team_features (team_id, " + <> statusCol + <> ") values (?, ?)" getLockStatusC :: forall m. @@ -393,13 +397,13 @@ getLockStatusC lockStatusCol tid = do where select :: PrepQuery R (Identity TeamId) (Identity (Maybe LockStatus)) select = - fromString $ - "select " - <> lockStatusCol - <> " from team_features where team_id = ?" + fromString + $ "select " + <> lockStatusCol + <> " from team_features where team_id = ?" setLockStatusC :: - MonadClient m => + (MonadClient m) => String -> TeamId -> LockStatus -> @@ -409,8 +413,10 @@ setLockStatusC col tid status = do where insert :: PrepQuery W (TeamId, LockStatus) () insert = - fromString $ - "insert into team_features (team_id, " <> col <> ") values (?, ?)" + fromString + $ "insert into team_features (team_id, " + <> col + <> ") values (?, ?)" getFeatureConfigMulti :: forall cfg m. diff --git a/services/galley/src/Galley/Cassandra/Util.hs b/services/galley/src/Galley/Cassandra/Util.hs index 2e3169fb523..f0cd114d5f4 100644 --- a/services/galley/src/Galley/Cassandra/Util.hs +++ b/services/galley/src/Galley/Cassandra/Util.hs @@ -23,5 +23,5 @@ import Polysemy import Polysemy.TinyLog import System.Logger.Message -logEffect :: Member TinyLog r => ByteString -> Sem r () +logEffect :: (Member TinyLog r) => ByteString -> Sem r () logEffect = debug . msg . val diff --git a/services/galley/src/Galley/Data/Types.hs b/services/galley/src/Galley/Data/Types.hs index 81feef99324..9cd3fe16257 100644 --- a/services/galley/src/Galley/Data/Types.hs +++ b/services/galley/src/Galley/Data/Types.hs @@ -76,7 +76,7 @@ toCode k s (val, ttl, cnv, mPw) = -- The 'key' is a stable, truncated, base64 encoded sha256 hash of the conversation ID -- The 'value' is a base64 encoded, 120-bit random value (changing on each generation) -generate :: MonadIO m => ConvId -> Scope -> Timeout -> m Code +generate :: (MonadIO m) => ConvId -> Scope -> Timeout -> m Code generate cnv s t = do key <- mkKey cnv val <- liftIO $ Value . unsafeRange . Ascii.encodeBase64Url <$> randBytes 15 @@ -90,7 +90,7 @@ generate cnv s t = do codeHasPassword = False } -mkKey :: MonadIO m => ConvId -> m Key +mkKey :: (MonadIO m) => ConvId -> m Key mkKey cnv = do sha256 <- liftIO $ fromJust <$> getDigestByName "SHA256" pure $ Key . unsafeRange . Ascii.encodeBase64Url . BS.take 15 $ digestBS sha256 (toByteString' cnv) diff --git a/services/galley/src/Galley/Effects/BackendNotificationQueueAccess.hs b/services/galley/src/Galley/Effects/BackendNotificationQueueAccess.hs index 9c2fe5d4004..fee78987c23 100644 --- a/services/galley/src/Galley/Effects/BackendNotificationQueueAccess.hs +++ b/services/galley/src/Galley/Effects/BackendNotificationQueueAccess.hs @@ -11,7 +11,7 @@ import Wire.API.Federation.Error data BackendNotificationQueueAccess m a where EnqueueNotification :: - KnownComponent c => + (KnownComponent c) => Q.DeliveryMode -> Remote x -> FedQueueClient c a -> diff --git a/services/galley/src/Galley/Effects/BrigAccess.hs b/services/galley/src/Galley/Effects/BrigAccess.hs index 642a3ab4c10..c825a3e7129 100644 --- a/services/galley/src/Galley/Effects/BrigAccess.hs +++ b/services/galley/src/Galley/Effects/BrigAccess.hs @@ -130,7 +130,7 @@ data BrigAccess m a where makeSem ''BrigAccess -getUser :: Member BrigAccess r => UserId -> Sem r (Maybe UserAccount) +getUser :: (Member BrigAccess r) => UserId -> Sem r (Maybe UserAccount) getUser = fmap listToMaybe . getUsers . pure addLegalHoldClientToUser :: diff --git a/services/galley/src/Galley/Effects/ConversationStore.hs b/services/galley/src/Galley/Effects/ConversationStore.hs index 234dfa64bda..d85d2258e85 100644 --- a/services/galley/src/Galley/Effects/ConversationStore.hs +++ b/services/galley/src/Galley/Effects/ConversationStore.hs @@ -106,5 +106,5 @@ data ConversationStore m a where makeSem ''ConversationStore -acceptConnectConversation :: Member ConversationStore r => ConvId -> Sem r () +acceptConnectConversation :: (Member ConversationStore r) => ConvId -> Sem r () acceptConnectConversation cid = setConversationType cid One2OneConv diff --git a/services/galley/src/Galley/Effects/ExternalAccess.hs b/services/galley/src/Galley/Effects/ExternalAccess.hs index 095ecb75b78..e2d0bb75404 100644 --- a/services/galley/src/Galley/Effects/ExternalAccess.hs +++ b/services/galley/src/Galley/Effects/ExternalAccess.hs @@ -33,8 +33,8 @@ import Polysemy import Wire.API.Event.Conversation data ExternalAccess m a where - Deliver :: Foldable f => f (BotMember, Event) -> ExternalAccess m [BotMember] + Deliver :: (Foldable f) => f (BotMember, Event) -> ExternalAccess m [BotMember] DeliverAsync :: (Foldable f) => f (BotMember, Event) -> ExternalAccess m () - DeliverAndDeleteAsync :: Foldable f => ConvId -> f (BotMember, Event) -> ExternalAccess m () + DeliverAndDeleteAsync :: (Foldable f) => ConvId -> f (BotMember, Event) -> ExternalAccess m () makeSem ''ExternalAccess diff --git a/services/galley/src/Galley/Effects/FederatorAccess.hs b/services/galley/src/Galley/Effects/FederatorAccess.hs index cfa3b508c76..eaa5e70ba01 100644 --- a/services/galley/src/Galley/Effects/FederatorAccess.hs +++ b/services/galley/src/Galley/Effects/FederatorAccess.hs @@ -39,12 +39,12 @@ import Wire.API.Federation.Error data FederatorAccess m a where RunFederated :: - KnownComponent c => + (KnownComponent c) => Remote x -> FederatorClient c a -> FederatorAccess m a RunFederatedEither :: - KnownComponent c => + (KnownComponent c) => Remote x -> FederatorClient c a -> FederatorAccess m (Either FederationError a) diff --git a/services/galley/src/Galley/Effects/FireAndForget.hs b/services/galley/src/Galley/Effects/FireAndForget.hs index 0a99f3c5551..b78264acaf3 100644 --- a/services/galley/src/Galley/Effects/FireAndForget.hs +++ b/services/galley/src/Galley/Effects/FireAndForget.hs @@ -36,14 +36,14 @@ data FireAndForget m a where makeSem ''FireAndForget -fireAndForget :: Member FireAndForget r => Sem r () -> Sem r () +fireAndForget :: (Member FireAndForget r) => Sem r () -> Sem r () fireAndForget = fireAndForgetOne -- | Run actions in separate threads and ignore results. -- -- /Note/: this will also ignore any state and error effects contained in the -- 'FireAndForget' action. Use with care. -interpretFireAndForget :: Member (Final IO) r => Sem (FireAndForget ': r) a -> Sem r a +interpretFireAndForget :: (Member (Final IO) r) => Sem (FireAndForget ': r) a -> Sem r a interpretFireAndForget = interpretFinal @IO $ \case FireAndForgetOne action -> do action' <- runS action diff --git a/services/galley/src/Galley/Effects/MemberStore.hs b/services/galley/src/Galley/Effects/MemberStore.hs index 0513cc6570e..e1e0d4c372f 100644 --- a/services/galley/src/Galley/Effects/MemberStore.hs +++ b/services/galley/src/Galley/Effects/MemberStore.hs @@ -86,7 +86,7 @@ data MemberStore m a where DeleteMembers :: ConvId -> UserList UserId -> MemberStore m () DeleteMembersInRemoteConversation :: Remote ConvId -> [UserId] -> MemberStore m () AddMLSClients :: GroupId -> Qualified UserId -> Set (ClientId, LeafIndex) -> MemberStore m () - PlanClientRemoval :: Foldable f => GroupId -> f ClientIdentity -> MemberStore m () + PlanClientRemoval :: (Foldable f) => GroupId -> f ClientIdentity -> MemberStore m () RemoveMLSClients :: GroupId -> Qualified UserId -> Set ClientId -> MemberStore m () RemoveAllMLSClients :: GroupId -> MemberStore m () LookupMLSClients :: GroupId -> MemberStore m ClientMap diff --git a/services/galley/src/Galley/Effects/TeamStore.hs b/services/galley/src/Galley/Effects/TeamStore.hs index cf0a2257156..bd403e17f55 100644 --- a/services/galley/src/Galley/Effects/TeamStore.hs +++ b/services/galley/src/Galley/Effects/TeamStore.hs @@ -141,7 +141,7 @@ data TeamStore m a where makeSem ''TeamStore listTeams :: - Member (ListItems p TeamId) r => + (Member (ListItems p TeamId) r) => UserId -> Maybe (PagingState p TeamId) -> PagingBounds p TeamId -> diff --git a/services/galley/src/Galley/External.hs b/services/galley/src/Galley/External.hs index a3ada1d3c51..098ab6bba93 100644 --- a/services/galley/src/Galley/External.hs +++ b/services/galley/src/Galley/External.hs @@ -94,35 +94,35 @@ deliver pp = mapM (async . exec) pp >>= foldM eval [] . zip (map fst pp) r <- waitCatch a case r of Right True -> do - Log.debug $ - field "provider" (toByteString (s ^. serviceRefProvider)) - ~~ field "service" (toByteString (s ^. serviceRefId)) - ~~ field "bot" (toByteString (botMemId b)) - ~~ msg (val "External delivery success") + Log.debug + $ field "provider" (toByteString (s ^. serviceRefProvider)) + ~~ field "service" (toByteString (s ^. serviceRefId)) + ~~ field "bot" (toByteString (botMemId b)) + ~~ msg (val "External delivery success") pure gone Right False -> do - Log.debug $ - field "provider" (toByteString (s ^. serviceRefProvider)) - ~~ field "service" (toByteString (s ^. serviceRefId)) - ~~ field "bot" (toByteString (botMemId b)) - ~~ msg (val "External service gone") + Log.debug + $ field "provider" (toByteString (s ^. serviceRefProvider)) + ~~ field "service" (toByteString (s ^. serviceRefId)) + ~~ field "bot" (toByteString (botMemId b)) + ~~ msg (val "External service gone") pure (b : gone) Left ex | Just (Http.HttpExceptionRequest _ (Http.StatusCodeException rs _)) <- fromException ex, Http.responseStatus rs == status410 -> do - Log.debug $ - field "provider" (toByteString (s ^. serviceRefProvider)) - ~~ field "service" (toByteString (s ^. serviceRefId)) - ~~ field "bot" (toByteString (botMemId b)) - ~~ msg (val "External bot gone") + Log.debug + $ field "provider" (toByteString (s ^. serviceRefProvider)) + ~~ field "service" (toByteString (s ^. serviceRefId)) + ~~ field "bot" (toByteString (botMemId b)) + ~~ msg (val "External bot gone") pure (b : gone) Left ex -> do - Log.info $ - field "provider" (toByteString (s ^. serviceRefProvider)) - ~~ field "service" (toByteString (s ^. serviceRefId)) - ~~ field "bot" (toByteString (botMemId b)) - ~~ field "error" (show ex) - ~~ msg (val "External delivery failure") + Log.info + $ field "provider" (toByteString (s ^. serviceRefProvider)) + ~~ field "service" (toByteString (s ^. serviceRefId)) + ~~ field "bot" (toByteString (botMemId b)) + ~~ field "error" (show ex) + ~~ msg (val "External delivery failure") pure gone -- Internal ------------------------------------------------------------------- @@ -134,18 +134,18 @@ deliver1 s bm e let u = s ^. serviceUrl let b = botMemId bm let HttpsUrl url = u - recovering x3 httpHandlers $ - const $ - sendMessage (s ^. serviceFingerprints) $ - method POST - . maybe id host (urlHost u) - . maybe (port 443) port (urlPort u) - . paths [url ^. pathL, "bots", toByteString' b, "messages"] - . header "Authorization" ("Bearer " <> t) - . json e - . timeout 5000 - . secure - . expect2xx + recovering x3 httpHandlers + $ const + $ sendMessage (s ^. serviceFingerprints) + $ method POST + . maybe id host (urlHost u) + . maybe (port 443) port (urlPort u) + . paths [url ^. pathL, "bots", toByteString' b, "messages"] + . header "Authorization" ("Bearer " <> t) + . json e + . timeout 5000 + . secure + . expect2xx | otherwise = pure () urlHost :: HttpsUrl -> Maybe ByteString diff --git a/services/galley/src/Galley/External/LegalHoldService/Internal.hs b/services/galley/src/Galley/External/LegalHoldService/Internal.hs index 6923ebf02da..df896ab0c85 100644 --- a/services/galley/src/Galley/External/LegalHoldService/Internal.hs +++ b/services/galley/src/Galley/External/LegalHoldService/Internal.hs @@ -45,12 +45,12 @@ makeVerifiedRequestWithManager :: Http.Manager -> ([Fingerprint Rsa] -> SSL.SSL makeVerifiedRequestWithManager mgr verifyFingerprints fpr (HttpsUrl url) reqBuilder = do let verified = verifyFingerprints [fpr] extHandleAll errHandler $ do - recovering x3 httpHandlers $ - const $ - liftIO $ - withVerifiedSslConnection verified mgr (reqBuilderMods . reqBuilder) $ - \req -> - Http.httpLbs req mgr + recovering x3 httpHandlers + $ const + $ liftIO + $ withVerifiedSslConnection verified mgr (reqBuilderMods . reqBuilder) + $ \req -> + Http.httpLbs req mgr where reqBuilderMods = maybe id Bilge.host (Bilge.extHost url) @@ -67,7 +67,7 @@ makeVerifiedRequestWithManager mgr verifyFingerprints fpr (HttpsUrl url) reqBuil a b = fromMaybe a (BS.stripSuffix "/" a) <> "/" <> fromMaybe b (BS.stripPrefix "/" b) x3 :: RetryPolicy x3 = limitRetries 3 <> exponentialBackoff 100000 - extHandleAll :: MonadCatch m => (SomeException -> m a) -> m a -> m a + extHandleAll :: (MonadCatch m) => (SomeException -> m a) -> m a -> m a extHandleAll f ma = catches ma diff --git a/services/galley/src/Galley/Intra/BackendNotificationQueue.hs b/services/galley/src/Galley/Intra/BackendNotificationQueue.hs index 756ce2379a6..b7e612f1c29 100644 --- a/services/galley/src/Galley/Intra/BackendNotificationQueue.hs +++ b/services/galley/src/Galley/Intra/BackendNotificationQueue.hs @@ -55,12 +55,12 @@ enqueueSingleNotification remoteDomain deliveryMode chanVar action = do where logError willRetry (SomeException e) status = do rid <- view reqId - Log.err $ - Log.msg @Text "failed to enqueue notification in RabbitMQ" - . Log.field "error" (displayException e) - . Log.field "willRetry" willRetry - . Log.field "retryCount" status.rsIterNumber - . Log.field "request" rid + Log.err + $ Log.msg @Text "failed to enqueue notification in RabbitMQ" + . Log.field "error" (displayException e) + . Log.field "willRetry" willRetry + . Log.field "retryCount" status.rsIterNumber + . Log.field "request" rid go ownDomain = do rid <- view reqId mChan <- timeout 1_000_000 (readMVar chanVar) diff --git a/services/galley/src/Galley/Intra/Client.hs b/services/galley/src/Galley/Intra/Client.hs index 5907498ad60..910ceb5d33e 100644 --- a/services/galley/src/Galley/Intra/Client.hs +++ b/services/galley/src/Galley/Intra/Client.hs @@ -62,11 +62,11 @@ import Wire.API.User.Client.Prekey lookupClients :: [UserId] -> App UserClients lookupClients uids = do r <- - call Brig $ - method POST - . path "/i/clients" - . json (UserSet $ Set.fromList uids) - . expect2xx + call Brig + $ method POST + . path "/i/clients" + . json (UserSet $ Set.fromList uids) + . expect2xx clients <- parseResponse (mkError status502 "server-error") r pure $ filterClients (not . Set.null) clients @@ -76,11 +76,11 @@ lookupClientsFull :: App UserClientsFull lookupClientsFull uids = do r <- - call Brig $ - method POST - . path "/i/clients/full" - . json (UserSet $ Set.fromList uids) - . expect2xx + call Brig + $ method POST + . path "/i/clients/full" + . json (UserSet $ Set.fromList uids) + . expect2xx clients <- parseResponse (mkError status502 "server-error") r pure $ filterClientsFull (not . Set.null) clients @@ -91,11 +91,12 @@ notifyClientsAboutLegalHoldRequest :: LastPrekey -> App () notifyClientsAboutLegalHoldRequest requesterUid targetUid lastPrekey' = do - void . call Brig $ - method POST - . paths ["i", "clients", "legalhold", toByteString' targetUid, "request"] - . json (LegalHoldClientRequest requesterUid lastPrekey') - . expect2xx + void + . call Brig + $ method POST + . paths ["i", "clients", "legalhold", toByteString' targetUid, "request"] + . json (LegalHoldClientRequest requesterUid lastPrekey') + . expect2xx -- | Calls 'Brig.User.API.Auth.legalHoldLoginH'. getLegalHoldAuthToken :: @@ -109,12 +110,13 @@ getLegalHoldAuthToken :: Sem r OpaqueAuthToken getLegalHoldAuthToken uid pw = do r <- - embedApp . call Brig $ - method POST - . path "/i/legalhold-login" - . queryItem "persist" "true" - . json (LegalHoldLogin uid pw Nothing) - . expect2xx + embedApp + . call Brig + $ method POST + . path "/i/legalhold-login" + . queryItem "persist" "true" + . json (LegalHoldLogin uid pw Nothing) + . expect2xx case getCookieValue "zuid" r of Nothing -> do P.warn $ Logger.msg @Text "Response from login missing auth cookie" @@ -150,23 +152,24 @@ removeLegalHoldClientFromUser :: UserId -> App () removeLegalHoldClientFromUser targetUid = do - void . call Brig $ - method DELETE - . paths ["i", "clients", "legalhold", toByteString' targetUid] - . contentJson - . expect2xx + void + . call Brig + $ method DELETE + . paths ["i", "clients", "legalhold", toByteString' targetUid] + . contentJson + . expect2xx -- | Calls 'Brig.API.addClientInternalH'. brigAddClient :: UserId -> ConnId -> NewClient -> App (Either AuthenticationError Client) brigAddClient uid connId client = do r <- - call Brig $ - method POST - . header "Z-Connection" (toByteString' connId) - . paths ["i", "clients", toByteString' uid] - . contentJson - . json client - . expectStatus (flip elem [201, 403]) + call Brig + $ method POST + . header "Z-Connection" (toByteString' connId) + . paths ["i", "clients", toByteString' uid] + . contentJson + . json client + . expectStatus (flip elem [201, 403]) if statusCode (responseStatus r) == 201 then Right <$> parseResponse (mkError status502 "server-error") r else pure (Left ReAuthFailed) diff --git a/services/galley/src/Galley/Intra/Effects.hs b/services/galley/src/Galley/Intra/Effects.hs index ef071400ab0..8abf976a6bd 100644 --- a/services/galley/src/Galley/Intra/Effects.hs +++ b/services/galley/src/Galley/Intra/Effects.hs @@ -54,14 +54,14 @@ interpretBrigAccess = interpret $ \case embedApp $ getConnectionsUnqualified uids muids mrel GetConnectionsUnqualifiedBidi uids1 uids2 mrel1 mrel2 -> do logEffect "BrigAccess.GetConnectionsUnqualifiedBidi" - embedApp $ - UnliftIO.concurrently + embedApp + $ UnliftIO.concurrently (getConnectionsUnqualified uids1 (Just uids2) mrel1) (getConnectionsUnqualified uids2 (Just uids1) mrel2) GetConnections uids mquids mrel -> do logEffect "BrigAccess.GetConnections" - embedApp $ - getConnections uids mquids mrel + embedApp + $ getConnections uids mquids mrel PutConnectionInternal uc -> do logEffect "BrigAccess.PutConnectionInternal" embedApp $ putConnectionInternal uc diff --git a/services/galley/src/Galley/Intra/Spar.hs b/services/galley/src/Galley/Intra/Spar.hs index 989df2563ed..039a7046b6d 100644 --- a/services/galley/src/Galley/Intra/Spar.hs +++ b/services/galley/src/Galley/Intra/Spar.hs @@ -34,17 +34,18 @@ import Wire.API.User (ScimUserInfo, UserSet (..), scimUserInfos) -- | Notify Spar that a team is being deleted. deleteTeam :: TeamId -> App () deleteTeam tid = do - void . call Spar $ - method DELETE - . paths ["i", "teams", toByteString' tid] - . expect2xx + void + . call Spar + $ method DELETE + . paths ["i", "teams", toByteString' tid] + . expect2xx -- | Get the SCIM user info for a user. lookupScimUserInfos :: [UserId] -> App [ScimUserInfo] lookupScimUserInfos uids = do response <- - call Spar $ - method POST - . paths ["i", "scim", "userinfos"] - . json (UserSet $ Set.fromList uids) + call Spar + $ method POST + . paths ["i", "scim", "userinfos"] + . json (UserSet $ Set.fromList uids) pure $ foldMap scimUserInfos $ responseJsonMaybe response diff --git a/services/galley/src/Galley/Intra/Team.hs b/services/galley/src/Galley/Intra/Team.hs index ebe748c1235..db602faf90f 100644 --- a/services/galley/src/Galley/Intra/Team.hs +++ b/services/galley/src/Galley/Intra/Team.hs @@ -32,8 +32,8 @@ import Network.Wai.Utilities.Error getSize :: TeamId -> App TeamSize getSize tid = do r <- - call Brig $ - method GET - . paths ["/i/teams", toByteString' tid, "size"] - . expect2xx + call Brig + $ method GET + . paths ["/i/teams", toByteString' tid, "size"] + . expect2xx parseResponse (mkError status502 "server-error") r diff --git a/services/galley/src/Galley/Intra/User.hs b/services/galley/src/Galley/Intra/User.hs index 27b3497afae..15e15bf07d2 100644 --- a/services/galley/src/Galley/Intra/User.hs +++ b/services/galley/src/Galley/Intra/User.hs @@ -85,12 +85,12 @@ getConnectionsUnqualified :: App [ConnectionStatus] getConnectionsUnqualified uFrom uTo rlt = do r <- - call Brig $ - method POST - . path "/i/users/connections-status" - . maybe id rfilter rlt - . json ConnectionsStatusRequest {csrFrom = uFrom, csrTo = uTo} - . expect2xx + call Brig + $ method POST + . path "/i/users/connections-status" + . maybe id rfilter rlt + . json ConnectionsStatusRequest {csrFrom = uFrom, csrTo = uTo} + . expect2xx parseResponse (mkError status502 "server-error") r where rfilter = queryItem "filter" . (pack . map toLower . show) @@ -109,11 +109,11 @@ getConnections :: getConnections [] _ _ = pure [] getConnections uFrom uTo rlt = do r <- - call Brig $ - method POST - . path "/i/users/connections-status/v2" - . json (ConnectionsStatusRequestV2 uFrom uTo rlt) - . expect2xx + call Brig + $ method POST + . path "/i/users/connections-status/v2" + . json (ConnectionsStatusRequestV2 uFrom uTo rlt) + . expect2xx parseResponse (mkError status502 "server-error") r putConnectionInternal :: @@ -121,10 +121,10 @@ putConnectionInternal :: App Status putConnectionInternal updateConn = do response <- - call Brig $ - method PUT - . paths ["/i/connections/connection-update"] - . json updateConn + call Brig + $ method PUT + . paths ["/i/connections/connection-update"] + . json updateConn pure $ responseStatus response deleteBot :: @@ -132,14 +132,14 @@ deleteBot :: BotId -> App () deleteBot cid bot = do - void $ - call Brig $ - method DELETE - . path "/bot/self" - . header "Z-Type" "bot" - . header "Z-Bot" (toByteString' bot) - . header "Z-Conversation" (toByteString' cid) - . expect2xx + void + $ call Brig + $ method DELETE + . path "/bot/self" + . header "Z-Type" "bot" + . header "Z-Bot" (toByteString' bot) + . header "Z-Conversation" (toByteString' cid) + . expect2xx -- | Calls 'Brig.User.API.Auth.reAuthUserH'. reAuthUser :: @@ -166,9 +166,9 @@ check :: [Status] -> Request -> Request check allowed r = r { Http.checkResponse = \rq rs -> - unless (responseStatus rs `elem` allowed) $ - let ex = StatusCodeException (rs {responseBody = ()}) mempty - in throwM $ HttpExceptionRequest rq ex + unless (responseStatus rs `elem` allowed) + $ let ex = StatusCodeException (rs {responseBody = ()}) mempty + in throwM $ HttpExceptionRequest rq ex } -- | Calls 'Brig.API.listActivatedAccountsH'. @@ -176,11 +176,11 @@ lookupActivatedUsers :: [UserId] -> App [User] lookupActivatedUsers = chunkify $ \uids -> do let users = BSC.intercalate "," $ toByteString' <$> uids r <- - call Brig $ - method GET - . path "/i/users" - . queryItem "ids" users - . expect2xx + call Brig + $ method GET + . path "/i/users" + . queryItem "ids" users + . expect2xx parseResponse (mkError status502 "server-error") r -- | URLs with more than ~160 uids produce 400 responses, because HAProxy has a @@ -201,44 +201,44 @@ chunkify doChunk keys = mconcat <$> (doChunk `mapM` chunks keys) getUsers :: [UserId] -> App [Brig.UserAccount] getUsers = chunkify $ \uids -> do resp <- - call Brig $ - method GET - . path "/i/users" - . queryItem "ids" (BSC.intercalate "," (toByteString' <$> uids)) - . expect2xx + call Brig + $ method GET + . path "/i/users" + . queryItem "ids" (BSC.intercalate "," (toByteString' <$> uids)) + . expect2xx pure . fromMaybe [] . responseJsonMaybe $ resp -- | Calls 'Brig.API.deleteUserNoAuthH'. deleteUser :: UserId -> App () deleteUser uid = do - void $ - call Brig $ - method DELETE - . paths ["/i/users", toByteString' uid] - . expect2xx + void + $ call Brig + $ method DELETE + . paths ["/i/users", toByteString' uid] + . expect2xx -- | Calls 'Brig.API.getContactListH'. getContactList :: UserId -> App [UserId] getContactList uid = do r <- - call Brig $ - method GET - . paths ["/i/users", toByteString' uid, "contacts"] - . expect2xx + call Brig + $ method GET + . paths ["/i/users", toByteString' uid, "contacts"] + . expect2xx cUsers <$> parseResponse (mkError status502 "server-error") r -- | Calls 'Brig.API.Internal.getRichInfoMultiH' getRichInfoMultiUser :: [UserId] -> App [(UserId, RichInfo)] getRichInfoMultiUser = chunkify $ \uids -> do resp <- - call Brig $ - method GET - . paths ["/i/users/rich-info"] - . queryItem "ids" (toByteString' (List uids)) - . expect2xx + call Brig + $ method GET + . paths ["/i/users/rich-info"] + . queryItem "ids" (toByteString' (List uids)) + . expect2xx parseResponse (mkError status502 "server-error: could not parse response to `GET brig:/i/users/rich-info`") resp -getAccountConferenceCallingConfigClient :: HasCallStack => UserId -> App (WithStatusNoLock ConferenceCallingConfig) +getAccountConferenceCallingConfigClient :: (HasCallStack) => UserId -> App (WithStatusNoLock ConferenceCallingConfig) getAccountConferenceCallingConfigClient uid = runHereClientM (namedClient @IAPI.API @"get-account-conference-calling-config" uid) >>= handleServantResp @@ -247,9 +247,9 @@ updateSearchVisibilityInbound :: Multi.TeamStatus SearchVisibilityInboundConfig updateSearchVisibilityInbound = handleServantResp <=< runHereClientM - . namedClient @IAPI.API @"updateSearchVisibilityInbound" + . namedClient @IAPI.API @"updateSearchVisibilityInbound" -runHereClientM :: HasCallStack => Client.ClientM a -> App (Either Client.ClientError a) +runHereClientM :: (HasCallStack) => Client.ClientM a -> App (Either Client.ClientError a) runHereClientM action = do mgr <- view manager brigep <- view brig diff --git a/services/galley/src/Galley/Keys.hs b/services/galley/src/Galley/Keys.hs index 5cbfa540b21..0b764fb17c9 100644 --- a/services/galley/src/Galley/Keys.hs +++ b/services/galley/src/Galley/Keys.hs @@ -97,15 +97,15 @@ loadECDSAKeyPair :: IO (ECDSA.PrivateKey c, ECDSA.PublicKey c) loadECDSAKeyPair path = do bytes <- LBS.readFile path - either (throwIO . MLSPrivateKeyException path) pure $ - decodeEcdsaKeyPair @c bytes + either (throwIO . MLSPrivateKeyException path) pure + $ decodeEcdsaKeyPair @c bytes loadEd25519KeyPair :: FilePath -> IO (Ed25519.SecretKey, Ed25519.PublicKey) loadEd25519KeyPair path = do bytes <- LBS.readFile path priv <- - either (throwIO . MLSPrivateKeyException path) pure $ - decodeEd25519PrivateKey bytes + either (throwIO . MLSPrivateKeyException path) pure + $ decodeEd25519PrivateKey bytes pure (priv, Ed25519.toPublic priv) decodeEcdsaKeyPair :: @@ -151,11 +151,13 @@ decodeEcdsaKeyPair bytes = do ] -> pure (priv, pub) _ -> Left "invalid ECDSA key format: expected rfc5915 private key format" priv <- - first displayException . eitherCryptoError $ - ECDSA.decodePrivate curve privBS + first displayException + . eitherCryptoError + $ ECDSA.decodePrivate curve privBS pub <- - first displayException . eitherCryptoError $ - ECDSA.decodePublic curve pubBS + first displayException + . eitherCryptoError + $ ECDSA.decodePublic curve pubBS pure (priv, pub) decodeEd25519PrivateKey :: diff --git a/services/galley/src/Galley/Queue.hs b/services/galley/src/Galley/Queue.hs index 2ec064374ba..de320bde244 100644 --- a/services/galley/src/Galley/Queue.hs +++ b/services/galley/src/Galley/Queue.hs @@ -38,10 +38,10 @@ data Queue a = Queue _queue :: Stm.TBQueue a } -new :: MonadIO m => Natural -> m (Queue a) +new :: (MonadIO m) => Natural -> m (Queue a) new n = liftIO $ Queue <$> Stm.newTVarIO 0 <*> Stm.newTBQueueIO n -tryPush :: MonadIO m => Queue a -> a -> m Bool +tryPush :: (MonadIO m) => Queue a -> a -> m Bool tryPush q a = liftIO . atomically $ do isFull <- Stm.isFullTBQueue (_queue q) unless isFull $ do @@ -49,16 +49,16 @@ tryPush q a = liftIO . atomically $ do Stm.writeTBQueue (_queue q) a pure (not isFull) -pop :: MonadIO m => Queue a -> m a +pop :: (MonadIO m) => Queue a -> m a pop q = liftIO . atomically $ do Stm.modifyTVar' (_len q) (pred . max 1) Stm.readTBQueue (_queue q) -len :: MonadIO m => Queue a -> m Word +len :: (MonadIO m) => Queue a -> m Word len q = liftIO $ Stm.readTVarIO (_len q) interpretQueue :: - Member (Embed IO) r => + (Member (Embed IO) r) => Queue a -> Sem (E.Queue a ': r) x -> Sem r x diff --git a/services/galley/src/Galley/Run.hs b/services/galley/src/Galley/Run.hs index 4ac4bc764ca..9793183c3a5 100644 --- a/services/galley/src/Galley/Run.hs +++ b/services/galley/src/Galley/Run.hs @@ -70,12 +70,12 @@ run :: Opts -> IO () run opts = lowerCodensity $ do (app, env) <- mkApp opts settings' <- - lift $ - newSettings $ - defaultServer - (unpack $ opts ^. galley . host) - (portNumber $ fromIntegral $ opts ^. galley . port) - (env ^. App.applog) + lift + $ newSettings + $ defaultServer + (unpack $ opts ^. galley . host) + (portNumber $ fromIntegral $ opts ^. galley . port) + (env ^. App.applog) forM_ (env ^. aEnv) $ \aws -> void $ Codensity $ Async.withAsync $ collectAuthMetrics (aws ^. awsEnv) @@ -120,10 +120,10 @@ mkApp opts = -- report a 400 `invalid UUID` error. fallback :: Application fallback _ k = - k $ - responseLBS HTTP.status404 [("Content-Type", "application/json")] $ - Aeson.encode $ - mkError HTTP.status404 "no-endpoint" "The requested endpoint does not exist" + k + $ responseLBS HTTP.status404 [("Content-Type", "application/json")] + $ Aeson.encode + $ mkError HTTP.status404 "no-endpoint" "The requested endpoint does not exist" servantApp :: Env -> Application servantApp e0 r cont = do @@ -159,8 +159,8 @@ bodyParserErrorFormatter' _ _ errMsg = { Servant.errHTTPCode = HTTP.statusCode HTTP.status400, Servant.errReasonPhrase = UTF8.toString $ HTTP.statusMessage HTTP.status400, Servant.errBody = - Aeson.encode $ - Aeson.object + Aeson.encode + $ Aeson.object [ "code" Aeson..= Aeson.Number 400, "message" Aeson..= errMsg, "label" Aeson..= ("bad-request" :: Text) @@ -185,8 +185,8 @@ refreshMetrics = do {-# NOINLINE deleteQueueLengthGauge #-} deleteQueueLengthGauge :: Prom.Gauge deleteQueueLengthGauge = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "galley.deletequeue.len", Prom.metricHelp = "Length of the galley delete queue" @@ -194,8 +194,9 @@ deleteQueueLengthGauge = collectAuthMetrics :: (MonadIO m) => AWS.Env -> m () collectAuthMetrics env = do - liftIO $ - forever $ do + liftIO + $ forever + $ do mbRemaining <- readAuthExpiration env gaugeTokenRemaing mbRemaining threadDelay 1_000_000 diff --git a/services/galley/src/Galley/Schema/V24.hs b/services/galley/src/Galley/Schema/V24.hs index 7ace99b3b71..cd6cd9a2e91 100644 --- a/services/galley/src/Galley/Schema/V24.hs +++ b/services/galley/src/Galley/Schema/V24.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 24 "Use LeveledCompactionStrategy on clients" $ - schema' + Migration 24 "Use LeveledCompactionStrategy on clients" + $ schema' [r| ALTER TABLE clients WITH compaction = {'class': 'LeveledCompactionStrategy'}; diff --git a/services/galley/src/Galley/Schema/V25.hs b/services/galley/src/Galley/Schema/V25.hs index 420afffec0a..6c25788b31b 100644 --- a/services/galley/src/Galley/Schema/V25.hs +++ b/services/galley/src/Galley/Schema/V25.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 25 "Add conversation_codes table" $ - schema' + Migration 25 "Add conversation_codes table" + $ schema' [r| CREATE TABLE conversation_codes ( key ascii, -- opaque conversation ID diff --git a/services/galley/src/Galley/Schema/V26.hs b/services/galley/src/Galley/Schema/V26.hs index 8dc98b98fa1..1de7d67e90e 100644 --- a/services/galley/src/Galley/Schema/V26.hs +++ b/services/galley/src/Galley/Schema/V26.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 26 "Add conversation access_role" $ - schema' [r| ALTER TABLE conversation ADD access_role int; |] + Migration 26 "Add conversation access_role" + $ schema' [r| ALTER TABLE conversation ADD access_role int; |] diff --git a/services/galley/src/Galley/Schema/V27.hs b/services/galley/src/Galley/Schema/V27.hs index 096f210ed6e..1309737ce9e 100644 --- a/services/galley/src/Galley/Schema/V27.hs +++ b/services/galley/src/Galley/Schema/V27.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 27 "Add conversation message_timer" $ - schema' [r| ALTER TABLE conversation ADD message_timer bigint; |] + Migration 27 "Add conversation message_timer" + $ schema' [r| ALTER TABLE conversation ADD message_timer bigint; |] diff --git a/services/galley/src/Galley/Schema/V28.hs b/services/galley/src/Galley/Schema/V28.hs index 959dee20c7f..a8f27391f2e 100644 --- a/services/galley/src/Galley/Schema/V28.hs +++ b/services/galley/src/Galley/Schema/V28.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 28 "Add (extra) otr muted status to member" $ - schema' [r| ALTER TABLE member ADD otr_muted_status int; |] + Migration 28 "Add (extra) otr muted status to member" + $ schema' [r| ALTER TABLE member ADD otr_muted_status int; |] diff --git a/services/galley/src/Galley/Schema/V29.hs b/services/galley/src/Galley/Schema/V29.hs index a30664fdc2f..2df50ef98a7 100644 --- a/services/galley/src/Galley/Schema/V29.hs +++ b/services/galley/src/Galley/Schema/V29.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 29 "Add conversation receipt mode" $ - schema' [r| ALTER TABLE conversation ADD receipt_mode int; |] + Migration 29 "Add conversation receipt mode" + $ schema' [r| ALTER TABLE conversation ADD receipt_mode int; |] diff --git a/services/galley/src/Galley/Schema/V53_AddRemoteConvStatus.hs b/services/galley/src/Galley/Schema/V53_AddRemoteConvStatus.hs index 674a14273df..64b64b24e6f 100644 --- a/services/galley/src/Galley/Schema/V53_AddRemoteConvStatus.hs +++ b/services/galley/src/Galley/Schema/V53_AddRemoteConvStatus.hs @@ -24,8 +24,8 @@ import Text.RawString.QQ -- This migration adds fields that track remote conversation status for a local user. migration :: Migration migration = - Migration 53 "Add fields for remote conversation status (hidden/archived/muted)" $ - schema' + Migration 53 "Add fields for remote conversation status (hidden/archived/muted)" + $ schema' [r| ALTER TABLE user_remote_conv ADD ( hidden boolean, diff --git a/services/galley/src/Galley/Schema/V63_MLSConversationClients.hs b/services/galley/src/Galley/Schema/V63_MLSConversationClients.hs index 1a82ab231b6..539e23efbb2 100644 --- a/services/galley/src/Galley/Schema/V63_MLSConversationClients.hs +++ b/services/galley/src/Galley/Schema/V63_MLSConversationClients.hs @@ -23,8 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 63 "Add a column for a list of MLS clients in a conversation" $ - schema' + Migration 63 "Add a column for a list of MLS clients in a conversation" + $ schema' [r| ALTER TABLE member ADD ( mls_clients set ) diff --git a/services/galley/src/Galley/Schema/V65_MLSRemoteClients.hs b/services/galley/src/Galley/Schema/V65_MLSRemoteClients.hs index c2a7deb9795..b7bd7972708 100644 --- a/services/galley/src/Galley/Schema/V65_MLSRemoteClients.hs +++ b/services/galley/src/Galley/Schema/V65_MLSRemoteClients.hs @@ -23,8 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 65 "Add a column for a list of MLS clients for remote members of a conversation" $ - schema' + Migration 65 "Add a column for a list of MLS clients for remote members of a conversation" + $ schema' [r| ALTER TABLE member_remote_user ADD ( mls_clients set ) diff --git a/services/galley/src/Galley/Schema/V66_AddSplashScreen.hs b/services/galley/src/Galley/Schema/V66_AddSplashScreen.hs index b5e9c31c327..0c3f38cf8f4 100644 --- a/services/galley/src/Galley/Schema/V66_AddSplashScreen.hs +++ b/services/galley/src/Galley/Schema/V66_AddSplashScreen.hs @@ -23,8 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 66 "Add splash screen column for team" $ - schema' + Migration 66 "Add splash screen column for team" + $ schema' [r| ALTER TABLE team ADD ( splash_screen text ) diff --git a/services/galley/src/Galley/Schema/V67_MLSFeature.hs b/services/galley/src/Galley/Schema/V67_MLSFeature.hs index 5391d1967ed..3a906a4de46 100644 --- a/services/galley/src/Galley/Schema/V67_MLSFeature.hs +++ b/services/galley/src/Galley/Schema/V67_MLSFeature.hs @@ -23,8 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 67 "Add team feature config for MLSConfig" $ - schema' + Migration 67 "Add team feature config for MLSConfig" + $ schema' [r| ALTER TABLE team_features ADD ( mls_status int, mls_default_protocol int, diff --git a/services/galley/src/Galley/Schema/V68_MLSCommitLock.hs b/services/galley/src/Galley/Schema/V68_MLSCommitLock.hs index 24380e5d914..4695b5a4c8b 100644 --- a/services/galley/src/Galley/Schema/V68_MLSCommitLock.hs +++ b/services/galley/src/Galley/Schema/V68_MLSCommitLock.hs @@ -23,8 +23,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 68 "Add lock table for MLS commits" $ - schema' + Migration 68 "Add lock table for MLS commits" + $ schema' [r| CREATE TABLE mls_commit_locks ( group_id blob, epoch bigint, diff --git a/services/galley/src/Galley/Schema/V69_MLSProposal.hs b/services/galley/src/Galley/Schema/V69_MLSProposal.hs index e0730ce253a..e2f62d5b3a3 100644 --- a/services/galley/src/Galley/Schema/V69_MLSProposal.hs +++ b/services/galley/src/Galley/Schema/V69_MLSProposal.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 69 "Introduce an MLS proposals table" $ - schema' + Migration 69 "Introduce an MLS proposals table" + $ schema' [r| CREATE TABLE mls_proposal_refs ( group_id blob, epoch bigint, diff --git a/services/galley/src/Galley/Schema/V70_MLSCipherSuite.hs b/services/galley/src/Galley/Schema/V70_MLSCipherSuite.hs index d445270b99d..5fb5facbf9e 100644 --- a/services/galley/src/Galley/Schema/V70_MLSCipherSuite.hs +++ b/services/galley/src/Galley/Schema/V70_MLSCipherSuite.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 70 "Add the MLS cipher suite column to the conversation table" $ - schema' + Migration 70 "Add the MLS cipher suite column to the conversation table" + $ schema' [r| ALTER TABLE conversation ADD ( cipher_suite int ) diff --git a/services/galley/src/Galley/Schema/V75_MLSGroupInfo.hs b/services/galley/src/Galley/Schema/V75_MLSGroupInfo.hs index 84b6df1504b..5ed4763944f 100644 --- a/services/galley/src/Galley/Schema/V75_MLSGroupInfo.hs +++ b/services/galley/src/Galley/Schema/V75_MLSGroupInfo.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 75 "Add the MLS public group state column to the conversation table" $ - schema' + Migration 75 "Add the MLS public group state column to the conversation table" + $ schema' [r| ALTER TABLE conversation ADD ( public_group_state blob ) diff --git a/services/galley/src/Galley/Schema/V76_ProposalOrigin.hs b/services/galley/src/Galley/Schema/V76_ProposalOrigin.hs index 3324af00cb8..a07f4cc8879 100644 --- a/services/galley/src/Galley/Schema/V76_ProposalOrigin.hs +++ b/services/galley/src/Galley/Schema/V76_ProposalOrigin.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 76 "Add the origin column to the pending proposals table" $ - schema' + Migration 76 "Add the origin column to the pending proposals table" + $ schema' [r| ALTER TABLE mls_proposal_refs ADD ( origin int ) diff --git a/services/galley/src/Galley/Schema/V80_AddConversationCodePassword.hs b/services/galley/src/Galley/Schema/V80_AddConversationCodePassword.hs index 24ae8e2faf4..60f42650f9c 100644 --- a/services/galley/src/Galley/Schema/V80_AddConversationCodePassword.hs +++ b/services/galley/src/Galley/Schema/V80_AddConversationCodePassword.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 80 "Add optional password to conversation_codes table" $ - schema' + Migration 80 "Add optional password to conversation_codes table" + $ schema' [r| ALTER TABLE conversation_codes ADD ( password blob diff --git a/services/galley/src/Galley/Schema/V89_MlsLockStatus.hs b/services/galley/src/Galley/Schema/V89_MlsLockStatus.hs index 26e42738b8d..b759e7d3cd3 100644 --- a/services/galley/src/Galley/Schema/V89_MlsLockStatus.hs +++ b/services/galley/src/Galley/Schema/V89_MlsLockStatus.hs @@ -25,8 +25,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 89 "Add lock status for MLSConfig" $ - schema' + Migration 89 "Add lock status for MLSConfig" + $ schema' [r| ALTER TABLE team_features ADD ( mls_lock_status int ) diff --git a/services/galley/src/Galley/Schema/V90_EnforceFileDownloadLocationConfig.hs b/services/galley/src/Galley/Schema/V90_EnforceFileDownloadLocationConfig.hs index b55842de725..bd1bde69d6d 100644 --- a/services/galley/src/Galley/Schema/V90_EnforceFileDownloadLocationConfig.hs +++ b/services/galley/src/Galley/Schema/V90_EnforceFileDownloadLocationConfig.hs @@ -25,8 +25,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 90 "Add fields for EnforceFileDownloadLocationConfig" $ - schema' + Migration 90 "Add fields for EnforceFileDownloadLocationConfig" + $ schema' [r| ALTER TABLE team_features ADD ( enforce_file_download_location_lock_status int, enforce_file_download_location_status int, diff --git a/services/galley/src/Galley/Schema/V91_TeamMemberDeletedLimitedEventFanout.hs b/services/galley/src/Galley/Schema/V91_TeamMemberDeletedLimitedEventFanout.hs index 3ad5f314390..7cb1b23835b 100644 --- a/services/galley/src/Galley/Schema/V91_TeamMemberDeletedLimitedEventFanout.hs +++ b/services/galley/src/Galley/Schema/V91_TeamMemberDeletedLimitedEventFanout.hs @@ -22,8 +22,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 91 "Add a field for the team member deleted limited event fanout" $ - schema' + Migration 91 "Add a field for the team member deleted limited event fanout" + $ schema' [r| ALTER TABLE team_features ADD ( limited_event_fanout_status int ) diff --git a/services/galley/src/Galley/Schema/V92_MlsE2EIdConfig.hs b/services/galley/src/Galley/Schema/V92_MlsE2EIdConfig.hs index 0c11ebf6cd6..c269acd9cfb 100644 --- a/services/galley/src/Galley/Schema/V92_MlsE2EIdConfig.hs +++ b/services/galley/src/Galley/Schema/V92_MlsE2EIdConfig.hs @@ -22,8 +22,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 92 "Add mls_e2eid_crl_proxy and mls_e2eid_use_proxy_on_mobile to team_features" $ - schema' + Migration 92 "Add mls_e2eid_crl_proxy and mls_e2eid_use_proxy_on_mobile to team_features" + $ schema' [r| ALTER TABLE team_features ADD ( mls_e2eid_crl_proxy blob, mls_e2eid_use_proxy_on_mobile boolean diff --git a/services/galley/src/Galley/Types/UserList.hs b/services/galley/src/Galley/Types/UserList.hs index 3dbc81444de..071403b5c9d 100644 --- a/services/galley/src/Galley/Types/UserList.hs +++ b/services/galley/src/Galley/Types/UserList.hs @@ -43,7 +43,7 @@ instance Semigroup (UserList a) where instance Monoid (UserList a) where mempty = UserList mempty mempty -toUserList :: Foldable f => Local x -> f (Qualified a) -> UserList a +toUserList :: (Foldable f) => Local x -> f (Qualified a) -> UserList a toUserList loc = uncurry UserList . partitionQualified loc ulAddLocal :: a -> UserList a -> UserList a @@ -59,7 +59,7 @@ ulFromRemotes :: [Remote a] -> UserList a ulFromRemotes = UserList [] -- | Remove from the first list all the users that are in the second list. -ulDiff :: Eq a => UserList a -> UserList a -> UserList a +ulDiff :: (Eq a) => UserList a -> UserList a -> UserList a ulDiff (UserList lA rA) (UserList lB rB) = UserList (filter (`notElem` lB) lA) diff --git a/services/galley/src/Galley/Validation.hs b/services/galley/src/Galley/Validation.hs index 964963e4e65..7d045d21026 100644 --- a/services/galley/src/Galley/Validation.hs +++ b/services/galley/src/Galley/Validation.hs @@ -51,9 +51,9 @@ rangeCheckedMaybe (Just a) = Just <$> rangeChecked a newtype ConvSizeChecked f a = ConvSizeChecked {fromConvSize :: f a} deriving (Functor, Foldable, Traversable) -deriving newtype instance Semigroup (f a) => Semigroup (ConvSizeChecked f a) +deriving newtype instance (Semigroup (f a)) => Semigroup (ConvSizeChecked f a) -deriving newtype instance Monoid (f a) => Monoid (ConvSizeChecked f a) +deriving newtype instance (Monoid (f a)) => Monoid (ConvSizeChecked f a) checkedConvSize :: (Member (Error InvalidInput) r, Foldable f) => @@ -67,5 +67,5 @@ checkedConvSize o x = do then pure (ConvSizeChecked x) else throwErr (errorMsg minV limit "") -throwErr :: Member (Error InvalidInput) r => String -> Sem r a +throwErr :: (Member (Error InvalidInput) r) => String -> Sem r a throwErr = throw . InvalidRange . fromString diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index 62c10b3e20a..dbb0d1f5745 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -319,12 +319,13 @@ testGetConvQualifiedV2 = do defNewProteusConv { newConvUsers = [bob] } - bimap ((<>) a) ((<>) p) acc) ([], []) v - liftIO $ - assertBool "No unreachable backend in the test" (allRemotes /= participatingRemotes) + liftIO + $ assertBool "No unreachable backend in the test" (allRemotes /= participatingRemotes) let convName = "some chat" otherLocals = [qAlex] joiners = allRemotes <> otherLocals unreachableBackends = - Set.fromList $ - foldMap + Set.fromList + $ foldMap ( \rb -> guard (rbReachable rb == BackendUnreachable) $> tDomain rb @@ -399,10 +400,10 @@ postConvWithUnreachableRemoteUsers rbs = do { newConvName = checked convName, newConvQualifiedUsers = joiners } - getAllConvs alice - liftIO $ - assertEqual + liftIO + $ assertEqual "Alice does have a group conversation, while she should not!" [] groupConvs @@ -449,9 +450,9 @@ postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do -- Deleted eve WS.bracketR2 c bob eve $ \(wsB, wsE) -> do deleteClient eve ec (Just defPassword) !!! const 200 === statusCode - liftIO $ - WS.assertMatch_ (5 # WS.Second) wsE $ - wsAssertClientRemoved ec + liftIO + $ WS.assertMatch_ (5 # WS.Second) wsE + $ wsAssertClientRemoved ec let m4 = [(bob, bc, toBase64Text "ciphertext4"), (eve, ec, toBase64Text "ciphertext4")] postOtrMessage I.id alice ac conv m4 !!! do const 201 === statusCode @@ -717,8 +718,8 @@ postMessageQualifiedLocalOwningBackendMissingClients = do pure resp2 !!! do const 412 === statusCode let expectedMissing = - QualifiedUserClients $ - Map.fromList + QualifiedUserClients + $ Map.fromList [ ( owningDomain, Map.fromList [ (bobUnqualified, Set.singleton bobClient), @@ -797,21 +798,24 @@ postMessageQualifiedLocalOwningBackendRedundantAndDeletedClients = do pure resp2 !!! do const 201 === statusCode let expectedRedundant = - QualifiedUserClients . Map.fromList $ - [ ( owningDomain, - Map.fromList - [ (nonMemberUnqualified, Set.singleton nonMemberOwningDomainClient) - ] - ), - ( remoteDomain, - Map.fromList - [ (nonMemberRemoteUnqualified, Set.singleton nonMemberRemoteClient) - ] - ) - ] + QualifiedUserClients + . Map.fromList + $ [ ( owningDomain, + Map.fromList + [ (nonMemberUnqualified, Set.singleton nonMemberOwningDomainClient) + ] + ), + ( remoteDomain, + Map.fromList + [ (nonMemberRemoteUnqualified, Set.singleton nonMemberRemoteClient) + ] + ) + ] expectedDeleted = - QualifiedUserClients . Map.singleton owningDomain . Map.fromList $ - [(chadUnqualified, Set.singleton chadClientNonExistent)] + QualifiedUserClients + . Map.singleton owningDomain + . Map.fromList + $ [(chadUnqualified, Set.singleton chadClientNonExistent)] assertMismatchQualified mempty mempty expectedRedundant expectedDeleted mempty liftIO $ do let encodedTextForBob = toBase64Text "text-for-bob" @@ -923,8 +927,10 @@ postMessageQualifiedLocalOwningBackendIgnoreMissingClients = do pure resp2 !!! do const 412 === statusCode let expectedMissing = - QualifiedUserClients . Map.singleton owningDomain . Map.fromList $ - [(chadUnqualified, Set.singleton chadClient2)] + QualifiedUserClients + . Map.singleton owningDomain + . Map.fromList + $ [(chadUnqualified, Set.singleton chadClient2)] assertMismatchQualified mempty expectedMissing mempty mempty mempty WS.assertNoEvent (1 # Second) [wsBob, wsChad] @@ -943,8 +949,10 @@ postMessageQualifiedLocalOwningBackendIgnoreMissingClients = do pure resp2 !!! do const 412 === statusCode let expectedMissing = - QualifiedUserClients . Map.singleton remoteDomain . Map.fromList $ - [(qUnqualified deeRemote, Set.singleton deeClient)] + QualifiedUserClients + . Map.singleton remoteDomain + . Map.fromList + $ [(qUnqualified deeRemote, Set.singleton deeClient)] assertMismatchQualified mempty expectedMissing mempty mempty mempty WS.assertNoEvent (1 # Second) [wsBob, wsChad] @@ -1043,8 +1051,8 @@ postMessageQualifiedFailedToSendFetchingClients = do let failedToSend = QualifiedUserClients $ Map.fromList [(qDomain deeRemote, Map.fromList [(qUnqualified deeRemote, mempty)])] failedToConfirm = - QualifiedUserClients $ - Map.fromList + QualifiedUserClients + $ Map.fromList [ (qDomain bobRemote, Map.fromList [(qUnqualified bobRemote, Set.fromList [bobClient]), (qUnqualified deeRemote, mempty)]) ] @@ -1119,9 +1127,10 @@ postJoinConvOk = do WS.bracketR2 c alice bob $ \(wsA, wsB) -> do postJoinConv bob conv !!! const 200 === statusCode postJoinConv bob conv !!! const 204 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB] $ - wsAssertMemberJoinWithRole qconv qbob [qbob] roleNameWireMember + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB] + $ wsAssertMemberJoinWithRole qconv qbob [qbob] roleNameWireMember testJoinCodeConv :: TestM () testJoinCodeConv = do @@ -1296,9 +1305,10 @@ postJoinCodeConvOk = do postJoinCodeConv bob payload !!! const 204 === statusCode -- eve cannot join postJoinCodeConv eve payload !!! const 403 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB] $ - wsAssertMemberJoinWithRole qconv qbob [qbob] roleNameWireMember + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB] + $ wsAssertMemberJoinWithRole qconv qbob [qbob] roleNameWireMember -- changing access to non-activated should give eve access Right accessRolesWithGuests <- liftIO $ genAccessRolesV2 [TeamMemberAccessRole, NonTeamMemberAccessRole, GuestAccessRole] [] let nonActivatedAccess = ConversationAccessData (Set.singleton CodeAccess) accessRolesWithGuests @@ -1385,9 +1395,10 @@ postConvertCodeConv = do putQualifiedAccessUpdate alice qconv nonActivatedAccess !!! const 200 === statusCode -- test no-op putQualifiedAccessUpdate alice qconv nonActivatedAccess !!! const 204 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA] $ - wsAssertConvAccessUpdate qconv qalice nonActivatedAccess + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA] + $ wsAssertConvAccessUpdate qconv qalice nonActivatedAccess -- Create/get/update/delete codes getConvCode alice conv !!! const 404 === statusCode c1 <- (.code) . decodeConvCodeEvent <$> (postConvCode alice conv postConvCode alice conv WS.bracketR3 c alice bob eve $ \(wsA, wsB, wsE) -> do postJoinCodeConv mallory j !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsE] $ - wsAssertMemberJoinWithRole qconv qmallory [qmallory] roleNameWireMember + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsE] + $ wsAssertMemberJoinWithRole qconv qmallory [qmallory] roleNameWireMember WS.bracketRN c [alice, bob, eve, mallory] $ \[wsA, wsB, wsE, wsM] -> do let teamAccess = ConversationAccessData (Set.fromList [InviteAccess, CodeAccess]) (Set.fromList [TeamMemberAccessRole]) putQualifiedAccessUpdate alice qconv teamAccess !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsE, wsM] $ - wsAssertConvAccessUpdate qconv qalice teamAccess + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsE, wsM] + $ wsAssertConvAccessUpdate qconv qalice teamAccess -- non-team members get kicked out liftIO $ do - WS.assertMatchN_ (5 # Second) [wsA, wsB, wsE, wsM] $ - wsAssertMemberLeave qconv qalice (pure qeve) EdReasonRemoved - WS.assertMatchN_ (5 # Second) [wsA, wsB, wsE, wsM] $ - wsAssertMemberLeave qconv qalice (pure qmallory) EdReasonRemoved + WS.assertMatchN_ (5 # Second) [wsA, wsB, wsE, wsM] + $ wsAssertMemberLeave qconv qalice (pure qeve) EdReasonRemoved + WS.assertMatchN_ (5 # Second) [wsA, wsB, wsE, wsM] + $ wsAssertMemberLeave qconv qalice (pure qmallory) EdReasonRemoved -- joining (for mallory) is no longer possible postJoinCodeConv mallory j !!! const 403 === statusCode -- team members (dave) can still join @@ -1564,9 +1577,9 @@ getConvsOk :: TestM () getConvsOk = do usr <- randomUser convs <- getAllConvs usr - liftIO $ - [selfConv usr, mlsSelfConvId usr] - @?= map (qUnqualified . cnvQualifiedId) convs + liftIO + $ [selfConv usr, mlsSelfConvId usr] + @?= map (qUnqualified . cnvQualifiedId) convs getConvsOk2 :: TestM () getConvsOk2 = do @@ -1577,24 +1590,28 @@ getConvsOk2 = do do r <- responseJsonError - =<< getConvs alice [cnvQualifiedId cnv1] Int32 -> Int -> UserId -> Maybe ConversationPagingState -> Int -> TestM (Maybe ConversationPagingState) +getChunkedConvs :: (HasCallStack) => Int32 -> Int -> UserId -> Maybe ConversationPagingState -> Int -> TestM (Maybe ConversationPagingState) getChunkedConvs size lastSize alice pagingState n = do resp <- getConvPage alice pagingState (Just size) UserId -> t Int -> TestM () + walk :: (Foldable t) => UserId -> t Int -> TestM () walk u = foldM_ (next u 3) Nothing next :: @@ -1847,14 +1864,15 @@ getConvsPagingOk = do r :: ConvIdsPage <- responseJsonError =<< getConvPage u state (Just step) - NonConnectedBackends mempty - void $ - withTempMockFederator' + void + $ withTempMockFederator' mock ( do postConvQualified @@ -2000,13 +2018,14 @@ postConvQualifiedFederationNotEnabled = do g <- viewGalley unreachable :: UnreachableBackends <- responseJsonError - =<< postConvHelper g alice [bob] (Request -> Request) -> UserId -> [Qualified UserId] -> m ResponseLBS +postConvHelper :: (MonadHttp m) => (Request -> Request) -> UserId -> [Qualified UserId] -> m ResponseLBS postConvHelper g zusr newUsers = do let conv = NewConv [] newUsers (checked "gossip") (Set.fromList []) Nothing Nothing Nothing Nothing roleNameWireAdmin BaseProtocolProteusTag post $ g . path "/conversations" . zUser zusr . zConn "conn" . zType "access" . json conv @@ -2410,16 +2429,17 @@ testBulkGetQualifiedConvs = do mockConversationA = mkProteusConv (qUnqualified remoteConvIdA) bobId roleNameWireAdmin [bobAsOtherMember] mockConversationB = mkProteusConv (qUnqualified remoteConvIdB) carlId roleNameWireAdmin [carlAsOtherMember] req = - ListConversations . unsafeRange $ - [ localConvId, - remoteConvIdA, - remoteConvIdB, - remoteConvIdALocallyNotFound, - localConvIdNotFound, - localConvIdNotParticipating, - remoteConvIdBNotFoundOnRemote, - remoteConvIdCFailure - ] + ListConversations + . unsafeRange + $ [ localConvId, + remoteConvIdA, + remoteConvIdB, + remoteConvIdALocallyNotFound, + localConvIdNotFound, + localConvIdNotParticipating, + remoteConvIdBNotFoundOnRemote, + remoteConvIdCFailure + ] (respAll, receivedRequests) <- do let mock = do d <- frTargetDomain <$> getRequest @@ -2439,8 +2459,8 @@ testBulkGetQualifiedConvs = do sortOn cnvQualifiedId $ pure (remoteConversationView lAlice defMemberStatus (toRemoteUnsafe remoteDomainA mockConversationA)) - <> pure (remoteConversationView lAlice defMemberStatus (toRemoteUnsafe remoteDomainB mockConversationB)) - <> [localConv] + <> pure (remoteConversationView lAlice defMemberStatus (toRemoteUnsafe remoteDomainB mockConversationB)) + <> [localConv] actualFound = sortOn cnvQualifiedId $ crFound convs assertEqual "found conversations" expectedFound actualFound @@ -2471,8 +2491,8 @@ testAddRemoteMemberInvalidDomain = do e :: UnreachableBackends <- responseJsonError =<< postQualifiedMembers alice (remoteBob :| []) qconvId - (getSelfMember (qUnqualified chuck) conv chuck') + liftIO + $ assertEqual "wrong self member" (Just chuck) (memId <$> chuck') postMembersOk3 :: TestM () postMembersOk3 = do @@ -2664,11 +2685,14 @@ leaveRemoteConvQualifiedOk = do <|> mockedFederatedGalleyResponse (resp, fedRequests) <- - withTempMockFederator' mockResponses $ - deleteMemberQualified alice qAlice qconv + withTempMockFederator' mockResponses + $ deleteMemberQualified alice qAlice qconv let leaveRequest :: LeaveConversationRequest = - fromJust . decode . frBody . Imports.head $ - fedRequests + fromJust + . decode + . frBody + . Imports.head + $ fedRequests liftIO $ do statusCode resp @?= 200 case responseJsonEither resp of @@ -2686,17 +2710,20 @@ leaveNonExistentRemoteConv = do let mockResponses = do guardComponent Galley - mockReply $ - LeaveConversationResponse (Left RemoveFromConversationErrorNotFound) + mockReply + $ LeaveConversationResponse (Left RemoveFromConversationErrorNotFound) (resp, fedRequests) <- - withTempMockFederator' mockResponses $ - responseJsonError - =<< deleteMemberQualified (qUnqualified alice) alice conv - responseJsonUnsafe rs @@ -3280,8 +3310,10 @@ postTypingIndicatorsV2 = do ) !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsAlice, wsBob] $ \n -> + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsAlice, wsBob] + $ \n -> wsAssertTyping (tUntagged lcnv) (tUntagged aliceL) StartedTyping n post @@ -3294,8 +3326,10 @@ postTypingIndicatorsV2 = do ) !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsAlice, wsBob] $ \n -> + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsAlice, wsBob] + $ \n -> wsAssertTyping (tUntagged lcnv) (tUntagged bobL) StoppedTyping n postTypingIndicators :: TestM () @@ -3327,8 +3361,10 @@ postTypingIndicators = do ) !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsAlice, wsBob] $ \n -> + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsAlice, wsBob] + $ \n -> wsAssertTyping (tUntagged lcnv) (tUntagged bobL) StoppedTyping n -- to bob from alice @@ -3342,8 +3378,10 @@ postTypingIndicators = do ) !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsAlice, wsBob] $ \n -> + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsAlice, wsBob] + $ \n -> wsAssertTyping (tUntagged lcnv) (tUntagged aliceL) StartedTyping n postTypingIndicatorsHandlesNonsense :: TestM () @@ -3382,12 +3420,14 @@ removeUserNoFederation = do WS.bracketR3 c alice' bob' carl' $ \(wsA, wsB, wsC) -> do deleteUser bob' !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB] $ - wsAssertMembersLeave qconv1 bob [bob] - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsC] $ - wsAssertMembersLeave qconv2 bob [bob] + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB] + $ wsAssertMembersLeave qconv1 bob [bob] + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsC] + $ wsAssertMembersLeave qconv2 bob [bob] -- Check memberships mems1 <- fmap cnvMembers . responseJsonUnsafe <$> getConvQualified alice' qconv1 mems2 <- fmap cnvMembers . responseJsonUnsafe <$> getConvQualified alice' qconv2 @@ -3428,8 +3468,8 @@ testOne2OneConversationRequest shouldBeLocal actor desired = do RemoteActor -> do fedGalleyClient <- view tsFedGalleyClient GetConversationsResponse convs <- - runFedClient @"get-conversations" fedGalleyClient (tDomain bob) $ - GetConversationsRequest + runFedClient @"get-conversations" fedGalleyClient (tDomain bob) + $ GetConversationsRequest { userId = tUnqualified bob, convIds = [qUnqualified convId] } @@ -3446,8 +3486,8 @@ testOne2OneConversationRequest shouldBeLocal actor desired = do found <- do let rconv = mkProteusConv (qUnqualified convId) (tUnqualified bob) roleNameWireAdmin [] (resp, _) <- - withTempMockFederator' (mockReply (GetConversationsResponse [rconv])) $ - getConvQualified (tUnqualified alice) convId + withTempMockFederator' (mockReply (GetConversationsResponse [rconv])) + $ getConvQualified (tUnqualified alice) convId pure $ statusCode resp == 200 liftIO $ found @?= ((actor, desired) == (LocalActor, Included)) ) diff --git a/services/galley/test/integration/API/Federation.hs b/services/galley/test/integration/API/Federation.hs index abd5bfccac8..f6988872458 100644 --- a/services/galley/test/integration/API/Federation.hs +++ b/services/galley/test/integration/API/Federation.hs @@ -127,19 +127,20 @@ getConversationsAllFound = do do convs <- responseJsonError - =<< getConvs bob [cnv1Id, cnvQualifiedId cnv2] liftIO nextRandom GetConversationsResponse convs <- - runFedClient @"get-conversations" fedGalleyClient localDomain $ - GetConversationsRequest rando [qUnqualified . cnvQualifiedId $ cnv1] + runFedClient @"get-conversations" fedGalleyClient localDomain + $ GetConversationsRequest rando [qUnqualified . cnvQualifiedId $ cnv1] liftIO $ assertEqual "conversation list not empty" [] convs onConvCreated :: TestM () @@ -211,8 +213,8 @@ onConvCreated = do expectedOthers = [(qBob, roleNameWireAdmin), (qDee, roleNameWireMember)] expectedFrom = qBob -- since Charlie is not connected to Bob; expect a conversation with Alice&Bob only - WS.assertMatch_ (5 # Second) wsA $ - wsAssertConvCreateWithRole qconv expectedFrom expectedSelf expectedOthers + WS.assertMatch_ (5 # Second) wsA + $ wsAssertConvCreateWithRole qconv expectedFrom expectedSelf expectedOthers WS.assertNoEvent (1 # Second) [wsC] convs <- listRemoteConvs remoteDomain alice liftIO $ convs @?= [Qualified conv remoteDomain] @@ -248,8 +250,8 @@ addLocalUser = do WS.bracketRN c [alice, charlie, dee] $ \[wsA, wsC, wsD] -> do void $ runFedClient @"on-conversation-updated" fedGalleyClient remoteDomain cu liftIO $ do - WS.assertMatch_ (5 # Second) wsA $ - wsAssertMemberJoinWithRole qconv qbob [qalice] roleNameWireMember + WS.assertMatch_ (5 # Second) wsA + $ wsAssertMemberJoinWithRole qconv qbob [qalice] roleNameWireMember -- Since charlie is not really present in the conv, they don't get any -- notifications WS.assertNoEvent (1 # Second) [wsC] @@ -286,8 +288,8 @@ addUnconnectedUsersOnly = do let expectedSelf = qAlice expectedOthers = [(qBob, roleNameWireAdmin)] expectedFrom = qBob - WS.assertMatch_ (5 # Second) wsA $ - wsAssertConvCreateWithRole qconv expectedFrom expectedSelf expectedOthers + WS.assertMatch_ (5 # Second) wsA + $ wsAssertConvCreateWithRole qconv expectedFrom expectedSelf expectedOthers -- Bob attempts to add unconnected Charlie (possible abuse) let cu = @@ -349,10 +351,12 @@ removeLocalUser = do afterAddition <- listRemoteConvs remoteDomain alice void $ runFedClient @"on-conversation-updated" fedGalleyClient remoteDomain cuRemove liftIO $ do - void . WS.assertMatch (3 # Second) ws $ - wsAssertMemberJoinWithRole qconv qBob [qAlice] roleNameWireMember - void . WS.assertMatch (3 # Second) ws $ - wsAssertMembersLeave qconv qAlice [qAlice] + void + . WS.assertMatch (3 # Second) ws + $ wsAssertMemberJoinWithRole qconv qBob [qAlice] roleNameWireMember + void + . WS.assertMatch (3 # Second) ws + $ wsAssertMembersLeave qconv qAlice [qAlice] afterRemoval <- listRemoteConvs remoteDomain alice liftIO $ do afterAddition @?= [qconv] @@ -412,22 +416,22 @@ removeRemoteUser = do WS.bracketRN c [alice, charlie, dee, flo] $ \[wsA, wsC, wsD, wsF] -> do void $ runFedClient @"on-conversation-updated" fedGalleyClient remoteDomain (cuRemove qEve) liftIO $ do - WS.assertMatchN_ (3 # Second) [wsA, wsD] $ - wsAssertMembersLeave qconv qBob [qEve] + WS.assertMatchN_ (3 # Second) [wsA, wsD] + $ wsAssertMembersLeave qconv qBob [qEve] WS.assertNoEvent (1 # Second) [wsC, wsF] WS.bracketRN c [alice, charlie, dee, flo] $ \[wsA, wsC, wsD, wsF] -> do void $ runFedClient @"on-conversation-updated" fedGalleyClient remoteDomain (cuRemove qDee) liftIO $ do - WS.assertMatchN_ (3 # Second) [wsA, wsD] $ - wsAssertMembersLeave qconv qBob [qDee] + WS.assertMatchN_ (3 # Second) [wsA, wsD] + $ wsAssertMembersLeave qconv qBob [qDee] WS.assertNoEvent (1 # Second) [wsC, wsF] WS.bracketRN c [alice, charlie, dee, flo] $ \[wsA, wsC, wsD, wsF] -> do void $ runFedClient @"on-conversation-updated" fedGalleyClient remoteDomain (cuRemove qFlo) liftIO $ do - WS.assertMatchN_ (3 # Second) [wsA] $ - wsAssertMembersLeave qconv qBob [qFlo] + WS.assertMatchN_ (3 # Second) [wsA] + $ wsAssertMembersLeave qconv qBob [qFlo] WS.assertNoEvent (1 # Second) [wsC, wsF, wsD] notifyUpdate :: [Qualified UserId] -> SomeConversationAction -> EventType -> EventData -> TestM () @@ -504,9 +508,9 @@ notifyUpdateUnavailable extras action etype edata = do } WS.bracketR2 c alice charlie $ \(wsA, wsC) -> do ((), _fedRequests) <- - withTempMockFederator' (throw $ MockErrorResponse Http.status500 "Down for maintenance") $ - void $ - runFedClient @"on-conversation-updated" fedGalleyClient bdom cu + withTempMockFederator' (throw $ MockErrorResponse Http.status500 "Down for maintenance") + $ void + $ runFedClient @"on-conversation-updated" fedGalleyClient bdom cu liftIO $ do WS.assertMatch_ (5 # Second) wsA $ \n -> do let e = List1.head (WS.unpackPayload n) @@ -698,8 +702,8 @@ addRemoteUser = do WS.bracketRN c (map qUnqualified [qalice, qcharlie, qdee, qflo]) $ \[wsA, wsC, wsD, wsF] -> do void $ runFedClient @"on-conversation-updated" fedGalleyClient bdom cu void . liftIO $ do - WS.assertMatchN_ (5 # Second) [wsA, wsD] $ - wsAssertMemberJoinWithRole qconv qbob [qeve, qdee] roleNameWireMember + WS.assertMatchN_ (5 # Second) [wsA, wsD] + $ wsAssertMemberJoinWithRole qconv qbob [qeve, qdee] roleNameWireMember WS.assertNoEvent (1 # Second) [wsC] WS.assertNoEvent (1 # Second) [wsF] @@ -712,16 +716,16 @@ leaveConversationNonExistent = do g <- viewGalley let leaveRequest = FedGalley.LeaveConversationRequest conv (qUnqualified alice) resp <- - fmap (.response) $ - responseJsonError @_ @LeaveConversationResponse - =<< post - ( g - . paths ["federation", "leave-conversation"] - . content "application/json" - . header "Wire-Origin-Domain" (toByteString' remoteDomain) - . json leaveRequest - ) - ) [(alice, msg aliceC1), (alice, msg aliceC2), (eve, msg eveC)] + UserClientMap + $ Map.fromListWith (<>) [(alice, msg aliceC1), (alice, msg aliceC2), (eve, msg eveC)] rm = FedGalley.RemoteMessage { FedGalley.time = now, @@ -852,15 +856,15 @@ sendMessage = do -- conversation let responses1 = guardComponent Brig *> mockReply [bobProfile, chadProfile] (convId, requests1) <- - withTempMockFederator' ("get-not-fully-connected-backends" ~> NonConnectedBackends mempty <|> responses1 <|> mockReply EmptyResponse) $ - fmap decodeConvId $ - postConvQualified - aliceId - Nothing - defNewProteusConv - { newConvQualifiedUsers = [bob, chad] - } - NonConnectedBackends mempty <|> responses1 <|> mockReply EmptyResponse) + $ fmap decodeConvId + $ postConvQualified + aliceId + Nothing + defNewProteusConv + { newConvQualifiedUsers = [bob, chad] + } + SomeConversationAction -> Maybe (ConversationAction tag) getConvAction tquery (SomeConversationAction tag action) = diff --git a/services/galley/test/integration/API/Federation/Util.hs b/services/galley/test/integration/API/Federation/Util.hs index 9f2f052365c..c4e6a41ea49 100644 --- a/services/galley/test/integration/API/Federation/Util.hs +++ b/services/galley/test/integration/API/Federation/Util.hs @@ -44,22 +44,22 @@ class HasTrivialHandler api where instance HasTrivialHandler (Verb m c cs a) where trivialHandler name = throwError err501 {errBody = cs ("mock not implemented: " <> name)} -instance HasTrivialHandler api => HasTrivialHandler ((path :: Symbol) :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler ((path :: Symbol) :> api) where trivialHandler = trivialHandler @api -instance HasTrivialHandler api => HasTrivialHandler (OriginDomainHeader :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler (OriginDomainHeader :> api) where trivialHandler name _ = trivialHandler @api name -instance HasTrivialHandler api => HasTrivialHandler (MakesFederatedCall comp name :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler (MakesFederatedCall comp name :> api) where trivialHandler name _ = trivialHandler @api name -instance HasTrivialHandler api => HasTrivialHandler (ReqBody cs a :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler (ReqBody cs a :> api) where trivialHandler name _ = trivialHandler @api name -instance HasTrivialHandler api => HasTrivialHandler (Until v :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler (Until v :> api) where trivialHandler = trivialHandler @api -instance HasTrivialHandler api => HasTrivialHandler (From v :> api) where +instance (HasTrivialHandler api) => HasTrivialHandler (From v :> api) where trivialHandler = trivialHandler @api trivialNamedHandler :: diff --git a/services/galley/test/integration/API/MLS.hs b/services/galley/test/integration/API/MLS.hs index dcb01c32c56..5566d9bd28a 100644 --- a/services/galley/test/integration/API/MLS.hs +++ b/services/galley/test/integration/API/MLS.hs @@ -275,7 +275,7 @@ testSenderNotInConversation = do err <- responseJsonError =<< postMessage bob1 (mpMessage message) - do events <- sendAndConsumeCommitBundle commit for_ (zip bobClients wss) $ \(_, ws) -> - WS.assertMatch (5 # Second) ws $ - wsAssertMLSWelcome alice qcnv welcome + WS.assertMatch (5 # Second) ws + $ wsAssertMLSWelcome alice qcnv welcome pure events event <- assertOne events @@ -303,8 +303,8 @@ testAddUserWithBundle = do -- check that bob can now see the conversation convs <- getAllConvs (qUnqualified bob) - liftIO $ - assertBool + liftIO + $ assertBool "Users added to an MLS group should find it when listing conversations" (qcnv `elem` map cnvQualifiedId convs) @@ -327,7 +327,7 @@ testAddUserNotConnected = do err <- responseJsonError =<< localPostCommitBundle (mpSender commit) bundle - >= sendAndConsumeCommitBundle + void + $ createAddCommitWithKeyPackages alice1 [(bob2, kp.raw)] + >>= sendAndConsumeCommitBundle testSendAnotherUsersCommit :: TestM () testSendAnotherUsersCommit = do @@ -394,7 +394,7 @@ testSendAnotherUsersCommit = do err <- responseJsonError =<< (localPostCommitBundle bob1 =<< createBundle mp) - [Nothing, Just bobDomain, Just charlieDomain] + createAndConnectUsers + $ domainText + <$$> [Nothing, Just bobDomain, Just charlieDomain] runMLSTest $ do [alice1, bob1, _charlie1] <- traverse createMLSClient users (_, qcnv) <- setupMLSGroup alice1 @@ -489,7 +490,7 @@ testAddRemotesSomeUnreachable = do <|> welcomeMockByDomain [bobDomain] ) $ localPostCommitBundle (mpSender commit) bundle - >= sendAndConsumeCommitBundle - liftIO $ - assertBool "No events after external commit expected" (null ecEvents) + liftIO + $ assertBool "No events after external commit expected" (null ecEvents) message <- createApplicationMessage bob1 "hello" void $ sendAndConsumeMessage message @@ -717,8 +720,8 @@ testExternalCommitNewClient = do ecEvents <- createExternalCommit nc Nothing (fmap Conv qcnv) >>= sendAndConsumeCommitBundle - liftIO $ - assertBool "No events after external commit expected" (null ecEvents) + liftIO + $ assertBool "No events after external commit expected" (null ecEvents) message <- createApplicationMessage nc "hello" void $ sendAndConsumeMessage message @@ -740,46 +743,47 @@ testExternalCommitNewClientResendBackendProposal = do Just (_, bobIdx2) <- find (\(ci, _) -> ci == bob2) <$> getClientsFromGroupState alice1 bob mlsBracket [alice1, bob1] $ \[wsA, wsB] -> do - liftTest $ - deleteClient (qUnqualified bob) (ciClient bob2) (Just defPassword) - !!! statusCode === const 200 - WS.assertMatchN_ (5 # WS.Second) [wsB] $ - wsAssertClientRemoved (ciClient bob2) + liftTest + $ deleteClient (qUnqualified bob) (ciClient bob2) (Just defPassword) + !!! statusCode === const 200 + WS.assertMatchN_ (5 # WS.Second) [wsB] + $ wsAssertClientRemoved (ciClient bob2) State.modify $ \mls -> mls { mlsMembers = Set.difference (mlsMembers mls) (Set.fromList [bob2]) } - WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] $ - wsAssertBackendRemoveProposalWithEpoch bob qcnv bobIdx2 (Epoch 1) + WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] + $ wsAssertBackendRemoveProposalWithEpoch bob qcnv bobIdx2 (Epoch 1) [bob3, bob4] <- for [bob, bob] $ \qusr' -> do ci <- createMLSClient qusr' - WS.assertMatchN_ (5 # WS.Second) [wsB] $ - wsAssertClientAdded (ciClient ci) + WS.assertMatchN_ (5 # WS.Second) [wsB] + $ wsAssertClientAdded (ciClient ci) pure ci - void $ - createExternalAddProposal bob3 - >>= sendAndConsumeMessage + void + $ createExternalAddProposal bob3 + >>= sendAndConsumeMessage - WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] $ - void . wsAssertAddProposal bob qcnv + WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] + $ void + . wsAssertAddProposal bob qcnv mp <- createExternalCommit bob4 Nothing (fmap Conv qcnv) ecEvents <- sendAndConsumeCommitBundle mp - liftIO $ - assertBool "No events after external commit expected" (null ecEvents) + liftIO + $ assertBool "No events after external commit expected" (null ecEvents) - WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] $ - wsAssertMLSMessage (fmap Conv qcnv) bob (mpMessage mp) + WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] + $ wsAssertMLSMessage (fmap Conv qcnv) bob (mpMessage mp) -- The backend proposals for bob2 are replayed, but the external add -- proposal for bob3 has to replayed by the client and is thus not found -- here. - WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] $ - wsAssertBackendRemoveProposalWithEpoch bob qcnv bobIdx2 (Epoch 2) + WS.assertMatchN_ (5 # WS.Second) [wsA, wsB] + $ wsAssertBackendRemoveProposalWithEpoch bob qcnv bobIdx2 (Epoch 2) WS.assertNoEvent (2 # WS.Second) [wsA, wsB] testAppMessage :: TestM () @@ -797,8 +801,8 @@ testAppMessage = do events <- sendAndConsumeMessage message liftIO $ events @?= [] liftIO $ do - WS.assertMatchN_ (5 # WS.Second) (tail wss) $ - wsAssertMLSMessage (fmap Conv qcnv) alice (mpMessage message) + WS.assertMatchN_ (5 # WS.Second) (tail wss) + $ wsAssertMLSMessage (fmap Conv qcnv) alice (mpMessage message) WS.assertNoEvent (2 # WS.Second) [head wss] testAppMessage2 :: TestM () @@ -829,8 +833,8 @@ testAppMessage2 = do -- check that the corresponding event is received by everyone except bob1 -- (the sender) and no message is received by bob1 liftIO $ do - WS.assertMatchN_ (5 # WS.Second) [wsAlice1, wsBob2, wsCharlie1] $ - wsAssertMLSMessage (fmap Conv conversation) bob (mpMessage message) + WS.assertMatchN_ (5 # WS.Second) [wsAlice1, wsBob2, wsCharlie1] + $ wsAssertMLSMessage (fmap Conv conversation) bob (mpMessage message) WS.assertNoEvent (2 # WS.Second) [wsBob1] testAppMessageUnreachable :: TestM () @@ -846,8 +850,8 @@ testAppMessageUnreachable = do commit <- createAddCommit alice1 [bob] ([event], _) <- - withTempMockFederator' (receiveCommitMock [bob1] <|> welcomeMock) $ - sendAndConsumeCommitBundle commit + withTempMockFederator' (receiveCommitMock [bob1] <|> welcomeMock) + $ sendAndConsumeCommitBundle commit message <- createApplicationMessage alice1 "hi, bob!" _ <- sendAndConsumeMessage message @@ -935,8 +939,9 @@ testRemoteToLocal = do mp <- createAddCommit alice1 [bob] let mock = receiveCommitMock [bob1] <|> welcomeMock <|> claimKeyPackagesMock kpb - void . withTempMockFederator' mock $ - sendAndConsumeCommitBundle mp + void + . withTempMockFederator' mock + $ sendAndConsumeCommitBundle mp traverse_ consumeWelcome (mpWelcome mp) message <- createApplicationMessage bob1 "hello from another backend" @@ -957,8 +962,8 @@ testRemoteToLocal = do MLSMessageResponseUpdates updates <- runFedClient @"send-mls-message" fedGalleyClient bobDomain msr liftIO $ do updates @?= [] - WS.assertMatch_ (5 # Second) ws $ - wsAssertMLSMessage (fmap Conv qcnv) bob (mpMessage message) + WS.assertMatch_ (5 # Second) ws + $ wsAssertMLSMessage (fmap Conv qcnv) bob (mpMessage message) testRemoteToLocalWrongConversation :: TestM () testRemoteToLocalWrongConversation = do @@ -1073,32 +1078,33 @@ testExternalAddProposal = do -- create group with alice1 and bob1 (_, qcnv) <- setupMLSGroup alice1 - void $ - createAddCommit alice1 [bob] - >>= sendAndConsumeCommitBundle + void + $ createAddCommit alice1 [bob] + >>= sendAndConsumeCommitBundle -- bob joins with an external proposal bob2 <- createMLSClient bob mlsBracket [alice1, bob1] $ \wss -> do - void $ - createExternalAddProposal bob2 - >>= sendAndConsumeMessage - liftTest $ - WS.assertMatchN_ (5 # Second) wss $ - void . wsAssertAddProposal bob qcnv - - void $ - createPendingProposalCommit alice1 - >>= sendAndConsumeCommitBundle + void + $ createExternalAddProposal bob2 + >>= sendAndConsumeMessage + liftTest + $ WS.assertMatchN_ (5 # Second) wss + $ void + . wsAssertAddProposal bob qcnv + + void + $ createPendingProposalCommit alice1 + >>= sendAndConsumeCommitBundle -- alice sends a message do msg <- createApplicationMessage alice1 "hi bob" mlsBracket [bob1, bob2] $ \wss -> do void $ sendAndConsumeMessage msg - liftTest $ - WS.assertMatchN_ (5 # Second) wss $ - wsAssertMLSMessage (fmap Conv qcnv) alice (mpMessage msg) + liftTest + $ WS.assertMatchN_ (5 # Second) wss + $ wsAssertMLSMessage (fmap Conv qcnv) alice (mpMessage msg) -- bob adds charlie putOtherMemberQualified @@ -1128,23 +1134,24 @@ testExternalAddProposalNonAdminCommit = do -- create group with alice1 and bob1 (_, qcnv) <- setupMLSGroup alice1 - void $ - createAddCommit alice1 [bob] - >>= sendAndConsumeCommitBundle + void + $ createAddCommit alice1 [bob] + >>= sendAndConsumeCommitBundle -- bob joins with an external proposal mlsBracket [alice1, bob1] $ \wss -> do - void $ - createExternalAddProposal bob2 - >>= sendAndConsumeMessage - liftTest $ - WS.assertMatchN_ (5 # Second) wss $ - void . wsAssertAddProposal bob qcnv + void + $ createExternalAddProposal bob2 + >>= sendAndConsumeMessage + liftTest + $ WS.assertMatchN_ (5 # Second) wss + $ void + . wsAssertAddProposal bob qcnv -- bob1 commits - void $ - createPendingProposalCommit bob1 - >>= sendAndConsumeCommitBundle + void + $ createPendingProposalCommit bob1 + >>= sendAndConsumeCommitBundle -- scenario: -- alice adds bob and charlie @@ -1164,9 +1171,9 @@ testExternalAddProposalWrongClient = do void $ uploadNewKeyPackage charlie1 void $ setupMLSGroup alice1 - void $ - createAddCommit alice1 [bob, charlie] - >>= sendAndConsumeCommitBundle + void + $ createAddCommit alice1 [bob, charlie] + >>= sendAndConsumeCommitBundle prop <- createExternalAddProposal bob2 postMessage charlie1 (mpMessage prop) @@ -1187,9 +1194,9 @@ testExternalAddProposalWrongUser = do void $ uploadNewKeyPackage bob1 void $ setupMLSGroup alice1 - void $ - createAddCommit alice1 [bob] - >>= sendAndConsumeCommitBundle + void + $ createAddCommit alice1 [bob] + >>= sendAndConsumeCommitBundle prop <- createExternalAddProposal charlie1 postMessage charlie1 (mpMessage prop) @@ -1210,9 +1217,9 @@ testBackendRemoveProposalRecreateClient = do (_, idx) <- assertOne =<< getClientsFromGroupState alice1 alice - liftTest $ - deleteClient (qUnqualified alice) (ciClient alice1) (Just defPassword) - !!! const 200 === statusCode + liftTest + $ deleteClient (qUnqualified alice) (ciClient alice1) (Just defPassword) + !!! const 200 === statusCode State.modify $ \mls -> mls { mlsMembers = Set.difference (mlsMembers mls) (Set.singleton alice1) @@ -1222,11 +1229,11 @@ testBackendRemoveProposalRecreateClient = do proposal <- mlsBracket [alice2] $ \[wsA] -> do -- alice2 joins the conversation, causing the external remove proposal to -- be re-established - void $ - createExternalCommit alice2 Nothing cnv - >>= sendAndConsumeCommitBundle - WS.assertMatch (5 # WS.Second) wsA $ - wsAssertBackendRemoveProposal alice (Conv <$> qcnv) idx + void + $ createExternalCommit alice2 Nothing cnv + >>= sendAndConsumeCommitBundle + WS.assertMatch (5 # WS.Second) wsA + $ wsAssertBackendRemoveProposal alice (Conv <$> qcnv) idx consumeMessage1 alice2 proposal void $ createPendingProposalCommit alice2 >>= sendAndConsumeCommitBundle @@ -1275,8 +1282,8 @@ testBackendRemoveProposalLocalConvRemoteUser = do bobClients <- getClientsFromGroupState alice1 bob fedGalleyClient <- view tsFedGalleyClient - void $ - runFedClient + void + $ runFedClient @"on-user-deleted-conversations" fedGalleyClient (qDomain bob) @@ -1287,8 +1294,8 @@ testBackendRemoveProposalLocalConvRemoteUser = do ) for_ bobClients $ \(_, idx) -> - WS.assertMatch (5 # WS.Second) wsA $ - wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idx + WS.assertMatch (5 # WS.Second) wsA + $ wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idx sendRemoteMLSWelcome :: TestM () sendRemoteMLSWelcome = do @@ -1308,18 +1315,18 @@ sendRemoteMLSWelcome = do WS.bracketR cannon (qUnqualified bob) $ \wsB -> do -- send welcome message - void $ - runFedClient @"mls-welcome" fedGalleyClient (qDomain alice) $ - MLSWelcomeRequest - (qUnqualified alice) - (Base64ByteString welcome) - [qUnqualified (cidQualifiedClient bob1)] - qcid + void + $ runFedClient @"mls-welcome" fedGalleyClient (qDomain alice) + $ MLSWelcomeRequest + (qUnqualified alice) + (Base64ByteString welcome) + [qUnqualified (cidQualifiedClient bob1)] + qcid -- check that the corresponding event is received liftIO $ do - WS.assertMatch_ (5 # WS.Second) wsB $ - wsAssertMLSWelcome alice qcid welcome + WS.assertMatch_ (5 # WS.Second) wsB + $ wsAssertMLSWelcome alice qcid welcome testBackendRemoveProposalLocalConvLocalLeaverCreator :: TestM () testBackendRemoveProposalLocalConvLocalLeaverCreator = do @@ -1333,9 +1340,9 @@ testBackendRemoveProposalLocalConvLocalLeaverCreator = do aliceClients <- getClientsFromGroupState alice1 alice mlsBracket [alice1, bob1, bob2] $ \wss -> void $ do - liftTest $ - deleteMemberQualified (qUnqualified alice) alice qcnv - !!! const 200 === statusCode + liftTest + $ deleteMemberQualified (qUnqualified alice) alice qcnv + !!! const 200 === statusCode -- remove alice's client from the test state State.modify $ \mls -> mls @@ -1349,8 +1356,8 @@ testBackendRemoveProposalLocalConvLocalLeaverCreator = do traverse_ (uncurry consumeMessage1) (zip [bob1, bob2] msgs) -- but everyone should receive leave events - WS.assertMatchN_ (5 # WS.Second) wss $ - wsAssertMembersLeave qcnv alice [alice] + WS.assertMatchN_ (5 # WS.Second) wss + $ wsAssertMembersLeave qcnv alice [alice] -- check that no more events are sent, so in particular alice does not -- receive any MLS messages @@ -1378,9 +1385,9 @@ testBackendRemoveProposalLocalConvLocalLeaverCommitter = do bobClients <- getClientsFromGroupState alice1 bob mlsBracket [alice1, charlie1, bob1, bob2] $ \wss -> void $ do - liftTest $ - deleteMemberQualified (qUnqualified bob) bob qcnv - !!! const 200 === statusCode + liftTest + $ deleteMemberQualified (qUnqualified bob) bob qcnv + !!! const 200 === statusCode -- remove bob clients from the test state State.modify $ \mls -> mls @@ -1394,8 +1401,8 @@ testBackendRemoveProposalLocalConvLocalLeaverCommitter = do traverse_ (uncurry consumeMessage1) (zip [alice1, charlie1] msgs) -- but everyone should receive leave events - WS.assertMatchN_ (5 # WS.Second) wss $ - wsAssertMembersLeave qcnv bob [bob] + WS.assertMatchN_ (5 # WS.Second) wss + $ wsAssertMembersLeave qcnv bob [bob] -- check that no more events are sent, so in particular bob does not -- receive any MLS messages @@ -1420,8 +1427,8 @@ testBackendRemoveProposalLocalConvRemoteLeaver = do mlsBracket [alice1] $ \[wsA] -> void $ do void $ sendAndConsumeCommitBundle commit fedGalleyClient <- view tsFedGalleyClient - void $ - runFedClient + void + $ runFedClient @"update-conversation" fedGalleyClient (qDomain bob) @@ -1432,8 +1439,8 @@ testBackendRemoveProposalLocalConvRemoteLeaver = do } for_ bobClients $ \(_, idx) -> - WS.assertMatch_ (5 # WS.Second) wsA $ - wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idx + WS.assertMatch_ (5 # WS.Second) wsA + $ wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idx testBackendRemoveProposalLocalConvLocalClient :: TestM () testBackendRemoveProposalLocalConvLocalClient = do @@ -1447,23 +1454,23 @@ testBackendRemoveProposalLocalConvLocalClient = do Just (_, idxBob1) <- find (\(ci, _) -> ci == bob1) <$> getClientsFromGroupState alice1 bob mlsBracket [alice1, bob1, charlie1] $ \[wsA, wsB, wsC] -> do - liftTest $ - deleteClient (ciUser bob1) (ciClient bob1) (Just defPassword) - !!! statusCode === const 200 + liftTest + $ deleteClient (ciUser bob1) (ciClient bob1) (Just defPassword) + !!! statusCode === const 200 State.modify $ \mls -> mls { mlsMembers = Set.difference (mlsMembers mls) (Set.fromList [bob1]) } - WS.assertMatch_ (5 # WS.Second) wsB $ - wsAssertClientRemoved (ciClient bob1) + WS.assertMatch_ (5 # WS.Second) wsB + $ wsAssertClientRemoved (ciClient bob1) (msg : _) <- WS.assertMatchN (5 # WS.Second) [wsA, wsC] $ \notification -> do wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idxBob1 notification - for_ [alice1, bob2, charlie1] $ - flip consumeMessage1 msg + for_ [alice1, bob2, charlie1] + $ flip consumeMessage1 msg mp <- createPendingProposalCommit charlie1 events <- sendAndConsumeCommitBundle mp @@ -1488,15 +1495,15 @@ testBackendRemoveProposalLocalConvRemoteClient = do void $ sendAndConsumeCommitBundle commit fedGalleyClient <- view tsFedGalleyClient - void $ - runFedClient + void + $ runFedClient @"on-client-removed" fedGalleyClient (ciDomain bob1) (ClientRemovedRequest (ciUser bob1) (ciClient bob1) [qUnqualified qcnv]) - WS.assertMatch_ (5 # WS.Second) wsA $ - \notification -> + WS.assertMatch_ (5 # WS.Second) wsA + $ \notification -> void $ wsAssertBackendRemoveProposal bob (Conv <$> qcnv) idxBob1 notification testGetGroupInfoOfLocalConv :: TestM () @@ -1673,10 +1680,11 @@ testSelfConversationList isBelowV3 = do convIds :: ConvIdsPage <- responseJsonError =<< listEndpoint u Nothing (Just 100) - >= sendAndConsumeCommitBundle - liftTest $ - deleteMemberQualified (qUnqualified alice) alice qcnv - !!! do - const 403 === statusCode - const (Just "invalid-op") === fmap Wai.label . responseJsonError + liftTest + $ deleteMemberQualified (qUnqualified alice) alice qcnv + !!! do + const 403 === statusCode + const (Just "invalid-op") === fmap Wai.label . responseJsonError assertMLSNotEnabled :: Assertions () assertMLSNotEnabled = do @@ -1726,12 +1735,12 @@ assertMLSNotEnabled = do postMLSConvDisabled :: TestM () postMLSConvDisabled = do alice <- randomQualifiedUser - withMLSDisabled $ - postConvQualified + withMLSDisabled + $ postConvQualified (qUnqualified alice) (Just (ClientId 0)) defNewMLSConv - !!! assertMLSNotEnabled + !!! assertMLSNotEnabled postMLSMessageDisabled :: TestM () postMLSMessageDisabled = do @@ -1742,9 +1751,9 @@ postMLSMessageDisabled = do void $ setupMLSGroup alice1 mp <- createAddCommit alice1 [bob] bundle <- createBundle mp - withMLSDisabled $ - localPostCommitBundle (mpSender mp) bundle - !!! assertMLSNotEnabled + withMLSDisabled + $ localPostCommitBundle (mpSender mp) bundle + !!! assertMLSNotEnabled postMLSBundleDisabled :: TestM () postMLSBundleDisabled = do @@ -1768,9 +1777,9 @@ getGroupInfoDisabled = do (_, qcnv) <- setupMLSGroup alice1 void $ createAddCommit alice1 [bob] >>= sendAndConsumeCommitBundle - withMLSDisabled $ - localGetGroupInfo (qUnqualified alice) (fmap Conv qcnv) - !!! assertMLSNotEnabled + withMLSDisabled + $ localGetGroupInfo (qUnqualified alice) (fmap Conv qcnv) + !!! assertMLSNotEnabled deleteSubConversationDisabled :: TestM () deleteSubConversationDisabled = do @@ -1781,8 +1790,9 @@ deleteSubConversationDisabled = do DeleteSubConversationRequest (GroupId "MLS") (Epoch 0) - withMLSDisabled $ - deleteSubConv alice cnvId scnvId dsc !!! assertMLSNotEnabled + withMLSDisabled + $ deleteSubConv alice cnvId scnvId dsc + !!! assertMLSNotEnabled testExternalCommitSameClientSubConv :: TestM () testExternalCommitSameClientSubConv = do @@ -1798,20 +1808,20 @@ testExternalCommitSameClientSubConv = do -- alice1 and bob1 create and join a subconversation, respectively qsub <- createSubConv qcnv alice1 subId - void $ - createExternalCommit bob1 Nothing qsub - >>= sendAndConsumeCommitBundle + void + $ createExternalCommit bob1 Nothing qsub + >>= sendAndConsumeCommitBundle Just (_, idxBob1) <- find (\(ci, _) -> ci == bob1) <$> getClientsFromGroupState alice1 bob -- bob1 leaves and immediately rejoins mlsBracket [alice1, bob1] $ \[wsA, wsB] -> do void $ leaveCurrentConv bob1 qsub - WS.assertMatchN_ (5 # WS.Second) [wsA] $ - wsAssertBackendRemoveProposal bob qsub idxBob1 - void $ - createExternalCommit bob1 Nothing qsub - >>= sendAndConsumeCommitBundle + WS.assertMatchN_ (5 # WS.Second) [wsA] + $ wsAssertBackendRemoveProposal bob qsub idxBob1 + void + $ createExternalCommit bob1 Nothing qsub + >>= sendAndConsumeCommitBundle WS.assertNoEvent (2 # WS.Second) [wsB] testJoinSubNonMemberClient :: TestM () @@ -1855,10 +1865,10 @@ testAddClientSubConvFailure = do === fmap Wai.message . responseJsonError finalSub <- - liftTest $ - responseJsonError - =<< getSubConv (qUnqualified alice) qcnv subId - welcomeMock) $ - createAddCommit alice1 [bob] >>= sendAndConsumeCommitBundle + void + $ withTempMockFederator' (receiveCommitMock [bob1] <|> welcomeMock) + $ createAddCommit alice1 [bob] + >>= sendAndConsumeCommitBundle testSendMessageSubConv :: TestM () testSendMessageSubConv = do @@ -1952,8 +1963,9 @@ testSendMessageSubConv = do mlsBracket [bob1, bob2] $ \wss -> do events <- sendAndConsumeMessage message liftIO $ events @?= [] - liftIO $ - WS.assertMatchN_ (5 # WS.Second) wss $ \n -> do + liftIO + $ WS.assertMatchN_ (5 # WS.Second) wss + $ \n -> do wsAssertMLSMessage qcs alice (mpMessage message) n testGetRemoteSubConv :: Bool -> TestM () @@ -1973,19 +1985,19 @@ testGetRemoteSubConv isAMember = do } let mock = do guardRPC "get-sub-conversation" - mockReply $ - if isAMember + mockReply + $ if isAMember then GetSubConversationsResponseSuccess fakeSubConv else GetSubConversationsResponseError ConvNotFound (_, reqs) <- - withTempMockFederator' mock $ - getSubConv (qUnqualified alice) qconv sconv - TestM () testRemoteMemberGetSubConv isAMember = do @@ -2004,8 +2016,9 @@ testRemoteMemberGetSubConv isAMember = do mp <- createAddCommit alice1 [bob] let mock = receiveCommitMock [bob1] <|> welcomeMock <|> claimKeyPackagesMock kpb - void . withTempMockFederator' mock $ - sendAndConsumeCommitBundle mp + void + . withTempMockFederator' mock + $ sendAndConsumeCommitBundle mp let subconv = SubConvId "conference" @@ -2055,26 +2068,26 @@ testJoinDeletedSubConvWithRemoval = do void $ createAddCommit alice1 [bob] >>= sendAndConsumeCommitBundle let subConvId = SubConvId "conference" qsconvId <- createSubConv qcnv alice1 subConvId - void $ - createExternalCommit bob1 Nothing qsconvId - >>= sendAndConsumeCommitBundle - liftTest $ - leaveSubConv (ciUser alice1) (ciClient alice1) qcnv subConvId - !!! const 200 === statusCode + void + $ createExternalCommit bob1 Nothing qsconvId + >>= sendAndConsumeCommitBundle + liftTest + $ leaveSubConv (ciUser alice1) (ciClient alice1) qcnv subConvId + !!! const 200 === statusCode -- no committing by Bob of the backend-generated remove proposal for alice1 -- (simulating his client crashing) do sub <- - liftTest $ - responseJsonError - =<< getSubConv (qUnqualified bob) qcnv subConvId - do void $ createSubConv qcnv bob1 subConvId @@ -2088,15 +2101,16 @@ testDeleteSubConvStale = do alice1 <- createMLSClient alice (_, qcnv) <- setupMLSGroup alice1 sub <- - liftTest $ - responseJsonError - =<< getSubConv (qUnqualified alice) qcnv sconv - >= sendAndConsumeCommitBundle + void + $ createPendingProposalCommit alice1 + >>= sendAndConsumeCommitBundle pure (qcnv, sub) -- the commit was made, yet the epoch for the request body is old @@ -2125,16 +2139,16 @@ testDeleteRemoteSubConv isAMember = do let mock = do guardRPC "delete-sub-conversation" - mockReply $ - if isAMember + mockReply + $ if isAMember then DeleteSubConversationResponseSuccess else DeleteSubConversationResponseError ConvNotFound dsc = DeleteSubConversationRequest groupId epoch (_, reqs) <- - withTempMockFederator' mock $ - deleteSubConv (qUnqualified alice) qconv sconv dsc - >= sendAndConsumeCommitBundle -- bob leaves - liftTest $ - leaveSubConv (ciUser bob1) (ciClient bob1) qcnv subId - !!! const 200 === statusCode + liftTest + $ leaveSubConv (ciUser bob1) (ciClient bob1) qcnv subId + !!! const 200 === statusCode -- check that leave-sub-conversation is called void $ assertOne (filter ((== "leave-sub-conversation") . frRPC) reqs) @@ -2241,8 +2255,8 @@ testRemoveUserParent = do [alice, bob, charlie] <- createAndConnectUsers [Nothing, Nothing, Nothing] let subname = SubConvId "conference" - (qcnv, [alice1, bob1, bob2, _charlie1, _charlie2]) <- runMLSTest $ - do + (qcnv, [alice1, bob1, bob2, _charlie1, _charlie2]) <- runMLSTest + $ do clients@[alice1, bob1, bob2, charlie1, charlie2] <- traverse createMLSClient @@ -2270,9 +2284,9 @@ testRemoveUserParent = do sub :: PublicSubConversation <- responseJsonError =<< getSubConv (qUnqualified bob) qcnv subname - EmptyResponse, "get-not-fully-connected-backends" ~> NonConnectedBackends mempty, - "get-mls-clients" ~> - Set.fromList + "get-mls-clients" + ~> Set.fromList ( map (flip ClientInfo True . ciClient) clients ) ] @@ -82,8 +82,8 @@ welcomeMockByDomain reachables = do sendMessageMock :: Mock LByteString sendMessageMock = - "send-mls-message" ~> - MLSMessageResponseUpdates + "send-mls-message" + ~> MLSMessageResponseUpdates [] claimKeyPackagesMock :: KeyPackageBundle -> Mock LByteString @@ -93,8 +93,8 @@ queryGroupStateMock :: ByteString -> Qualified UserId -> Mock LByteString queryGroupStateMock gs qusr = do guardRPC "query-group-info" uid <- (\(a :: GetGroupInfoRequest) -> a.sender) <$> getRequestBody - mockReply $ - if uid == qUnqualified qusr + mockReply + $ if uid == qUnqualified qusr then GetGroupInfoResponseState (Base64ByteString gs) else GetGroupInfoResponseError ConvNotFound diff --git a/services/galley/test/integration/API/MLS/Util.hs b/services/galley/test/integration/API/MLS/Util.hs index 3c38958eb58..b9576ae45fb 100644 --- a/services/galley/test/integration/API/MLS/Util.hs +++ b/services/galley/test/integration/API/MLS/Util.hs @@ -158,26 +158,32 @@ remotePostCommitBundle rsender qcs bundle = do client (tDomain rsender) msr - >>= liftIO . \case + >>= liftIO + . \case MLSMessageResponseError e -> - assertFailure $ - "error while receiving commit bundle: " <> show e + assertFailure + $ "error while receiving commit bundle: " + <> show e MLSMessageResponseProtocolError e -> - assertFailure $ - "protocol error while receiving commit bundle: " <> T.unpack e + assertFailure + $ "protocol error while receiving commit bundle: " + <> T.unpack e MLSMessageResponseProposalFailure e -> - assertFailure $ - "proposal failure while receiving commit bundle: " <> displayException e + assertFailure + $ "proposal failure while receiving commit bundle: " + <> displayException e e@(MLSMessageResponseUnreachableBackends _) -> - assertFailure $ - "error while receiving commit bundle: " <> show e + assertFailure + $ "error while receiving commit bundle: " + <> show e e@(MLSMessageResponseNonFederatingBackends _) -> - assertFailure $ - "error while receiving commit bundle: " <> show e + assertFailure + $ "error while receiving commit bundle: " + <> show e MLSMessageResponseUpdates _ -> pure [] postCommitBundle :: - HasCallStack => + (HasCallStack) => ClientIdentity -> Qualified ConvOrSubConvId -> ByteString -> @@ -187,9 +193,10 @@ postCommitBundle sender qcs bundle = do foldQualified loc ( \_ -> - fmap mmssEvents . responseJsonError + fmap mmssEvents + . responseJsonError =<< localPostCommitBundle sender bundle - remotePostCommitBundle rsender qcs bundle) (cidQualifiedUser sender $> sender) @@ -238,8 +245,9 @@ instance HasBrig MLSTest where viewBrig = MLSTest $ lift viewBrig instance HasSettingsOverrides MLSTest where - withSettingsOverrides f (MLSTest action) = MLSTest $ - State.StateT $ \s -> + withSettingsOverrides f (MLSTest action) = MLSTest + $ State.StateT + $ \s -> withSettingsOverrides f (State.runStateT action s) liftTest :: TestM a -> MLSTest a @@ -270,7 +278,7 @@ data MessagePackage = MessagePackage } deriving (Show) -takeLastPrekeyNG :: HasCallStack => MLSTest LastPrekey +takeLastPrekeyNG :: (HasCallStack) => MLSTest LastPrekey takeLastPrekeyNG = do s <- State.get case mlsUnusedPrekeys s of @@ -290,7 +298,7 @@ randomFileName = do bd <- State.gets mlsBaseDir (bd ) . UUID.toString <$> liftIO UUIDV4.nextRandom -mlscli :: HasCallStack => ClientIdentity -> [String] -> Maybe ByteString -> MLSTest ByteString +mlscli :: (HasCallStack) => ClientIdentity -> [String] -> Maybe ByteString -> MLSTest ByteString mlscli qcid args mbstdin = do bd <- State.gets mlsBaseDir let cdir = bd cid2Str qcid @@ -308,8 +316,8 @@ mlscli qcid args mbstdin = do else pure Imports.id out <- - liftIO $ - spawn + liftIO + $ spawn ( proc "mls-test-cli" ( ["--store", cdir "store"] @@ -328,13 +336,13 @@ argSubst :: String -> String -> String -> String argSubst from to_ s = if s == from then to_ else s -createWireClient :: HasCallStack => Qualified UserId -> MLSTest ClientIdentity +createWireClient :: (HasCallStack) => Qualified UserId -> MLSTest ClientIdentity createWireClient qusr = do lpk <- takeLastPrekeyNG clientId <- liftTest $ randomClient (qUnqualified qusr) lpk pure $ mkClientIdentity qusr clientId -initMLSClient :: HasCallStack => ClientIdentity -> MLSTest () +initMLSClient :: (HasCallStack) => ClientIdentity -> MLSTest () initMLSClient cid = do bd <- State.gets mlsBaseDir createDirectory $ bd cid2Str cid @@ -360,13 +368,13 @@ createLocalMLSClient (tUntagged -> qusr) = do -- | Create new mls client and register with backend. If the user is remote, -- this only creates a fake client (see 'createFakeMLSClient'). -createMLSClient :: HasCallStack => Qualified UserId -> MLSTest ClientIdentity +createMLSClient :: (HasCallStack) => Qualified UserId -> MLSTest ClientIdentity createMLSClient qusr = do loc <- liftTest $ qualifyLocal () foldQualified loc createLocalMLSClient (createFakeMLSClient . tUntagged) qusr -- | Like 'createMLSClient', but do not actually register client with backend. -createFakeMLSClient :: HasCallStack => Qualified UserId -> MLSTest ClientIdentity +createFakeMLSClient :: (HasCallStack) => Qualified UserId -> MLSTest ClientIdentity createFakeMLSClient qusr = do c <- liftIO $ generate arbitrary let cid = mkClientIdentity qusr c @@ -374,7 +382,7 @@ createFakeMLSClient qusr = do pure cid -- | create and upload to backend -uploadNewKeyPackage :: HasCallStack => ClientIdentity -> MLSTest (RawMLS KeyPackage) +uploadNewKeyPackage :: (HasCallStack) => ClientIdentity -> MLSTest (RawMLS KeyPackage) uploadNewKeyPackage qcid = do (kp, _) <- generateKeyPackage qcid @@ -389,33 +397,33 @@ uploadNewKeyPackage qcid = do !!! const 201 === statusCode pure kp -generateKeyPackage :: HasCallStack => ClientIdentity -> MLSTest (RawMLS KeyPackage, KeyPackageRef) +generateKeyPackage :: (HasCallStack) => ClientIdentity -> MLSTest (RawMLS KeyPackage, KeyPackageRef) generateKeyPackage qcid = do kpData <- mlscli qcid ["key-package", "create"] Nothing kp <- liftIO $ decodeMLSError kpData let ref = fromJust (kpRef' kp) pure (kp, ref) -setClientGroupState :: HasCallStack => ClientIdentity -> ByteString -> MLSTest () +setClientGroupState :: (HasCallStack) => ClientIdentity -> ByteString -> MLSTest () setClientGroupState cid g = State.modify $ \s -> s {mlsClientGroupState = Map.insert cid g (mlsClientGroupState s)} -getClientGroupState :: HasCallStack => ClientIdentity -> MLSTest ByteString +getClientGroupState :: (HasCallStack) => ClientIdentity -> MLSTest ByteString getClientGroupState cid = do mgs <- State.gets (Map.lookup cid . mlsClientGroupState) case mgs of Nothing -> liftIO $ assertFailure ("Attempted to get non-existing group state for client " <> show cid) Just g -> pure g -hasClientGroupState :: HasCallStack => ClientIdentity -> MLSTest Bool +hasClientGroupState :: (HasCallStack) => ClientIdentity -> MLSTest Bool hasClientGroupState cid = State.gets (isJust . Map.lookup cid . mlsClientGroupState) -- | Create a conversation from a provided action and then create a -- corresponding group. setupMLSGroupWithConv :: - HasCallStack => + (HasCallStack) => MLSTest Conversation -> ClientIdentity -> MLSTest (GroupId, Qualified ConvId) @@ -435,7 +443,7 @@ setupMLSGroupWithConv convAction creator = do pure (groupId, qcnv) -- | Create conversation and corresponding group. -setupMLSGroup :: HasCallStack => ClientIdentity -> MLSTest (GroupId, Qualified ConvId) +setupMLSGroup :: (HasCallStack) => ClientIdentity -> MLSTest (GroupId, Qualified ConvId) setupMLSGroup creator = setupMLSGroupWithConv action creator where action = @@ -446,17 +454,17 @@ setupMLSGroup creator = setupMLSGroupWithConv action creator (Just (ciClient creator)) defNewMLSConv ) - ClientIdentity -> MLSTest (GroupId, Qualified ConvId) +setupMLSSelfGroup :: (HasCallStack) => ClientIdentity -> MLSTest (GroupId, Qualified ConvId) setupMLSSelfGroup creator = setupMLSGroupWithConv action creator where action = responseJsonError =<< liftTest (getSelfConv (ciUser creator)) - Qualified ConvOrSubConvId -> GroupId -> MLSTest () createGroup cid qcs gid = do @@ -498,17 +506,17 @@ getConvId = >>= maybe (liftIO (assertFailure "Uninitialised test conversation")) pure createSubConv :: - HasCallStack => + (HasCallStack) => Qualified ConvId -> ClientIdentity -> SubConvId -> MLSTest (Qualified ConvOrSubConvId) createSubConv qcnv creator subId = do sub <- - liftTest $ - responseJsonError - =<< getSubConv (ciUser creator) qcnv subId - >= sendAndConsumeCommitBundle @@ -517,7 +525,7 @@ createSubConv qcnv creator subId = do -- | Create a local group only without a conversation. This simulates creating -- an MLS conversation on a remote backend. setupFakeMLSGroup :: - HasCallStack => + (HasCallStack) => ClientIdentity -> Maybe SubConvId -> MLSTest (GroupId, Qualified ConvId) @@ -527,7 +535,7 @@ setupFakeMLSGroup creator mSubId = do createGroup creator (fmap Conv qcnv) groupId pure (groupId, qcnv) -claimLocalKeyPackages :: HasCallStack => ClientIdentity -> Local UserId -> MLSTest KeyPackageBundle +claimLocalKeyPackages :: (HasCallStack) => ClientIdentity -> Local UserId -> MLSTest KeyPackageBundle claimLocalKeyPackages qcid lusr = do brigCall <- viewBrig responseJsonError @@ -536,10 +544,10 @@ claimLocalKeyPackages qcid lusr = do . paths ["mls", "key-packages", "claim", toByteString' (tDomain lusr), toByteString' (tUnqualified lusr)] . zUser (ciUser qcid) ) - Qualified UserId -> MLSTest [ClientIdentity] +getUserClients :: (HasCallStack) => Qualified UserId -> MLSTest [ClientIdentity] getUserClients qusr = do bd <- State.gets mlsBaseDir files <- getDirectoryContents bd @@ -550,14 +558,15 @@ getUserClients qusr = do pure . mapMaybe toClient $ files -- | Generate one key package for each client of a remote user -claimRemoteKeyPackages :: HasCallStack => Remote UserId -> MLSTest KeyPackageBundle +claimRemoteKeyPackages :: (HasCallStack) => Remote UserId -> MLSTest KeyPackageBundle claimRemoteKeyPackages (tUntagged -> qusr) = do clients <- getUserClients qusr - fmap (KeyPackageBundle . Set.fromList) $ - for clients $ \cid -> do + fmap (KeyPackageBundle . Set.fromList) + $ for clients + $ \cid -> do (kp, ref) <- generateKeyPackage cid - pure $ - KeyPackageBundleEntry + pure + $ KeyPackageBundleEntry { user = qusr, client = ciClient cid, ref = ref, @@ -566,7 +575,7 @@ claimRemoteKeyPackages (tUntagged -> qusr) = do -- | Claim key package for a local user, or generate and map key packages for remote ones. claimKeyPackages :: - HasCallStack => + (HasCallStack) => ClientIdentity -> Qualified UserId -> MLSTest KeyPackageBundle @@ -586,14 +595,14 @@ bundleKeyPackages bundle = -- Note that this alters the state of the group immediately. If we want to test -- a scenario where the commit is rejected by the backend, we can restore the -- group to the previous state by using an older version of the group file. -createAddCommit :: HasCallStack => ClientIdentity -> [Qualified UserId] -> MLSTest MessagePackage +createAddCommit :: (HasCallStack) => ClientIdentity -> [Qualified UserId] -> MLSTest MessagePackage createAddCommit cid users = do kps <- fmap (concatMap bundleKeyPackages) . traverse (claimKeyPackages cid) $ users liftIO $ assertBool "no key packages could be claimed" (not (null kps)) createAddCommitWithKeyPackages cid kps createExternalCommit :: - HasCallStack => + (HasCallStack) => ClientIdentity -> Maybe ByteString -> Qualified ConvOrSubConvId -> @@ -625,22 +634,22 @@ createExternalCommit qcid mpgs qcs = do } newPgs <- liftIO $ BS.readFile pgsFile - pure $ - MessagePackage + pure + $ MessagePackage { mpSender = qcid, mpMessage = commit, mpWelcome = Nothing, mpGroupInfo = Just newPgs } -createAddProposals :: HasCallStack => ClientIdentity -> [Qualified UserId] -> MLSTest [MessagePackage] +createAddProposals :: (HasCallStack) => ClientIdentity -> [Qualified UserId] -> MLSTest [MessagePackage] createAddProposals cid users = do kps <- fmap (concatMap bundleKeyPackages) . traverse (claimKeyPackages cid) $ users traverse (createAddProposalWithKeyPackage cid) kps -- | Create an application message. createApplicationMessage :: - HasCallStack => + (HasCallStack) => ClientIdentity -> String -> MLSTest MessagePackage @@ -651,8 +660,8 @@ createApplicationMessage cid messageContent = do ["message", "--group-in", "", messageContent, "--group-out", ""] Nothing - pure $ - MessagePackage + pure + $ MessagePackage { mpSender = cid, mpMessage = message, mpWelcome = Nothing, @@ -660,7 +669,7 @@ createApplicationMessage cid messageContent = do } createAddCommitWithKeyPackages :: - HasCallStack => + (HasCallStack) => ClientIdentity -> [(ClientIdentity, ByteString)] -> MLSTest MessagePackage @@ -694,8 +703,8 @@ createAddCommitWithKeyPackages qcid clientsAndKeyPackages = do welcome <- liftIO $ BS.readFile welcomeFile gi <- liftIO $ BS.readFile giFile - pure $ - MessagePackage + pure + $ MessagePackage { mpSender = qcid, mpMessage = commit, mpWelcome = Just welcome, @@ -720,7 +729,7 @@ createAddProposalWithKeyPackage cid (_, kp) = do mpGroupInfo = Nothing } -createPendingProposalCommit :: HasCallStack => ClientIdentity -> MLSTest MessagePackage +createPendingProposalCommit :: (HasCallStack) => ClientIdentity -> MLSTest MessagePackage createPendingProposalCommit qcid = do bd <- State.gets mlsBaseDir welcomeFile <- liftIO $ emptyTempFile bd "welcome" @@ -757,7 +766,7 @@ readWelcome fp = runMaybeT $ do guard $ fileSize stat > 0 liftIO $ BS.readFile fp -createRemoveCommit :: HasCallStack => ClientIdentity -> [ClientIdentity] -> MLSTest MessagePackage +createRemoveCommit :: (HasCallStack) => ClientIdentity -> [ClientIdentity] -> MLSTest MessagePackage createRemoveCommit cid targets = do bd <- State.gets mlsBaseDir welcomeFile <- liftIO $ emptyTempFile bd "welcome" @@ -794,7 +803,7 @@ createRemoveCommit cid targets = do mpGroupInfo = Just pgs } -createExternalAddProposal :: HasCallStack => ClientIdentity -> MLSTest MessagePackage +createExternalAddProposal :: (HasCallStack) => ClientIdentity -> MLSTest MessagePackage createExternalAddProposal joiner = do groupId <- State.gets mlsGroupId >>= \case @@ -825,14 +834,14 @@ createExternalAddProposal joiner = do mpGroupInfo = Nothing } -consumeWelcome :: HasCallStack => ByteString -> MLSTest () +consumeWelcome :: (HasCallStack) => ByteString -> MLSTest () consumeWelcome welcome = do qcids <- State.gets mlsNewMembers for_ qcids $ \qcid -> do hasState <- hasClientGroupState qcid liftIO $ assertBool "Existing clients in a conversation should not consume welcomes" (not hasState) - void $ - mlscli + void + $ mlscli qcid [ "group", "from-welcome", @@ -843,16 +852,16 @@ consumeWelcome welcome = do (Just welcome) -- | Make all member clients consume a given message. -consumeMessage :: HasCallStack => MessagePackage -> MLSTest () +consumeMessage :: (HasCallStack) => MessagePackage -> MLSTest () consumeMessage msg = do mems <- State.gets mlsMembers for_ (Set.delete (mpSender msg) mems) $ \cid -> consumeMessage1 cid (mpMessage msg) -consumeMessage1 :: HasCallStack => ClientIdentity -> ByteString -> MLSTest () +consumeMessage1 :: (HasCallStack) => ClientIdentity -> ByteString -> MLSTest () consumeMessage1 cid msg = - void $ - mlscli + void + $ mlscli cid [ "consume", "--group", @@ -865,14 +874,14 @@ consumeMessage1 cid msg = -- | Send an MLS message and simulate clients receiving it. If the message is a -- commit, the 'sendAndConsumeCommitBundle' function should be used instead. -sendAndConsumeMessage :: HasCallStack => MessagePackage -> MLSTest [Event] +sendAndConsumeMessage :: (HasCallStack) => MessagePackage -> MLSTest [Event] sendAndConsumeMessage mp = do for_ mp.mpWelcome $ \_ -> liftIO $ assertFailure "use sendAndConsumeCommitBundle" res <- - fmap mmssEvents $ - responseJsonError - =<< postMessage (mpSender mp) (mpMessage mp) - MessagePackage -> m ByteString createBundle mp = do bundle <- - either (liftIO . assertFailure . T.unpack) pure $ - mkBundle mp + either (liftIO . assertFailure . T.unpack) pure + $ mkBundle mp pure (encodeMLS' bundle) -sendAndConsumeCommitBundle :: HasCallStack => MessagePackage -> MLSTest [Event] +sendAndConsumeCommitBundle :: (HasCallStack) => MessagePackage -> MLSTest [Event] sendAndConsumeCommitBundle mp = do qcs <- getConvId bundle <- createBundle mp @@ -914,7 +923,7 @@ sendAndConsumeCommitBundle mp = do pure resp mlsBracket :: - HasCallStack => + (HasCallStack) => [ClientIdentity] -> ([WS.WebSocket] -> MLSTest a) -> MLSTest a @@ -947,8 +956,12 @@ clientKeyPair :: ClientIdentity -> MLSTest (ByteString, ByteString) clientKeyPair cid = do bd <- State.gets mlsBaseDir credential <- - liftIO . BS.readFile $ - bd cid2Str cid "store" T.unpack (T.decodeUtf8 (B64U.encode "self")) + liftIO + . BS.readFile + $ bd + cid2Str cid + "store" + T.unpack (T.decodeUtf8 (B64U.encode "self")) case runGetOrFail ((,) <$> parseMLSBytes @VarInt <*> parseMLSBytes @VarInt) (LBS.fromStrict credential) of @@ -978,24 +991,24 @@ receiveOnConvUpdated conv origUser joiner = do cjRole = roleNameWireMember } } - void $ - runFedClient + void + $ runFedClient @"on-conversation-updated" client (qDomain conv) cu -getGroupInfo :: HasCallStack => Qualified UserId -> Qualified ConvOrSubConvId -> TestM ByteString +getGroupInfo :: (HasCallStack) => Qualified UserId -> Qualified ConvOrSubConvId -> TestM ByteString getGroupInfo qusr qcs = do loc <- qualifyLocal () foldQualified loc ( \lusr -> - fmap (LBS.toStrict . fromJust . responseBody) $ - localGetGroupInfo + fmap (LBS.toStrict . fromJust . responseBody) + $ localGetGroupInfo (tUnqualified lusr) qcs - remoteGetGroupInfo rusr qcs) qusr @@ -1061,14 +1074,14 @@ getSelfConv :: TestM ResponseLBS getSelfConv u = do g <- viewGalley - get $ - g - . paths ["/conversations", "mls-self"] - . zUser u - . zConn "conn" - . zType "access" - -withMLSDisabled :: HasSettingsOverrides m => m a -> m a + get + $ g + . paths ["/conversations", "mls-self"] + . zUser u + . zConn "conn" + . zType "access" + +withMLSDisabled :: (HasSettingsOverrides m) => m a -> m a withMLSDisabled = withSettingsOverrides noMLS where noMLS = Opts.settings . Opts.mlsPrivateKeyPaths .~ Nothing @@ -1080,16 +1093,16 @@ getSubConv :: TestM ResponseLBS getSubConv u qcnv sconv = do g <- viewGalley - get $ - g - . paths - [ "conversations", - toByteString' (qDomain qcnv), - toByteString' (qUnqualified qcnv), - "subconversations", - LBS.toStrict (toLazyByteString (toEncodedUrlPiece sconv)) - ] - . zUser u + get + $ g + . paths + [ "conversations", + toByteString' (qDomain qcnv), + toByteString' (qUnqualified qcnv), + "subconversations", + LBS.toStrict (toLazyByteString (toEncodedUrlPiece sconv)) + ] + . zUser u deleteSubConv :: UserId -> @@ -1099,18 +1112,18 @@ deleteSubConv :: TestM ResponseLBS deleteSubConv u qcnv sconv dsc = do g <- viewGalley - delete $ - g - . paths - [ "conversations", - toByteString' (qDomain qcnv), - toByteString' (qUnqualified qcnv), - "subconversations", - LBS.toStrict (toLazyByteString (toEncodedUrlPiece sconv)) - ] - . zUser u - . contentJson - . json dsc + delete + $ g + . paths + [ "conversations", + toByteString' (qDomain qcnv), + toByteString' (qUnqualified qcnv), + "subconversations", + LBS.toStrict (toLazyByteString (toEncodedUrlPiece sconv)) + ] + . zUser u + . contentJson + . json dsc leaveSubConv :: UserId -> @@ -1120,18 +1133,18 @@ leaveSubConv :: TestM ResponseLBS leaveSubConv u c qcnv subId = do g <- viewGalley - delete $ - g - . paths - [ "conversations", - toByteString' (qDomain qcnv), - toByteString' (qUnqualified qcnv), - "subconversations", - toHeader subId, - "self" - ] - . zUser u - . zClient c + delete + $ g + . paths + [ "conversations", + toByteString' (qDomain qcnv), + toByteString' (qUnqualified qcnv), + "subconversations", + toHeader subId, + "self" + ] + . zUser u + . zClient c remoteLeaveCurrentConv :: Remote ClientIdentity -> @@ -1152,17 +1165,20 @@ remoteLeaveCurrentConv rcid qcnv subId = do client (tDomain rcid) lscr - >>= liftIO . \case + >>= liftIO + . \case LeaveSubConversationResponseError e -> - assertFailure $ - "error while leaving remote conversation: " <> show e + assertFailure + $ "error while leaving remote conversation: " + <> show e LeaveSubConversationResponseProtocolError e -> - assertFailure $ - "protocol error while leaving remote conversation: " <> T.unpack e + assertFailure + $ "protocol error while leaving remote conversation: " + <> T.unpack e LeaveSubConversationResponseOk -> pure () leaveCurrentConv :: - HasCallStack => + (HasCallStack) => ClientIdentity -> Qualified ConvOrSubConvId -> MLSTest () diff --git a/services/galley/test/integration/API/MessageTimer.hs b/services/galley/test/integration/API/MessageTimer.hs index 2e85dec5a8f..663bf180ecf 100644 --- a/services/galley/test/integration/API/MessageTimer.hs +++ b/services/galley/test/integration/API/MessageTimer.hs @@ -184,9 +184,10 @@ messageTimerEvent = do let update = ConversationMessageTimerUpdate timer1sec putMessageTimerUpdate alice cid update !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB] $ - wsAssertConvMessageTimerUpdate qcid qalice update + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB] + $ wsAssertConvMessageTimerUpdate qcid qalice update ---------------------------------------------------------------------------- -- Utilities diff --git a/services/galley/test/integration/API/Roles.hs b/services/galley/test/integration/API/Roles.hs index 1fdf61a1e4b..9707cf827c3 100644 --- a/services/galley/test/integration/API/Roles.hs +++ b/services/galley/test/integration/API/Roles.hs @@ -87,14 +87,16 @@ handleConversationRoleAdmin = do qcid = Qualified cid localDomain -- Make sure everyone gets the correct event postMembersWithRole alice (pure qeve) qcid role !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsC] $ - wsAssertMemberJoinWithRole qcid qalice [qeve] role + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsC] + $ wsAssertMemberJoinWithRole qcid qalice [qeve] role -- Add a member to help out with testing postMembersWithRole alice (pure qjack) qcid roleNameWireMember !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsC] $ - wsAssertMemberJoinWithRole qcid qalice [qjack] roleNameWireMember + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsC] + $ wsAssertMemberJoinWithRole qcid qalice [qjack] roleNameWireMember pure cid -- Added bob as a wire_admin and do the checks wireAdminChecks cid alice bob jack @@ -128,9 +130,10 @@ handleConversationRoleMember = do qcid = Qualified cid localDomain -- Make sure everyone gets the correct event postMembersWithRole alice (pure qeve) qcid role !!! const 200 === statusCode - void . liftIO $ - WS.assertMatchN (5 # Second) [wsA, wsB, wsC] $ - wsAssertMemberJoinWithRole qcid qalice [qeve] role + void + . liftIO + $ WS.assertMatchN (5 # Second) [wsA, wsB, wsC] + $ wsAssertMemberJoinWithRole qcid qalice [qeve] role pure cid -- Added bob as a wire_member and do the checks wireMemberChecks cid bob alice chuck @@ -255,9 +258,10 @@ testConversationAccessRole = do conv <- responseJsonError =<< postConvQualified (qUnqualified alice) Nothing nc - Assertions () +assertActionSucceeded :: (HasCallStack) => Assertions () assertActionSucceeded = const 200 === statusCode -assertActionDenied :: HasCallStack => Assertions () +assertActionDenied :: (HasCallStack) => Assertions () assertActionDenied = do const 403 === statusCode const (Just "action-denied") === fmap label . responseJsonUnsafe diff --git a/services/galley/test/integration/API/SQS.hs b/services/galley/test/integration/API/SQS.hs index 16c7307c012..2057433b150 100644 --- a/services/galley/test/integration/API/SQS.hs +++ b/services/galley/test/integration/API/SQS.hs @@ -42,13 +42,13 @@ import Test.Tasty.HUnit import TestSetup import Util.Test.SQS qualified as SQS -withTeamEventWatcher :: HasCallStack => (SQS.SQSWatcher TeamEvent -> TestM ()) -> TestM () +withTeamEventWatcher :: (HasCallStack) => (SQS.SQSWatcher TeamEvent -> TestM ()) -> TestM () withTeamEventWatcher action = do view tsTeamEventWatcher >>= \case Nothing -> pure () Just w -> action w -assertIfWatcher :: HasCallStack => String -> (TeamEvent -> Bool) -> (String -> Maybe TeamEvent -> TestM ()) -> TestM () +assertIfWatcher :: (HasCallStack) => String -> (TeamEvent -> Bool) -> (String -> Maybe TeamEvent -> TestM ()) -> TestM () assertIfWatcher l matcher assertion = view tsTeamEventWatcher >>= \case Nothing -> pure () @@ -63,7 +63,7 @@ tActivateWithCurrency c l (Just e) = liftIO $ do assertEqual "currency" cur (e ^. eventData . maybe'currency) tActivateWithCurrency _ l Nothing = liftIO $ assertFailure $ l <> ": Expected 1 TeamActivate, got nothing" -assertTeamActivateWithCurrency :: HasCallStack => String -> TeamId -> Maybe Currency.Alpha -> TestM () +assertTeamActivateWithCurrency :: (HasCallStack) => String -> TeamId -> Maybe Currency.Alpha -> TestM () assertTeamActivateWithCurrency l tid c = assertIfWatcher l (teamActivateMatcher tid) (tActivateWithCurrency c) @@ -73,7 +73,7 @@ tActivate l (Just e) = liftIO $ do assertEqual "count" 1 (e ^. eventData . memberCount) tActivate l Nothing = liftIO $ assertFailure $ l <> ": Expected 1 TeamActivate, got nothing" -assertTeamActivate :: HasCallStack => String -> TeamId -> TestM () +assertTeamActivate :: (HasCallStack) => String -> TeamId -> TestM () assertTeamActivate l tid = assertIfWatcher l (teamActivateMatcher tid) tActivate @@ -84,7 +84,7 @@ tDelete :: (HasCallStack, MonadIO m) => String -> Maybe E.TeamEvent -> m () tDelete l (Just e) = liftIO $ assertEqual (l <> ": eventType") E.TeamEvent'TEAM_DELETE (e ^. eventType) tDelete l Nothing = liftIO $ assertFailure $ l <> ": Expected 1 TeamDelete, got nothing" -assertTeamDelete :: HasCallStack => Int -> String -> TeamId -> TestM () +assertTeamDelete :: (HasCallStack) => Int -> String -> TeamId -> TestM () assertTeamDelete maxWaitSeconds l tid = withTeamEventWatcher $ \w -> do mEvent <- SQS.waitForMessage w maxWaitSeconds (\e -> e ^. eventType == E.TeamEvent'TEAM_DELETE && decodeIdFromBS (e ^. teamId) == tid) @@ -94,7 +94,7 @@ tSuspend :: (HasCallStack, MonadIO m) => String -> Maybe E.TeamEvent -> m () tSuspend l (Just e) = liftIO $ assertEqual (l <> "eventType") E.TeamEvent'TEAM_SUSPEND (e ^. eventType) tSuspend l Nothing = liftIO $ assertFailure $ l <> ": Expected 1 TeamSuspend, got nothing" -assertTeamSuspend :: HasCallStack => String -> TeamId -> TestM () +assertTeamSuspend :: (HasCallStack) => String -> TeamId -> TestM () assertTeamSuspend l tid = assertIfWatcher l (\e -> e ^. eventType == E.TeamEvent'TEAM_SUSPEND && decodeIdFromBS (e ^. teamId) == tid) tSuspend @@ -114,7 +114,7 @@ tUpdate _ _ l Nothing = liftIO $ assertFailure $ l <> ": Expected 1 TeamUpdate, updateMatcher :: TeamId -> TeamEvent -> Bool updateMatcher tid e = e ^. eventType == E.TeamEvent'TEAM_UPDATE && decodeIdFromBS (e ^. teamId) == tid -assertTeamUpdate :: HasCallStack => String -> TeamId -> Int32 -> [UserId] -> TestM () +assertTeamUpdate :: (HasCallStack) => String -> TeamId -> Int32 -> [UserId] -> TestM () assertTeamUpdate l tid c uids = assertIfWatcher l (\e -> e ^. eventType == E.TeamEvent'TEAM_UPDATE && decodeIdFromBS (e ^. teamId) == tid) $ tUpdate c uids diff --git a/services/galley/test/integration/API/Teams.hs b/services/galley/test/integration/API/Teams.hs index 060116473e0..3fd800504d3 100644 --- a/services/galley/test/integration/API/Teams.hs +++ b/services/galley/test/integration/API/Teams.hs @@ -99,67 +99,67 @@ import Wire.API.User.Client.Prekey qualified as PC tests :: IO TestSetup -> TestTree tests s = - testGroup "Teams API" $ - [ test s "create team" testCreateTeam, - test s "GET /teams (deprecated)" testGetTeams, - test s "create binding team with currency" testCreateBindingTeamWithCurrency, - testGroup "List Team Members" $ - [ test s "a member should be able to list their team" testListTeamMembersDefaultLimit, - let numMembers = 5 - in test - s - ("admins should be able to get a csv stream with their team (" <> show numMembers <> " members)") - (testListTeamMembersCsv numMembers), - test s "the list should be limited to the number requested (hard truncation is not tested here)" testListTeamMembersTruncated, - test s "pagination" testListTeamMembersPagination - ], - testGroup "List Team Members (by ids)" $ - [ test s "a member should be able to list their team" testListTeamMembersDefaultLimitByIds, - test s "id list length limit is enforced" testListTeamMembersTruncatedByIds - ], - testGroup "List Team members unchecked" $ - [test s "the list should be truncated" testUncheckedListTeamMembers], - test s "enable/disable SSO" testEnableSSOPerTeam, - test s "enable/disable Custom Search Visibility" testEnableTeamSearchVisibilityPerTeam, - test s "create 1-1 conversation between non-team members (fail)" testCreateOne2OneFailForNonTeamMembers, - test s "create 1-1 conversation between binding team members" (testCreateOne2OneWithMembers RoleMember), - test s "create 1-1 conversation between binding team members as partner" (testCreateOne2OneWithMembers RoleExternalPartner), - test s "poll team-level event queue" testTeamQueue, - test s "add new team member internal" testAddTeamMemberInternal, - test s "remove aka delete team member (binding, owner has passwd)" (testRemoveBindingTeamMember True), - test s "remove aka delete team member (binding, owner has no passwd)" (testRemoveBindingTeamMember False), - test s "remove aka delete team owner (binding)" testRemoveBindingTeamOwner, - test s "add team conversation (no role as argument)" testAddTeamConvLegacy, - test s "add team conversation with role" testAddTeamConvWithRole, - test s "add team conversation as partner (fail)" testAddTeamConvAsExternalPartner, - test s "add team MLS conversation" testCreateTeamMLSConv, - test s "add team member to conversation without connection" testAddTeamMemberToConv, - test s "update conversation as member" (testUpdateTeamConv RoleMember roleNameWireAdmin), - test s "update conversation as partner" (testUpdateTeamConv RoleExternalPartner roleNameWireMember), - test s "delete binding team internal single member" testDeleteBindingTeamSingleMember, - test s "delete binding team internal no members" testDeleteBindingTeamNoMembers, - test s "delete binding team more than one member" testDeleteBindingTeamMoreThanOneMember, - test s "delete binding team (owner has passwd)" (testDeleteBindingTeam True), - test s "delete binding team (owner has no passwd)" (testDeleteBindingTeam False), - testGroup - "delete team - verification code" - [ test s "success" testDeleteTeamVerificationCodeSuccess, - test s "testDeleteTeamVerificationCodeWrongCode - wrong code" testDeleteTeamVerificationCodeWrongCode, - test s "testDeleteTeamVerificationCodeMissingCode - missing code" testDeleteTeamVerificationCodeMissingCode, - test s "testDeleteTeamVerificationCodeExpiredCode - expired code" testDeleteTeamVerificationCodeExpiredCode - ], - test s "delete team conversation" testDeleteTeamConv, - test s "update team data" testUpdateTeam, - test s "update team data icon validation" testUpdateTeamIconValidation, - test s "testUpdateTeamMember - update team member" testUpdateTeamMember, - test s "update team status" testUpdateTeamStatus, - test s "send billing events to owners even in large teams" testBillingInLargeTeam, - testGroup "broadcast" $ - [ (BroadcastLegacyBody, BroadcastJSON), - (BroadcastLegacyQueryParams, BroadcastJSON), - (BroadcastLegacyBody, BroadcastProto), - (BroadcastQualified, BroadcastProto) - ] + testGroup "Teams API" + $ [ test s "create team" testCreateTeam, + test s "GET /teams (deprecated)" testGetTeams, + test s "create binding team with currency" testCreateBindingTeamWithCurrency, + testGroup "List Team Members" + $ [ test s "a member should be able to list their team" testListTeamMembersDefaultLimit, + let numMembers = 5 + in test + s + ("admins should be able to get a csv stream with their team (" <> show numMembers <> " members)") + (testListTeamMembersCsv numMembers), + test s "the list should be limited to the number requested (hard truncation is not tested here)" testListTeamMembersTruncated, + test s "pagination" testListTeamMembersPagination + ], + testGroup "List Team Members (by ids)" + $ [ test s "a member should be able to list their team" testListTeamMembersDefaultLimitByIds, + test s "id list length limit is enforced" testListTeamMembersTruncatedByIds + ], + testGroup "List Team members unchecked" + $ [test s "the list should be truncated" testUncheckedListTeamMembers], + test s "enable/disable SSO" testEnableSSOPerTeam, + test s "enable/disable Custom Search Visibility" testEnableTeamSearchVisibilityPerTeam, + test s "create 1-1 conversation between non-team members (fail)" testCreateOne2OneFailForNonTeamMembers, + test s "create 1-1 conversation between binding team members" (testCreateOne2OneWithMembers RoleMember), + test s "create 1-1 conversation between binding team members as partner" (testCreateOne2OneWithMembers RoleExternalPartner), + test s "poll team-level event queue" testTeamQueue, + test s "add new team member internal" testAddTeamMemberInternal, + test s "remove aka delete team member (binding, owner has passwd)" (testRemoveBindingTeamMember True), + test s "remove aka delete team member (binding, owner has no passwd)" (testRemoveBindingTeamMember False), + test s "remove aka delete team owner (binding)" testRemoveBindingTeamOwner, + test s "add team conversation (no role as argument)" testAddTeamConvLegacy, + test s "add team conversation with role" testAddTeamConvWithRole, + test s "add team conversation as partner (fail)" testAddTeamConvAsExternalPartner, + test s "add team MLS conversation" testCreateTeamMLSConv, + test s "add team member to conversation without connection" testAddTeamMemberToConv, + test s "update conversation as member" (testUpdateTeamConv RoleMember roleNameWireAdmin), + test s "update conversation as partner" (testUpdateTeamConv RoleExternalPartner roleNameWireMember), + test s "delete binding team internal single member" testDeleteBindingTeamSingleMember, + test s "delete binding team internal no members" testDeleteBindingTeamNoMembers, + test s "delete binding team more than one member" testDeleteBindingTeamMoreThanOneMember, + test s "delete binding team (owner has passwd)" (testDeleteBindingTeam True), + test s "delete binding team (owner has no passwd)" (testDeleteBindingTeam False), + testGroup + "delete team - verification code" + [ test s "success" testDeleteTeamVerificationCodeSuccess, + test s "testDeleteTeamVerificationCodeWrongCode - wrong code" testDeleteTeamVerificationCodeWrongCode, + test s "testDeleteTeamVerificationCodeMissingCode - missing code" testDeleteTeamVerificationCodeMissingCode, + test s "testDeleteTeamVerificationCodeExpiredCode - expired code" testDeleteTeamVerificationCodeExpiredCode + ], + test s "delete team conversation" testDeleteTeamConv, + test s "update team data" testUpdateTeam, + test s "update team data icon validation" testUpdateTeamIconValidation, + test s "testUpdateTeamMember - update team member" testUpdateTeamMember, + test s "update team status" testUpdateTeamStatus, + test s "send billing events to owners even in large teams" testBillingInLargeTeam, + testGroup "broadcast" + $ [ (BroadcastLegacyBody, BroadcastJSON), + (BroadcastLegacyQueryParams, BroadcastJSON), + (BroadcastLegacyBody, BroadcastProto), + (BroadcastQualified, BroadcastProto) + ] <&> \(api, ty) -> let bcast = def {bAPI = api, bType = ty} in testGroup @@ -171,7 +171,7 @@ tests s = test s "no-team" (postCryptoBroadcastMessageNoTeam bcast), test s "100 (or max conns)" (postCryptoBroadcastMessage100OrMaxConns bcast) ] - ] + ] timeout :: WS.Timeout timeout = 3 # Second @@ -223,20 +223,20 @@ testListTeamMembersDefaultLimit :: TestM () testListTeamMembersDefaultLimit = do (owner, tid, [member1, member2]) <- Util.createBindingTeamWithNMembers 2 listFromServer <- Util.getTeamMembers owner tid - liftIO $ - assertEqual + liftIO + $ assertEqual "list members" (Set.fromList [owner, member1, member2]) (Set.fromList (map (^. Teams.userId) $ listFromServer ^. teamMembers)) - liftIO $ - assertBool + liftIO + $ assertBool "member list indicates that there are no more members" (listFromServer ^. teamMemberListType == ListComplete) -- | for ad-hoc load-testing, set @numMembers@ to, say, 10k and see what -- happens. but please don't give that number to our ci! :) -- for additional tests of the CSV download particularly with SCIM users, please refer to 'Test.Spar.Scim.UserSpec' -testListTeamMembersCsv :: HasCallStack => Int -> TestM () +testListTeamMembersCsv :: (HasCallStack) => Int -> TestM () testListTeamMembersCsv numMembers = do let teamSize = numMembers + 1 @@ -257,7 +257,7 @@ testListTeamMembersCsv numMembers = do users <- Util.getUsersByHandle (catMaybes someHandles) mbrs <- view teamMembers <$> Util.bulkGetTeamMembers owner tid (U.userId <$> users) - let check :: Eq a => String -> (TeamExportUser -> Maybe a) -> UserId -> Maybe a -> IO () + let check :: (Eq a) => String -> (TeamExportUser -> Maybe a) -> UserId -> Maybe a -> IO () check msg getTeamExportUserAttr uid userAttr = do assertBool msg (isJust userAttr) assertEqual (msg <> ": " <> show uid) 1 (countOn getTeamExportUserAttr userAttr usersInCsv) @@ -280,16 +280,16 @@ testListTeamMembersCsv numMembers = do assertEqual ("tExportUserId: " <> show (U.userId user)) (U.userId user) (tExportUserId export) assertEqual "tExportNumDevices: " (Map.findWithDefault (-1) (U.userId user) numClientMappings) (tExportNumDevices export) where - userToIdPIssuer :: HasCallStack => U.User -> Maybe HttpsUrl + userToIdPIssuer :: (HasCallStack) => U.User -> Maybe HttpsUrl userToIdPIssuer usr = case (U.userIdentity >=> U.ssoIdentity) usr of Just (U.UserSSOId (SAML.UserRef (SAML.Issuer issuer) _)) -> either (const $ error "shouldn't happen") Just $ mkHttpsUrl issuer Just _ -> Nothing Nothing -> Nothing - decodeCSV :: FromNamedRecord a => LByteString -> Either String [a] + decodeCSV :: (FromNamedRecord a) => LByteString -> Either String [a] decodeCSV bstr = decodeByName bstr <&> (snd >>> V.toList) - countOn :: Eq b => (a -> b) -> b -> [a] -> Int + countOn :: (Eq b) => (a -> b) -> b -> [a] -> Int countOn prop val xs = sum $ fmap (bool 0 1 . (== val) . prop) xs addClients :: Map.Map UserId Int -> TestM () @@ -334,13 +334,13 @@ testListTeamMembersTruncated :: TestM () testListTeamMembersTruncated = do (owner, tid, _) <- Util.createBindingTeamWithNMembers 4 listFromServer <- Util.getTeamMembersTruncated owner tid 2 - liftIO $ - assertEqual + liftIO + $ assertEqual "member list is not limited to the requested number" 2 (length $ listFromServer ^. teamMembers) - liftIO $ - assertBool + liftIO + $ assertBool "member list does not indicate that there are more members" (listFromServer ^. teamMemberListType == ListTruncated) @@ -357,16 +357,16 @@ testListTeamMembersDefaultLimitByIds = do check owner tid [phantom] [] check owner tid [owner, alien, phantom] [owner] where - check :: HasCallStack => UserId -> TeamId -> [UserId] -> [UserId] -> TestM () + check :: (HasCallStack) => UserId -> TeamId -> [UserId] -> [UserId] -> TestM () check owner tid uidsIn uidsOut = do listFromServer <- Util.bulkGetTeamMembers owner tid uidsIn - liftIO $ - assertEqual + liftIO + $ assertEqual "list members" (Set.fromList uidsOut) (Set.fromList (map (^. userId) $ listFromServer ^. teamMembers)) - liftIO $ - assertBool + liftIO + $ assertBool "has_more is always false" (listFromServer ^. teamMemberListType == ListComplete) @@ -381,13 +381,13 @@ testUncheckedListTeamMembers :: TestM () testUncheckedListTeamMembers = do (_, tid, _) <- Util.createBindingTeamWithNMembers 4 listFromServer <- Util.getTeamMembersInternalTruncated tid 2 - liftIO $ - assertEqual + liftIO + $ assertEqual "member list is not limited to the requested number" 2 (length $ listFromServer ^. teamMembers) - liftIO $ - assertBool + liftIO + $ assertBool "member list does not indicate that there are more members" (listFromServer ^. teamMemberListType == ListTruncated) @@ -396,12 +396,12 @@ testEnableSSOPerTeam = do owner <- Util.randomUser tid <- Util.createBindingTeamInternal "foo" owner assertTeamActivate "create team" tid - let check :: HasCallStack => String -> Public.FeatureStatus -> TestM () + let check :: (HasCallStack) => String -> Public.FeatureStatus -> TestM () check msg enabledness = do status :: Public.WithStatusNoLock Public.SSOConfig <- responseJsonUnsafe <$> (getSSOEnabledInternal tid TestM () + let putSSOEnabledInternalCheckNotImplemented :: (HasCallStack) => TestM () putSSOEnabledInternalCheckNotImplemented = do g <- viewGalley waierr <- @@ -489,7 +489,7 @@ testCreateOne2OneFailForNonTeamMembers = do const "non-binding-team-members" === (Error.label . responseJsonUnsafeWithMsg "error label") testCreateOne2OneWithMembers :: - HasCallStack => + (HasCallStack) => -- | Role of the user who creates the conversation Role -> TestM () @@ -709,7 +709,7 @@ testRemoveBindingTeamOwner = do Util.waitForMemberDeletion ownerB tid ownerWithoutEmail assertTeamUpdate "Remove ownerWithoutEmail" tid 2 [ownerB] where - check :: HasCallStack => TeamId -> UserId -> UserId -> Maybe PlainTextPassword6 -> Maybe LText -> TestM () + check :: (HasCallStack) => TeamId -> UserId -> UserId -> Maybe PlainTextPassword6 -> Maybe LText -> TestM () check tid deleter deletee pass maybeError = do g <- viewGalley delete @@ -735,8 +735,8 @@ testAddTeamConvLegacy = do mem1 <- newTeamMember' p <$> Util.randomUser mem2 <- newTeamMember' p <$> Util.randomUser Util.connectUsers owner (list1 (mem1 ^. userId) [extern, mem2 ^. userId]) - allUserIds <- for [owner, extern, mem1 ^. userId, mem2 ^. userId] $ - \u -> Qualified u <$> viewFederationDomain + allUserIds <- for [owner, extern, mem1 ^. userId, mem2 ^. userId] + $ \u -> Qualified u <$> viewFederationDomain WS.bracketRN c (qUnqualified <$> allUserIds) $ \wss -> do cid <- Util.createTeamConvLegacy owner tid (qUnqualified <$> allUserIds) (Just "blaa") mapM_ (checkConvCreateEvent cid) wss @@ -961,8 +961,8 @@ testDeleteBindingTeamSingleMember = do === statusCode assertTeamUpdate "team member leave 1" tid 1 [owner] -- Async things are hard... - void $ - retryWhileN + void + $ retryWhileN 10 (/= Just True) (getDeletedState extern (other ^. userId)) @@ -1214,7 +1214,8 @@ testDeleteBindingTeam ownerHasPassword = do -- Note that given the async nature of team deletion, we may -- have other events in the queue (such as TEAM_UPDATE) assertTeamDelete 10 "team delete, should be there" tid - forM_ [owner, mem1 ^. userId, mem2 ^. userId] $ + forM_ [owner, mem1 ^. userId, mem2 ^. userId] + $ -- Ensure users are marked as deleted; since we already -- received the event, should _really_ be deleted Util.ensureDeletedState True extern @@ -1236,8 +1237,8 @@ testDeleteTeamConv = do (cid1, qcid1) <- WS.bracketR c owner $ \wsOwner -> do cid1 <- Util.createTeamConv owner tid [] (Just "blaa") Nothing Nothing qcid1 <- Qualified cid1 <$> viewFederationDomain - WS.assertMatch_ (5 # Second) wsOwner $ - wsAssertConvCreate qcid1 qOwner + WS.assertMatch_ (5 # Second) wsOwner + $ wsAssertConvCreate qcid1 qOwner pure (cid1, qcid1) let access = ConversationAccessData (Set.fromList [InviteAccess, CodeAccess]) (Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole]) putQualifiedAccessUpdate owner qcid1 access !!! const 200 === statusCode @@ -1245,8 +1246,8 @@ testDeleteTeamConv = do cid2 <- WS.bracketR c owner $ \wsOwner -> do cid2 <- Util.createTeamConv owner tid (qUnqualified <$> members) (Just "blup") Nothing Nothing qcid2 <- Qualified cid2 <$> viewFederationDomain - WS.assertMatch_ (5 # Second) wsOwner $ - wsAssertConvCreate qcid2 qOwner + WS.assertMatch_ (5 # Second) wsOwner + $ wsAssertConvCreate qcid2 qOwner pure cid2 Util.postMembers owner (qExtern :| [qMember]) qcid1 !!! const 200 === statusCode for_ (qExtern : members) $ \u -> Util.assertConvMember u cid1 @@ -1466,15 +1467,15 @@ testUpdateTeamStatus = do Util.changeTeamStatus tid TeamsIntra.Suspended Util.changeTeamStatus tid TeamsIntra.Active assertTeamActivate "activate again" tid - void $ - put + void + $ put ( g . paths ["i", "teams", toByteString' tid, "status"] . json (TeamStatusUpdate TeamsIntra.Deleted Nothing) ) - !!! do - const 403 === statusCode - const "invalid-team-status-update" === (Error.label . responseJsonUnsafeWithMsg "error label") + !!! do + const 403 === statusCode + const "invalid-team-status-update" === (Error.label . responseJsonUnsafeWithMsg "error label") postCryptoBroadcastMessage :: Broadcast -> TestM () postCryptoBroadcastMessage bcast = do @@ -1512,19 +1513,23 @@ postCryptoBroadcastMessage bcast = do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [] [] -- Bob should get the broadcast (team member of alice) - void . liftIO $ - WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext1")) + void + . liftIO + $ WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext1")) -- Charlie should get the broadcast (contact of alice and user of teams feature) - void . liftIO $ - WS.assertMatch t wsC (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) + void + . liftIO + $ WS.assertMatch t wsC (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) -- Dan should get the broadcast (contact of alice and not user of teams feature) - void . liftIO $ - WS.assertMatch t wsD (wsAssertOtr (q (selfConv dan)) (q alice) ac dc (toBase64Text "ciphertext3")) + void + . liftIO + $ WS.assertMatch t wsD (wsAssertOtr (q (selfConv dan)) (q alice) ac dc (toBase64Text "ciphertext3")) -- Alice's first client should not get the broadcast assertNoMsg wsA1 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac (toBase64Text "ciphertext0")) -- Alice's second client should get the broadcast - void . liftIO $ - WS.assertMatch t wsA2 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac2 (toBase64Text "ciphertext0")) + void + . liftIO + $ WS.assertMatch t wsA2 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac2 (toBase64Text "ciphertext0")) postCryptoBroadcastMessageFilteredTooLargeTeam :: Broadcast -> TestM () postCryptoBroadcastMessageFilteredTooLargeTeam bcast = do @@ -1578,19 +1583,23 @@ postCryptoBroadcastMessageFilteredTooLargeTeam bcast = do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [] [] -- Bob should get the broadcast (team member of alice) - void . liftIO $ - WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext1")) + void + . liftIO + $ WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext1")) -- Charlie should get the broadcast (contact of alice and user of teams feature) - void . liftIO $ - WS.assertMatch t wsC (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) + void + . liftIO + $ WS.assertMatch t wsC (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) -- Dan should get the broadcast (contact of alice and not user of teams feature) - void . liftIO $ - WS.assertMatch t wsD (wsAssertOtr (q (selfConv dan)) (q alice) ac dc (toBase64Text "ciphertext3")) + void + . liftIO + $ WS.assertMatch t wsD (wsAssertOtr (q (selfConv dan)) (q alice) ac dc (toBase64Text "ciphertext3")) -- Alice's first client should not get the broadcast assertNoMsg wsA1 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac (toBase64Text "ciphertext0")) -- Alice's second client should get the broadcast - void . liftIO $ - WS.assertMatch t wsA2 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac2 (toBase64Text "ciphertext0")) + void + . liftIO + $ WS.assertMatch t wsA2 (wsAssertOtr (q (selfConv alice)) (q alice) ac ac2 (toBase64Text "ciphertext0")) postCryptoBroadcastMessageReportMissingBody :: Broadcast -> TestM () postCryptoBroadcastMessageReportMissingBody bcast = do @@ -1640,10 +1649,12 @@ postCryptoBroadcastMessage2 bcast = do Util.postBroadcast (q alice) ac bcast {bMessage = m2} !!! do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [] [] - void . liftIO $ - WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext2")) - void . liftIO $ - WS.assertMatch t wsE (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) + void + . liftIO + $ WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext2")) + void + . liftIO + $ WS.assertMatch t wsE (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext2")) -- Redundant self WS.bracketR3 c alice bob charlie $ \(wsA, wsB, wsE) -> do let m3 = @@ -1654,24 +1665,27 @@ postCryptoBroadcastMessage2 bcast = do Util.postBroadcast (q alice) ac bcast {bMessage = m3} !!! do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [(alice, Set.singleton ac)] [] - void . liftIO $ - WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext3")) - void . liftIO $ - WS.assertMatch t wsE (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext3")) + void + . liftIO + $ WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext3")) + void + . liftIO + $ WS.assertMatch t wsE (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext3")) -- Alice should not get it assertNoMsg wsA (wsAssertOtr (q (selfConv alice)) (q alice) ac ac (toBase64Text "ciphertext3")) -- Deleted charlie WS.bracketR2 c bob charlie $ \(wsB, wsE) -> do deleteClient charlie cc (Just defPassword) !!! const 200 === statusCode - liftIO $ - WS.assertMatch_ (5 # WS.Second) wsE $ - wsAssertClientRemoved cc + liftIO + $ WS.assertMatch_ (5 # WS.Second) wsE + $ wsAssertClientRemoved cc let m4 = [(bob, bc, toBase64Text "ciphertext4"), (charlie, cc, toBase64Text "ciphertext4")] Util.postBroadcast (q alice) ac bcast {bMessage = m4} !!! do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [] [(charlie, Set.singleton cc)] - void . liftIO $ - WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext4")) + void + . liftIO + $ WS.assertMatch t wsB (wsAssertOtr (q (selfConv bob)) (q alice) ac bc (toBase64Text "ciphertext4")) -- charlie should not get it assertNoMsg wsE (wsAssertOtr (q (selfConv charlie)) (q alice) ac cc (toBase64Text "ciphertext4")) @@ -1703,8 +1717,9 @@ postCryptoBroadcastMessage100OrMaxConns bcast = do const 201 === statusCode assertBroadcastMismatch localDomain (bAPI bcast) [] [] [] let qbobself = Qualified (selfConv bob) localDomain - void . liftIO $ - WS.assertMatch t (Imports.head ws) (wsAssertOtr qbobself qalice ac bc (toBase64Text "ciphertext")) + void + . liftIO + $ WS.assertMatch t (Imports.head ws) (wsAssertOtr qbobself qalice ac bc (toBase64Text "ciphertext")) for_ (zip (tail ws) others) $ \(wsU, (u, clt)) -> do let qself = Qualified (selfConv u) localDomain liftIO $ WS.assertMatch t wsU (wsAssertOtr qself qalice ac clt (toBase64Text "ciphertext")) @@ -1728,27 +1743,27 @@ newTeamMember' perms uid = Member.mkTeamMember uid perms Nothing LH.defUserLegal -- 'putTeamFeatureInternal'. Since these functions all work in slightly different monads -- and with different kinds of internal checks, it's quite tedious to do so. -getSSOEnabledInternal :: HasCallStack => TeamId -> TestM ResponseLBS +getSSOEnabledInternal :: (HasCallStack) => TeamId -> TestM ResponseLBS getSSOEnabledInternal = Util.getTeamFeatureInternal @Public.SSOConfig -putSSOEnabledInternal :: HasCallStack => TeamId -> Public.FeatureStatus -> TestM () +putSSOEnabledInternal :: (HasCallStack) => TeamId -> Public.FeatureStatus -> TestM () putSSOEnabledInternal tid statusValue = void $ Util.putTeamFeatureInternal @Public.SSOConfig expect2xx tid (Public.WithStatusNoLock statusValue Public.SSOConfig Public.FeatureTTLUnlimited) -getSearchVisibility :: HasCallStack => (Request -> Request) -> UserId -> TeamId -> MonadHttp m => m ResponseLBS +getSearchVisibility :: (HasCallStack) => (Request -> Request) -> UserId -> TeamId -> (MonadHttp m) => m ResponseLBS getSearchVisibility g uid tid = do - get $ - g - . paths ["teams", toByteString' tid, "search-visibility"] - . zUser uid + get + $ g + . paths ["teams", toByteString' tid, "search-visibility"] + . zUser uid -putSearchVisibility :: HasCallStack => (Request -> Request) -> UserId -> TeamId -> TeamSearchVisibility -> MonadHttp m => m ResponseLBS +putSearchVisibility :: (HasCallStack) => (Request -> Request) -> UserId -> TeamId -> TeamSearchVisibility -> (MonadHttp m) => m ResponseLBS putSearchVisibility g uid tid vis = do - put $ - g - . paths ["teams", toByteString' tid, "search-visibility"] - . zUser uid - . json (TeamSearchVisibilityView vis) + put + $ g + . paths ["teams", toByteString' tid, "search-visibility"] + . zUser uid + . json (TeamSearchVisibilityView vis) checkJoinEvent :: (MonadIO m, MonadCatch m) => TeamId -> UserId -> WS.WebSocket -> m () checkJoinEvent tid usr w = WS.assertMatch_ timeout w $ \notif -> do diff --git a/services/galley/test/integration/API/Teams/LegalHold.hs b/services/galley/test/integration/API/Teams/LegalHold.hs index 57dfd9f43b0..77896207454 100644 --- a/services/galley/test/integration/API/Teams/LegalHold.hs +++ b/services/galley/test/integration/API/Teams/LegalHold.hs @@ -85,12 +85,12 @@ testsInternal s = testWhitelistingTeams :: TestM () testWhitelistingTeams = do - let testTeamWhitelisted :: HasCallStack => TeamId -> TestM Bool + let testTeamWhitelisted :: (HasCallStack) => TeamId -> TestM Bool testTeamWhitelisted tid = do res <- getLHWhitelistedTeam tid pure (Bilge.responseStatus res == status200) - let expectWhitelisted :: HasCallStack => Bool -> TeamId -> TestM () + let expectWhitelisted :: (HasCallStack) => Bool -> TeamId -> TestM () expectWhitelisted yes tid = do let msg = if yes then "team should be whitelisted" else "team should not be whitelisted" aFewTimesAssertBool msg (== yes) (testTeamWhitelisted tid) @@ -124,18 +124,18 @@ testCreateLegalHoldTeamSettings = withTeam $ \owner tid -> do postSettings owner tid brokenService !!! testResponse 412 (Just "legalhold-unavailable") -- checks /status of legal hold service (boolean argument says whether the service is -- behaving or not) - let lhapp :: HasCallStack => IsWorking -> Chan Void -> Application + let lhapp :: (HasCallStack) => IsWorking -> Chan Void -> Application lhapp NotWorking _ _ cont = cont respondBad lhapp Working _ req cont = do if - | pathInfo req /= ["legalhold", "status"] -> cont respondBad - | requestMethod req /= "GET" -> cont respondBad - | otherwise -> cont respondOk + | pathInfo req /= ["legalhold", "status"] -> cont respondBad + | requestMethod req /= "GET" -> cont respondBad + | otherwise -> cont respondOk respondOk :: Wai.Response respondOk = responseLBS status200 mempty mempty respondBad :: Wai.Response respondBad = responseLBS status404 mempty mempty - lhtest :: HasCallStack => IsWorking -> Warp.Port -> Chan Void -> TestM () + lhtest :: (HasCallStack) => IsWorking -> Warp.Port -> Chan Void -> TestM () lhtest NotWorking _ _ = do postSettings owner tid brokenService !!! testResponse 412 (Just "legalhold-unavailable") lhtest Working lhPort _ = do @@ -217,7 +217,7 @@ testRemoveLegalHoldFromTeam = do -- fails if LH for team is disabled deleteSettings (Just defPassword) owner tid !!! testResponse 403 (Just "legalhold-disable-unimplemented") -testAddTeamUserTooLargeWithLegalholdWhitelisted :: HasCallStack => TestM () +testAddTeamUserTooLargeWithLegalholdWhitelisted :: (HasCallStack) => TestM () testAddTeamUserTooLargeWithLegalholdWhitelisted = withTeam $ \owner tid -> do o <- view tsGConf let fanoutLimit = fromIntegral @_ @Integer . fromRange $ Galley.currentFanoutLimit o @@ -256,7 +256,7 @@ testCannotCreateLegalHoldDeviceOldAPI = do data GroupConvInvCase = InviteOnlyConsenters | InviteAlsoNonConsenters deriving (Show, Eq, Ord, Bounded, Enum) -testBenchHack :: HasCallStack => TestM () +testBenchHack :: (HasCallStack) => TestM () testBenchHack = do {- representative sample run on an old laptop: @@ -299,13 +299,13 @@ testBenchHack = do print =<< testBenchHack' 300 print =<< testBenchHack' 600 -testBenchHack' :: HasCallStack => Int -> TestM (Int, Time.NominalDiffTime) +testBenchHack' :: (HasCallStack) => Int -> TestM (Int, Time.NominalDiffTime) testBenchHack' numPeers = do (legalholder :: UserId, tid) <- createBindingTeam peers :: [UserId] <- replicateM numPeers randomUser galley <- viewGalley - let doEnableLH :: HasCallStack => TestM () + let doEnableLH :: (HasCallStack) => TestM () doEnableLH = do withLHWhitelist tid (requestLegalHoldDevice' galley legalholder legalholder tid) !!! testResponse 201 Nothing withLHWhitelist tid (approveLegalHoldDevice' galley (Just defPassword) legalholder legalholder tid) !!! testResponse 200 Nothing diff --git a/services/galley/test/integration/API/Teams/LegalHold/DisabledByDefault.hs b/services/galley/test/integration/API/Teams/LegalHold/DisabledByDefault.hs index a9315929573..998c7f17fc2 100644 --- a/services/galley/test/integration/API/Teams/LegalHold/DisabledByDefault.hs +++ b/services/galley/test/integration/API/Teams/LegalHold/DisabledByDefault.hs @@ -118,8 +118,8 @@ testRequestLegalHoldDevice = do -- test device creation without consent requestLegalHoldDevice member member tid !!! testResponse 403 (Just "operation-denied") UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "User with insufficient permissions should be unable to start flow" UserLegalHoldNoConsent userStatus @@ -127,8 +127,8 @@ testRequestLegalHoldDevice = do do requestLegalHoldDevice owner member tid !!! testResponse 409 (Just "legalhold-no-consent") UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "User with insufficient permissions should be unable to start flow" UserLegalHoldNoConsent userStatus @@ -149,8 +149,8 @@ testRequestLegalHoldDevice = do do requestLegalHoldDevice member member tid !!! testResponse 403 (Just "operation-denied") UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "User with insufficient permissions should be unable to start flow" UserLegalHoldDisabled userStatus @@ -158,16 +158,16 @@ testRequestLegalHoldDevice = do do requestLegalHoldDevice owner member tid !!! testResponse 201 Nothing UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "requestLegalHoldDevice should set user status to Pending" UserLegalHoldPending userStatus do requestLegalHoldDevice owner member tid !!! testResponse 204 Nothing UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "requestLegalHoldDevice when already pending should leave status as Pending" UserLegalHoldPending userStatus @@ -209,8 +209,8 @@ testApproveLegalHoldDevice = do approveLegalHoldDevice (Just defPassword) owner member tid !!! testResponse 403 (Just "legalhold-not-enabled") cannon <- view tsCannon - WS.bracketRN cannon [owner, member, member, member2, outsideContact, stranger] $ - \[ows, mws, mws', member2Ws, outsideContactWs, strangerWs] -> withDummyTestServiceForTeam' owner tid $ \_ chan -> do + WS.bracketRN cannon [owner, member, member, member2, outsideContact, stranger] + $ \[ows, mws, mws', member2Ws, outsideContactWs, strangerWs] -> withDummyTestServiceForTeam' owner tid $ \_ chan -> do requestLegalHoldDevice owner member tid !!! testResponse 201 Nothing liftIO . assertMatchJSON chan $ \(RequestNewLegalHoldClient userId' teamId') -> do assertEqual "userId == member" userId' member @@ -226,11 +226,11 @@ testApproveLegalHoldDevice = do cassState <- view tsCass liftIO $ do clients' <- Cql.runClient cassState $ lookupClients [member] - assertBool "Expect clientId to be saved on the user" $ - Clients.contains member someClientId clients' + assertBool "Expect clientId to be saved on the user" + $ Clients.contains member someClientId clients' UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "After approval user legalhold status should be Enabled" UserLegalHoldEnabled userStatus @@ -261,8 +261,8 @@ testGetLegalHoldDeviceStatus = do addTeamMemberInternal tid member (rolePermissions RoleMember) Nothing forM_ [owner, member] $ \uid -> do status <- getUserStatusTyped uid tid - liftIO $ - assertEqual + liftIO + $ assertEqual "unexpected status" (UserLegalHoldStatusResponse UserLegalHoldNoConsent Nothing Nothing) status @@ -270,8 +270,8 @@ testGetLegalHoldDeviceStatus = do grantConsent tid member do UserLegalHoldStatusResponse userStatus lastPrekey' clientId' <- getUserStatusTyped member tid - liftIO $ - do + liftIO + $ do assertEqual "User legal hold status should start as disabled" UserLegalHoldDisabled userStatus assertEqual "last_prekey should be Nothing when LH is disabled" Nothing lastPrekey' assertEqual "client.id should be Nothing when LH is disabled" Nothing clientId' @@ -279,24 +279,24 @@ testGetLegalHoldDeviceStatus = do requestLegalHoldDevice owner member tid !!! testResponse 201 Nothing assertZeroLegalHoldDevices member UserLegalHoldStatusResponse userStatus lastPrekey' clientId' <- getUserStatusTyped member tid - liftIO $ - do + liftIO + $ do assertEqual "requestLegalHoldDevice should set user status to Pending" UserLegalHoldPending userStatus assertEqual "last_prekey should be set when LH is pending" (Just (head someLastPrekeys)) lastPrekey' assertEqual "client.id should be set when LH is pending" (Just someClientId) clientId' do requestLegalHoldDevice owner member tid !!! testResponse 204 Nothing UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "requestLegalHoldDevice when already pending should leave status as Pending" UserLegalHoldPending userStatus do approveLegalHoldDevice (Just defPassword) member member tid !!! testResponse 200 Nothing UserLegalHoldStatusResponse userStatus lastPrekey' clientId' <- getUserStatusTyped member tid - liftIO $ - do + liftIO + $ do assertEqual "approving should change status to Enabled" UserLegalHoldEnabled userStatus assertEqual "last_prekey should be set when LH is pending" (Just (head someLastPrekeys)) lastPrekey' assertEqual "client.id should be set when LH is pending" (Just someClientId) clientId' @@ -361,18 +361,18 @@ testCreateLegalHoldTeamSettings = do postSettings owner tid brokenService !!! testResponse 412 (Just "legalhold-unavailable") -- checks /status of legal hold service (boolean argument says whether the service is -- behaving or not) - let lhapp :: HasCallStack => IsWorking -> Chan Void -> Application + let lhapp :: (HasCallStack) => IsWorking -> Chan Void -> Application lhapp NotWorking _ _ cont = cont respondBad lhapp Working _ req cont = do if - | pathInfo req /= ["legalhold", "status"] -> cont respondBad - | requestMethod req /= "GET" -> cont respondBad - | otherwise -> cont respondOk + | pathInfo req /= ["legalhold", "status"] -> cont respondBad + | requestMethod req /= "GET" -> cont respondBad + | otherwise -> cont respondOk respondOk :: Wai.Response respondOk = responseLBS status200 mempty mempty respondBad :: Wai.Response respondBad = responseLBS status404 mempty mempty - lhtest :: HasCallStack => IsWorking -> Warp.Port -> Chan Void -> TestM () + lhtest :: (HasCallStack) => IsWorking -> Warp.Port -> Chan Void -> TestM () lhtest NotWorking _ _ = do postSettings owner tid brokenService !!! testResponse 412 (Just "legalhold-unavailable") lhtest Working lhPort _ = do @@ -462,8 +462,8 @@ testRemoveLegalHoldFromTeam = do requestLegalHoldDevice owner member tid !!! testResponse 201 Nothing approveLegalHoldDevice (Just defPassword) member member tid !!! testResponse 200 Nothing UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "After approval user legalhold status should be Enabled" UserLegalHoldEnabled userStatus @@ -489,8 +489,8 @@ testRemoveLegalHoldFromTeam = do -- deletion of settings should disable for all team members and remove their clients do UserLegalHoldStatusResponse userStatus _ _ <- getUserStatusTyped member tid - liftIO $ - assertEqual + liftIO + $ assertEqual "After approval user legalhold status should be Disabled" UserLegalHoldDisabled userStatus @@ -526,8 +526,8 @@ testEnablePerTeam = do UserLegalHoldStatusResponse status _ _ <- getUserStatusTyped member tid liftIO $ assertEqual "User legal hold status should be disabled after disabling for team" UserLegalHoldDisabled status viewLHS <- getSettingsTyped owner tid - liftIO $ - assertEqual + liftIO + $ assertEqual "LH Service settings should be disabled" ViewLegalHoldServiceDisabled viewLHS @@ -601,11 +601,11 @@ testGetTeamMembersIncludesLHStatus = do findMemberStatus ms = ms ^? traversed . filtered (has $ Team.userId . only member) . legalHoldStatus - let check :: HasCallStack => UserLegalHoldStatus -> String -> TestM () + let check :: (HasCallStack) => UserLegalHoldStatus -> String -> TestM () check status msg = do members' <- view teamMembers <$> getTeamMembers owner tid - liftIO $ - assertEqual + liftIO + $ assertEqual ("legal hold status should be " <> msg) (Just status) (findMemberStatus members') @@ -640,7 +640,7 @@ testOldClientsBlockDeviceHandshake = do -- has to be a team member, granting LH consent for personal users is not supported. createBindingTeam - let doEnableLH :: HasCallStack => UserId -> UserId -> TestM ClientId + let doEnableLH :: (HasCallStack) => UserId -> UserId -> TestM ClientId doEnableLH owner uid = do requestLegalHoldDevice owner uid tid !!! testResponse 201 Nothing approveLegalHoldDevice (Just defPassword) uid uid tid !!! testResponse 200 Nothing @@ -683,7 +683,7 @@ testOldClientsBlockDeviceHandshake = do UserId -> ClientId -> TestM ResponseLBS + let runit :: (HasCallStack) => UserId -> ClientId -> TestM ResponseLBS runit sender senderClient = do postOtrMessage id sender senderClient convId rcps where @@ -718,7 +718,7 @@ testClaimKeys testcase = do (legalholder, tid) <- createBindingTeam (peer, teamPeer) <- createBindingTeam - let doEnableLH :: HasCallStack => TeamId -> UserId -> UserId -> TestM ClientId + let doEnableLH :: (HasCallStack) => TeamId -> UserId -> UserId -> TestM ClientId doEnableLH team owner uid = do requestLegalHoldDevice owner uid team !!! testResponse 201 Nothing approveLegalHoldDevice (Just defPassword) uid uid team !!! testResponse 200 Nothing @@ -772,7 +772,7 @@ testClaimKeys testcase = do -------------------------------------------------------------------- -- setup helpers -withDummyTestServiceForTeam' :: HasCallStack => UserId -> TeamId -> (Warp.Port -> Chan (Wai.Request, LByteString) -> TestM a) -> TestM a +withDummyTestServiceForTeam' :: (HasCallStack) => UserId -> TeamId -> (Warp.Port -> Chan (Wai.Request, LByteString) -> TestM a) -> TestM a withDummyTestServiceForTeam' owner tid go = do withDummyTestServiceForTeamNoService $ \lhPort chan -> do newService <- newLegalHoldService lhPort diff --git a/services/galley/test/integration/API/Teams/LegalHold/Util.hs b/services/galley/test/integration/API/Teams/LegalHold/Util.hs index 85e2e37d195..e4be8ea3e97 100644 --- a/services/galley/test/integration/API/Teams/LegalHold/Util.hs +++ b/services/galley/test/integration/API/Teams/LegalHold/Util.hs @@ -65,13 +65,16 @@ import Wire.API.UserEvent qualified as Ev -- | Create a new legal hold service creation request with the URL from the integration test -- config. -newLegalHoldService :: HasCallStack => Warp.Port -> TestM NewLegalHoldService +newLegalHoldService :: (HasCallStack) => Warp.Port -> TestM NewLegalHoldService newLegalHoldService lhPort = do config <- view (tsIConf . to provider) key' <- liftIO $ readServiceKey (publicKey config) let Just url = - fromByteString $ - encodeUtf8 (botHost config) <> ":" <> cs (show lhPort) <> "/legalhold" + fromByteString + $ encodeUtf8 (botHost config) + <> ":" + <> cs (show lhPort) + <> "/legalhold" pure NewLegalHoldService { newLegalHoldServiceUrl = url, @@ -88,7 +91,7 @@ readServiceKey fp = liftIO $ do withDummyTestServiceForTeam :: forall a. - HasCallStack => + (HasCallStack) => UserId -> TeamId -> -- | the test @@ -104,7 +107,7 @@ withDummyTestServiceForTeam owner tid go = -- the config file), and see if it works as well as with our mock service. withDummyTestServiceForTeamNoService :: forall a. - HasCallStack => + (HasCallStack) => -- | the test (Warp.Port -> Chan (Wai.Request, LByteString) -> TestM a) -> TestM a @@ -126,7 +129,8 @@ withDummyTestServiceForTeamNoService go = do initiateResp :: Wai.Response initiateResp = - Wai.json $ + Wai.json + $ -- FUTUREWORK: use another key to prevent collisions with keys used by tests NewLegalHoldClient somePrekeys (head $ someLastPrekeys) @@ -151,7 +155,7 @@ withDummyTestServiceForTeamNoService go = do -- it's here for historical reason because we did this in galley.yaml -- at some point in the past rather than in an internal end-point, and that required spawning -- another galley 'Application' with 'withSettingsOverrides'. -withLHWhitelist :: forall a. HasCallStack => TeamId -> TestM a -> TestM a +withLHWhitelist :: forall a. (HasCallStack) => TeamId -> TestM a -> TestM a withLHWhitelist tid action = do void $ putLHWhitelistTeam tid opts <- view tsGConf @@ -159,7 +163,7 @@ withLHWhitelist tid action = do -- | If you play with whitelists, you should use this one. Every whitelisted team that does -- not get fully deleted will blow up the whitelist that is cached in every warp handler. -withTeam :: forall a. HasCallStack => (HasCallStack => UserId -> TeamId -> TestM a) -> TestM a +withTeam :: forall a. (HasCallStack) => ((HasCallStack) => UserId -> TeamId -> TestM a) -> TestM a withTeam action = bracket createBindingTeam @@ -173,7 +177,7 @@ withTeam action = withFreePortAnyAddr :: (MonadMask m, MonadIO m) => ((Warp.Port, Socket) -> m a) -> m a withFreePortAnyAddr = bracket openFreePortAnyAddr (liftIO . Socket.close . snd) -openFreePortAnyAddr :: MonadIO m => m (Warp.Port, Socket) +openFreePortAnyAddr :: (MonadIO m) => m (Warp.Port, Socket) openFreePortAnyAddr = liftIO $ bindRandomPortTCP "*" -- | Run a test with an mock legal hold service application. The mock service is also binding @@ -184,7 +188,7 @@ openFreePortAnyAddr = liftIO $ bindRandomPortTCP "*" -- they can be run several times if they fail the first time. this is the allow for the ssl -- service to have some time to propagate through the test system (needed on k8s). withTestService :: - HasCallStack => + (HasCallStack) => -- | the mock service (Chan e -> Application) -> -- | the test @@ -197,48 +201,51 @@ withTestService mkApp go = withFreePortAnyAddr $ \(sPort, sock) -> do let defs = Warp.defaultSettings {Warp.settingsPort = sPort, Warp.settingsBeforeMainLoop = putMVar serverStarted ()} buf <- liftIO newChan srv <- - liftIO . Async.async $ - Warp.runTLSSocket tlss defs sock $ - mkApp buf + liftIO + . Async.async + $ Warp.runTLSSocket tlss defs sock + $ mkApp buf takeMVar serverStarted go sPort buf `finally` liftIO (Async.cancel srv) publicKeyNotMatchingService :: PEM publicKeyNotMatchingService = let Right [k] = - pemParseBS . BS.unlines $ - [ "-----BEGIN PUBLIC KEY-----", - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu+Kg/PHHU3atXrUbKnw0", - "G06FliXcNt3lMwl2os5twEDcPPFw/feGiAKymxp+7JqZDrseS5D9THGrW+OQRIPH", - "WvUBdiLfGrZqJO223DB6D8K2Su/odmnjZJ2z23rhXoEArTplu+Dg9K+c2LVeXTKV", - "VPOaOzgtAB21XKRiQ4ermqgi3/njr03rXyq/qNkuNd6tNcg+HAfGxfGvvCSYBfiS", - "bUKr/BeArYRcjzr/h5m1In6fG/if9GEI6m8dxHT9JbY53wiksowy6ajCuqskIFg8", - "7X883H+LA/d6X5CTiPv1VMxXdBUiGPuC9IT/6CNQ1/LFt0P37ax58+LGYlaFo7la", - "nQIDAQAZ", - "-----END PUBLIC KEY-----" - ] + pemParseBS + . BS.unlines + $ [ "-----BEGIN PUBLIC KEY-----", + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu+Kg/PHHU3atXrUbKnw0", + "G06FliXcNt3lMwl2os5twEDcPPFw/feGiAKymxp+7JqZDrseS5D9THGrW+OQRIPH", + "WvUBdiLfGrZqJO223DB6D8K2Su/odmnjZJ2z23rhXoEArTplu+Dg9K+c2LVeXTKV", + "VPOaOzgtAB21XKRiQ4ermqgi3/njr03rXyq/qNkuNd6tNcg+HAfGxfGvvCSYBfiS", + "bUKr/BeArYRcjzr/h5m1In6fG/if9GEI6m8dxHT9JbY53wiksowy6ajCuqskIFg8", + "7X883H+LA/d6X5CTiPv1VMxXdBUiGPuC9IT/6CNQ1/LFt0P37ax58+LGYlaFo7la", + "nQIDAQAZ", + "-----END PUBLIC KEY-----" + ] in k ---------------------------------------------------------------------- -- API helpers -getEnabled :: HasCallStack => TeamId -> TestM ResponseLBS +getEnabled :: (HasCallStack) => TeamId -> TestM ResponseLBS getEnabled tid = do g <- viewGalley - get $ - g - . paths ["i", "teams", toByteString' tid, "features", "legalhold"] + get + $ g + . paths ["i", "teams", toByteString' tid, "features", "legalhold"] -renewToken :: HasCallStack => Text -> TestM () +renewToken :: (HasCallStack) => Text -> TestM () renewToken tok = do b <- viewBrig - void . post $ - b - . paths ["access"] - . cookieRaw "zuid" (toByteString' tok) - . expect2xx - -putEnabled :: HasCallStack => TeamId -> Public.FeatureStatus -> TestM () + void + . post + $ b + . paths ["access"] + . cookieRaw "zuid" (toByteString' tok) + . expect2xx + +putEnabled :: (HasCallStack) => TeamId -> Public.FeatureStatus -> TestM () putEnabled tid enabled = do g <- viewGalley putEnabledM g tid enabled @@ -246,63 +253,63 @@ putEnabled tid enabled = do putEnabledM :: (HasCallStack, MonadHttp m, MonadIO m) => GalleyR -> TeamId -> Public.FeatureStatus -> m () putEnabledM g tid enabled = void $ putEnabledM' g expect2xx tid enabled -putEnabled' :: HasCallStack => (Bilge.Request -> Bilge.Request) -> TeamId -> Public.FeatureStatus -> TestM ResponseLBS +putEnabled' :: (HasCallStack) => (Bilge.Request -> Bilge.Request) -> TeamId -> Public.FeatureStatus -> TestM ResponseLBS putEnabled' extra tid enabled = do g <- viewGalley putEnabledM' g extra tid enabled putEnabledM' :: (HasCallStack, MonadHttp m) => GalleyR -> (Bilge.Request -> Bilge.Request) -> TeamId -> Public.FeatureStatus -> m ResponseLBS putEnabledM' g extra tid enabled = do - put $ - g - . paths ["i", "teams", toByteString' tid, "features", "legalhold"] - . json (Public.WithStatusNoLock enabled Public.LegalholdConfig Public.FeatureTTLUnlimited) - . extra + put + $ g + . paths ["i", "teams", toByteString' tid, "features", "legalhold"] + . json (Public.WithStatusNoLock enabled Public.LegalholdConfig Public.FeatureTTLUnlimited) + . extra -postSettings :: HasCallStack => UserId -> TeamId -> NewLegalHoldService -> TestM ResponseLBS +postSettings :: (HasCallStack) => UserId -> TeamId -> NewLegalHoldService -> TestM ResponseLBS postSettings uid tid new = -- Retry calls to this endpoint, on k8s it sometimes takes a while to establish a working -- connection. retrying policy only412 $ \_ -> do g <- viewGalley - post $ - g - . paths ["teams", toByteString' tid, "legalhold", "settings"] - . zUser uid - . zConn "conn" - . zType "access" - . json new + post + $ g + . paths ["teams", toByteString' tid, "legalhold", "settings"] + . zUser uid + . zConn "conn" + . zType "access" + . json new where policy :: RetryPolicy policy = limitRetriesByCumulativeDelay 5_000_000 $ exponentialBackoff 50 only412 :: RetryStatus -> ResponseLBS -> TestM Bool only412 _ resp = pure $ statusCode resp == 412 -getSettingsTyped :: HasCallStack => UserId -> TeamId -> TestM ViewLegalHoldService +getSettingsTyped :: (HasCallStack) => UserId -> TeamId -> TestM ViewLegalHoldService getSettingsTyped uid tid = responseJsonUnsafe <$> (getSettings uid tid UserId -> TeamId -> TestM ResponseLBS +getSettings :: (HasCallStack) => UserId -> TeamId -> TestM ResponseLBS getSettings uid tid = do g <- viewGalley - get $ - g - . paths ["teams", toByteString' tid, "legalhold", "settings"] - . zUser uid - . zConn "conn" - . zType "access" + get + $ g + . paths ["teams", toByteString' tid, "legalhold", "settings"] + . zUser uid + . zConn "conn" + . zType "access" -deleteSettings :: HasCallStack => Maybe PlainTextPassword6 -> UserId -> TeamId -> TestM ResponseLBS +deleteSettings :: (HasCallStack) => Maybe PlainTextPassword6 -> UserId -> TeamId -> TestM ResponseLBS deleteSettings mPassword uid tid = do g <- viewGalley - delete $ - g - . paths ["teams", toByteString' tid, "legalhold", "settings"] - . zUser uid - . zConn "conn" - . zType "access" - . json (RemoveLegalHoldSettingsRequest mPassword) - -getUserStatusTyped :: HasCallStack => UserId -> TeamId -> TestM UserLegalHoldStatusResponse + delete + $ g + . paths ["teams", toByteString' tid, "legalhold", "settings"] + . zUser uid + . zConn "conn" + . zType "access" + . json (RemoveLegalHoldSettingsRequest mPassword) + +getUserStatusTyped :: (HasCallStack) => UserId -> TeamId -> TestM UserLegalHoldStatusResponse getUserStatusTyped uid tid = do g <- viewGalley getUserStatusTyped' g uid tid @@ -314,14 +321,14 @@ getUserStatusTyped' g uid tid = do getUserStatus' :: (HasCallStack, MonadHttp m) => GalleyR -> UserId -> TeamId -> m ResponseLBS getUserStatus' g uid tid = do - get $ - g - . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] - . zUser uid - . zConn "conn" - . zType "access" + get + $ g + . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] + . zUser uid + . zConn "conn" + . zType "access" -approveLegalHoldDevice :: HasCallStack => Maybe PlainTextPassword6 -> UserId -> UserId -> TeamId -> TestM ResponseLBS +approveLegalHoldDevice :: (HasCallStack) => Maybe PlainTextPassword6 -> UserId -> UserId -> TeamId -> TestM ResponseLBS approveLegalHoldDevice mPassword zusr uid tid = do g <- viewGalley approveLegalHoldDevice' g mPassword zusr uid tid @@ -335,16 +342,16 @@ approveLegalHoldDevice' :: TeamId -> m ResponseLBS approveLegalHoldDevice' g mPassword zusr uid tid = do - put $ - g - . paths ["teams", toByteString' tid, "legalhold", toByteString' uid, "approve"] - . zUser zusr - . zConn "conn" - . zType "access" - . json (ApproveLegalHoldForUserRequest mPassword) + put + $ g + . paths ["teams", toByteString' tid, "legalhold", toByteString' uid, "approve"] + . zUser zusr + . zConn "conn" + . zType "access" + . json (ApproveLegalHoldForUserRequest mPassword) disableLegalHoldForUser :: - HasCallStack => + (HasCallStack) => Maybe PlainTextPassword6 -> TeamId -> UserId -> @@ -363,14 +370,14 @@ disableLegalHoldForUser' :: UserId -> m ResponseLBS disableLegalHoldForUser' g mPassword tid zusr uid = do - delete $ - g - . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] - . zUser zusr - . zType "access" - . json (DisableLegalHoldForUserRequest mPassword) + delete + $ g + . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] + . zUser zusr + . zType "access" + . json (DisableLegalHoldForUserRequest mPassword) -assertExactlyOneLegalHoldDevice :: HasCallStack => UserId -> TestM () +assertExactlyOneLegalHoldDevice :: (HasCallStack) => UserId -> TestM () assertExactlyOneLegalHoldDevice uid = do clients :: [Client] <- getClients uid >>= responseJsonError @@ -378,7 +385,7 @@ assertExactlyOneLegalHoldDevice uid = do let numdevs = length $ clientType <$> clients assertEqual ("expected exactly one legal hold device for user: " <> show uid) numdevs 1 -assertZeroLegalHoldDevices :: HasCallStack => UserId -> TestM () +assertZeroLegalHoldDevices :: (HasCallStack) => UserId -> TestM () assertZeroLegalHoldDevices uid = do clients :: [Client] <- getClients uid >>= responseJsonError @@ -396,7 +403,7 @@ assertZeroLegalHoldDevices uid = do ---------------------------------------------------------------------- ---- Device helpers -grantConsent :: HasCallStack => TeamId -> UserId -> TestM () +grantConsent :: (HasCallStack) => TeamId -> UserId -> TestM () grantConsent tid zusr = do g <- viewGalley grantConsent' g tid zusr @@ -406,27 +413,28 @@ grantConsent' = grantConsent'' expect2xx grantConsent'' :: (HasCallStack, MonadHttp m, MonadIO m) => (Bilge.Request -> Bilge.Request) -> GalleyR -> TeamId -> UserId -> m () grantConsent'' expectation g tid zusr = do - void . post $ - g - . paths ["teams", toByteString' tid, "legalhold", "consent"] - . zUser zusr - . zConn "conn" - . zType "access" - . expectation - -requestLegalHoldDevice :: HasCallStack => UserId -> UserId -> TeamId -> TestM ResponseLBS + void + . post + $ g + . paths ["teams", toByteString' tid, "legalhold", "consent"] + . zUser zusr + . zConn "conn" + . zType "access" + . expectation + +requestLegalHoldDevice :: (HasCallStack) => UserId -> UserId -> TeamId -> TestM ResponseLBS requestLegalHoldDevice zusr uid tid = do g <- viewGalley requestLegalHoldDevice' g zusr uid tid requestLegalHoldDevice' :: (HasCallStack, MonadHttp m) => GalleyR -> UserId -> UserId -> TeamId -> m ResponseLBS requestLegalHoldDevice' g zusr uid tid = do - post $ - g - . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] - . zUser zusr - . zConn "conn" - . zType "access" + post + $ g + . paths ["teams", toByteString' tid, "legalhold", toByteString' uid] + . zUser zusr + . zConn "conn" + . zType "access" ---------------------------------------------------------------------- -- test helpers @@ -441,8 +449,10 @@ instance FromJSON Ev.UserEvent where "user.legalhold-request" -> Ev.LegalHoldClientRequested <$> ( Ev.LegalHoldClientRequestedData - <$> o .: "id" -- this is the target user - <*> o .: "last_prekey" + <$> o + .: "id" -- this is the target user + <*> o + .: "last_prekey" <*> (o .: "client" >>= withObject "id" (.: "id")) ) x -> fail $ "Ev.UserEvent: unsupported event type: " ++ show x @@ -462,16 +472,18 @@ instance FromJSON Ev.ConnectionEvent where case tag of "user.connection" -> Ev.ConnectionUpdated - <$> o .: "connection" + <$> o + .: "connection" <*> pure Nothing x -> fail $ "unspported event type: " ++ show x assertNotification :: (HasCallStack, FromJSON a, MonadIO m) => WS.WebSocket -> (a -> Assertion) -> m () assertNotification ws predicate = void . liftIO . WS.assertMatch (5 WS.# WS.Second) ws $ \notif -> do - unless ((NonEmpty.length . List1.toNonEmpty $ ntfPayload $ notif) == 1) $ - error $ - "not suppored by test helper: event with more than one object in the payload: " <> cs (Aeson.encode notif) + unless ((NonEmpty.length . List1.toNonEmpty $ ntfPayload $ notif) == 1) + $ error + $ "not suppored by test helper: event with more than one object in the payload: " + <> cs (Aeson.encode notif) let j = Aeson.Object $ List1.head (ntfPayload notif) case Aeson.fromJSON j of Aeson.Success x -> predicate x @@ -505,7 +517,7 @@ assertMatchChan c match = go [] refill buf error "Timeout" -getLHWhitelistedTeam :: HasCallStack => TeamId -> TestM ResponseLBS +getLHWhitelistedTeam :: (HasCallStack) => TeamId -> TestM ResponseLBS getLHWhitelistedTeam tid = do galleyCall <- viewGalley getLHWhitelistedTeam' galleyCall tid @@ -517,7 +529,7 @@ getLHWhitelistedTeam' g tid = do . paths ["i", "legalhold", "whitelisted-teams", toByteString' tid] ) -putLHWhitelistTeam :: HasCallStack => TeamId -> TestM ResponseLBS +putLHWhitelistTeam :: (HasCallStack) => TeamId -> TestM ResponseLBS putLHWhitelistTeam tid = do galleyCall <- viewGalley putLHWhitelistTeam' galleyCall tid @@ -529,7 +541,7 @@ putLHWhitelistTeam' g tid = do . paths ["i", "legalhold", "whitelisted-teams", toByteString' tid] ) -_deleteLHWhitelistTeam :: HasCallStack => TeamId -> TestM ResponseLBS +_deleteLHWhitelistTeam :: (HasCallStack) => TeamId -> TestM ResponseLBS _deleteLHWhitelistTeam tid = do galleyCall <- viewGalley deleteLHWhitelistTeam' galleyCall tid @@ -569,8 +581,8 @@ instance IsTest LHTest where if featureLegalHold == expectedFlag then do hunitResult <- try $ void . flip runReaderT setup . runTestM $ testAction - pure $ - case hunitResult of + pure + $ case hunitResult of Right _ -> testPassed "" Left (HUnitFailure stack message) -> testFailed $ prependCallStack stack message else pure . skipTest $ "test skipped because: \n " <> show expectedFlag <> " /= " <> show featureLegalHold diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index 5f80a490368..4f70152ef59 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -192,11 +192,11 @@ instance HasBrig TestM where symmPermissions :: [Perm] -> Permissions symmPermissions p = let s = Set.fromList p in fromJust (newPermissions s s) -createBindingTeam :: HasCallStack => TestM (UserId, TeamId) +createBindingTeam :: (HasCallStack) => TestM (UserId, TeamId) createBindingTeam = do first User.userId <$> createBindingTeam' -createBindingTeam' :: HasCallStack => TestM (User, TeamId) +createBindingTeam' :: (HasCallStack) => TestM (User, TeamId) createBindingTeam' = do owner <- randomTeamCreator' teams <- getTeams (User.userId owner) [] @@ -206,7 +206,7 @@ createBindingTeam' = do refreshIndex pure (owner, tid) -createBindingTeamWithMembers :: HasCallStack => Int -> TestM (TeamId, UserId, [UserId]) +createBindingTeamWithMembers :: (HasCallStack) => Int -> TestM (TeamId, UserId, [UserId]) createBindingTeamWithMembers numUsers = do (owner, tid) <- createBindingTeam members <- forM [2 .. numUsers] $ \n -> do @@ -220,7 +220,7 @@ createBindingTeamWithMembers numUsers = do pure (tid, owner, members) -createBindingTeamWithQualifiedMembers :: HasCallStack => Int -> TestM (TeamId, Qualified UserId, [Qualified UserId]) +createBindingTeamWithQualifiedMembers :: (HasCallStack) => Int -> TestM (TeamId, Qualified UserId, [Qualified UserId]) createBindingTeamWithQualifiedMembers num = do localDomain <- viewFederationDomain (tid, owner, users) <- createBindingTeamWithMembers num @@ -256,7 +256,7 @@ createBindingTeamWithNMembersWithHandles withHandles n = do pure member1 pure (owner, tid, mems) where - mkRandomHandle :: MonadIO m => m Text + mkRandomHandle :: (MonadIO m) => m Text mkRandomHandle = liftIO $ do nrs <- replicateM 21 (randomRIO (97, 122)) -- a-z pure (cs (map chr nrs)) @@ -273,7 +273,7 @@ createBindingTeamWithNMembersWithHandles withHandles n = do !!! do const 200 === statusCode -changeTeamStatus :: HasCallStack => TeamId -> TeamStatus -> TestM () +changeTeamStatus :: (HasCallStack) => TeamId -> TeamStatus -> TestM () changeTeamStatus tid s = do g <- viewGalley put @@ -284,13 +284,13 @@ changeTeamStatus tid s = do !!! const 200 === statusCode -createBindingTeamInternal :: HasCallStack => Text -> UserId -> TestM TeamId +createBindingTeamInternal :: (HasCallStack) => Text -> UserId -> TestM TeamId createBindingTeamInternal name owner = do tid <- createBindingTeamInternalNoActivate name owner changeTeamStatus tid Active pure tid -createBindingTeamInternalNoActivate :: HasCallStack => Text -> UserId -> TestM TeamId +createBindingTeamInternalNoActivate :: (HasCallStack) => Text -> UserId -> TestM TeamId createBindingTeamInternalNoActivate name owner = do g <- viewGalley tid <- randomId @@ -301,7 +301,7 @@ createBindingTeamInternalNoActivate name owner = do const True === isJust . getHeader "Location" pure tid -createBindingTeamInternalWithCurrency :: HasCallStack => Text -> UserId -> Currency.Alpha -> TestM TeamId +createBindingTeamInternalWithCurrency :: (HasCallStack) => Text -> UserId -> Currency.Alpha -> TestM TeamId createBindingTeamInternalWithCurrency name owner cur = do g <- viewGalley tid <- createBindingTeamInternalNoActivate name owner @@ -311,33 +311,33 @@ createBindingTeamInternalWithCurrency name owner cur = do === statusCode pure tid -getTeamInternal :: HasCallStack => TeamId -> TestM TeamData +getTeamInternal :: (HasCallStack) => TeamId -> TestM TeamData getTeamInternal tid = do g <- viewGalley r <- get (g . paths ["i/teams", toByteString' tid]) UserId -> TeamId -> TestM Team +getTeam :: (HasCallStack) => UserId -> TeamId -> TestM Team getTeam usr tid = do g <- viewGalley r <- get (g . paths ["teams", toByteString' tid] . zUser usr) UserId -> TeamId -> TestM TeamMemberList +getTeamMembers :: (HasCallStack) => UserId -> TeamId -> TestM TeamMemberList getTeamMembers usr tid = do g <- viewGalley r <- get (g . paths ["teams", toByteString' tid, "members"] . zUser usr) UserId -> TeamId -> TestM ResponseLBS +getTeamMembersCsv :: (HasCallStack) => UserId -> TeamId -> TestM ResponseLBS getTeamMembersCsv usr tid = do g <- viewGalley get (g . accept "text/csv" . paths ["teams", toByteString' tid, "members/csv"] . zUser usr) UserId -> TeamId -> Int -> TestM TeamMemberList +getTeamMembersTruncated :: (HasCallStack) => UserId -> TeamId -> Int -> TestM TeamMemberList getTeamMembersTruncated usr tid n = do g <- viewGalley r <- get (g . paths ["teams", toByteString' tid, "members"] . zUser usr . queryItem "maxResults" (C.pack $ show n)) o .: "pagingState" -getTeamMembersPaginated :: HasCallStack => UserId -> TeamId -> Int -> Maybe Text -> TestM ResultPage +getTeamMembersPaginated :: (HasCallStack) => UserId -> TeamId -> Int -> Maybe Text -> TestM ResultPage getTeamMembersPaginated usr tid n mPs = do g <- viewGalley r <- @@ -374,7 +374,7 @@ getTeamMembersPaginated usr tid n mPs = do === statusCode responseJsonError r -getTeamMembersInternalTruncated :: HasCallStack => TeamId -> Int -> TestM TeamMemberList +getTeamMembersInternalTruncated :: (HasCallStack) => TeamId -> Int -> TestM TeamMemberList getTeamMembersInternalTruncated tid n = do g <- viewGalley r <- @@ -387,7 +387,7 @@ getTeamMembersInternalTruncated tid n = do === statusCode responseJsonError r -bulkGetTeamMembers :: HasCallStack => UserId -> TeamId -> [UserId] -> TestM TeamMemberList +bulkGetTeamMembers :: (HasCallStack) => UserId -> TeamId -> [UserId] -> TestM TeamMemberList bulkGetTeamMembers usr tid uids = do g <- viewGalley r <- @@ -401,7 +401,7 @@ bulkGetTeamMembers usr tid uids = do === statusCode responseJsonError r -bulkGetTeamMembersTruncated :: HasCallStack => UserId -> TeamId -> [UserId] -> Int -> TestM ResponseLBS +bulkGetTeamMembersTruncated :: (HasCallStack) => UserId -> TeamId -> [UserId] -> Int -> TestM ResponseLBS bulkGetTeamMembersTruncated usr tid uids trnc = do g <- viewGalley post @@ -412,7 +412,7 @@ bulkGetTeamMembersTruncated usr tid uids trnc = do . json (UserIdList uids) ) -getTeamMember :: HasCallStack => UserId -> TeamId -> UserId -> TestM TeamMember +getTeamMember :: (HasCallStack) => UserId -> TeamId -> UserId -> TestM TeamMember getTeamMember getter tid gettee = do g <- viewGalley getTeamMember' g getter tid gettee @@ -422,13 +422,13 @@ getTeamMember' g getter tid gettee = do r <- get (g . paths ["teams", toByteString' tid, "members", toByteString' gettee] . zUser getter) TeamId -> UserId -> TestM TeamMember +getTeamMemberInternal :: (HasCallStack) => TeamId -> UserId -> TestM TeamMember getTeamMemberInternal tid mid = do g <- viewGalley r <- get (g . paths ["i", "teams", toByteString' tid, "members", toByteString' mid]) UserId -> TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM () +addTeamMember :: (HasCallStack) => UserId -> TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM () addTeamMember usr tid muid mperms mmbinv = do g <- viewGalley let payload = json (mkNewTeamMember muid mperms mmbinv) @@ -437,23 +437,23 @@ addTeamMember usr tid muid mperms mmbinv = do === statusCode -- | FUTUREWORK: do not use this, it's broken!! use 'addUserToTeam' instead! https://wearezeta.atlassian.net/browse/SQSERVICES-471 -addTeamMemberInternal :: HasCallStack => TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM () +addTeamMemberInternal :: (HasCallStack) => TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM () addTeamMemberInternal tid muid mperms mmbinv = addTeamMemberInternal' tid muid mperms mmbinv !!! const 200 === statusCode -- | FUTUREWORK: do not use this, it's broken!! use 'addUserToTeam' instead! https://wearezeta.atlassian.net/browse/SQSERVICES-471 -addTeamMemberInternal' :: HasCallStack => TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM ResponseLBS +addTeamMemberInternal' :: (HasCallStack) => TeamId -> UserId -> Permissions -> Maybe (UserId, UTCTimeMillis) -> TestM ResponseLBS addTeamMemberInternal' tid muid mperms mmbinv = do g <- viewGalley let payload = json (mkNewTeamMember muid mperms mmbinv) post (g . paths ["i", "teams", toByteString' tid, "members"] . payload) -addUserToTeam :: HasCallStack => UserId -> TeamId -> TestM TeamMember +addUserToTeam :: (HasCallStack) => UserId -> TeamId -> TestM TeamMember addUserToTeam = addUserToTeamWithRole Nothing -addUserToTeam' :: HasCallStack => UserId -> TeamId -> TestM ResponseLBS +addUserToTeam' :: (HasCallStack) => UserId -> TeamId -> TestM ResponseLBS addUserToTeam' u t = snd <$> addUserToTeamWithRole' Nothing u t -addUserToTeamWithRole :: HasCallStack => Maybe Role -> UserId -> TeamId -> TestM TeamMember +addUserToTeamWithRole :: (HasCallStack) => Maybe Role -> UserId -> TeamId -> TestM TeamMember addUserToTeamWithRole role inviter tid = do (inv, rsp2) <- addUserToTeamWithRole' role inviter tid let invitee :: User = responseJsonUnsafe rsp2 @@ -465,7 +465,7 @@ addUserToTeamWithRole role inviter tid = do liftIO $ assertEqual "Wrong cookie" (Just "zuid") (setCookieName <$> zuid) pure mem -addUserToTeamWithRole' :: HasCallStack => Maybe Role -> UserId -> TeamId -> TestM (Invitation, ResponseLBS) +addUserToTeamWithRole' :: (HasCallStack) => Maybe Role -> UserId -> TeamId -> TestM (Invitation, ResponseLBS) addUserToTeamWithRole' role inviter tid = do brig <- viewBrig inviteeEmail <- randomEmail @@ -482,13 +482,13 @@ addUserToTeamWithRole' role inviter tid = do ) pure (inv, r) -addUserToTeamWithSSO :: HasCallStack => Bool -> TeamId -> TestM TeamMember +addUserToTeamWithSSO :: (HasCallStack) => Bool -> TeamId -> TestM TeamMember addUserToTeamWithSSO hasEmail tid = do let ssoid = UserSSOId mkSimpleSampleUref uid <- fmap (\(u :: User) -> User.userId u) $ responseJsonError =<< postSSOUser "SSO User" hasEmail ssoid tid getTeamMember uid tid uid -makeOwner :: HasCallStack => UserId -> TeamMember -> TeamId -> TestM () +makeOwner :: (HasCallStack) => UserId -> TeamMember -> TeamId -> TestM () makeOwner owner mem tid = do galley <- viewGalley let changeMember = mkNewTeamMember (mem ^. Team.userId) fullPermissions (mem ^. Team.invitation) @@ -504,8 +504,9 @@ makeOwner owner mem tid = do acceptInviteBody :: Email -> InvitationCode -> RequestBody acceptInviteBody email code = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= Name "bob", "email" .= fromEmail email, "password" .= defPassword, @@ -515,12 +516,12 @@ acceptInviteBody email code = postInvitation :: TeamId -> UserId -> InvitationRequest -> TestM ResponseLBS postInvitation t u i = do brig <- viewBrig - post $ - brig - . paths ["teams", toByteString' t, "invitations"] - . contentJson - . body (RequestBodyLBS $ encode i) - . zAuthAccess u "conn" + post + $ brig + . paths ["teams", toByteString' t, "invitations"] + . contentJson + . body (RequestBodyLBS $ encode i) + . zAuthAccess u "conn" zAuthAccess :: UserId -> ByteString -> (Request -> Request) zAuthAccess u conn = @@ -528,7 +529,7 @@ zAuthAccess u conn = . zConn conn . zType "access" -getInvitationCode :: HasCallStack => TeamId -> InvitationId -> TestM InvitationCode +getInvitationCode :: (HasCallStack) => TeamId -> InvitationId -> TestM InvitationCode getInvitationCode t ref = do brig <- viewBrig @@ -554,7 +555,7 @@ getInvitationCode t ref = do -- and therefore cannot be unset. However, given that this is to test the legacy -- API (i.e., no roles) it's fine to hardcode the JSON object in the test since -- it clearly shows the API that old(er) clients use. -createTeamConvLegacy :: HasCallStack => UserId -> TeamId -> [UserId] -> Maybe Text -> TestM ConvId +createTeamConvLegacy :: (HasCallStack) => UserId -> TeamId -> [UserId] -> Maybe Text -> TestM ConvId createTeamConvLegacy u tid us name = do g <- viewGalley let tinfo = ConvTeamInfo tid @@ -575,7 +576,7 @@ createTeamConvLegacy u tid us name = do >>= \r -> fromBS (getHeader' "Location" r) createTeamConv :: - HasCallStack => + (HasCallStack) => UserId -> TeamId -> [UserId] -> @@ -586,7 +587,7 @@ createTeamConv :: createTeamConv u tid us name acc mtimer = createTeamConvAccess u tid us name acc Nothing mtimer (Just roleNameWireAdmin) createTeamConvWithRole :: - HasCallStack => + (HasCallStack) => UserId -> TeamId -> [UserId] -> @@ -598,7 +599,7 @@ createTeamConvWithRole :: createTeamConvWithRole u tid us name acc mtimer convRole = createTeamConvAccess u tid us name acc Nothing mtimer (Just convRole) createTeamConvAccess :: - HasCallStack => + (HasCallStack) => UserId -> TeamId -> [UserId] -> @@ -722,17 +723,17 @@ postConvQualified :: TestM ResponseLBS postConvQualified u c n = do g <- viewGalley - post $ - g - . path "/conversations" - . zUser u - . maybe Imports.id zClient c - . zConn "conn" - . zType "access" - . json n + post + $ g + . path "/conversations" + . zUser u + . maybe Imports.id zClient c + . zConn "conn" + . zType "access" + . json n postConvWithRemoteUsersGeneric :: - HasCallStack => + (HasCallStack) => Mock LByteString -> UserId -> Maybe ClientId -> @@ -742,27 +743,27 @@ postConvWithRemoteUsersGeneric m u c n = do let mock = ("get-not-fully-connected-backends" ~> NonConnectedBackends mempty) <|> m - fmap fst $ - withTempMockFederator' mock $ - postConvQualified u c n {newConvName = setName (newConvName n)} - Maybe (Range n m Text) -> Maybe (Range n m Text) setName Nothing = checked "federated gossip" setName x = x postConvWithRemoteUsers :: - HasCallStack => + (HasCallStack) => UserId -> Maybe ClientId -> NewConv -> TestM (Response (Maybe LByteString)) postConvWithRemoteUsers u c n = - fmap fst $ - withTempMockFederator' (("get-not-fully-connected-backends" ~> NonConnectedBackends mempty) <|> mockReply EmptyResponse) $ - postConvQualified u c n {newConvName = setName (newConvName n)} - NonConnectedBackends mempty) <|> mockReply EmptyResponse) + $ postConvQualified u c n {newConvName = setName (newConvName n)} + Maybe (Range n m Text) -> Maybe (Range n m Text) setName Nothing = checked "federated gossip" @@ -827,23 +828,23 @@ postConnectConv :: UserId -> UserId -> Text -> Text -> Maybe Text -> TestM Respo postConnectConv a b name msg email = do qb <- Qualified b <$> viewFederationDomain g <- viewGalley - post $ - g - . path "/i/conversations/connect" - . zUser a - . zConn "conn" - . zType "access" - . json (Connect qb (Just msg) (Just name) email) + post + $ g + . path "/i/conversations/connect" + . zUser a + . zConn "conn" + . zType "access" + . json (Connect qb (Just msg) (Just name) email) putConvAccept :: UserId -> ConvId -> TestM ResponseLBS putConvAccept invited cid = do g <- viewGalley - put $ - g - . paths ["/i/conversations", C.pack $ show cid, "accept", "v2"] - . zUser invited - . zType "access" - . zConn "conn" + put + $ g + . paths ["/i/conversations", C.pack $ show cid, "accept", "v2"] + . zUser invited + . zType "access" + . zConn "conn" postOtrMessage :: (Request -> Request) -> @@ -864,14 +865,14 @@ postOtrMessage' :: TestM ResponseLBS postOtrMessage' reportMissing f u d c rec = do g <- viewGalley - post $ - g - . f - . paths ["conversations", toByteString' c, "otr", "messages"] - . zUser u - . zConn "conn" - . zType "access" - . json (mkOtrPayload d rec reportMissing "ZXhhbXBsZQ==") + post + $ g + . f + . paths ["conversations", toByteString' c, "otr", "messages"] + . zUser u + . zConn "conn" + . zType "access" + . json (mkOtrPayload d rec reportMissing "ZXhhbXBsZQ==") postProteusMessageQualifiedWithMockFederator :: UserId -> @@ -883,8 +884,8 @@ postProteusMessageQualifiedWithMockFederator :: Mock LByteString -> TestM (ResponseLBS, [FederatedRequest]) postProteusMessageQualifiedWithMockFederator senderUser senderClient convId recipients dat strat mock = - withTempMockFederator' mock $ - postProteusMessageQualified senderUser senderClient convId recipients dat strat + withTempMockFederator' mock + $ postProteusMessageQualified senderUser senderClient convId recipients dat strat postProteusMessageQualified :: (MonadIO m, HasGalley m, MonadHttp m) => @@ -898,14 +899,14 @@ postProteusMessageQualified :: postProteusMessageQualified senderUser senderClient (Qualified conv domain) recipients dat strat = do g <- viewGalley let protoMsg = mkQualifiedOtrPayload senderClient recipients dat strat - post $ - g - . paths ["conversations", toByteString' domain, toByteString' conv, "proteus", "messages"] - . zUser senderUser - . zConn "conn" - . zType "access" - . contentProtobuf - . bytes (Protolens.encodeMessage protoMsg) + post + $ g + . paths ["conversations", toByteString' domain, toByteString' conv, "proteus", "messages"] + . zUser senderUser + . zConn "conn" + . zType "access" + . contentProtobuf + . bytes (Protolens.encodeMessage protoMsg) data BroadcastAPI = BroadcastLegacyQueryParams @@ -951,8 +952,8 @@ postBroadcast lu c b = do (BroadcastQualified, BroadcastJSON) -> error "JSON not supported for the qualified broadcast API" (BroadcastQualified, BroadcastProto) -> let m = - Protolens.encodeMessage $ - mkQualifiedOtrPayload + Protolens.encodeMessage + $ mkQualifiedOtrPayload c (map ((_1 %~ (lu $>)) . (_3 %~ fromBase64TextLenient)) (bMessage b)) (fromBase64TextLenient (bData b)) @@ -965,19 +966,20 @@ postBroadcast lu c b = do (_, BroadcastJSON) -> json (mkOtrPayload c (bMessage b) bodyReport (bData b)) (_, BroadcastProto) -> let m = - runPut . encodeMessage $ - mkOtrProtoMessage c (otrRecipients (bMessage b)) bodyReport (bData b) + runPut + . encodeMessage + $ mkOtrProtoMessage c (otrRecipients (bMessage b)) bodyReport (bData b) in contentProtobuf . bytes m let name = case bAPI b of BroadcastQualified -> "proteus"; _ -> "otr" - post $ - g - . bReq b - . paths ["broadcast", name, "messages"] - . zUser u - . zConn "conn" - . zType "access" - . queryReport - . bdy + post + $ g + . bReq b + . paths ["broadcast", name, "messages"] + . zUser u + . zConn "conn" + . zType "access" + . queryReport + . bdy mkOtrReportMissing :: [UserId] -> Request -> Request mkOtrReportMissing = queryItem "report_missing" . BS.intercalate "," . map toByteString' @@ -994,7 +996,7 @@ mkOtrPayload sender rec reportMissingBody ad = mkOtrMessage :: (UserId, ClientId, Text) -> (Text, HashMap.HashMap Text Text) mkOtrMessage (usr, clt, m) = (fn usr, HashMap.singleton (fn clt) m) where - fn :: ToByteString a => a -> Text + fn :: (ToByteString a) => a -> Text fn = fromJust . fromByteString . toByteString' postProtoOtrMessage :: UserId -> ClientId -> ConvId -> OtrRecipients -> TestM ResponseLBS @@ -1004,15 +1006,15 @@ postProtoOtrMessage' :: Maybe [UserId] -> (Request -> Request) -> UserId -> Clie postProtoOtrMessage' reportMissing modif u d c rec = do g <- viewGalley let m = runPut (encodeMessage $ mkOtrProtoMessage d rec reportMissing "ZXhhbXBsZQ==") - in post $ - g - . modif - . paths ["conversations", toByteString' c, "otr", "messages"] - . zUser u - . zConn "conn" - . zType "access" - . contentProtobuf - . bytes m + in post + $ g + . modif + . paths ["conversations", toByteString' c, "otr", "messages"] + . zUser u + . zConn "conn" + . zType "access" + . contentProtobuf + . bytes m mkOtrProtoMessage :: ClientId -> OtrRecipients -> Maybe [UserId] -> Text -> Proto.NewOtrMessage mkOtrProtoMessage sender rec reportMissing ad = @@ -1023,17 +1025,17 @@ mkOtrProtoMessage sender rec reportMissing ad = & Proto.newOtrMessageData ?~ fromBase64TextLenient ad & Proto.newOtrMessageReportMissing .~ rmis -getConvs :: HasCallStack => UserId -> [Qualified ConvId] -> TestM ResponseLBS +getConvs :: (HasCallStack) => UserId -> [Qualified ConvId] -> TestM ResponseLBS getConvs u cids = do g <- viewGalley - post $ - g - . path "/conversations/list" - . zUser u - . zConn "conn" - . json (ListConversations (unsafeRange cids)) + post + $ g + . path "/conversations/list" + . zUser u + . zConn "conn" + . json (ListConversations (unsafeRange cids)) -getConvClients :: HasCallStack => GroupId -> TestM ClientList +getConvClients :: (HasCallStack) => GroupId -> TestM ClientList getConvClients gid = do g <- viewGalley responseJsonError @@ -1042,7 +1044,7 @@ getConvClients gid = do . paths ["i", "group", B64U.encode $ unGroupId gid] ) -getAllConvs :: HasCallStack => UserId -> TestM [Conversation] +getAllConvs :: (HasCallStack) => UserId -> TestM [Conversation] getAllConvs u = do g <- viewGalley cids <- do @@ -1058,12 +1060,12 @@ getAllConvs u = do GetPaginatedConversationIds ) ) - UserId -> Qualified ConvId -> m ResponseLBS getConvQualified u (Qualified conv domain) = do g <- viewGalley - get $ - g - . paths ["conversations", toByteString' domain, toByteString' conv] - . zUser u - . zConn "conn" - . zType "access" + get + $ g + . paths ["conversations", toByteString' domain, toByteString' conv] + . zUser u + . zConn "conn" + . zType "access" getConvIdsV2 :: UserId -> Maybe (Either [ConvId] ConvId) -> Maybe Int32 -> TestM ResponseLBS getConvIdsV2 u r s = do -- The endpoint is removed starting V3 g <- fmap (addPrefixAtVersion V2 .) (view tsUnversionedGalley) - get $ - g - . path "/conversations/ids" - . zUser u - . zConn "conn" - . zType "access" - . convRange r s + get + $ g + . path "/conversations/ids" + . zUser u + . zConn "conn" + . zType "access" + . convRange r s getConvPage :: UserId -> Maybe ConversationPagingState -> Maybe Int32 -> TestM ResponseLBS getConvPage u state count = do @@ -1154,25 +1156,27 @@ getConvPageWithGalley :: Maybe Int32 -> TestM ResponseLBS getConvPageWithGalley g u state count = - post $ - g - . path "/conversations/list-ids" - . zUser u - . zConn "conn" - -- generate JSON by hand here, so we can bypass the static range check - . json - ( object - ( map (\n -> "size" .= toJSON n) (toList count) - <> map (\s -> "paging_state" .= toJSON s) (toList state) - ) - ) + post + $ g + . path "/conversations/list-ids" + . zUser u + . zConn "conn" + -- generate JSON by hand here, so we can bypass the static range check + . json + ( object + ( map (\n -> "size" .= toJSON n) (toList count) + <> map (\s -> "paging_state" .= toJSON s) (toList state) + ) + ) -- | Does not page through conversation list listRemoteConvs :: Domain -> UserId -> TestM [Qualified ConvId] listRemoteConvs remoteDomain uid = do allConvs <- - fmap mtpResults . responseJsonError @_ @ConvIdsPage - =<< getConvPage uid Nothing (Just 100) qDomain qcnv == remoteDomain) allConvs postQualifiedMembers :: @@ -1184,18 +1188,18 @@ postQualifiedMembers :: postQualifiedMembers zusr invitees conv = do g <- viewGalley let invite = InviteQualified invitees roleNameWireAdmin - post $ - g - . paths - [ "conversations", - toByteString' . qDomain $ conv, - toByteString' . qUnqualified $ conv, - "members" - ] - . zUser zusr - . zConn "conn" - . zType "access" - . json invite + post + $ g + . paths + [ "conversations", + toByteString' . qDomain $ conv, + toByteString' . qUnqualified $ conv, + "members" + ] + . zUser zusr + . zConn "conn" + . zType "access" + . json invite postMembers :: (MonadIO m, MonadHttp m, HasGalley m) => @@ -1215,18 +1219,18 @@ postMembersWithRole :: postMembersWithRole u us c r = do g <- viewGalley let i = InviteQualified us r - post $ - g - . paths - [ "conversations", - toByteString' (qDomain c), - toByteString' (qUnqualified c), - "members" - ] - . zUser u - . zConn "conn" - . zType "access" - . json i + post + $ g + . paths + [ "conversations", + toByteString' (qDomain c), + toByteString' (qUnqualified c), + "members" + ] + . zUser u + . zConn "conn" + . zType "access" + . json i deleteMemberQualified :: (HasCallStack, MonadIO m, MonadHttp m, HasGalley m) => @@ -1236,40 +1240,40 @@ deleteMemberQualified :: m ResponseLBS deleteMemberQualified u1 (Qualified u2 u2Domain) (Qualified conv convDomain) = do g <- viewGalley - delete $ - g - . zUser u1 - . paths - [ "conversations", - toByteString' convDomain, - toByteString' conv, - "members", - toByteString' u2Domain, - toByteString' u2 - ] - . zConn "conn" - . zType "access" + delete + $ g + . zUser u1 + . paths + [ "conversations", + toByteString' convDomain, + toByteString' conv, + "members", + toByteString' u2Domain, + toByteString' u2 + ] + . zConn "conn" + . zType "access" getSelfMember :: UserId -> ConvId -> TestM ResponseLBS getSelfMember u c = do g <- viewGalley - get $ - g - . paths ["conversations", toByteString' c, "self"] - . zUser u - . zConn "conn" - . zType "access" + get + $ g + . paths ["conversations", toByteString' c, "self"] + . zUser u + . zConn "conn" + . zType "access" putMember :: UserId -> MemberUpdate -> Qualified ConvId -> TestM ResponseLBS putMember u m (Qualified c dom) = do g <- viewGalley - put $ - g - . paths ["conversations", toByteString' dom, toByteString' c, "self"] - . zUser u - . zConn "conn" - . zType "access" - . json m + put + $ g + . paths ["conversations", toByteString' dom, toByteString' c, "self"] + . zUser u + . zConn "conn" + . zType "access" + . json m putOtherMemberQualified :: (HasGalley m, MonadIO m, MonadHttp m) => @@ -1280,31 +1284,31 @@ putOtherMemberQualified :: m ResponseLBS putOtherMemberQualified from to m c = do g <- viewGalley - put $ - g - . paths - [ "conversations", - toByteString' (qDomain c), - toByteString' (qUnqualified c), - "members", - toByteString' (qDomain to), - toByteString' (qUnqualified to) - ] - . zUser from - . zConn "conn" - . zType "access" - . json m + put + $ g + . paths + [ "conversations", + toByteString' (qDomain c), + toByteString' (qUnqualified c), + "members", + toByteString' (qDomain to), + toByteString' (qUnqualified to) + ] + . zUser from + . zConn "conn" + . zType "access" + . json m putOtherMember :: UserId -> UserId -> OtherMemberUpdate -> ConvId -> TestM ResponseLBS putOtherMember from to m c = do g <- viewGalley - put $ - g - . paths ["conversations", toByteString' c, "members", toByteString' to] - . zUser from - . zConn "conn" - . zType "access" - . json m + put + $ g + . paths ["conversations", toByteString' c, "members", toByteString' to] + . zUser from + . zConn "conn" + . zType "access" + . json m putQualifiedConversationName :: (HasCallStack, HasGalley m, MonadIO m, MonadHttp m) => @@ -1376,23 +1380,23 @@ putReceiptMode u c r = do getJoinCodeConv :: UserId -> Code.Key -> Code.Value -> TestM ResponseLBS getJoinCodeConv u k v = do g <- viewGalley - get $ - g - . paths ["/conversations", "join"] - . zUser u - . queryItem "key" (toByteString' k) - . queryItem "code" (toByteString' v) + get + $ g + . paths ["/conversations", "join"] + . zUser u + . queryItem "key" (toByteString' k) + . queryItem "code" (toByteString' v) postJoinConv :: UserId -> ConvId -> TestM ResponseLBS postJoinConv u c = do -- This endpoint is removed from version v5 onwards g <- fmap (addPrefixAtVersion V4 .) (view tsUnversionedGalley) - post $ - g - . paths ["/conversations", toByteString' c, "join"] - . zUser u - . zConn "conn" - . zType "access" + post + $ g + . paths ["/conversations", toByteString' c, "join"] + . zUser u + . zConn "conn" + . zType "access" postJoinCodeConv :: UserId -> ConversationCode -> TestM ResponseLBS postJoinCodeConv = postJoinCodeConv' Nothing @@ -1400,14 +1404,14 @@ postJoinCodeConv = postJoinCodeConv' Nothing postJoinCodeConv' :: Maybe PlainTextPassword8 -> UserId -> ConversationCode -> TestM ResponseLBS postJoinCodeConv' mPw u j = do g <- viewGalley - post $ - g - . paths ["conversations", "join"] - . zUser u - . zConn "conn" - . zType "access" - -- `json (JoinConversationByCode j Nothing)` and `json j` are equivalent, using the latter to test backwards compatibility - . (if isJust mPw then json (JoinConversationByCode j mPw) else json j) + post + $ g + . paths ["conversations", "join"] + . zUser u + . zConn "conn" + . zType "access" + -- `json (JoinConversationByCode j Nothing)` and `json j` are equivalent, using the latter to test backwards compatibility + . (if isJust mPw then json (JoinConversationByCode j mPw) else json j) deleteFederation :: (MonadHttp m, HasGalley m, MonadIO m) => @@ -1415,8 +1419,9 @@ deleteFederation :: m ResponseLBS deleteFederation dom = do g <- viewGalley - delete $ - g . paths ["/i/federation", toByteString' dom] + delete + $ g + . paths ["/i/federation", toByteString' dom] putQualifiedAccessUpdate :: (MonadHttp m, HasGalley m, MonadIO m) => @@ -1426,13 +1431,13 @@ putQualifiedAccessUpdate :: m ResponseLBS putQualifiedAccessUpdate u (Qualified c domain) acc = do g <- viewGalley - put $ - g - . paths ["/conversations", toByteString' domain, toByteString' c, "access"] - . zUser u - . zConn "conn" - . zType "access" - . json acc + put + $ g + . paths ["/conversations", toByteString' domain, toByteString' c, "access"] + . zUser u + . zConn "conn" + . zType "access" + . json acc putMessageTimerUpdateQualified :: (HasGalley m, MonadIO m, MonadHttp m) => @@ -1442,30 +1447,30 @@ putMessageTimerUpdateQualified :: m ResponseLBS putMessageTimerUpdateQualified u c acc = do g <- viewGalley - put $ - g - . paths - [ "/conversations", - toByteString' (qDomain c), - toByteString' (qUnqualified c), - "message-timer" - ] - . zUser u - . zConn "conn" - . zType "access" - . json acc + put + $ g + . paths + [ "/conversations", + toByteString' (qDomain c), + toByteString' (qUnqualified c), + "message-timer" + ] + . zUser u + . zConn "conn" + . zType "access" + . json acc putMessageTimerUpdate :: UserId -> ConvId -> ConversationMessageTimerUpdate -> TestM ResponseLBS putMessageTimerUpdate u c acc = do g <- viewGalley - put $ - g - . paths ["/conversations", toByteString' c, "message-timer"] - . zUser u - . zConn "conn" - . zType "access" - . json acc + put + $ g + . paths ["/conversations", toByteString' c, "message-timer"] + . zUser u + . zConn "conn" + . zType "access" + . json acc postConvCode :: UserId -> ConvId -> TestM ResponseLBS postConvCode = postConvCode' Nothing @@ -1473,48 +1478,48 @@ postConvCode = postConvCode' Nothing postConvCode' :: Maybe PlainTextPassword8 -> UserId -> ConvId -> TestM ResponseLBS postConvCode' mPw u c = do g <- viewGalley - post $ - g - . paths ["/conversations", toByteString' c, "code"] - . zUser u - . zConn "conn" - . zType "access" - . json (CreateConversationCodeRequest mPw) + post + $ g + . paths ["/conversations", toByteString' c, "code"] + . zUser u + . zConn "conn" + . zType "access" + . json (CreateConversationCodeRequest mPw) postConvCodeCheck :: ConversationCode -> TestM ResponseLBS postConvCodeCheck code = do g <- viewGalley - post $ - g - . path "/conversations/code-check" - . json code + post + $ g + . path "/conversations/code-check" + . json code getConvCode :: UserId -> ConvId -> TestM ResponseLBS getConvCode u c = do g <- viewGalley - get $ - g - . paths ["/conversations", toByteString' c, "code"] - . zUser u - . zConn "conn" - . zType "access" + get + $ g + . paths ["/conversations", toByteString' c, "code"] + . zUser u + . zConn "conn" + . zType "access" deleteConvCode :: UserId -> ConvId -> TestM ResponseLBS deleteConvCode u c = do g <- viewGalley - delete $ - g - . paths ["/conversations", toByteString' c, "code"] - . zUser u - . zConn "conn" - . zType "access" + delete + $ g + . paths ["/conversations", toByteString' c, "code"] + . zUser u + . zConn "conn" + . zType "access" deleteUser :: (MonadIO m, MonadHttp m, HasGalley m, HasCallStack) => UserId -> m ResponseLBS deleteUser u = do g <- viewGalley delete (g . path "/i/user" . zUser u) -getTeamQueue :: HasCallStack => UserId -> Maybe NotificationId -> Maybe (Int, Bool) -> Bool -> TestM [(NotificationId, UserId)] +getTeamQueue :: (HasCallStack) => UserId -> Maybe NotificationId -> Maybe (Int, Bool) -> Bool -> TestM [(NotificationId, UserId)] getTeamQueue zusr msince msize onlyLast = parseEventList . responseJsonUnsafe <$> ( getTeamQueue' zusr msince (fst <$> msize) onlyLast @@ -1542,7 +1547,7 @@ getTeamQueue zusr msince msize onlyLast = EdMemberJoin uid -> uid _ -> error ("bad event type: " <> show (TE.eventType e)) -getTeamQueue' :: HasCallStack => UserId -> Maybe NotificationId -> Maybe Int -> Bool -> TestM ResponseLBS +getTeamQueue' :: (HasCallStack) => UserId -> Maybe NotificationId -> Maybe Int -> Bool -> TestM ResponseLBS getTeamQueue' zusr msince msize onlyLast = do g <- viewGalley get @@ -1565,23 +1570,23 @@ registerRemoteConv :: Qualified ConvId -> UserId -> Maybe Text -> Set OtherMembe registerRemoteConv convId originUser name othMembers = do fedGalleyClient <- view tsFedGalleyClient now <- liftIO getCurrentTime - void $ - runFedClient @"on-conversation-created" fedGalleyClient (qDomain convId) $ - ConversationCreated - { time = now, - origUserId = originUser, - cnvId = qUnqualified convId, - cnvType = RegularConv, - cnvAccess = [], - cnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], - cnvName = name, - nonCreatorMembers = othMembers, - messageTimer = Nothing, - receiptMode = Nothing, - protocol = ProtocolProteus - } + void + $ runFedClient @"on-conversation-created" fedGalleyClient (qDomain convId) + $ ConversationCreated + { time = now, + origUserId = originUser, + cnvId = qUnqualified convId, + cnvType = RegularConv, + cnvAccess = [], + cnvAccessRoles = Set.fromList [TeamMemberAccessRole, NonTeamMemberAccessRole], + cnvName = name, + nonCreatorMembers = othMembers, + messageTimer = Nothing, + receiptMode = Nothing, + protocol = ProtocolProteus + } -getFeatureStatusMulti :: forall cfg. KnownSymbol (FeatureSymbol cfg) => Multi.TeamFeatureNoConfigMultiRequest -> TestM ResponseLBS +getFeatureStatusMulti :: forall cfg. (KnownSymbol (FeatureSymbol cfg)) => Multi.TeamFeatureNoConfigMultiRequest -> TestM ResponseLBS getFeatureStatusMulti req = do g <- viewGalley post @@ -1593,20 +1598,20 @@ getFeatureStatusMulti req = do ------------------------------------------------------------------------------- -- Common Assertions -assertConvMemberWithRole :: HasCallStack => RoleName -> ConvId -> Qualified UserId -> TestM () +assertConvMemberWithRole :: (HasCallStack) => RoleName -> ConvId -> Qualified UserId -> TestM () assertConvMemberWithRole r c u = getSelfMember (qUnqualified u) c !!! do const 200 === statusCode const (Right u) === (fmap memId <$> responseJsonEither) const (Right r) === (fmap memConvRoleName <$> responseJsonEither) -assertConvMember :: HasCallStack => Qualified UserId -> ConvId -> TestM () +assertConvMember :: (HasCallStack) => Qualified UserId -> ConvId -> TestM () assertConvMember u c = getSelfMember (qUnqualified u) c !!! do const 200 === statusCode const (Right u) === (fmap memId <$> responseJsonEither) -assertNotConvMember :: HasCallStack => UserId -> ConvId -> TestM () +assertNotConvMember :: (HasCallStack) => UserId -> ConvId -> TestM () assertNotConvMember u c = getSelfMember u c !!! do const 200 === statusCode @@ -1627,7 +1632,7 @@ assertConvEquals c1 c2 = liftIO $ do otherMembers = Set.fromList . cmOthers . cnvMembers assertConv :: - HasCallStack => + (HasCallStack) => Response (Maybe Lazy.ByteString) -> ConvType -> Maybe UserId -> @@ -1639,7 +1644,7 @@ assertConv :: assertConv r t c s us n mt = assertConvWithRole r t c s us n mt roleNameWireAdmin assertConvWithRole :: - HasCallStack => + (HasCallStack) => Response (Maybe Lazy.ByteString) -> ConvType -> Maybe UserId -> @@ -1675,7 +1680,7 @@ assertConvWithRole r t c s us n mt role = do pure (cnvQualifiedId cnv) wsAssertOtr :: - HasCallStack => + (HasCallStack) => Qualified ConvId -> Qualified UserId -> ClientId -> @@ -1686,7 +1691,7 @@ wsAssertOtr :: wsAssertOtr = wsAssertOtr' "ZXhhbXBsZQ==" wsAssertOtr' :: - HasCallStack => + (HasCallStack) => Text -> Qualified ConvId -> Qualified UserId -> @@ -1704,7 +1709,7 @@ wsAssertOtr' evData conv usr from to txt n = do evtData e @?= EdOtrMessage (OtrMessage from to txt (Just evData)) wsAssertMLSWelcome :: - HasCallStack => + (HasCallStack) => Qualified UserId -> Qualified ConvId -> ByteString -> @@ -1719,7 +1724,7 @@ wsAssertMLSWelcome u cid welcome n = do evtData e @?= EdMLSWelcome welcome wsAssertMLSMessage :: - HasCallStack => + (HasCallStack) => Qualified ConvOrSubConvId -> Qualified UserId -> ByteString -> @@ -1731,7 +1736,7 @@ wsAssertMLSMessage qcs u message n = do assertMLSMessageEvent qcs u message e wsAssertClientRemoved :: - HasCallStack => + (HasCallStack) => ClientId -> Notification -> IO () @@ -1743,7 +1748,7 @@ wsAssertClientRemoved cid n = do (fromByteString . T.encodeUtf8 =<< eclient) @?= Just cid wsAssertClientAdded :: - HasCallStack => + (HasCallStack) => ClientId -> Notification -> IO () @@ -1755,7 +1760,7 @@ wsAssertClientAdded cid n = do (fromByteString . T.encodeUtf8 =<< eclient) @?= Just cid assertMLSMessageEvent :: - HasCallStack => + (HasCallStack) => Qualified ConvOrSubConvId -> Qualified UserId -> ByteString -> @@ -1772,10 +1777,10 @@ assertMLSMessageEvent qcs u message e = do evtData e @?= EdMLSMessage message -- | This assumes the default role name -wsAssertMemberJoin :: HasCallStack => Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> Notification -> IO () +wsAssertMemberJoin :: (HasCallStack) => Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> Notification -> IO () wsAssertMemberJoin conv usr new = wsAssertMemberJoinWithRole conv usr new roleNameWireAdmin -wsAssertMemberJoinWithRole :: HasCallStack => Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> RoleName -> Notification -> IO () +wsAssertMemberJoinWithRole :: (HasCallStack) => Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> RoleName -> Notification -> IO () wsAssertMemberJoinWithRole conv usr new role n = do let e = List1.head (WS.unpackPayload n) ntfTransient n @?= False @@ -1789,7 +1794,7 @@ assertJoinEvent conv usr new role e = do fmap (sort . mMembers) (evtData e ^? _EdMembersJoin) @?= Just (sort (fmap (`SimpleMember` role) new)) wsAssertFederationDeleted :: - HasCallStack => + (HasCallStack) => Domain -> Notification -> IO () @@ -1811,7 +1816,7 @@ assertFederationDeletedEvent dom e = do -- -- or if they can be combined in general. wsAssertMembersLeave :: - HasCallStack => + (HasCallStack) => Qualified ConvId -> Qualified UserId -> [Qualified UserId] -> @@ -1877,7 +1882,7 @@ wsAssertMemberLeave conv usr old reason n = do sorted (EdMembersLeave _ (QualifiedUserIdList m)) = EdMembersLeave reason (QualifiedUserIdList (sort m)) sorted x = x -wsAssertTyping :: HasCallStack => Qualified ConvId -> Qualified UserId -> TypingStatus -> Notification -> IO () +wsAssertTyping :: (HasCallStack) => Qualified ConvId -> Qualified UserId -> TypingStatus -> Notification -> IO () wsAssertTyping conv usr ts n = do let e = List1.head (WS.unpackPayload n) ntfTransient n @?= True @@ -1886,7 +1891,7 @@ wsAssertTyping conv usr ts n = do evtFrom e @?= usr evtData e @?= EdTyping ts -assertNoMsg :: HasCallStack => WS.WebSocket -> (Notification -> Assertion) -> TestM () +assertNoMsg :: (HasCallStack) => WS.WebSocket -> (Notification -> Assertion) -> TestM () assertNoMsg ws f = do x <- WS.awaitMatch (1 # Second) ws f liftIO $ case x of @@ -1919,7 +1924,7 @@ assertLeaveUpdate req qconvId remover alreadyPresentUsers = liftIO $ do ------------------------------------------------------------------------------- -- Helpers -testResponse :: HasCallStack => Int -> Maybe TestErrorLabel -> Assertions () +testResponse :: (HasCallStack) => Int -> Maybe TestErrorLabel -> Assertions () testResponse status mlabel = do const status === statusCode case mlabel of @@ -1943,16 +1948,16 @@ decodeConvCodeEvent r = case responseJsonUnsafe r of (Event _ _ _ _ (EdConvCodeUpdate c)) -> c _ -> error "Failed to parse ConversationCode from Event" -decodeConvId :: HasCallStack => Response (Maybe Lazy.ByteString) -> ConvId +decodeConvId :: (HasCallStack) => Response (Maybe Lazy.ByteString) -> ConvId decodeConvId = qUnqualified . decodeQualifiedConvId -decodeQualifiedConvId :: HasCallStack => Response (Maybe Lazy.ByteString) -> Qualified ConvId +decodeQualifiedConvId :: (HasCallStack) => Response (Maybe Lazy.ByteString) -> Qualified ConvId decodeQualifiedConvId = cnvQualifiedId . responseJsonUnsafe -decodeConvList :: HasCallStack => Response (Maybe Lazy.ByteString) -> [Conversation] +decodeConvList :: (HasCallStack) => Response (Maybe Lazy.ByteString) -> [Conversation] decodeConvList = convList . responseJsonUnsafeWithMsg "conversations" -decodeConvIdList :: HasCallStack => Response (Maybe Lazy.ByteString) -> [ConvId] +decodeConvIdList :: (HasCallStack) => Response (Maybe Lazy.ByteString) -> [ConvId] decodeConvIdList = convList . responseJsonUnsafeWithMsg "conversation-ids" decodeQualifiedConvIdList :: Response (Maybe Lazy.ByteString) -> Either String [Qualified ConvId] @@ -2056,39 +2061,40 @@ connectWithRemoteUser self other = do postConnection :: UserId -> UserId -> TestM ResponseLBS postConnection from to = do brig <- view tsUnversionedBrig - post $ - brig - . paths ["v1", "connections"] - . contentJson - . body payload - . zUser from - . zConn "conn" + post + $ brig + . paths ["v1", "connections"] + . contentJson + . body payload + . zUser from + . zConn "conn" where payload = - RequestBodyLBS . encode $ - ConnectionRequest to (unsafeRange "some conv name") + RequestBodyLBS + . encode + $ ConnectionRequest to (unsafeRange "some conv name") postConnectionQualified :: UserId -> Qualified UserId -> TestM ResponseLBS postConnectionQualified from (Qualified toUser toDomain) = do brig <- viewBrig - post $ - brig - . paths ["connections", toByteString' toDomain, toByteString' toUser] - . contentJson - . zUser from - . zConn "conn" + post + $ brig + . paths ["connections", toByteString' toDomain, toByteString' toUser] + . contentJson + . zUser from + . zConn "conn" -- | A copy of 'putConnection' from Brig integration tests. putConnection :: UserId -> UserId -> Relation -> TestM ResponseLBS putConnection from to r = do brig <- view tsUnversionedBrig - put $ - brig - . paths ["v1", "connections", toByteString' to] - . contentJson - . body payload - . zUser from - . zConn "conn" + put + $ brig + . paths ["v1", "connections", toByteString' to] + . contentJson + . body payload + . zUser from + . zConn "conn" where payload = RequestBodyLBS . encode $ object ["status" .= r] @@ -2097,32 +2103,35 @@ putConnectionQualified :: Qualified UserId -> UserId -> Relation -> TestM Respon putConnectionQualified fromQualified to r = do localDomain <- viewFederationDomain let (Qualified from qualifiedDomain) = fromQualified - liftIO $ - assertEqual + liftIO + $ assertEqual "The qualified user's domain is not local" localDomain qualifiedDomain brig <- view tsUnversionedBrig - put $ - brig - . paths ["v1", "connections", toByteString' to] - . contentJson - . body payload - . zUser from - . zConn "conn" + put + $ brig + . paths ["v1", "connections", toByteString' to] + . contentJson + . body payload + . zUser from + . zConn "conn" where payload = RequestBodyLBS . encode $ object ["status" .= r] -- | A copy of `assertConnections from Brig integration tests. -assertConnections :: HasCallStack => UserId -> [ConnectionStatus] -> TestM () +assertConnections :: (HasCallStack) => UserId -> [ConnectionStatus] -> TestM () assertConnections u cstat = do brig <- view tsUnversionedBrig resp <- listConnections brig u show cstat <> " is not a subset of " <> show cstat' + unless (all (`elem` cstat') cstat) + $ error + $ "connection check failed: " + <> show cstat + <> " is not a subset of " + <> show cstat' where status c = ConnectionStatus (ucFrom c) (qUnqualified $ ucTo c) (ucStatus c) listConnections brig usr = get $ brig . paths ["v1", "connections"] . zUser usr @@ -2130,45 +2139,45 @@ assertConnections u cstat = do randomUsers :: Int -> TestM [UserId] randomUsers n = replicateM n randomUser -randomUserTuple :: HasCallStack => TestM (UserId, Qualified UserId) +randomUserTuple :: (HasCallStack) => TestM (UserId, Qualified UserId) randomUserTuple = do qUid <- randomQualifiedUser pure (qUnqualified qUid, qUid) -randomUser :: HasCallStack => TestM UserId +randomUser :: (HasCallStack) => TestM UserId randomUser = qUnqualified <$> randomUser' False True True -randomQualifiedUser :: HasCallStack => TestM (Qualified UserId) +randomQualifiedUser :: (HasCallStack) => TestM (Qualified UserId) randomQualifiedUser = randomUser' False True True -randomQualifiedId :: MonadIO m => Domain -> m (Qualified (Id a)) +randomQualifiedId :: (MonadIO m) => Domain -> m (Qualified (Id a)) randomQualifiedId domain = Qualified <$> randomId <*> pure domain -randomTeamCreator :: HasCallStack => TestM UserId +randomTeamCreator :: (HasCallStack) => TestM UserId randomTeamCreator = qUnqualified <$> randomUser' True True True -randomTeamCreator' :: HasCallStack => TestM User +randomTeamCreator' :: (HasCallStack) => TestM User randomTeamCreator' = randomUser'' True True True -randomUser' :: HasCallStack => Bool -> Bool -> Bool -> TestM (Qualified UserId) +randomUser' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM (Qualified UserId) randomUser' isCreator hasPassword hasEmail = userQualifiedId <$> randomUser'' isCreator hasPassword hasEmail -randomUser'' :: HasCallStack => Bool -> Bool -> Bool -> TestM User +randomUser'' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM User randomUser'' isCreator hasPassword hasEmail = selfUser <$> randomUserProfile' isCreator hasPassword hasEmail -randomUserProfile' :: HasCallStack => Bool -> Bool -> Bool -> TestM SelfProfile +randomUserProfile' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM SelfProfile randomUserProfile' isCreator hasPassword hasEmail = do b <- viewBrig e <- liftIO randomEmail let p = - object $ - ["name" .= fromEmail e] - <> ["password" .= defPassword | hasPassword] - <> ["email" .= fromEmail e | hasEmail] - <> ["team" .= BindingNewTeam (newNewTeam (unsafeRange "teamName") DefaultIcon) | isCreator] + object + $ ["name" .= fromEmail e] + <> ["password" .= defPassword | hasPassword] + <> ["email" .= fromEmail e | hasEmail] + <> ["team" .= BindingNewTeam (newNewTeam (unsafeRange "teamName") DefaultIcon) | isCreator] responseJsonUnsafe <$> (post (b . path "/i/users" . json p) TestM UserId +ephemeralUser :: (HasCallStack) => TestM UserId ephemeralUser = do b <- viewBrig name <- UUID.toText <$> liftIO nextRandom @@ -2177,10 +2186,10 @@ ephemeralUser = do user <- responseJsonError r pure $ User.userId user -randomClient :: HasCallStack => UserId -> LastPrekey -> TestM ClientId +randomClient :: (HasCallStack) => UserId -> LastPrekey -> TestM ClientId randomClient uid lk = randomClientWithCaps uid lk Nothing -randomClientWithCaps :: HasCallStack => UserId -> LastPrekey -> Maybe (Set Client.ClientCapability) -> TestM ClientId +randomClientWithCaps :: (HasCallStack) => UserId -> LastPrekey -> Maybe (Set Client.ClientCapability) -> TestM ClientId randomClientWithCaps uid lk caps = do b <- viewBrig resp <- @@ -2203,12 +2212,12 @@ randomClientWithCaps uid lk caps = do newClientCapabilities = caps } -ensureDeletedState :: HasCallStack => Bool -> UserId -> UserId -> TestM () +ensureDeletedState :: (HasCallStack) => Bool -> UserId -> UserId -> TestM () ensureDeletedState check from u = do state <- getDeletedState from u liftIO $ assertEqual "Unxpected deleted state" state (Just check) -getDeletedState :: HasCallStack => UserId -> UserId -> TestM (Maybe Bool) +getDeletedState :: (HasCallStack) => UserId -> UserId -> TestM (Maybe Bool) getDeletedState from u = do b <- view tsUnversionedBrig fmap profileDeleted . responseJsonMaybe @@ -2222,24 +2231,24 @@ getDeletedState from u = do getClients :: UserId -> TestM ResponseLBS getClients u = do b <- viewBrig - get $ - b - . paths ["clients"] - . zUser u - . zConn "conn" + get + $ b + . paths ["clients"] + . zUser u + . zConn "conn" getInternalClientsFull :: UserSet -> TestM UserClientsFull getInternalClientsFull userSet = do b <- viewBrig res <- - post $ - b - . paths ["i", "clients", "full"] - . zConn "conn" - . json userSet + post + $ b + . paths ["i", "clients", "full"] + . zConn "conn" + . json userSet responseJsonError res -ensureClientCaps :: HasCallStack => UserId -> ClientId -> Client.ClientCapabilityList -> TestM () +ensureClientCaps :: (HasCallStack) => UserId -> ClientId -> Client.ClientCapabilityList -> TestM () ensureClientCaps uid cid caps = do UserClientsFull (Map.lookup uid -> (Just clnts)) <- getInternalClientsFull (UserSet $ Set.singleton uid) clnt <- assertOne . filter ((== cid) . clientId) $ Set.toList clnts @@ -2249,22 +2258,23 @@ ensureClientCaps uid cid caps = do deleteClient :: UserId -> ClientId -> Maybe PlainTextPassword6 -> TestM ResponseLBS deleteClient u c pw = do b <- viewBrig - delete $ - b - . paths ["clients", toByteString' c] - . zUser u - . zConn "conn" - . contentJson - . body payload + delete + $ b + . paths ["clients", toByteString' c] + . zUser u + . zConn "conn" + . contentJson + . body payload where payload = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "password" .= pw ] -- TODO: Refactor, as used also in brig -isUserDeleted :: HasCallStack => UserId -> TestM Bool +isUserDeleted :: (HasCallStack) => UserId -> TestM Bool isUserDeleted u = do b <- viewBrig r <- @@ -2278,7 +2288,7 @@ isUserDeleted u = do let decoded = fromMaybe (error $ "getStatus: failed to decode status" ++ show j) st pure $ decoded == Deleted where - maybeFromJSON :: FromJSON a => Value -> Maybe a + maybeFromJSON :: (FromJSON a) => Value -> Maybe a maybeFromJSON v = case fromJSON v of Success a -> Just a _ -> Nothing @@ -2287,10 +2297,10 @@ isMember :: UserId -> ConvId -> TestM Bool isMember usr cnv = do g <- viewGalley res <- - get $ - g - . paths ["i", "conversations", toByteString' cnv, "members", toByteString' usr] - . expect2xx + get + $ g + . paths ["i", "conversations", toByteString' cnv, "members", toByteString' usr] + . expect2xx pure $ isJust (responseJsonMaybe @Member res) randomUserWithClient :: LastPrekey -> TestM (UserId, ClientId) @@ -2352,7 +2362,7 @@ assertBroadcastMismatch localDomain BroadcastQualified = assertBroadcastMismatch _ _ = assertMismatch assertMismatchWithMessage :: - HasCallStack => + (HasCallStack) => Maybe String -> [(UserId, Set ClientId)] -> [(UserId, Set ClientId)] -> @@ -2370,7 +2380,7 @@ assertMismatchWithMessage mmsg missing redundant deleted = do formatMessage = maybe Imports.id (\msg -> ((msg <> "\n") <>)) mmsg assertMismatch :: - HasCallStack => + (HasCallStack) => [(UserId, Set ClientId)] -> [(UserId, Set ClientId)] -> [(UserId, Set ClientId)] -> @@ -2378,7 +2388,7 @@ assertMismatch :: assertMismatch = assertMismatchWithMessage Nothing assertMismatchQualified :: - HasCallStack => + (HasCallStack) => Client.QualifiedUserClients -> Client.QualifiedUserClients -> Client.QualifiedUserClients -> @@ -2405,7 +2415,7 @@ genRandom = liftIO . Q.generate $ Q.arbitrary defPassword :: PlainTextPassword6 defPassword = plainTextPassword6Unsafe "topsecretdefaultpassword" -randomEmail :: MonadIO m => m Email +randomEmail :: (MonadIO m) => m Email randomEmail = do uid <- liftIO nextRandom pure $ Email ("success+" <> UUID.toText uid) "simulator.amazonses.com" @@ -2507,13 +2517,13 @@ postSSOUser name hasEmail ssoid teamid = do brig <- viewBrig email <- randomEmail let o = - object $ - [ "name" .= name, - "cookie" .= defCookieLabel, - "sso_id" .= ssoid, - "team_id" .= teamid - ] - <> ["email" .= fromEmail email | hasEmail] + object + $ [ "name" .= name, + "cookie" .= defCookieLabel, + "sso_id" .= ssoid, + "team_id" .= teamid + ] + <> ["email" .= fromEmail email | hasEmail] bdy = Bilge.json o post (brig . path "/i/users" . bdy) @@ -2530,8 +2540,8 @@ instance HasSettingsOverrides TestM where liftIO . lowerCodensity $ do (galleyApp, _env) <- Run.mkApp opts -- FUTUREWORK: always call Run.closeApp at the end. port' <- withMockServer galleyApp - liftIO $ - runReaderT + liftIO + $ runReaderT (runTestM action) ( ts & tsUnversionedGalley .~ Bilge.host "127.0.0.1" . Bilge.port port' @@ -2541,9 +2551,9 @@ instance HasSettingsOverrides TestM where waitForMemberDeletion :: UserId -> TeamId -> UserId -> TestM () waitForMemberDeletion zusr tid uid = do maybeTimedOut <- timeout 2000000 loop - liftIO $ - when (isNothing maybeTimedOut) $ - assertFailure "Timed out waiting for member deletion" + liftIO + $ when (isNothing maybeTimedOut) + $ assertFailure "Timed out waiting for member deletion" where loop = do galley <- viewGalley @@ -2604,15 +2614,15 @@ getUserProfile zusr uid = do res <- get (brig . zUser zusr . paths ["v1", "users", toByteString' uid]) responseJsonError res -upgradeClientToLH :: HasCallStack => UserId -> ClientId -> TestM () +upgradeClientToLH :: (HasCallStack) => UserId -> ClientId -> TestM () upgradeClientToLH zusr cid = putCapabilities zusr cid [ClientSupportsLegalholdImplicitConsent] -putCapabilities :: HasCallStack => UserId -> ClientId -> [ClientCapability] -> TestM () +putCapabilities :: (HasCallStack) => UserId -> ClientId -> [ClientCapability] -> TestM () putCapabilities zusr cid caps = do brig <- viewBrig - void $ - put + void + $ put ( brig . zUser zusr . paths ["clients", toByteString' cid] @@ -2620,7 +2630,7 @@ putCapabilities zusr cid caps = do . expect2xx ) -getUsersPrekeysClientUnqualified :: HasCallStack => UserId -> UserId -> ClientId -> TestM ResponseLBS +getUsersPrekeysClientUnqualified :: (HasCallStack) => UserId -> UserId -> ClientId -> TestM ResponseLBS getUsersPrekeysClientUnqualified zusr uid cid = do brig <- view tsUnversionedBrig get @@ -2629,7 +2639,7 @@ getUsersPrekeysClientUnqualified zusr uid cid = do . paths ["v1", "users", toByteString' uid, "prekeys", toByteString' cid] ) -getUsersPrekeyBundleUnqualified :: HasCallStack => UserId -> UserId -> TestM ResponseLBS +getUsersPrekeyBundleUnqualified :: (HasCallStack) => UserId -> UserId -> TestM ResponseLBS getUsersPrekeyBundleUnqualified zusr uid = do brig <- view tsUnversionedBrig get @@ -2638,7 +2648,7 @@ getUsersPrekeyBundleUnqualified zusr uid = do . paths ["v1", "users", toByteString' uid, "prekeys"] ) -getMultiUserPrekeyBundleUnqualified :: HasCallStack => UserId -> UserClients -> TestM ResponseLBS +getMultiUserPrekeyBundleUnqualified :: (HasCallStack) => UserId -> UserClients -> TestM ResponseLBS getMultiUserPrekeyBundleUnqualified zusr userClients = do brig <- view tsUnversionedBrig post @@ -2691,7 +2701,7 @@ withTempMockFederator' resp action = do -- FederatedRequest against it. makeFedRequestToServant :: forall (api :: Type). - HasServer api '[] => + (HasServer api '[]) => Domain -> Server api -> FederatedRequest -> @@ -2739,18 +2749,18 @@ assertRightT = assertRight <=< runExceptT aFewTimes :: TestM a -> (a -> Bool) -> TestM a aFewTimes action good = do env <- ask - liftIO $ - retrying + liftIO + $ retrying (exponentialBackoff 1000 <> limitRetries 11) (\_ -> pure . not . good) (\_ -> runReaderT (runTestM action) env) -aFewTimesAssertBool :: HasCallStack => String -> (a -> Bool) -> TestM a -> TestM () +aFewTimesAssertBool :: (HasCallStack) => String -> (a -> Bool) -> TestM a -> TestM () aFewTimesAssertBool msg good action = do result <- aFewTimes action good liftIO $ assertBool msg (good result) -checkUserUpdateEvent :: HasCallStack => UserId -> WS.WebSocket -> TestM () +checkUserUpdateEvent :: (HasCallStack) => UserId -> WS.WebSocket -> TestM () checkUserUpdateEvent uid w = WS.assertMatch_ checkTimeout w $ \notif -> do let j = Object $ List1.head (ntfPayload notif) let etype = j ^? key "type" . _String @@ -2758,7 +2768,7 @@ checkUserUpdateEvent uid w = WS.assertMatch_ checkTimeout w $ \notif -> do etype @?= Just "user.update" euser @?= Just (UUID.toText (toUUID uid)) -checkUserDeleteEvent :: HasCallStack => UserId -> WS.Timeout -> WS.WebSocket -> TestM () +checkUserDeleteEvent :: (HasCallStack) => UserId -> WS.Timeout -> WS.WebSocket -> TestM () checkUserDeleteEvent uid timeout_ w = WS.assertMatch_ timeout_ w $ \notif -> do let j = Object $ List1.head (ntfPayload notif) let etype = j ^? key "type" . _String @@ -2766,14 +2776,14 @@ checkUserDeleteEvent uid timeout_ w = WS.assertMatch_ timeout_ w $ \notif -> do etype @?= Just "user.delete" euser @?= Just (UUID.toText (toUUID uid)) -checkTeamMemberJoin :: HasCallStack => TeamId -> UserId -> WS.WebSocket -> TestM () +checkTeamMemberJoin :: (HasCallStack) => TeamId -> UserId -> WS.WebSocket -> TestM () checkTeamMemberJoin tid uid w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= True let e = List1.head (WS.unpackPayload notif) e ^. eventTeam @?= tid e ^. eventData @?= EdMemberJoin uid -checkTeamMemberLeave :: HasCallStack => TeamId -> UserId -> WS.WebSocket -> TestM () +checkTeamMemberLeave :: (HasCallStack) => TeamId -> UserId -> WS.WebSocket -> TestM () checkTeamMemberLeave tid usr w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= True let e = List1.head (WS.unpackPayload notif) @@ -2787,7 +2797,7 @@ checkTeamUpdateEvent tid upd w = WS.assertMatch_ checkTimeout w $ \notif -> do e ^. eventTeam @?= tid e ^. eventData @?= EdTeamUpdate upd -checkConvCreateEvent :: (MonadIO m, MonadCatch m) => HasCallStack => ConvId -> WS.WebSocket -> m () +checkConvCreateEvent :: (MonadIO m, MonadCatch m) => (HasCallStack) => ConvId -> WS.WebSocket -> m () checkConvCreateEvent cid w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= False let e = List1.head (WS.unpackPayload notif) @@ -2797,7 +2807,7 @@ checkConvCreateEvent cid w = WS.assertMatch_ checkTimeout w $ \notif -> do other -> assertFailure $ "Unexpected event data: " <> show other wsAssertConvCreate :: - HasCallStack => + (HasCallStack) => Qualified ConvId -> Qualified UserId -> Notification -> @@ -2810,7 +2820,7 @@ wsAssertConvCreate conv eventFrom n = do evtFrom e @?= eventFrom wsAssertConvCreateWithRole :: - HasCallStack => + (HasCallStack) => Qualified ConvId -> Qualified UserId -> Qualified UserId -> @@ -2828,14 +2838,14 @@ wsAssertConvCreateWithRole conv eventFrom selfMember otherMembers n = do where toOtherMember (quid, role) = OtherMember quid Nothing role -checkTeamDeleteEvent :: HasCallStack => TeamId -> WS.WebSocket -> TestM () +checkTeamDeleteEvent :: (HasCallStack) => TeamId -> WS.WebSocket -> TestM () checkTeamDeleteEvent tid w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= False let e = List1.head (WS.unpackPayload notif) e ^. eventTeam @?= tid e ^. eventData @?= EdTeamDelete -checkConvDeleteEvent :: HasCallStack => Qualified ConvId -> WS.WebSocket -> TestM () +checkConvDeleteEvent :: (HasCallStack) => Qualified ConvId -> WS.WebSocket -> TestM () checkConvDeleteEvent cid w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= False let e = List1.head (WS.unpackPayload notif) @@ -2843,7 +2853,7 @@ checkConvDeleteEvent cid w = WS.assertMatch_ checkTimeout w $ \notif -> do evtConv e @?= cid evtData e @?= Conv.EdConvDelete -checkConvMemberLeaveEvent :: HasCallStack => Qualified ConvId -> Qualified UserId -> WS.WebSocket -> TestM () +checkConvMemberLeaveEvent :: (HasCallStack) => Qualified ConvId -> Qualified UserId -> WS.WebSocket -> TestM () checkConvMemberLeaveEvent cid usr w = WS.assertMatch_ checkTimeout w $ \notif -> do ntfTransient notif @?= False let e = List1.head (WS.unpackPayload notif) @@ -2863,11 +2873,11 @@ mockedFederatedBrigResponse users = do guardComponent Brig mockReply [mkProfile mem (Name name) | (mem, name) <- users] -fedRequestsForDomain :: HasCallStack => Domain -> Component -> [FederatedRequest] -> [FederatedRequest] +fedRequestsForDomain :: (HasCallStack) => Domain -> Component -> [FederatedRequest] -> [FederatedRequest] fedRequestsForDomain domain component = filter $ \req -> frTargetDomain req == domain && frComponent req == component -parseFedRequest :: FromJSON a => FederatedRequest -> Either String a +parseFedRequest :: (FromJSON a) => FederatedRequest -> Either String a parseFedRequest fr = eitherDecode (frBody fr) assertOne :: (HasCallStack, MonadIO m, Show a) => [a] -> m a @@ -2895,7 +2905,7 @@ iUpsertOne2OneConversation req = do galley <- viewGalley post (galley . path "/i/conversations/one2one/upsert" . Bilge.json req) -createOne2OneConvWithRemote :: HasCallStack => Local UserId -> Remote UserId -> TestM () +createOne2OneConvWithRemote :: (HasCallStack) => Local UserId -> Remote UserId -> TestM () createOne2OneConvWithRemote localUser remoteUser = do let convId = one2OneConvId BaseProtocolProteusTag (tUntagged localUser) (tUntagged remoteUser) mkRequest actor = @@ -2924,10 +2934,12 @@ generateRemoteAndConvIdWithDomain remoteDomain shouldBeLocal lUserId = do matchFedRequest :: Domain -> Text -> FederatedRequest -> Bool matchFedRequest domain reqpath req = - frTargetDomain req == domain - && frRPC req == reqpath + frTargetDomain req + == domain + && frRPC req + == reqpath -spawn :: HasCallStack => CreateProcess -> Maybe ByteString -> IO ByteString +spawn :: (HasCallStack) => CreateProcess -> Maybe ByteString -> IO ByteString spawn cp minput = do (mout, ex) <- withCreateProcess cp @@ -2943,7 +2955,7 @@ spawn cp minput = do (Just out, ExitSuccess) -> pure out _ -> assertFailure "Process didn't finish successfully" -decodeMLSError :: ParseMLS a => ByteString -> IO a +decodeMLSError :: (ParseMLS a) => ByteString -> IO a decodeMLSError s = case decodeMLS' s of Left e -> assertFailure ("Could not parse MLS object: " <> Text.unpack e) Right x -> pure x @@ -2957,7 +2969,7 @@ wsAssertConvReceiptModeUpdate conv usr new n = do evtFrom e @?= usr evtData e @?= EdConvReceiptModeUpdate (ConversationReceiptModeUpdate new) -wsAssertBackendRemoveProposalWithEpoch :: HasCallStack => Qualified UserId -> Qualified ConvId -> LeafIndex -> Epoch -> Notification -> IO ByteString +wsAssertBackendRemoveProposalWithEpoch :: (HasCallStack) => Qualified UserId -> Qualified ConvId -> LeafIndex -> Epoch -> Notification -> IO ByteString wsAssertBackendRemoveProposalWithEpoch fromUser convId idx epoch n = do bs <- wsAssertBackendRemoveProposal fromUser (Conv <$> convId) idx n let msg = fromRight (error "Failed to parse Message") $ decodeMLS' @Message bs @@ -2966,7 +2978,7 @@ wsAssertBackendRemoveProposalWithEpoch fromUser convId idx epoch n = do _ -> assertFailure "unexpected message content" pure bs -wsAssertBackendRemoveProposal :: HasCallStack => Qualified UserId -> Qualified ConvOrSubConvId -> LeafIndex -> Notification -> IO ByteString +wsAssertBackendRemoveProposal :: (HasCallStack) => Qualified UserId -> Qualified ConvOrSubConvId -> LeafIndex -> Notification -> IO ByteString wsAssertBackendRemoveProposal fromUser cnvOrSubCnv idx n = do let e = List1.head (WS.unpackPayload n) ntfTransient n @?= False @@ -2991,7 +3003,7 @@ wsAssertBackendRemoveProposal fromUser cnvOrSubCnv idx n = do getMLSMessageData d = error ("Expected EdMLSMessage, but got " <> show d) wsAssertAddProposal :: - HasCallStack => + (HasCallStack) => Qualified UserId -> Qualified ConvId -> Notification -> diff --git a/services/galley/test/integration/API/Util/TeamFeature.hs b/services/galley/test/integration/API/Util/TeamFeature.hs index 3191a4849ce..0f1e3e91ded 100644 --- a/services/galley/test/integration/API/Util/TeamFeature.hs +++ b/services/galley/test/integration/API/Util/TeamFeature.hs @@ -46,13 +46,13 @@ withCustomSearchFeature flag action = do Util.withSettingsOverrides (\opts -> opts & settings . featureFlags . flagTeamSearchVisibility .~ flag) action putTeamSearchVisibilityAvailableInternal :: - HasCallStack => + (HasCallStack) => TeamId -> Public.FeatureStatus -> (MonadIO m, MonadHttp m, HasGalley m) => m () putTeamSearchVisibilityAvailableInternal tid statusValue = - void $ - putTeamFeatureInternal + void + $ putTeamFeatureInternal @Public.SearchVisibilityAvailableConfig expect2xx tid @@ -65,9 +65,9 @@ getTeamFeatureInternal :: m ResponseLBS getTeamFeatureInternal tid = do g <- viewGalley - get $ - g - . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] + get + $ g + . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] getTeamFeature :: forall cfg m. @@ -77,10 +77,10 @@ getTeamFeature :: m ResponseLBS getTeamFeature uid tid = do galley <- viewGalley - get $ - galley - . paths ["teams", toByteString' tid, "features", Public.featureNameBS @cfg] - . zUser uid + get + $ galley + . paths ["teams", toByteString' tid, "features", Public.featureNameBS @cfg] + . zUser uid getAllTeamFeatures :: (HasCallStack, HasGalley m, MonadIO m, MonadHttp m) => @@ -89,10 +89,10 @@ getAllTeamFeatures :: m ResponseLBS getAllTeamFeatures uid tid = do g <- viewGalley - get $ - g - . paths ["teams", toByteString' tid, "features"] - . zUser uid + get + $ g + . paths ["teams", toByteString' tid, "features"] + . zUser uid getTeamFeatureFromAll :: forall cfg m. @@ -122,10 +122,10 @@ getAllFeatureConfigs :: m ResponseLBS getAllFeatureConfigs uid = do g <- viewGalley - get $ - g - . paths ["feature-configs"] - . zUser uid + get + $ g + . paths ["feature-configs"] + . zUser uid getFeatureConfig :: forall cfg m. @@ -159,11 +159,11 @@ putTeamFeature :: TestM ResponseLBS putTeamFeature uid tid status = do galley <- viewGalley - put $ - galley - . paths ["teams", toByteString' tid, "features", Public.featureNameBS @cfg] - . json status - . zUser uid + put + $ galley + . paths ["teams", toByteString' tid, "features", Public.featureNameBS @cfg] + . json status + . zUser uid putTeamFeatureInternal :: forall cfg m. @@ -180,11 +180,11 @@ putTeamFeatureInternal :: m ResponseLBS putTeamFeatureInternal reqmod tid status = do galley <- viewGalley - put $ - galley - . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] - . json status - . reqmod + put + $ galley + . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] + . json status + . reqmod setLockStatusInternal :: forall cfg. @@ -197,10 +197,10 @@ setLockStatusInternal :: TestM ResponseLBS setLockStatusInternal reqmod tid lockStatus = do galley <- viewGalley - put $ - galley - . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg, toByteString' lockStatus] - . reqmod + put + $ galley + . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg, toByteString' lockStatus] + . reqmod patchTeamFeatureInternal :: forall cfg. @@ -225,23 +225,23 @@ patchTeamFeatureInternalWithMod :: TestM ResponseLBS patchTeamFeatureInternalWithMod reqmod tid reqBody = do galley <- viewGalley - patch $ - galley - . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] - . json reqBody - . reqmod + patch + $ galley + . paths ["i", "teams", toByteString' tid, "features", Public.featureNameBS @cfg] + . json reqBody + . reqmod getGuestLinkStatus :: - HasCallStack => + (HasCallStack) => (Request -> Request) -> UserId -> ConvId -> TestM ResponseLBS getGuestLinkStatus galley u cid = - get $ - galley - . paths ["conversations", toByteString' cid, "features", Public.featureNameBS @Public.GuestLinksConfig] - . zUser u + get + $ galley + . paths ["conversations", toByteString' cid, "features", Public.featureNameBS @Public.GuestLinksConfig] + . zUser u checkTeamFeatureAllEndpoints :: forall cfg. @@ -276,9 +276,12 @@ checkTeamFeatureAllEndpoints uid tid expected = do checkTtl (FeatureTTLSeconds actualTtl) (FeatureTTLSeconds expectedTtl) = assertBool ("expected the actual TTL to be greater than 0 and equal to or no more than 2 seconds less than " <> show expectedTtl <> ", but it was " <> show actualTtl) - ( actualTtl > 0 - && actualTtl <= expectedTtl - && abs (fromIntegral @Word @Int actualTtl - fromIntegral @Word @Int expectedTtl) <= 2 + ( actualTtl + > 0 + && actualTtl + <= expectedTtl + && abs (fromIntegral @Word @Int actualTtl - fromIntegral @Word @Int expectedTtl) + <= 2 ) checkTtl FeatureTTLUnlimited FeatureTTLUnlimited = pure () checkTtl FeatureTTLUnlimited _ = assertFailure "expected the actual TTL to be unlimited, but it was limited" diff --git a/services/galley/test/integration/Federation.hs b/services/galley/test/integration/Federation.hs index 666c557ad7d..eb081783421 100644 --- a/services/galley/test/integration/Federation.hs +++ b/services/galley/test/integration/Federation.hs @@ -41,8 +41,8 @@ isConvMemberLTests = do convLocalMembers = [LocalMember userId defMemberStatus Nothing roleNameWireMember] convRemoteMembers = [RemoteMember rUserId roleNameWireMember] lconv = - toLocalUnsafe localDomain $ - Types.Conversation + toLocalUnsafe localDomain + $ Types.Conversation convId convLocalMembers convRemoteMembers diff --git a/services/galley/test/integration/Run.hs b/services/galley/test/integration/Run.hs index a5d212c39b4..0ff61fc1322 100644 --- a/services/galley/test/integration/Run.hs +++ b/services/galley/test/integration/Run.hs @@ -64,18 +64,18 @@ instance IsOption ServiceConfigFile where optionName = pure "service-config" optionHelp = pure "Service config file to read from" optionCLParser = - fmap ServiceConfigFile $ - strOption $ - ( short (untag (pure 's' :: Tagged ServiceConfigFile Char)) + fmap ServiceConfigFile + $ strOption + $ ( short (untag (pure 's' :: Tagged ServiceConfigFile Char)) <> long (untag (optionName :: Tagged ServiceConfigFile String)) <> help (untag (optionHelp :: Tagged ServiceConfigFile String)) ) runTests :: (String -> String -> TestTree) -> IO () -runTests run = defaultMainWithIngredients ings $ - askOption $ - \(ServiceConfigFile c) -> - askOption $ \(IntegrationConfigFile i) -> run c i +runTests run = defaultMainWithIngredients ings + $ askOption + $ \(ServiceConfigFile c) -> + askOption $ \(IntegrationConfigFile i) -> run c i where ings = includingOptions diff --git a/services/galley/test/unit/Run.hs b/services/galley/test/unit/Run.hs index bcf3593c74c..f2f240c5a0e 100644 --- a/services/galley/test/unit/Run.hs +++ b/services/galley/test/unit/Run.hs @@ -30,8 +30,8 @@ import Test.Tasty main :: IO () main = - defaultMain $ - testGroup + defaultMain + $ testGroup "Tests" [ Test.Galley.API.Message.tests, Test.Galley.API.One2One.tests, diff --git a/services/galley/test/unit/Test/Galley/API/Message.hs b/services/galley/test/unit/Test/Galley/API/Message.hs index 18c9512c665..244f429157a 100644 --- a/services/galley/test/unit/Test/Galley/API/Message.hs +++ b/services/galley/test/unit/Test/Galley/API/Message.hs @@ -47,10 +47,10 @@ tests = flatten :: Map Domain (Map UserId (Set ClientId)) -> Set (Domain, UserId, ClientId) flatten = - setOf $ - (itraversed <.> itraversed <. folded) - . withIndex - . to (\((d, u), c) -> (d, u, c)) + setOf + $ (itraversed <.> itraversed <. folded) + . withIndex + . to (\((d, u), c) -> (d, u, c)) type QualifiedUserClient = (Domain, UserId, ClientId) @@ -58,8 +58,8 @@ recipientSetToMap :: Set QualifiedUserClient -> Map (Domain, UserId) (Set Client recipientSetToMap = Set.foldr (\(d, u, c) m -> Map.insertWith Set.union (d, u) (Set.singleton c) m) mempty checkMessageClientSuccess :: TestTree -checkMessageClientSuccess = testProperty "success" $ - \(sender :: QualifiedUserClient) (msg :: Map QualifiedUserClient ByteString) (strat :: ClientMismatchStrategy) -> +checkMessageClientSuccess = testProperty "success" + $ \(sender :: QualifiedUserClient) (msg :: Map QualifiedUserClient ByteString) (strat :: ClientMismatchStrategy) -> let expectedRecipients = Map.keysSet msg expectedRecipientMap = recipientSetToMap expectedRecipients in not (Map.member sender msg) ==> @@ -67,8 +67,8 @@ checkMessageClientSuccess = testProperty "success" $ === (True, msg, QualifiedMismatch mempty mempty mempty) checkMessageClientRedundantSender :: TestTree -checkMessageClientRedundantSender = testProperty "sender should be part of redundant" $ - \(msg0 :: Map QualifiedUserClient ByteString) (sender :: QualifiedUserClient) (strat :: ClientMismatchStrategy) -> +checkMessageClientRedundantSender = testProperty "sender should be part of redundant" + $ \(msg0 :: Map QualifiedUserClient ByteString) (sender :: QualifiedUserClient) (strat :: ClientMismatchStrategy) -> let msg = Map.insert sender "msg to self" msg0 expectedRecipients = Map.keysSet msg0 expectedRecipientMap = recipientSetToMap expectedRecipients @@ -80,8 +80,8 @@ checkMessageClientRedundantSender = testProperty "sender should be part of redun -- don't always get a disjoint set between the intended recipietns and expected -- recipients. checkMessageClientEverythingReported :: TestTree -checkMessageClientEverythingReported = testProperty "all intended and expected recipients should be part of valid and extras" $ - \(sender :: QualifiedUserClient) (expected' :: Set QualifiedUserClient) (msg0 :: Map QualifiedUserClient ByteString) (msg' :: Map QualifiedUserClient ByteString) -> +checkMessageClientEverythingReported = testProperty "all intended and expected recipients should be part of valid and extras" + $ \(sender :: QualifiedUserClient) (expected' :: Set QualifiedUserClient) (msg0 :: Map QualifiedUserClient ByteString) (msg' :: Map QualifiedUserClient ByteString) -> let expectedRecipients = Map.keysSet msg0 <> expected' expectedRecipientMap = recipientSetToMap expectedRecipients msg = msg0 <> msg' @@ -93,8 +93,8 @@ checkMessageClientEverythingReported = testProperty "all intended and expected r === intendedRecipients <> expectedRecipients checkMessageClientMissingSubsetOfStrategy :: TestTree -checkMessageClientMissingSubsetOfStrategy = testProperty "missing clients should be a subset of the clients determined by the strategy" $ - \(sender :: QualifiedUserClient) (expected' :: Set QualifiedUserClient) (msg0 :: Map QualifiedUserClient ByteString) (msg' :: Map QualifiedUserClient ByteString) (strat :: ClientMismatchStrategy) -> +checkMessageClientMissingSubsetOfStrategy = testProperty "missing clients should be a subset of the clients determined by the strategy" + $ \(sender :: QualifiedUserClient) (expected' :: Set QualifiedUserClient) (msg0 :: Map QualifiedUserClient ByteString) (msg' :: Map QualifiedUserClient ByteString) (strat :: ClientMismatchStrategy) -> let expected = Map.keysSet msg0 <> expected' expectedMap = recipientSetToMap expected msg = msg0 <> msg' @@ -110,44 +110,44 @@ testBuildFailedToSend = [ testProperty "Empty case - trivial" $ collectFailedToSend [] - === mempty, + === mempty, testProperty "Empty case - single empty map" $ collectFailedToSend [mempty] - === mempty, + === mempty, testProperty "Empty case - multiple empty maps" $ collectFailedToSend [mempty, mempty] - === mempty, + === mempty, testProperty "Single domain" $ collectFailedToSend [Map.singleton (Domain "foo") mempty] - === Map.singleton (Domain "foo") mempty, + === Map.singleton (Domain "foo") mempty, testProperty "Single domain duplicated" $ collectFailedToSend [Map.singleton (Domain "foo") mempty, Map.singleton (Domain "foo") mempty] - === Map.singleton (Domain "foo") mempty, + === Map.singleton (Domain "foo") mempty, testProperty "Mutliple domains in multiple maps" $ collectFailedToSend [Map.singleton (Domain "foo") mempty, Map.singleton (Domain "bar") mempty] - === Map.fromList [(Domain "foo", mempty), (Domain "bar", mempty)], + === Map.fromList [(Domain "foo", mempty), (Domain "bar", mempty)], testProperty "Mutliple domains in single map" $ collectFailedToSend [Map.fromList [(Domain "foo", mempty), (Domain "bar", mempty)]] - === Map.fromList [(Domain "foo", mempty), (Domain "bar", mempty)], + === Map.fromList [(Domain "foo", mempty), (Domain "bar", mempty)], testProperty "Single domain duplicated with unique sub-maps" $ collectFailedToSend [ Map.singleton (Domain "foo") $ Map.singleton idA mempty, Map.singleton (Domain "foo") $ Map.singleton idB mempty ] - === Map.singleton - (Domain "foo") - ( Map.fromList - [ (idA, mempty), - (idB, mempty) - ] - ) + === Map.singleton + (Domain "foo") + ( Map.fromList + [ (idA, mempty), + (idB, mempty) + ] + ) ] where idA = Id $ fromJust $ Data.UUID.Types.fromString "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" diff --git a/services/galley/test/unit/Test/Galley/Intra/User.hs b/services/galley/test/unit/Test/Galley/Intra/User.hs index f90bdc7e139..f031206d079 100644 --- a/services/galley/test/unit/Test/Galley/Intra/User.hs +++ b/services/galley/test/unit/Test/Galley/Intra/User.hs @@ -35,7 +35,7 @@ tests = [ testChunkify ] -testChunkify :: HasCallStack => TestTree +testChunkify :: (HasCallStack) => TestTree testChunkify = testGroup "chunkify" diff --git a/services/galley/test/unit/Test/Galley/Mapping.hs b/services/galley/test/unit/Test/Galley/Mapping.hs index c18bb63f903..6d20ab0f3d7 100644 --- a/services/galley/test/unit/Test/Galley/Mapping.hs +++ b/services/galley/test/unit/Test/Galley/Mapping.hs @@ -52,46 +52,46 @@ tests :: TestTree tests = testGroup "ConversationMapping" - [ testProperty "conversation view for a valid user is non-empty" $ - \(ConvWithLocalUser c luid) -> isRight (run (conversationView luid c)), - testProperty "self user in conversation view is correct" $ - \(ConvWithLocalUser c luid) -> + [ testProperty "conversation view for a valid user is non-empty" + $ \(ConvWithLocalUser c luid) -> isRight (run (conversationView luid c)), + testProperty "self user in conversation view is correct" + $ \(ConvWithLocalUser c luid) -> fmap (memId . cmSelf . cnvMembers) (run (conversationView luid c)) == Right (tUntagged luid), - testProperty "conversation view metadata is correct" $ - \(ConvWithLocalUser c luid) -> + testProperty "conversation view metadata is correct" + $ \(ConvWithLocalUser c luid) -> fmap cnvMetadata (run (conversationView luid c)) == Right (Data.convMetadata c), - testProperty "other members in conversation view do not contain self" $ - \(ConvWithLocalUser c luid) -> case run $ conversationView luid c of + testProperty "other members in conversation view do not contain self" + $ \(ConvWithLocalUser c luid) -> case run $ conversationView luid c of Left _ -> False Right cnv -> tUntagged luid `notElem` map omQualifiedId (cmOthers (cnvMembers cnv)), - testProperty "conversation view contains all users" $ - \(ConvWithLocalUser c luid) -> + testProperty "conversation view contains all users" + $ \(ConvWithLocalUser c luid) -> fmap (sort . cnvUids) (run (conversationView luid c)) == Right (sort (convUids (tDomain luid) c)), - testProperty "conversation view for an invalid user is empty" $ - \(RandomConversation c) luid -> + testProperty "conversation view for an invalid user is empty" + $ \(RandomConversation c) luid -> notElem (tUnqualified luid) (map lmId (Data.convLocalMembers c)) ==> isLeft (run (conversationView luid c)), - testProperty "remote conversation view for a valid user is non-empty" $ - \(ConvWithRemoteUser c ruid) dom -> + testProperty "remote conversation view for a valid user is non-empty" + $ \(ConvWithRemoteUser c ruid) dom -> qDomain (tUntagged ruid) /= dom ==> isJust (conversationToRemote dom ruid c), - testProperty "self user role in remote conversation view is correct" $ - \(ConvWithRemoteUser c ruid) dom -> + testProperty "self user role in remote conversation view is correct" + $ \(ConvWithRemoteUser c ruid) dom -> qDomain (tUntagged ruid) /= dom ==> fmap (selfRole . members) (conversationToRemote dom ruid c) == Just roleNameWireMember, - testProperty "remote conversation view metadata is correct" $ - \(ConvWithRemoteUser c ruid) dom -> + testProperty "remote conversation view metadata is correct" + $ \(ConvWithRemoteUser c ruid) dom -> qDomain (tUntagged ruid) /= dom ==> fmap (.metadata) (conversationToRemote dom ruid c) == Just (Data.convMetadata c), - testProperty "remote conversation view does not contain self" $ - \(ConvWithRemoteUser c ruid) dom -> case conversationToRemote dom ruid c of + testProperty "remote conversation view does not contain self" + $ \(ConvWithRemoteUser c ruid) dom -> case conversationToRemote dom ruid c of Nothing -> False Just rcnv -> tUntagged ruid diff --git a/services/gundeck/migrate-data/src/Gundeck/DataMigration.hs b/services/gundeck/migrate-data/src/Gundeck/DataMigration.hs index 6c01b748bf7..bb59c0d899b 100644 --- a/services/gundeck/migrate-data/src/Gundeck/DataMigration.hs +++ b/services/gundeck/migrate-data/src/Gundeck/DataMigration.hs @@ -76,8 +76,8 @@ migrate l cas ms = do finally (go env) (cleanup env) where go env = - runMigrationAction env $ - runMigrations ms + runMigrationAction env + $ runMigrations ms mkEnv :: Logger -> CassandraSettings -> IO Env mkEnv l cas = @@ -116,5 +116,5 @@ persistVersion (MigrationVersion v) desc time = C.write cql (C.params C.LocalQuo cql :: C.QueryString C.W (Int32, Text, UTCTime) () cql = "insert into data_migration (id, version, descr, date) values (1,?,?,?)" -info :: Log.MonadLogger m => String -> m () +info :: (Log.MonadLogger m) => String -> m () info = Log.info . Log.msg diff --git a/services/gundeck/migrate-data/src/Gundeck/DataMigration/Types.hs b/services/gundeck/migrate-data/src/Gundeck/DataMigration/Types.hs index 4ad3dbb20d9..99f9d47609a 100644 --- a/services/gundeck/migrate-data/src/Gundeck/DataMigration/Types.hs +++ b/services/gundeck/migrate-data/src/Gundeck/DataMigration/Types.hs @@ -53,7 +53,7 @@ instance (MonadIO m, MonadThrow m) => C.MonadClient (MigrationActionT m) where liftClient = liftCassandra localState f = local (\env -> env {cassandraClientState = f $ cassandraClientState env}) -instance MonadIO m => MonadLogger (MigrationActionT m) where +instance (MonadIO m) => MonadLogger (MigrationActionT m) where log level f = do env <- ask Logger.log (logger env) level f @@ -67,7 +67,7 @@ runMigrationAction :: Env -> MigrationActionT m a -> m a runMigrationAction env action = runReaderT (unMigrationAction action) env -liftCassandra :: MonadIO m => C.Client a -> MigrationActionT m a +liftCassandra :: (MonadIO m) => C.Client a -> MigrationActionT m a liftCassandra m = do env <- ask lift $ C.runClient (cassandraClientState env) m diff --git a/services/gundeck/migrate-data/src/V1_DeleteApnsVoipTokens.hs b/services/gundeck/migrate-data/src/V1_DeleteApnsVoipTokens.hs index 0c7645797b8..a42a5e22848 100644 --- a/services/gundeck/migrate-data/src/V1_DeleteApnsVoipTokens.hs +++ b/services/gundeck/migrate-data/src/V1_DeleteApnsVoipTokens.hs @@ -33,18 +33,18 @@ migration = { version = MigrationVersion 1, text = "Delete APNS_VOIP push tokens", action = - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) getPushTokens - .| C.mapM - ( \(i, p) -> - Log.info (Log.field "push tokens" (show (i * pageSize))) - >> pure p - ) - .| C.concatMap (filter isVoipToken) - .| C.map (\(uid, token, app, transport, _mArn) -> (uid, token, app, transport)) - .| C.mapM_ deletePushToken + .| C.mapM + ( \(i, p) -> + Log.info (Log.field "push tokens" (show (i * pageSize))) + >> pure p + ) + .| C.concatMap (filter isVoipToken) + .| C.map (\(uid, token, app, transport, _mArn) -> (uid, token, app, transport)) + .| C.mapM_ deletePushToken } pageSize :: Int32 @@ -56,14 +56,14 @@ pageSize = 1000 -- | We do not use the push token types here because they will likely be -- changed in future breaking this migration. getPushTokens :: - MonadClient m => + (MonadClient m) => ConduitM () [(UserId, Text, Text, Int32, Maybe Text)] m () getPushTokens = paginateC cql (paramsP LocalQuorum () pageSize) x5 where cql :: PrepQuery R () (UserId, Text, Text, Int32, Maybe Text) cql = "SELECT usr, ptoken, app, transport, arn FROM user_push" -deletePushToken :: MonadClient m => (UserId, Text, Text, Int32) -> m () +deletePushToken :: (MonadClient m) => (UserId, Text, Text, Int32) -> m () deletePushToken pair = retry x5 $ write cql (params LocalQuorum pair) where diff --git a/services/gundeck/src/Gundeck/API/Internal.hs b/services/gundeck/src/Gundeck/API/Internal.hs index 357d49bfe83..40b16cfad5e 100644 --- a/services/gundeck/src/Gundeck/API/Internal.hs +++ b/services/gundeck/src/Gundeck/API/Internal.hs @@ -43,33 +43,40 @@ sitemap = do -- Push API ----------------------------------------------------------- - post "/i/push/v2" (continue pushH) $ - request .&. accept "application" "json" + post "/i/push/v2" (continue pushH) + $ request + .&. accept "application" "json" -- Presence API ---------------------------------------------------------- - get "/i/presences/:uid" (continue Presence.list) $ - param "uid" .&. accept "application" "json" + get "/i/presences/:uid" (continue Presence.list) + $ param "uid" + .&. accept "application" "json" - get "/i/presences" (continue Presence.listAll) $ - param "ids" .&. accept "application" "json" + get "/i/presences" (continue Presence.listAll) + $ param "ids" + .&. accept "application" "json" - post "/i/presences" (continue Presence.add) $ - request .&. accept "application" "json" + post "/i/presences" (continue Presence.add) + $ request + .&. accept "application" "json" - delete "/i/presences/:uid/devices/:did/cannons/:cannon" (continue Presence.remove) $ - param "uid" .&. param "did" .&. param "cannon" + delete "/i/presences/:uid/devices/:did/cannons/:cannon" (continue Presence.remove) + $ param "uid" + .&. param "did" + .&. param "cannon" -- User-Client API ------------------------------------------------------- - delete "/i/clients/:cid" (continue unregisterClientH) $ - header "Z-User" .&. param "cid" + delete "/i/clients/:cid" (continue unregisterClientH) + $ header "Z-User" + .&. param "cid" - delete "/i/user" (continue removeUserH) $ - header "Z-User" + delete "/i/user" (continue removeUserH) + $ header "Z-User" - get "/i/push-tokens/:uid" (continue getPushTokensH) $ - param "uid" + get "/i/push-tokens/:uid" (continue getPushTokensH) + $ param "uid" type JSON = Media "application" "json" diff --git a/services/gundeck/src/Gundeck/API/Public.hs b/services/gundeck/src/Gundeck/API/Public.hs index e2034b3d62e..cf4fb549370 100644 --- a/services/gundeck/src/Gundeck/API/Public.hs +++ b/services/gundeck/src/Gundeck/API/Public.hs @@ -92,8 +92,8 @@ paginateUntilV2 :: paginateUntilV2 uid mbSince mbClient mbSize = do let size = fromMaybe (unsafeRange 1000) mbSize Notification.PaginateResult gap page <- Notification.paginate uid (join since) mbClient size - pure $ - if gap + pure + $ if gap then Public.GetNotificationsWithStatusNotFound page else case since of Just (Just _) -> Public.GetNotificationsSuccess page diff --git a/services/gundeck/src/Gundeck/Aws.hs b/services/gundeck/src/Gundeck/Aws.hs index ea5fe968866..aeafb64b7a2 100644 --- a/services/gundeck/src/Gundeck/Aws.hs +++ b/services/gundeck/src/Gundeck/Aws.hs @@ -168,8 +168,8 @@ mkEnv lgr opts mgr = do <&> do AWS.configureService sqs >>> AWS.configureService (sns & set AWS.service_timeout (Just (AWS.Seconds 5))) - pure $ - baseEnv + pure + $ baseEnv { AWS.logger = awsLogger g, AWS.region = opts ^. O.aws . O.region, AWS.retryCheck = retryCheck, @@ -208,15 +208,15 @@ mkEnv lgr opts mgr = do getQueueUrl :: AWS.Env -> Text -> IO QueueUrl getQueueUrl e q = do x <- - runResourceT $ - AWS.trying AWS._Error $ - AWS.send e (SQS.newGetQueueUrl q) + runResourceT + $ AWS.trying AWS._Error + $ AWS.send e (SQS.newGetQueueUrl q) either (throwM . GeneralError) (pure . QueueUrl . view SQS.getQueueUrlResponse_queueUrl) x -execute :: MonadIO m => Env -> Amazon a -> m a +execute :: (MonadIO m) => Env -> Amazon a -> m a execute e m = liftIO $ runResourceT (runReaderT (unAmazon m) e) -------------------------------------------------------------------------------- @@ -246,12 +246,14 @@ updateEndpoint us tk arn = do Right _ -> pure () Left x@(AWS.ServiceError e) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isMetadataLengthError (e ^. serviceError_message) -> + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isMetadataLengthError (e ^. serviceError_message) -> throwM $ InvalidCustomData arn Left x -> - throwM $ - if is "SNS" 404 x + throwM + $ if is "SNS" 404 x then EndpointNotFound arn else GeneralError x where @@ -313,15 +315,19 @@ createEndpoint u tr arnEnv app token = do Just ep <- parseExistsError (e ^. serviceError_message) -> pure (Left (EndpointInUse ep)) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isLengthError (e ^. serviceError_message) -> + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isLengthError (e ^. serviceError_message) -> pure (Left (TokenTooLong $ tokenLength token)) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isTokenError (e ^. serviceError_message) -> do - debug $ - msg @Text "InvalidParameter: InvalidToken" - . field "response" (show x) + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isTokenError (e ^. serviceError_message) -> do + debug + $ msg @Text "InvalidParameter: InvalidToken" + . field "response" (show x) pure (Left (InvalidToken token)) | is "SNS" 404 x -> pure (Left (AppNotFound app)) @@ -419,19 +425,27 @@ publish arn txt attrs = do | is "SNS" 400 x && AWS.newErrorCode "EndpointDisabled" == e ^. serviceError_code -> pure (Left (EndpointDisabled arn)) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isProtocolSizeError (e ^. serviceError_message) -> + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isProtocolSizeError (e ^. serviceError_message) -> pure (Left (PayloadTooLarge arn)) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isSnsSizeError (e ^. serviceError_message) -> + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isSnsSizeError (e ^. serviceError_message) -> pure (Left (PayloadTooLarge arn)) | is "SNS" 400 x - && AWS.newErrorCode "InvalidParameter" == e ^. serviceError_code - && isArnError (e ^. serviceError_message) -> + && AWS.newErrorCode "InvalidParameter" + == e + ^. serviceError_code + && isArnError (e ^. serviceError_message) -> pure (Left (InvalidEndpoint arn)) | is "SNS" 403 x - && AWS.newErrorCode "AuthorizationError" == e ^. serviceError_code -> + && AWS.newErrorCode "AuthorizationError" + == e + ^. serviceError_code -> pure (Left (UnauthorisedEndpoint arn)) Left x -> throwM (GeneralError x) where @@ -466,8 +480,8 @@ listen throttleMillis callback = do forever . handleAny unexpectedError $ do msgs <- fromMaybe [] . view SQS.receiveMessageResponse_messages <$> send amazonkaEnv (receive url) void $ mapConcurrently (onMessage amazonkaEnv url) msgs - when (null msgs) $ - threadDelay (1000 * throttleMillis) + when (null msgs) + $ threadDelay (1000 * throttleMillis) where receive url = SQS.newReceiveMessage url @@ -478,9 +492,11 @@ listen throttleMillis callback = do Nothing -> err . msg $ val "Failed to parse SQS event notification" Just e -> do - info $ - "sqs-event" .= toText (e ^. evType) - ~~ "arn" .= toText (e ^. evEndpoint) + info + $ "sqs-event" + .= toText (e ^. evType) + ~~ "arn" + .= toText (e ^. evEndpoint) ~~ msg (val "Received SQS event") liftIO $ callback e for_ (m ^. message_receiptHandle) (void . send awsE . SQS.newDeleteMessage url) diff --git a/services/gundeck/src/Gundeck/Aws/Arn.hs b/services/gundeck/src/Gundeck/Aws/Arn.hs index 17588d08106..0ff914c5d57 100644 --- a/services/gundeck/src/Gundeck/Aws/Arn.hs +++ b/services/gundeck/src/Gundeck/Aws/Arn.hs @@ -114,7 +114,7 @@ instance ToText EndpointTopic where instance FromText EndpointTopic where fromText = parseOnly endpointTopicParser -mkSnsArn :: ToText topic => Region -> Account -> topic -> SnsArn topic +mkSnsArn :: (ToText topic) => Region -> Account -> topic -> SnsArn topic mkSnsArn r a t = let txt = Text.intercalate ":" ["arn:aws:sns", toText r, toText a, toText t] in SnsArn txt r a t @@ -164,8 +164,13 @@ endpointTopicParser = do transportParser :: Parser Transport transportParser = - string "GCM" $> GCM - <|> string "APNS_VOIP_SANDBOX" $> APNSVoIPSandbox - <|> string "APNS_VOIP" $> APNSVoIP - <|> string "APNS_SANDBOX" $> APNSSandbox - <|> string "APNS" $> APNS + string "GCM" + $> GCM + <|> string "APNS_VOIP_SANDBOX" + $> APNSVoIPSandbox + <|> string "APNS_VOIP" + $> APNSVoIP + <|> string "APNS_SANDBOX" + $> APNSSandbox + <|> string "APNS" + $> APNS diff --git a/services/gundeck/src/Gundeck/Env.hs b/services/gundeck/src/Gundeck/Env.hs index 8fc8b78abaf..81f37d4c52a 100644 --- a/services/gundeck/src/Gundeck/Env.hs +++ b/services/gundeck/src/Gundeck/Env.hs @@ -143,10 +143,10 @@ createRedisPool l ep username password identifier = do Redis.connectTLSParams = tlsParams } - Log.info l $ - Log.msg (Log.val $ "starting connection to " <> identifier <> "...") - . Log.field "connectionMode" (show $ ep ^. O.connectionMode) - . Log.field "connInfo" (safeShowConnInfo redisConnInfo) + Log.info l + $ Log.msg (Log.val $ "starting connection to " <> identifier <> "...") + . Log.field "connectionMode" (show $ ep ^. O.connectionMode) + . Log.field "connInfo" (safeShowConnInfo redisConnInfo) let connectWithRetry = Redis.connectRobust l (capDelay 1000000 (exponentialBackoff 50000)) r <- case ep ^. O.connectionMode of Master -> connectWithRetry $ Redis.checkedConnect redisConnInfo diff --git a/services/gundeck/src/Gundeck/Instances.hs b/services/gundeck/src/Gundeck/Instances.hs index 83ab2a692b4..12286801806 100644 --- a/services/gundeck/src/Gundeck/Instances.hs +++ b/services/gundeck/src/Gundeck/Instances.hs @@ -83,8 +83,9 @@ instance ToText (Id a) where instance FromText (Id a) where fromText = - Parser.parseOnly $ - Parser.take 36 >>= \txt -> + Parser.parseOnly + $ Parser.take 36 + >>= \txt -> txt & Text.encodeUtf8 & Uuid.fromASCIIBytes diff --git a/services/gundeck/src/Gundeck/Monad.hs b/services/gundeck/src/Gundeck/Monad.hs index a3a9207864f..1f9cb150e45 100644 --- a/services/gundeck/src/Gundeck/Monad.hs +++ b/services/gundeck/src/Gundeck/Monad.hs @@ -114,7 +114,7 @@ instance Redis.MonadRedis WithDefaultRedis where Redis.runRobust defaultConn action instance Redis.RedisCtx WithDefaultRedis (Either Redis.Reply) where - returnDecode :: Redis.RedisResult a => Redis.Reply -> WithDefaultRedis (Either Redis.Reply a) + returnDecode :: (Redis.RedisResult a) => Redis.Reply -> WithDefaultRedis (Either Redis.Reply a) returnDecode = Redis.liftRedis . Redis.returnDecode -- | 'Gundeck' doesn't have an instance for 'MonadRedis' because it contains two @@ -151,7 +151,7 @@ instance Redis.MonadRedis WithAdditionalRedis where pure ret instance Redis.RedisCtx WithAdditionalRedis (Either Redis.Reply) where - returnDecode :: Redis.RedisResult a => Redis.Reply -> WithAdditionalRedis (Either Redis.Reply a) + returnDecode :: (Redis.RedisResult a) => Redis.Reply -> WithAdditionalRedis (Either Redis.Reply a) returnDecode = Redis.liftRedis . Redis.returnDecode instance MonadLogger Gundeck where @@ -179,10 +179,10 @@ runDirect e m = `catch` ( \(exception :: SomeException) -> do case fromException exception of Nothing -> - Log.err (e ^. applog) $ - Log.msg ("IO Exception occurred" :: ByteString) - . Log.field "message" (displayException exception) - . Log.field "request" (unRequestId (e ^. reqId)) + Log.err (e ^. applog) + $ Log.msg ("IO Exception occurred" :: ByteString) + . Log.field "message" (displayException exception) + . Log.field "request" (unRequestId (e ^. reqId)) Just (_ :: AsyncCancelled) -> pure () throwIO exception ) @@ -192,14 +192,17 @@ lookupReqId l r = case lookup requestIdName (requestHeaders r) of Just rid -> pure $ RequestId rid Nothing -> do localRid <- RequestId . UUID.toASCIIBytes <$> UUID.nextRandom - Log.info l $ - "request-id" .= localRid - ~~ "method" .= requestMethod r - ~~ "path" .= rawPathInfo r + Log.info l + $ "request-id" + .= localRid + ~~ "method" + .= requestMethod r + ~~ "path" + .= rawPathInfo r ~~ msg (val "generated a new request id for local request") pure localRid -fromJsonBody :: FromJSON a => JsonRequest a -> Gundeck a +fromJsonBody :: (FromJSON a) => JsonRequest a -> Gundeck a fromJsonBody r = exceptT (throwM . mkError status400 "bad-request") pure (parseBody r) {-# INLINE fromJsonBody #-} diff --git a/services/gundeck/src/Gundeck/Notification/Data.hs b/services/gundeck/src/Gundeck/Notification/Data.hs index de18c7f5eaf..5a13003fe65 100644 --- a/services/gundeck/src/Gundeck/Notification/Data.hs +++ b/services/gundeck/src/Gundeck/Notification/Data.hs @@ -106,7 +106,7 @@ add n tgts (JSON.encode -> payload) (notificationTTLSeconds -> t) = do \(? , ?) \ \USING TTL ?" -fetchId :: MonadClient m => UserId -> NotificationId -> Maybe ClientId -> m (Maybe QueuedNotification) +fetchId :: (MonadClient m) => UserId -> NotificationId -> Maybe ClientId -> m (Maybe QueuedNotification) fetchId u n c = runMaybeT $ do row <- MaybeT $ retry x1 $ query1 cqlById (params LocalQuorum (u, n)) MaybeT $ fetchPayload c row @@ -141,8 +141,8 @@ fetchLast u c = do let nextPage = case results of [] -> pure emptyPage (n : _) -> - retry x1 $ - paginate cqlSeek (paramsP LocalQuorum (u, n ^. _1) pageSize) + retry x1 + $ paginate cqlSeek (paramsP LocalQuorum (u, n ^. _1) pageSize) pure $ Page True results nextPage cqlLast :: PrepQuery R (Identity UserId) NotifRow @@ -158,7 +158,7 @@ fetchLast u c = do \WHERE user = ? AND id < ? \ \ORDER BY id DESC" -fetchPayload :: MonadClient m => Maybe ClientId -> NotifRow -> m (Maybe QueuedNotification) +fetchPayload :: (MonadClient m) => Maybe ClientId -> NotifRow -> m (Maybe QueuedNotification) fetchPayload c (id_, mbPayload, mbPayloadRef, _mbPayloadRefSize, mbClients) = case (mbPayload, mbPayloadRef) of (Just payload, _) -> pure $ toNotifSingle c (id_, payload, mbClients) @@ -237,8 +237,8 @@ fetch u c Nothing (fromIntegral . fromRange -> size) = do fetch u c (Just since) (fromIntegral . fromRange -> size) = do pageSize <- fromMaybe 100 <$> asks (^. options . settings . internalPageSize) let page1 = - retry x1 $ - paginate cqlSince (paramsP LocalQuorum (u, TimeUuid (toUUID since)) pageSize) + retry x1 + $ paginate cqlSince (paramsP LocalQuorum (u, TimeUuid (toUUID since)) pageSize) -- We fetch 2 more rows than requested. The first is to accommodate the -- notification corresponding to the `since` argument itself. The second is -- to get an accurate `hasMore`, just like in the case above. @@ -249,8 +249,8 @@ fetch u c (Just since) (fromIntegral . fromRange -> size) = do let (ns', sinceFound) = case Seq.viewl ns of x :< xs | since == x ^. queuedNotificationId -> (xs, True) _ -> (ns, False) - pure $! - (mkResultPage size more ns') + pure + $! (mkResultPage size more ns') { resultGap = not sinceFound } where @@ -261,7 +261,7 @@ fetch u c (Just since) (fromIntegral . fromRange -> size) = do \WHERE user = ? AND id >= ? \ \ORDER BY id ASC" -deleteAll :: MonadClient m => UserId -> m () +deleteAll :: (MonadClient m) => UserId -> m () deleteAll u = write cql (params LocalQuorum (Identity u)) & retry x5 where cql :: PrepQuery W (Identity UserId) () diff --git a/services/gundeck/src/Gundeck/Presence.hs b/services/gundeck/src/Gundeck/Presence.hs index 4c626fe35ee..4259dfc731f 100644 --- a/services/gundeck/src/Gundeck/Presence.hs +++ b/services/gundeck/src/Gundeck/Presence.hs @@ -40,17 +40,19 @@ list (uid ::: _) = setStatus status200 . json <$> runWithDefaultRedis (Data.list listAll :: List UserId ::: JSON -> Gundeck Response listAll (uids ::: _) = - setStatus status200 . json . concat + setStatus status200 + . json + . concat <$> runWithDefaultRedis (Data.listAll (fromList uids)) add :: Request ::: JSON -> Gundeck Response add (req ::: _) = do p <- fromJsonBody (JsonRequest req) Data.add p - pure $ - ( setStatus status201 - . addHeader hLocation (toByteString' (resource p)) - ) + pure + $ ( setStatus status201 + . addHeader hLocation (toByteString' (resource p)) + ) empty remove :: UserId ::: ConnId ::: CannonId -> Gundeck Response diff --git a/services/gundeck/src/Gundeck/Push.hs b/services/gundeck/src/Gundeck/Push.hs index 009052623d0..c5f4e3fa137 100644 --- a/services/gundeck/src/Gundeck/Push.hs +++ b/services/gundeck/src/Gundeck/Push.hs @@ -85,7 +85,7 @@ push ps = do throwM (mkError status500 "server-error" "Server Error") -- | Abstract over all effects in 'pushAll' (for unit testing). -class MonadThrow m => MonadPushAll m where +class (MonadThrow m) => MonadPushAll m where mpaNotificationTTL :: m NotificationTTL mpaMkNotificationId :: m NotificationId mpaListAllPresences :: [UserId] -> m [[Presence]] @@ -113,7 +113,7 @@ runWithBudget'' budget fallback action = do Just tbs -> runWithBudget' tbs budget fallback action -- | Abstract over all effects in 'nativeTargets' (for unit testing). -class Monad m => MonadNativeTargets m where +class (Monad m) => MonadNativeTargets m where mntgtLogErr :: SomeException -> m () mntgtLookupAddresses :: UserId -> m [Address] @@ -121,7 +121,7 @@ instance MonadNativeTargets Gundeck where mntgtLogErr e = Log.err (msg (val "Failed to get native push address: " +++ show e)) mntgtLookupAddresses rcp = Data.lookup rcp Data.One -class Monad m => MonadMapAsync m where +class (Monad m) => MonadMapAsync m where mntgtMapAsync :: (a -> m b) -> [a] -> m [Either SomeException b] mntgtPerPushConcurrency :: m (Maybe Int) @@ -172,17 +172,20 @@ pushAny' p = do let rcps = fromRange (p ^. pushRecipients) let uniq = uncurry list1 $ head &&& tail $ toList rcps let tgts = mkTarget <$> uniq - unless (p ^. pushTransient) $ - mpaStreamAdd i tgts pload =<< mpaNotificationTTL + unless (p ^. pushTransient) + $ mpaStreamAdd i tgts pload + =<< mpaNotificationTTL mpaForkIO $ do alreadySent <- mpyPush notif tgts (p ^. pushOrigin) (p ^. pushOriginConnection) (p ^. pushConnections) - unless (p ^. pushTransient) $ - mpaPushNative notif (p ^. pushNativePriority) =<< nativeTargets p (nativeTargetsRecipients p) alreadySent + unless (p ^. pushTransient) + $ mpaPushNative notif (p ^. pushNativePriority) + =<< nativeTargets p (nativeTargetsRecipients p) alreadySent where mkTarget :: Recipient -> NotificationTarget mkTarget r = target (r ^. recipientId) - & targetClients .~ case r ^. recipientClients of + & targetClients + .~ case r ^. recipientClients of RecipientClientsAll -> [] RecipientClientsSome cs -> toList cs @@ -195,9 +198,9 @@ pushAll pushes = do let cassandraTargets :: [CassandraTargets] cassandraTargets = map mkCassandraTargets newNotifications forM_ cassandraTargets $ \CassandraTargets {..} -> - unless (ntfTransient ctNotification) $ - mpaStreamAdd (ntfId ctNotification) ctNotificationTargets (ntfPayload ctNotification) - =<< mpaNotificationTTL + unless (ntfTransient ctNotification) + $ mpaStreamAdd (ntfId ctNotification) ctNotificationTargets (ntfPayload ctNotification) + =<< mpaNotificationTTL mpaForkIO $ do -- websockets wsTargets <- mapM mkWSTargets newNotifications @@ -212,9 +215,10 @@ pushAll pushes = do -- to be sent out. -- If perPushConcurrency is defined, we take the min with 'perNativePushConcurrency', as native push requests -- to cassandra and SNS are limited to 'perNativePushConcurrency' in parallel. - unless (psh ^. pushTransient) $ - mpaRunWithBudget cost () $ - mpaPushNative notif (psh ^. pushNativePriority) =<< nativeTargets psh rcps' alreadySent + unless (psh ^. pushTransient) + $ mpaRunWithBudget cost () + $ mpaPushNative notif (psh ^. pushNativePriority) + =<< nativeTargets psh rcps' alreadySent -- | A new notification to be stored in C* and pushed over websockets data NewNotification = NewNotification @@ -223,7 +227,7 @@ data NewNotification = NewNotification nnRecipients :: List1 Recipient } -mkNewNotification :: forall m. MonadPushAll m => Push -> m NewNotification +mkNewNotification :: forall m. (MonadPushAll m) => Push -> m NewNotification mkNewNotification psh = NewNotification psh <$> mkNotif <*> rcps where mkNotif :: m Notification @@ -252,7 +256,8 @@ mkCassandraTargets NewNotification {..} = mkTarget :: Recipient -> NotificationTarget mkTarget r = target (r ^. recipientId) - & targetClients .~ case r ^. recipientClients of + & targetClients + .~ case r ^. recipientClients of RecipientClientsAll -> [] -- clients are stored in cassandra as a list with a notification. empty list -- is interpreted as "all clients" by 'Gundeck.Notification.Data.toNotif'. @@ -266,12 +271,12 @@ data WSTargets = WSTargets wstPresences :: List1 (Recipient, [Presence]) } -mkWSTargets :: MonadPushAll m => NewNotification -> m WSTargets +mkWSTargets :: (MonadPushAll m) => NewNotification -> m WSTargets mkWSTargets NewNotification {..} = do withPresences <- addPresences nnRecipients pure $ WSTargets nnPush nnNotification withPresences where - addPresences :: forall m. MonadPushAll m => List1 Recipient -> m (List1 (Recipient, [Presence])) + addPresences :: forall m. (MonadPushAll m) => List1 Recipient -> m (List1 (Recipient, [Presence])) addPresences (toList -> rcps) = do presences <- mpaListAllPresences $ fmap (view recipientId) rcps zip1 rcps presences @@ -302,8 +307,11 @@ shouldActuallyPush :: Push -> Recipient -> Presence -> Bool shouldActuallyPush psh rcp pres = not isOrigin && okByPushAllowlist && okByRecipientAllowlist where isOrigin = - psh ^. pushOrigin == Just (userId pres) - && psh ^. pushOriginConnection == Just (connId pres) + psh + ^. pushOrigin + == Just (userId pres) + && psh + ^. pushOriginConnection == Just (connId pres) okByPushAllowlist :: Bool okByPushAllowlist = not allowlistExists || isAllowlisted @@ -331,8 +339,10 @@ nativeTargetsRecipients :: Push -> [Recipient] nativeTargetsRecipients psh = filter routeNative (toList (fromRange (psh ^. pushRecipients))) where routeNative u = - u ^. recipientRoute /= RouteDirect - && (Just (u ^. recipientId) /= psh ^. pushOrigin || psh ^. pushNativeIncludeOrigin) + u + ^. recipientRoute + /= RouteDirect + && (Just (u ^. recipientId) /= psh ^. pushOrigin || psh ^. pushNativeIncludeOrigin) -- | FUTUREWORK: 'nativeTargets' calls cassandra once for each 'Recipient' of the 'Push'. Instead, -- it should be called once with @[Push]@ for every call to 'pushAll', and that call should @@ -362,14 +372,18 @@ nativeTargets psh rcps' alreadySent = -- Include client if not found in already served presences. | otherwise = isNothing (List.find (isOnline a) alreadySent) isOnline a x = - a ^. addrUser == Presence.userId x - && (a ^. addrConn == Presence.connId x || equalClient a x) + a + ^. addrUser + == Presence.userId x + && (a ^. addrConn == Presence.connId x || equalClient a x) equalClient a x = Just (a ^. addrClient) == Presence.clientId x eligibleClient _ RecipientClientsAll = True eligibleClient a (RecipientClientsSome cs) = (a ^. addrClient) `elem` cs whitelistedOrNoWhitelist a = null (psh ^. pushConnections) - || a ^. addrConn `elem` psh ^. pushConnections + || a + ^. addrConn `elem` psh + ^. pushConnections check :: Either SomeException [a] -> m [a] check (Left e) = mntgtLogErr e >> pure [] @@ -379,17 +393,17 @@ type AddTokenResponse = Either Public.AddTokenError Public.AddTokenSuccess addToken :: UserId -> ConnId -> PushToken -> Gundeck AddTokenResponse addToken uid cid newtok = mpaRunWithBudget 1 (Left Public.AddTokenErrorNoBudget) $ runExceptT $ do - when (newtok ^. tokenTransport `elem` [APNSVoIP, APNSVoIPSandbox]) $ - throwError Public.AddTokenErrorApnsVoipNotSupported + when (newtok ^. tokenTransport `elem` [APNSVoIP, APNSVoIPSandbox]) + $ throwError Public.AddTokenErrorApnsVoipNotSupported (cur, old) <- lift $ foldl' (matching newtok) (Nothing, []) <$> Data.lookup uid Data.LocalQuorum - lift $ - Log.info $ - "user" - .= UUID.toASCIIBytes (toUUID uid) - ~~ "token" - .= Text.take 16 (tokenText (newtok ^. token)) - ~~ msg (val "Registering push token") + lift + $ Log.info + $ "user" + .= UUID.toASCIIBytes (toUUID uid) + ~~ "token" + .= Text.take 16 (tokenText (newtok ^. token)) + ~~ msg (val "Registering push token") addr <- continue newtok cur lift $ Native.deleteTokens old (Just addr) pure $ Public.AddTokenSuccess newtok @@ -400,9 +414,15 @@ addToken uid cid newtok = mpaRunWithBudget 1 (Left Public.AddTokenErrorNoBudget) Address -> (Maybe Address, [Address]) matching t (x, old) a - | a ^. addrTransport == t ^. tokenTransport - && a ^. addrApp == t ^. tokenApp - && a ^. addrClient == t ^. tokenClient = + | a + ^. addrTransport == t + ^. tokenTransport + && a + ^. addrApp == t + ^. tokenApp + && a + ^. addrClient == t + ^. tokenClient = if a ^. addrToken == t ^. token then (Just a, old) else (x, a : old) @@ -434,11 +454,11 @@ addToken uid cid newtok = mpaRunWithBudget 1 (Left Public.AddTokenErrorNoBudget) lift $ Log.info $ msg ("Push token of unknown application: '" <> appNameText app' <> "'") throwError Public.AddTokenErrorNotFound Left (Aws.InvalidToken _) -> do - lift $ - Log.info $ - "token" - .= tokenText tok - ~~ msg (val "Invalid push token.") + lift + $ Log.info + $ "token" + .= tokenText tok + ~~ msg (val "Invalid push token.") throwError Public.AddTokenErrorInvalid Left (Aws.TokenTooLong l) -> do lift $ Log.info $ msg ("Push token is too long: token length = " ++ show l) @@ -513,21 +533,21 @@ updateEndpoint uid t arn e = do logMessage requestId m = "user" .= UUID.toASCIIBytes (toUUID uid) - ~~ "token" - .= Text.take 16 (t ^. token . to tokenText) - ~~ "tokenTransport" - .= show (t ^. tokenTransport) - ~~ "tokenApp" - .= (t ^. tokenApp . to appNameText) - ~~ "arn" - .= toText arn - ~~ "endpointTransport" - .= show (arn ^. snsTopic . endpointTransport) - ~~ "endpointAppName" - .= (arn ^. snsTopic . endpointAppName . to appNameText) - ~~ "request" - .= unRequestId requestId - ~~ msg (val m) + ~~ "token" + .= Text.take 16 (t ^. token . to tokenText) + ~~ "tokenTransport" + .= show (t ^. tokenTransport) + ~~ "tokenApp" + .= (t ^. tokenApp . to appNameText) + ~~ "arn" + .= toText arn + ~~ "endpointTransport" + .= show (arn ^. snsTopic . endpointTransport) + ~~ "endpointAppName" + .= (arn ^. snsTopic . endpointAppName . to appNameText) + ~~ "request" + .= unRequestId requestId + ~~ msg (val m) deleteToken :: UserId -> Token -> Gundeck (Maybe ()) deleteToken uid tok = do @@ -536,7 +556,7 @@ deleteToken uid tok = do [] -> pure Nothing xs -> Native.deleteTokens xs Nothing $> Just () ) - . filter (\x -> x ^. addrToken == tok) + . filter (\x -> x ^. addrToken == tok) listTokens :: UserId -> Gundeck PushTokenList listTokens uid = PushTokenList . map (^. addrPushToken) <$> Data.lookup uid Data.LocalQuorum diff --git a/services/gundeck/src/Gundeck/Push/Data.hs b/services/gundeck/src/Gundeck/Push/Data.hs index c688f64f4db..80e6d8224b7 100644 --- a/services/gundeck/src/Gundeck/Push/Data.hs +++ b/services/gundeck/src/Gundeck/Push/Data.hs @@ -42,25 +42,25 @@ lookup u c = foldM mk [] =<< retry x1 (query q (params c (Identity u))) q = "select usr, transport, app, ptoken, arn, connection, client from user_push where usr = ?" mk as r = maybe as (: as) <$> mkAddr r -insert :: MonadClient m => UserId -> Transport -> AppName -> Token -> EndpointArn -> ConnId -> ClientId -> m () +insert :: (MonadClient m) => UserId -> Transport -> AppName -> Token -> EndpointArn -> ConnId -> ClientId -> m () insert u t a p e o c = retry x5 $ write q (params LocalQuorum (u, t, a, p, e, o, c)) where q :: PrepQuery W (UserId, Transport, AppName, Token, EndpointArn, ConnId, ClientId) () q = "insert into user_push (usr, transport, app, ptoken, arn, connection, client) values (?, ?, ?, ?, ?, ?, ?)" -updateArn :: MonadClient m => UserId -> Transport -> AppName -> Token -> EndpointArn -> m () +updateArn :: (MonadClient m) => UserId -> Transport -> AppName -> Token -> EndpointArn -> m () updateArn uid transport app token arn = retry x5 $ write q (params LocalQuorum (arn, uid, transport, app, token)) where q :: PrepQuery W (EndpointArn, UserId, Transport, AppName, Token) () q = {- `IF EXISTS`, but that requires benchmarking -} "update user_push set arn = ? where usr = ? and transport = ? and app = ? and ptoken = ?" -delete :: MonadClient m => UserId -> Transport -> AppName -> Token -> m () +delete :: (MonadClient m) => UserId -> Transport -> AppName -> Token -> m () delete u t a p = retry x5 $ write q (params LocalQuorum (u, t, a, p)) where q :: PrepQuery W (UserId, Transport, AppName, Token) () q = "delete from user_push where usr = ? and transport = ? and app = ? and ptoken = ?" -erase :: MonadClient m => UserId -> m () +erase :: (MonadClient m) => UserId -> m () erase u = retry x5 $ write q (params LocalQuorum (Identity u)) where q :: PrepQuery W (Identity UserId) () @@ -73,11 +73,11 @@ mkAddr :: mkAddr (usr, trp, app, tok, arn, con, clt) = case (clt, arn) of (Just c, Just a) -> pure $! Just $! Address usr a con (pushToken trp app tok c) _ -> do - Log.info $ - field "user" (toByteString usr) - ~~ field "transport" (show trp) - ~~ field "app" (appNameText app) - ~~ field "token" (tokenText tok) - ~~ msg (val "Deleting legacy push token without a client or ARN.") + Log.info + $ field "user" (toByteString usr) + ~~ field "transport" (show trp) + ~~ field "app" (appNameText app) + ~~ field "token" (tokenText tok) + ~~ msg (val "Deleting legacy push token without a client or ARN.") delete usr trp app tok pure Nothing diff --git a/services/gundeck/src/Gundeck/Push/Native.hs b/services/gundeck/src/Gundeck/Push/Native.hs index 917960c4e7e..eef08d2e9d6 100644 --- a/services/gundeck/src/Gundeck/Push/Native.hs +++ b/services/gundeck/src/Gundeck/Push/Native.hs @@ -63,8 +63,8 @@ push m addrs = do {-# NOINLINE nativePushSuccessCounter #-} nativePushSuccessCounter :: Prom.Counter nativePushSuccessCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.success", Prom.metricHelp = "Number of times native pushes were successfully pushed" @@ -73,8 +73,8 @@ nativePushSuccessCounter = {-# NOINLINE nativePushDisabledCounter #-} nativePushDisabledCounter :: Prom.Counter nativePushDisabledCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.disabled", Prom.metricHelp = "Number of times native pushes were not pushed due to a disabled endpoint" @@ -83,8 +83,8 @@ nativePushDisabledCounter = {-# NOINLINE nativePushInvalidCounter #-} nativePushInvalidCounter :: Prom.Counter nativePushInvalidCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.invalid", Prom.metricHelp = "Number of times native pushes were not pushed due to an invalid endpoint" @@ -93,8 +93,8 @@ nativePushInvalidCounter = {-# NOINLINE nativePushTooLargeCounter #-} nativePushTooLargeCounter :: Prom.Counter nativePushTooLargeCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.too_large", Prom.metricHelp = "Number of times native pushes were not pushed due to payload being too large" @@ -103,8 +103,8 @@ nativePushTooLargeCounter = {-# NOINLINE nativePushUnauthorizedCounter #-} nativePushUnauthorizedCounter :: Prom.Counter nativePushUnauthorizedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.unauthorized", Prom.metricHelp = "Number of times native pushes were not pushed due to an unauthorized endpoint" @@ -113,8 +113,8 @@ nativePushUnauthorizedCounter = {-# NOINLINE nativePushErrorCounter #-} nativePushErrorCounter :: Prom.Counter nativePushErrorCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.native.errors", Prom.metricHelp = "Number of times native pushes were not pushed due to an unexpected error" @@ -142,18 +142,18 @@ push1 = push1' 0 Failure (PushException ex) _ -> onPushException ex where onSuccess = do - Log.debug $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "notificationId" (toText (npNotificationid m)) - ~~ Log.msg (val "Native push success") + Log.debug + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "notificationId" (toText (npNotificationid m)) + ~~ Log.msg (val "Native push success") Prom.incCounter nativePushSuccessCounter onDisabled = handleAny (logError a "Failed to cleanup disabled endpoint") $ do - Log.info $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ field "cause" ("EndpointDisabled" :: Text) - ~~ msg (val "Removing disabled endpoint and token") + Log.info + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ field "cause" ("EndpointDisabled" :: Text) + ~~ msg (val "Removing disabled endpoint and token") Prom.incCounter nativePushDisabledCounter Data.delete (a ^. addrUser) (a ^. addrTransport) (a ^. addrApp) (a ^. addrToken) onTokenRemoved @@ -161,17 +161,17 @@ push1 = push1' 0 Aws.execute e (Aws.deleteEndpoint (a ^. addrEndpoint)) onPayloadTooLarge = do Prom.incCounter nativePushTooLargeCounter - Log.warn $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ msg (val "Payload too large") + Log.warn + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ msg (val "Payload too large") onInvalidEndpoint = handleAny (logError a "Failed to cleanup orphaned push token") $ do - Log.warn $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ field "cause" ("InvalidEndpoint" :: Text) - ~~ msg (val "Invalid ARN. Deleting orphaned push token") + Log.warn + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ field "cause" ("InvalidEndpoint" :: Text) + ~~ msg (val "Invalid ARN. Deleting orphaned push token") Prom.incCounter nativePushInvalidCounter Data.delete (a ^. addrUser) (a ^. addrTransport) (a ^. addrApp) (a ^. addrToken) onTokenRemoved @@ -192,9 +192,9 @@ push1 = push1' 0 Left (Aws.AppNotFound app') -> Log.info $ msg ("Push token of unknown application: '" <> appNameText app' <> "'") Left (Aws.InvalidToken _) -> - Log.info $ - "token" - .= tokenText tok + Log.info + $ "token" + .= tokenText tok ~~ msg (val "Invalid push token.") Left (Aws.TokenTooLong l) -> Log.info $ msg ("Push token is too long: token length = " ++ show l) @@ -202,11 +202,11 @@ push1 = push1' 0 Data.updateArn uid trp app tok arn push1' (succ n) m (a & addrEndpoint .~ arn) -- try to send the push message with the new ARN onPersistentlyUnauthorisedEndpoint = handleAny (logError a "Found orphaned push token") $ do - Log.warn $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ field "cause" ("UnauthorisedEndpoint" :: Text) - ~~ msg (val "Invalid ARN. Dropping push message.") + Log.warn + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ field "cause" ("UnauthorisedEndpoint" :: Text) + ~~ msg (val "Invalid ARN. Dropping push message.") Prom.incCounter nativePushUnauthorizedCounter onPushException ex = do logError a "Native push failed" ex @@ -225,12 +225,12 @@ publish m a = flip catches pushException $ do uid = a ^. addrUser transp = a ^. addrTransport txt = serialise m uid transp - Log.debug $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ field "notificationId" (toText (npNotificationid m)) - ~~ field "prio" (show (npPriority m)) - ~~ Log.msg (val "Native push") + Log.debug + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ field "notificationId" (toText (npNotificationid m)) + ~~ field "prio" (show (npPriority m)) + ~~ Log.msg (val "Native push") case txt of Left f -> pure $! Failure f a Right v -> toResult <$> Aws.publish ept v mempty @@ -256,11 +256,11 @@ deleteTokens :: [Address] -> Maybe Address -> Gundeck () deleteTokens tokens new = do aws' <- view awsEnv forM_ tokens $ \a -> do - Log.info $ - field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) - ~~ field "token" (Text.take 16 (tokenText (a ^. addrToken))) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ msg (val "Deleting push token") + Log.info + $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) + ~~ field "token" (Text.take 16 (tokenText (a ^. addrToken))) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ msg (val "Deleting push token") Data.delete (a ^. addrUser) (a ^. addrTransport) (a ^. addrApp) (a ^. addrToken) ept <- Aws.execute aws' (Aws.lookupEndpoint (a ^. addrEndpoint)) for_ ept $ \ep -> @@ -275,16 +275,16 @@ deleteTokens tokens new = do delete aws' a where delete aws' a = do - Log.info $ - field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ msg (val "Deleting SNS endpoint") + Log.info + $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ msg (val "Deleting SNS endpoint") Aws.execute aws' (Aws.deleteEndpoint (a ^. addrEndpoint)) update aws' a us = do - Log.info $ - field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ msg (val "Updating SNS endpoint") + Log.info + $ field "user" (UUID.toASCIIBytes (toUUID (a ^. addrUser))) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ msg (val "Updating SNS endpoint") Aws.execute aws' (Aws.updateEndpoint us (a ^. addrToken) (a ^. addrEndpoint)) migrate a a' u = do let oldArn = a ^. addrEndpoint @@ -306,8 +306,8 @@ deleteTokens tokens new = do logError :: (Exception e, MonadLogger m) => Address -> Text -> e -> m () logError a m exn = - Log.err $ - field "user" (toByteString (a ^. addrUser)) - ~~ field "arn" (toText (a ^. addrEndpoint)) - ~~ field "error" (show exn) - ~~ msg m + Log.err + $ field "user" (toByteString (a ^. addrUser)) + ~~ field "arn" (toText (a ^. addrEndpoint)) + ~~ field "error" (show exn) + ~~ msg m diff --git a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs index bf9e0e491cc..648a888f834 100644 --- a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs +++ b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs @@ -35,7 +35,7 @@ import Gundeck.Push.Native.Types import Gundeck.Types import Imports -serialise :: HasCallStack => NativePush -> UserId -> Transport -> Either Failure LT.Text +serialise :: (HasCallStack) => NativePush -> UserId -> Transport -> Either Failure LT.Text serialise (NativePush nid prio _aps) uid transport = do case renderText transport prio o of Nothing -> Left PayloadTooLarge diff --git a/services/gundeck/src/Gundeck/Push/Native/Types.hs b/services/gundeck/src/Gundeck/Push/Native/Types.hs index d191bfb0459..66b70a0ad3f 100644 --- a/services/gundeck/src/Gundeck/Push/Native/Types.hs +++ b/services/gundeck/src/Gundeck/Push/Native/Types.hs @@ -74,8 +74,10 @@ addrClient = addrPushToken . tokenClient addrEqualClient :: Address -> Address -> Bool addrEqualClient a a' = - view addrConn a == view addrConn a' - || view addrClient a == view addrClient a' + view addrConn a + == view addrConn a' + || view addrClient a + == view addrClient a' instance Show Address where show a = diff --git a/services/gundeck/src/Gundeck/Push/Websocket.hs b/services/gundeck/src/Gundeck/Push/Websocket.hs index e6b8f2121b5..ca57d8fa41d 100644 --- a/services/gundeck/src/Gundeck/Push/Websocket.hs +++ b/services/gundeck/src/Gundeck/Push/Websocket.hs @@ -59,7 +59,7 @@ class (Monad m, MonadThrow m, Log.MonadLogger m) => MonadBulkPush m where mbpBulkSend :: URI -> BulkPushRequest -> m (URI, Either SomeException BulkPushResponse) mbpDeleteAllPresences :: [Presence] -> m () mbpPosixTime :: m Milliseconds - mbpMapConcurrently :: Traversable t => (a -> m b) -> t a -> m (t b) + mbpMapConcurrently :: (Traversable t) => (a -> m b) -> t a -> m (t b) mbpMonitorBadCannons :: (URI, (SomeException, [Presence])) -> m () instance MonadBulkPush Gundeck where @@ -71,7 +71,7 @@ instance MonadBulkPush Gundeck where -- | Send a 'Notification's to associated 'Presence's. Send at most one request to each Cannon. -- Return the lists of 'Presence's successfully reached for each resp. 'Notification'. -bulkPush :: forall m. MonadBulkPush m => [(Notification, [Presence])] -> m [(NotificationId, [Presence])] +bulkPush :: forall m. (MonadBulkPush m) => [(Notification, [Presence])] -> m [(NotificationId, [Presence])] -- REFACTOR: make presences lists (and notification list) non-empty where applicable? are there -- better types to express more of our semantics / invariants? (what about duplicates in presence -- lists?) @@ -110,28 +110,28 @@ monitorBadCannons (_uri, (_err, prcs)) = {-# NOINLINE pushWsUnreachableCounter #-} pushWsUnreachableCounter :: Prom.Counter pushWsUnreachableCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "push.ws.unreachable", Prom.metricHelp = "Number of times websocket pushes were not pushed due cannon being unreachable" } -logBadCannons :: Log.MonadLogger m => (URI, (SomeException, [Presence])) -> m () +logBadCannons :: (Log.MonadLogger m) => (URI, (SomeException, [Presence])) -> m () logBadCannons (uri, (err, prcs)) = do forM_ prcs $ \prc -> - Log.warn $ - logPresence prc - ~~ Log.field "created_at" (ms $ createdAt prc) - ~~ Log.field "cannon_uri" (show uri) - ~~ Log.field "resource_target" (show $ resource prc) - ~~ Log.field "http_exception" (intercalate " | " . lines . show $ err) - ~~ Log.msg (val "WebSocket presence unreachable: ") + Log.warn + $ logPresence prc + ~~ Log.field "created_at" (ms $ createdAt prc) + ~~ Log.field "cannon_uri" (show uri) + ~~ Log.field "resource_target" (show $ resource prc) + ~~ Log.field "http_exception" (intercalate " | " . lines . show $ err) + ~~ Log.msg (val "WebSocket presence unreachable: ") -logPrcsGone :: Log.MonadLogger m => Presence -> m () +logPrcsGone :: (Log.MonadLogger m) => Presence -> m () logPrcsGone prc = Log.debug $ logPresence prc ~~ Log.msg (val "WebSocket presence gone") -logSuccesses :: Log.MonadLogger m => (a, Presence) -> m () +logSuccesses :: (Log.MonadLogger m) => (a, Presence) -> m () logSuccesses (_, prc) = Log.debug $ logPresence prc ~~ Log.msg (val "WebSocket push success") fanOut :: [(Notification, [Presence])] -> [(URI, BulkPushRequest)] @@ -176,11 +176,11 @@ bulkSend' :: m BulkPushResponse bulkSend' uri bulkPushRequest = do forM_ (fromBulkPushRequest bulkPushRequest) $ \(notification, targets) -> - Log.debug $ - Log.msg ("Bulk sending notification to Cannon." :: Text) - . Log.field "ntf_id" (show (ntfId notification)) - . Log.field "user_ids" (show (map ptUserId targets)) - . Log.field "conn_ids" (show (map ptConnId targets)) + Log.debug + $ Log.msg ("Bulk sending notification to Cannon." :: Text) + . Log.field "ntf_id" (show (ntfId notification)) + . Log.field "user_ids" (show (map ptUserId targets)) + . Log.field "conn_ids" (show (map ptConnId targets)) let jsbody = encode bulkPushRequest req <- @@ -198,9 +198,9 @@ bulkSend' uri bulkPushRequest = do check req = req { Http.checkResponse = \rq rs -> - when (responseStatus rs /= status200) $ - let ex = StatusCodeException (rs {responseBody = ()}) mempty - in throwM $ HttpExceptionRequest rq ex + when (responseStatus rs /= status200) + $ let ex = StatusCodeException (rs {responseBody = ()}) mempty + in throwM $ HttpExceptionRequest rq ex } decodeBulkResp :: Maybe L.ByteString -> m BulkPushResponse decodeBulkResp Nothing = throwM $ ErrorCall "missing response body from cannon" @@ -249,14 +249,15 @@ flowBack rawresps = FlowBack broken gone delivered . mconcat . fmap fromBulkPushResponse . rights - $ snd <$> rawresps + $ snd + <$> rawresps lefts' :: [(c, Either a b)] -> [(c, a)] lefts' [] = [] lefts' ((c, Left x) : xs) = (c, x) : lefts' xs lefts' ((_, Right _) : xs) = lefts' xs {-# INLINE mkPresencesByCannon #-} -mkPresencesByCannon :: MonadThrow m => [Presence] -> URI -> m [Presence] +mkPresencesByCannon :: (MonadThrow m) => [Presence] -> URI -> m [Presence] mkPresencesByCannon prcs uri = maybe (throwM err) pure $ Map.lookup uri mp where err = ErrorCall "internal error in Gundeck: invalid URL in bulkpush result" @@ -269,7 +270,7 @@ mkPresencesByCannon prcs uri = maybe (throwM err) pure $ Map.lookup uri mp go prc (Just prcs') = Just $ prc : prcs' {-# INLINE mkPresenceByPushTarget #-} -mkPresenceByPushTarget :: MonadThrow m => [Presence] -> PushTarget -> m Presence +mkPresenceByPushTarget :: (MonadThrow m) => [Presence] -> PushTarget -> m Presence mkPresenceByPushTarget prcs ptarget = maybe (throwM err) pure $ Map.lookup ptarget mp where err = ErrorCall "internal error in Cannon: invalid PushTarget in bulkpush response" @@ -283,7 +284,7 @@ bulkresource = URI . (\x -> x {URI.uriPath = "/i/bulkpush"}) . fromURI . resourc -- TODO: a Map-based implementation would be faster for sufficiently large inputs. do we want to -- take the time and benchmark the difference? move it to types-common? {-# INLINE groupAssoc #-} -groupAssoc :: Ord a => [(a, b)] -> [(a, [b])] +groupAssoc :: (Ord a) => [(a, b)] -> [(a, [b])] groupAssoc = groupAssoc' compare -- TODO: Also should we give 'Notification' an 'Ord' instance? @@ -326,9 +327,9 @@ push notif (toList -> tgts) originUser originConn conns = do . zip tgts <$> runWithDefaultRedis (Presence.listAll (view targetUser <$> tgts)) noPresences exn = do - Log.err $ - Log.field "error" (show exn) - ~~ Log.msg (val "Failed to get presences.") + Log.err + $ Log.field "error" (show exn) + ~~ Log.msg (val "Failed to get presences.") pure [] filterByClient = map $ \(tgt, ps) -> let cs = tgt ^. targetClients @@ -351,10 +352,10 @@ push notif (toList -> tgts) originUser originConn conns = do pure (ok, p : gone) onResult (ok, gone) (PushFailure p _) = do Prom.incCounter pushWsUnreachableCounter - Log.info $ - logPresence p - ~~ Log.field "created_at" (ms $ createdAt p) - ~~ Log.msg (val "WebSocket presence unreachable: " +++ toByteString (resource p)) + Log.info + $ logPresence p + ~~ Log.field "created_at" (ms $ createdAt p) + ~~ Log.msg (val "WebSocket presence unreachable: " +++ toByteString (resource p)) now <- posixTime if now - createdAt p > 10 * posixDay then pure (ok, p : gone) @@ -378,19 +379,19 @@ send n pp = where fn js p = do req <- Http.setUri empty (fromURI (resource p)) - recovering x1 rpcHandlers $ - const $ - rpc' "cannon" (check req) $ - method POST - . contentJson - . lbytes js - . timeout 3000 -- ms + recovering x1 rpcHandlers + $ const + $ rpc' "cannon" (check req) + $ method POST + . contentJson + . lbytes js + . timeout 3000 -- ms check r = r { Http.checkResponse = \rq rs -> - unless (responseStatus rs `elem` [status200, status410]) $ - let ex = StatusCodeException (rs {responseBody = ()}) mempty - in throwM $ HttpExceptionRequest rq ex + unless (responseStatus rs `elem` [status200, status410]) + $ let ex = StatusCodeException (rs {responseBody = ()}) mempty + in throwM $ HttpExceptionRequest rq ex } eval p (Left e) = PushFailure p e eval p (Right r) = if statusCode r == 200 then PushSuccess p else PushGone p diff --git a/services/gundeck/src/Gundeck/React.hs b/services/gundeck/src/Gundeck/React.hs index d97f4312ccc..842576bae45 100644 --- a/services/gundeck/src/Gundeck/React.hs +++ b/services/gundeck/src/Gundeck/React.hs @@ -78,9 +78,9 @@ onUpdated ev = withEndpoint ev $ \e as -> logUserEvent (a ^. addrUser) ev $ msg (val "Removing superseded token") deleteToken (a ^. addrUser) ev (a ^. addrToken) (a ^. addrClient) if - | null sup -> pure () - | null cur -> deleteEndpoint ev - | otherwise -> updateEndpoint ev e (map (view addrUser) cur) + | null sup -> pure () + | null cur -> deleteEndpoint ev + | otherwise -> updateEndpoint ev e (map (view addrUser) cur) onFailure :: Event -> Gundeck () onFailure ev = withEndpoint ev $ \e as -> @@ -99,23 +99,29 @@ onPermFailure ev = withEndpoint ev $ \_ as -> do onTTLExpired :: Event -> Gundeck () onTTLExpired ev = - Log.warn $ - "arn" .= toText (ev ^. evEndpoint) - ~~ "cause" .= toText (ev ^. evType) + Log.warn + $ "arn" + .= toText (ev ^. evEndpoint) + ~~ "cause" + .= toText (ev ^. evType) ~~ msg (val "Notification TTL expired") onUnknownFailure :: Event -> Text -> Gundeck () onUnknownFailure ev r = - Log.warn $ - "arn" .= toText (ev ^. evEndpoint) - ~~ "cause" .= toText (ev ^. evType) + Log.warn + $ "arn" + .= toText (ev ^. evEndpoint) + ~~ "cause" + .= toText (ev ^. evType) ~~ msg (val "Unknown failure, reason: " +++ r) onUnhandledEventType :: Event -> Gundeck () onUnhandledEventType ev = - Log.warn $ - "arn" .= toText (ev ^. evEndpoint) - ~~ "cause" .= toText (ev ^. evType) + Log.warn + $ "arn" + .= toText (ev ^. evEndpoint) + ~~ "cause" + .= toText (ev ^. evType) ~~ msg (val "Unhandled event type") ------------------------------------------------------------------------------- @@ -133,8 +139,9 @@ withEndpoint ev f = do as <- concat <$> mapM (`Push.lookup` Push.LocalQuorum) us case filter ((== (ev ^. evEndpoint)) . view addrEndpoint) as of [] -> do - logEvent ev $ - "token" .= Text.take 16 (tokenText (ep ^. endpointToken)) + logEvent ev + $ "token" + .= Text.take 16 (tokenText (ep ^. endpointToken)) ~~ msg (val "Deleting orphaned SNS endpoint") Aws.execute v (Aws.deleteEndpoint (ev ^. evEndpoint)) as' -> f ep as' @@ -153,8 +160,9 @@ updateEndpoint ev ep us = do deleteToken :: UserId -> Event -> Token -> ClientId -> Gundeck () deleteToken u ev tk cl = do - logUserEvent u ev $ - "token" .= Text.take 16 (tokenText tk) + logUserEvent u ev + $ "token" + .= Text.take 16 (tokenText tk) ~~ msg (val "Deleting push token") i <- mkNotificationId let t = mkPushToken ev tk cl @@ -172,13 +180,16 @@ mkPushToken ev tk cl = logEvent :: Event -> (Msg -> Msg) -> Gundeck () logEvent ev f = - Log.info $ - "arn" .= toText (ev ^. evEndpoint) - ~~ "cause" .= toText (ev ^. evType) + Log.info + $ "arn" + .= toText (ev ^. evEndpoint) + ~~ "cause" + .= toText (ev ^. evType) ~~ f logUserEvent :: UserId -> Event -> (Msg -> Msg) -> Gundeck () logUserEvent u ev f = - logEvent ev $ - "user" .= toByteString u + logEvent ev + $ "user" + .= toByteString u ~~ f diff --git a/services/gundeck/src/Gundeck/Redis.hs b/services/gundeck/src/Gundeck/Redis.hs index a4784349db2..3b356620075 100644 --- a/services/gundeck/src/Gundeck/Redis.hs +++ b/services/gundeck/src/Gundeck/Redis.hs @@ -85,7 +85,7 @@ connectRobust l retryStrategy connectLowLevel = do const $ Catch.Handler (\(e :: IOException) -> logEx (Log.err l) e "network error when connecting to Redis" >> pure True) ] . const -- ignore RetryStatus - logEx :: Show e => ((Msg -> Msg) -> IO ()) -> e -> ByteString -> IO () + logEx :: (Show e) => ((Msg -> Msg) -> IO ()) -> e -> ByteString -> IO () logEx lLevel e description = lLevel $ Log.msg (Log.val description) . Log.field "error" (show e) -- | Run a 'Redis' action through a 'RobustConnection'. @@ -121,7 +121,8 @@ safeForever :: m () -> m () safeForever l action = - forever $ - action `catchAny` \e -> do + forever + $ action + `catchAny` \e -> do Log.err l $ Log.msg (Log.val "Uncaught exception while connecting to redis") . Log.field "error" (displayException e) threadDelay 1e6 -- pause to keep worst-case noise in logs manageable diff --git a/services/gundeck/src/Gundeck/Redis/HedisExtensions.hs b/services/gundeck/src/Gundeck/Redis/HedisExtensions.hs index 0dee66eee8e..7842fc98822 100644 --- a/services/gundeck/src/Gundeck/Redis/HedisExtensions.hs +++ b/services/gundeck/src/Gundeck/Redis/HedisExtensions.hs @@ -164,7 +164,7 @@ instance RedisResult ClusterInfoResponse where $ Char8.lines bulkData decode r = Left r -clusterInfo :: RedisCtx m f => m (f ClusterInfoResponse) +clusterInfo :: (RedisCtx m f) => m (f ClusterInfoResponse) clusterInfo = sendRequest ["CLUSTER", "INFO"] checkedConnectCluster :: ConnectInfo -> IO Connection diff --git a/services/gundeck/src/Gundeck/Run.hs b/services/gundeck/src/Gundeck/Run.hs index 8dcfc3b764c..b625d64fb15 100644 --- a/services/gundeck/src/Gundeck/Run.hs +++ b/services/gundeck/src/Gundeck/Run.hs @@ -58,8 +58,8 @@ import Wire.API.Routes.Version.Wai run :: Opts -> IO () run o = do (rThreads, e) <- createEnv o - runClient (e ^. cstate) $ - versionCheck schemaVersion + runClient (e ^. cstate) + $ versionCheck schemaVersion let l = e ^. applog s <- newSettings $ defaultServer (unpack $ o ^. gundeck . host) (o ^. gundeck . port) l let throttleMillis = fromMaybe defSqsThrottleMillis $ o ^. (settings . sqsThrottleMillis) @@ -110,10 +110,11 @@ servantSitemap' env = Servant.hoistServer (Proxy @GundeckAPI) toServantHandler s toServantHandler :: Gundeck a -> Handler a toServantHandler m = Handler . ExceptT $ Right <$> runDirect env m -collectAuthMetrics :: MonadIO m => AWS.Env -> m () +collectAuthMetrics :: (MonadIO m) => AWS.Env -> m () collectAuthMetrics env = do - liftIO $ - forever $ do + liftIO + $ forever + $ do mbRemaining <- readAuthExpiration env gaugeTokenRemaing mbRemaining threadDelay 1_000_000 diff --git a/services/gundeck/src/Gundeck/Schema/V4.hs b/services/gundeck/src/Gundeck/Schema/V4.hs index ee2908219e2..1bce2b7c6b3 100644 --- a/services/gundeck/src/Gundeck/Schema/V4.hs +++ b/services/gundeck/src/Gundeck/Schema/V4.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 4 "Add user_push.arn column" $ - schema' [r| alter columnfamily user_push add arn text; |] + Migration 4 "Add user_push.arn column" + $ schema' [r| alter columnfamily user_push add arn text; |] diff --git a/services/gundeck/src/Gundeck/Schema/V5.hs b/services/gundeck/src/Gundeck/Schema/V5.hs index 97abe2a4b32..3cdacd13b2c 100644 --- a/services/gundeck/src/Gundeck/Schema/V5.hs +++ b/services/gundeck/src/Gundeck/Schema/V5.hs @@ -26,5 +26,5 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 5 "Add user_push.fallback column" $ - schema' [r| alter columnfamily user_push add fallback int; |] + Migration 5 "Add user_push.fallback column" + $ schema' [r| alter columnfamily user_push add fallback int; |] diff --git a/services/gundeck/src/Gundeck/Schema/V7.hs b/services/gundeck/src/Gundeck/Schema/V7.hs index c44dab3fbab..5d80ca11a0a 100644 --- a/services/gundeck/src/Gundeck/Schema/V7.hs +++ b/services/gundeck/src/Gundeck/Schema/V7.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = - Migration 7 "Add notifications column family" $ - schema' + Migration 7 "Add notifications column family" + $ schema' [r| create columnfamily if not exists notifications ( user uuid -- user id diff --git a/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs b/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs index cccfea4fdf6..689a6ccf48d 100644 --- a/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs +++ b/services/gundeck/src/Gundeck/ThreadBudget/Internal.hs @@ -64,37 +64,40 @@ budgetSpent' = sum . fmap fst . filter (isJust . snd) . HM.elems . bmap cancelAllThreads :: ThreadBudgetState -> IO () cancelAllThreads (ThreadBudgetState _ ref) = readIORef ref - >>= mapM_ cancel . mapMaybe snd . HM.elems . bmap + >>= mapM_ cancel + . mapMaybe snd + . HM.elems + . bmap -mkThreadBudgetState :: HasCallStack => MaxConcurrentNativePushes -> IO ThreadBudgetState +mkThreadBudgetState :: (HasCallStack) => MaxConcurrentNativePushes -> IO ThreadBudgetState mkThreadBudgetState limits = ThreadBudgetState limits <$> newIORef (BudgetMap 0 HM.empty) -- | Allocate the resources for a new action to be called (but don't call the action yet). allocate :: - IORef BudgetMap -> UUID -> Int -> MonadIO m => m Int + IORef BudgetMap -> UUID -> Int -> (MonadIO m) => m Int allocate ref key newspent = - atomicModifyIORef' ref $ - \(BudgetMap spent hm) -> + atomicModifyIORef' ref + $ \(BudgetMap spent hm) -> ( BudgetMap (spent + newspent) (HM.insert key (newspent, Nothing) hm), spent ) -- | Register an already-allocated action with its 'Async'. register :: - IORef BudgetMap -> UUID -> Async () -> MonadIO m => m Int + IORef BudgetMap -> UUID -> Async () -> (MonadIO m) => m Int register ref key handle = - atomicModifyIORef' ref $ - \(BudgetMap spent hm) -> + atomicModifyIORef' ref + $ \(BudgetMap spent hm) -> ( BudgetMap spent (HM.adjust (_2 ?~ handle) key hm), spent ) -- | Remove an registered and/or allocated action from a 'BudgetMap'. unregister :: - IORef BudgetMap -> UUID -> MonadIO m => m () + IORef BudgetMap -> UUID -> (MonadIO m) => m () unregister ref key = - atomicModifyIORef' ref $ - \bhm@(BudgetMap spent hm) -> + atomicModifyIORef' ref + $ \bhm@(BudgetMap spent hm) -> case HM.lookup key hm of Just (newspent, _) -> (BudgetMap (spent - newspent) (HM.delete key hm), ()) Nothing -> (bhm, ()) @@ -142,9 +145,11 @@ runWithBudget' (ThreadBudgetState limits ref) spent fallback action = do where go :: UUID -> Int -> m a go key oldsize = do - LC.debug $ - "key" LC..= toText key - LC.~~ "spent" LC..= oldsize + LC.debug + $ "key" + LC..= toText key + LC.~~ "spent" + LC..= oldsize LC.~~ LC.msg (LC.val "runWithBudget: go") handle <- async action _ <- register ref key (void handle) @@ -159,10 +164,13 @@ runWithBudget' (ThreadBudgetState limits ref) spent fallback action = do then threadBudgetHardLimitBreachedCounter else threadBudgetSoftLimitBreachedCounter Prom.incCounter counter - LC.warn $ - "spent" LC..= show oldsize - LC.~~ "soft-breach" LC..= soft' - LC.~~ "hard-breach" LC..= hard' + LC.warn + $ "spent" + LC..= show oldsize + LC.~~ "soft-breach" + LC..= soft' + LC.~~ "hard-breach" + LC..= hard' LC.~~ LC.msg ("runWithBudget: " <> limit <> " limit reached") -- | Fork a thread that checks with the given frequency if any async handles stored in the @@ -201,8 +209,8 @@ recordMetrics limits ref = do {-# NOINLINE threadBudgetAllocatedGauge #-} threadBudgetAllocatedGauge :: Prom.Gauge threadBudgetAllocatedGauge = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "net.nativepush.thread_budget_allocated", Prom.metricHelp = "Number of allocated threads for native pushes" @@ -211,8 +219,8 @@ threadBudgetAllocatedGauge = {-# NOINLINE threadBudgetHardLimitGauge #-} threadBudgetHardLimitGauge :: Prom.Gauge threadBudgetHardLimitGauge = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "net.nativepush.thread_budget_hard_limit", Prom.metricHelp = "Hard limit for threads for native pushes" @@ -221,8 +229,8 @@ threadBudgetHardLimitGauge = {-# NOINLINE threadBudgetSoftLimitGauge #-} threadBudgetSoftLimitGauge :: Prom.Gauge threadBudgetSoftLimitGauge = - Prom.unsafeRegister $ - Prom.gauge + Prom.unsafeRegister + $ Prom.gauge Prom.Info { Prom.metricName = "net.nativepush.thread_budget_soft_limit", Prom.metricHelp = "Soft limit for threads for native pushes" @@ -231,8 +239,8 @@ threadBudgetSoftLimitGauge = {-# NOINLINE threadBudgetHardLimitBreachedCounter #-} threadBudgetHardLimitBreachedCounter :: Prom.Counter threadBudgetHardLimitBreachedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "net.nativepush.thread_budget_hard_limit_breached", Prom.metricHelp = "Number of times hard limit for threads for native pushes was breached" @@ -241,14 +249,14 @@ threadBudgetHardLimitBreachedCounter = {-# NOINLINE threadBudgetSoftLimitBreachedCounter #-} threadBudgetSoftLimitBreachedCounter :: Prom.Counter threadBudgetSoftLimitBreachedCounter = - Prom.unsafeRegister $ - Prom.counter + Prom.unsafeRegister + $ Prom.counter Prom.Info { Prom.metricName = "net.nativepush.thread_budget_soft_limit_breached", Prom.metricHelp = "Number of times soft limit for threads for native pushes was breached" } -threadDelayNominalDiffTime :: NominalDiffTime -> MonadIO m => m () +threadDelayNominalDiffTime :: NominalDiffTime -> (MonadIO m) => m () threadDelayNominalDiffTime = threadDelay . round . (* 1000000) . toRational staleTolerance :: NominalDiffTime @@ -275,8 +283,11 @@ removeStaleHandles ref = do (mapM_ waitCatch . (snd =<<)) . HM.lookup key . bmap =<< readIORef ref unregister ref key isSanitary <- (\bm -> bspent bm == budgetSpent' bm) <$> readIORef ref - unless isSanitary . LC.warn . LC.msg . LC.val $ - "watchThreadBudgetState: total overall thread budget diverged from async weights (repaired)." + unless isSanitary + . LC.warn + . LC.msg + . LC.val + $ "watchThreadBudgetState: total overall thread budget diverged from async weights (repaired)." where getStaleHandles :: m (Set UUID) getStaleHandles = @@ -290,8 +301,9 @@ removeStaleHandles ref = do pure [key | isJust status] warnStaleHandles :: Int -> BudgetMap -> m () warnStaleHandles num (BudgetMap spent _) = - LC.warn $ - "spent" LC..= show spent + LC.warn + $ "spent" + LC..= show spent LC.~~ LC.msg ("watchThreadBudgetState: removed " <> show num <> " stale handles.") safeForever :: @@ -300,7 +312,8 @@ safeForever :: m () -> m () safeForever action = - forever $ - action `catchAny` \exc -> do + forever + $ action + `catchAny` \exc -> do LC.err $ "error" LC..= show exc LC.~~ LC.msg (LC.val "watchThreadBudgetState: crashed; retrying") threadDelay 60000000 -- pause to keep worst-case noise in logs manageable diff --git a/services/gundeck/src/Gundeck/Util.hs b/services/gundeck/src/Gundeck/Util.hs index bbcc42fba94..9b210881463 100644 --- a/services/gundeck/src/Gundeck/Util.hs +++ b/services/gundeck/src/Gundeck/Util.hs @@ -48,7 +48,7 @@ mapAsync :: mapAsync f = mapM waitCatch <=< mapM (async . f) {-# INLINE mapAsync #-} -maybeEqual :: Eq a => Maybe a -> Maybe a -> Bool +maybeEqual :: (Eq a) => Maybe a -> Maybe a -> Bool maybeEqual (Just x) (Just y) = x == y maybeEqual _ _ = False {-# INLINE maybeEqual #-} diff --git a/services/gundeck/src/Gundeck/Util/DelayQueue.hs b/services/gundeck/src/Gundeck/Util/DelayQueue.hs index f63781e8e94..55198be626b 100644 --- a/services/gundeck/src/Gundeck/Util/DelayQueue.hs +++ b/services/gundeck/src/Gundeck/Util/DelayQueue.hs @@ -54,7 +54,7 @@ new c d l = do queue <- newIORef PSQ.empty pure $! DelayQueue queue c d l -enqueue :: Ord k => DelayQueue k v -> k -> v -> IO Bool +enqueue :: (Ord k) => DelayQueue k v -> k -> v -> IO Bool enqueue (DelayQueue queue clock d l) k v = do time <- getTime clock let !p = time + delayTime d @@ -62,8 +62,8 @@ enqueue (DelayQueue queue clock d l) k v = do if PSQ.size q >= getLimit l then (q, False) else - swap $ - PSQ.alter + swap + $ PSQ.alter ( \case Nothing -> (True, Just (p, v)) Just pv -> (True, Just pv) @@ -71,7 +71,7 @@ enqueue (DelayQueue queue clock d l) k v = do k q -dequeue :: Ord k => DelayQueue k v -> IO (Maybe (Either Delay v)) +dequeue :: (Ord k) => DelayQueue k v -> IO (Maybe (Either Delay v)) dequeue (DelayQueue queue clock _ _) = do time <- getTime clock atomicModifyIORef' queue $ \q -> @@ -80,10 +80,11 @@ dequeue (DelayQueue queue clock _ _) = do Just (_, p, v, q') | p <= time -> (q', Just (Right v)) Just (_, p, _, _) -> (q, Just (Left (Delay (p - time)))) -cancel :: Ord k => DelayQueue k v -> k -> IO Bool +cancel :: (Ord k) => DelayQueue k v -> k -> IO Bool cancel (DelayQueue queue _ _ _) k = - atomicModifyIORef' queue $ - swap . PSQ.alter (\pv -> (isJust pv, Nothing)) k + atomicModifyIORef' queue + $ swap + . PSQ.alter (\pv -> (isJust pv, Nothing)) k length :: DelayQueue k v -> IO Int length q = PSQ.size <$> readIORef (_queue q) diff --git a/services/gundeck/src/Gundeck/Util/Redis.hs b/services/gundeck/src/Gundeck/Util/Redis.hs index 5ae9c1b1886..3eb7fddeccc 100644 --- a/services/gundeck/src/Gundeck/Util/Redis.hs +++ b/services/gundeck/src/Gundeck/Util/Redis.hs @@ -35,15 +35,15 @@ x1 = limitRetries 1 <> exponentialBackoff 100000 x3 :: RetryPolicy x3 = limitRetries 3 <> exponentialBackoff 100000 -handlers :: MonadLogger m => [a -> Handler m Bool] +handlers :: (MonadLogger m) => [a -> Handler m Bool] handlers = [ const . Handler $ \case RedisSimpleError (Error err) -> pure $ "READONLY" `BS.isPrefixOf` err RedisTxError err -> pure $ "READONLY" `isPrefixOf` err err -> do - Log.warn $ - Log.msg (Log.val "Redis error; not retrying.") - ~~ "redis.errMsg" .= show err + Log.warn + $ Log.msg (Log.val "Redis error; not retrying.") + ~~ "redis.errMsg" .= show err pure False ] @@ -57,7 +57,7 @@ data RedisError instance Exception RedisError -fromTxResult :: MonadThrow m => TxResult a -> m a +fromTxResult :: (MonadThrow m) => TxResult a -> m a fromTxResult = \case TxSuccess a -> pure a TxAborted -> throwM RedisTxAborted diff --git a/services/gundeck/test/integration/API.hs b/services/gundeck/test/integration/API.hs index ffc11bd7b80..a1dd215a801 100644 --- a/services/gundeck/test/integration/API.hs +++ b/services/gundeck/test/integration/API.hs @@ -148,17 +148,23 @@ replacePresence = do sendPush (push uid [uid]) getPresence gu (showUser uid) !!! do const 2 === length . decodePresence - assertTrue "Cannon is not removed" $ - elem localhost8080 . map resource . decodePresence + assertTrue "Cannon is not removed" + $ elem localhost8080 + . map resource + . decodePresence setPresence gu pres2 !!! const 201 === statusCode getPresence gu (showUser uid) !!! do const 2 === length . decodePresence - assertTrue "New Cannon" $ - elem localhost8081 . map resource . decodePresence - assertTrue "Old Cannon is removed" $ - notElem localhost8080 . map resource . decodePresence + assertTrue "New Cannon" + $ elem localhost8081 + . map resource + . decodePresence + assertTrue "Old Cannon is removed" + $ notElem localhost8080 + . map resource + . decodePresence where pload = List1.singleton $ KeyMap.fromList ["foo" .= (42 :: Int)] push u us = newPush (Just u) (toRecipients us) pload & pushOriginConnection ?~ ConnId "dev" @@ -264,7 +270,8 @@ bulkPush isE2E numUsers numConnsPerUser = do pushE2E u ucs = targets <&> \(uid, connid) -> newPush (Just u) (toRecipients [uid]) (ploadE2E connid) - & pushConnections .~ Set.singleton connid + & pushConnections + .~ Set.singleton connid where targets :: [(UserId, ConnId)] targets = @@ -401,7 +408,8 @@ targetClientPush = do pload c = List1.singleton (pevent c) rcpt u c = recipient u RouteAny - & recipientClients .~ RecipientClientsSome (List1.singleton c) + & recipientClients + .~ RecipientClientsSome (List1.singleton c) push u c = newPush (Just u) (unsafeRange (Set.singleton (rcpt u c))) (pload c) storeNotificationsEvenWhenRedisIsDown :: TestM () @@ -413,8 +421,12 @@ storeNotificationsEvenWhenRedisIsDown = do withSettingsOverrides ( \gundeckSettings -> gundeckSettings - & redis . Gundeck.Options.host .~ "localhost" - & redis . Gundeck.Options.port .~ proxyPort + & redis + . Gundeck.Options.host + .~ "localhost" + & redis + . Gundeck.Options.port + .~ proxyPort ) $ do let pload = textPayload "hello" @@ -476,8 +488,9 @@ testMissingNotifsV2 = do testMissingNotifsV3 :: TestM () testMissingNotifsV3 = - testMissingNotifs "v3" $ - const $ do + testMissingNotifs "v3" + $ const + $ do const 404 === statusCode const Nothing === parseNotifications @@ -631,8 +644,8 @@ testFilterNotifByClient = do const 200 === statusCode const (Just n') === parseNotification -- Add a lot of notifications for client 3 - replicateM_ 101 $ - sendPush + replicateM_ 101 + $ sendPush ( buildPush alice [(alice, RecipientClientsSome (List1.singleton clt3))] @@ -897,19 +910,19 @@ testRedisMigration = do -- * Helpers -ensurePresent :: HasCallStack => UserId -> Int -> TestM () +ensurePresent :: (HasCallStack) => UserId -> Int -> TestM () ensurePresent u n = do gu <- view tsGundeck retryWhile ((n /=) . length . decodePresence) (getPresence gu (showUser u)) !!! (const n === length . decodePresence) -connectUser :: HasCallStack => CannonR -> UserId -> ConnId -> TestM (TChan ByteString) +connectUser :: (HasCallStack) => CannonR -> UserId -> ConnId -> TestM (TChan ByteString) connectUser ca uid con = do [(_, [ch])] <- connectUsersAndDevices ca [(uid, [con])] pure ch connectUsersAndDevices :: - HasCallStack => + (HasCallStack) => CannonR -> [(UserId, [ConnId])] -> TestM [(UserId, [TChan ByteString])] @@ -919,7 +932,7 @@ connectUsersAndDevices ca uidsAndConnIds = do strip = fmap (_2 %~ fmap fst) connectUsersAndDevicesWithSendingClients :: - HasCallStack => + (HasCallStack) => CannonR -> [(UserId, [ConnId])] -> TestM [(UserId, [(TChan ByteString, TChan ByteString)])] @@ -939,7 +952,7 @@ connectUsersAndDevicesWithSendingClients ca uidsAndConnIds = do -- in a Ping Writer and gives access to 'WS.Message's -- this can be used to test Ping/Pong behaviour on the control channel connectUsersAndDevicesWithSendingClientsRaw :: - HasCallStack => + (HasCallStack) => CannonR -> [(UserId, [ConnId])] -> TestM [(UserId, [(TChan WS.Message, TChan ByteString)])] @@ -958,7 +971,7 @@ connectUsersAndDevicesWithSendingClientsRaw ca uidsAndConnIds = do assertPresences :: (UserId, [ConnId]) -> TestM () assertPresences (uid, conns) = wsAssertPresences uid (length conns) -wsRun :: HasCallStack => CannonR -> UserId -> ConnId -> WS.ClientApp () -> TestM (Async ()) +wsRun :: (HasCallStack) => CannonR -> UserId -> ConnId -> WS.ClientApp () -> TestM (Async ()) wsRun ca uid (ConnId con) app = do liftIO $ async $ WS.runClientWith caHost caPort caPath caOpts caHdrs app where @@ -969,7 +982,7 @@ wsRun ca uid (ConnId con) app = do caOpts = WS.defaultConnectionOptions caHdrs = [("Z-User", showUser uid), ("Z-Connection", con)] -wsAssertPresences :: HasCallStack => UserId -> Int -> TestM () +wsAssertPresences :: (HasCallStack) => UserId -> Int -> TestM () wsAssertPresences uid numPres = do gu <- view tsGundeck retryWhile ((numPres /=) . length . decodePresence) (getPresence gu $ showUser uid) @@ -1003,18 +1016,18 @@ retryWhileN n f m = waitForMessageRaw :: TChan WS.Message -> IO (Maybe WS.Message) waitForMessageRaw = System.Timeout.timeout 3000000 . liftIO . atomically . readTChan -waitForMessage :: ToByteString a => TChan a -> IO (Maybe a) +waitForMessage :: (ToByteString a) => TChan a -> IO (Maybe a) waitForMessage = waitForMessage' 1000000 -waitForMessage' :: ToByteString a => Int -> TChan a -> IO (Maybe a) +waitForMessage' :: (ToByteString a) => Int -> TChan a -> IO (Maybe a) waitForMessage' musecs = System.Timeout.timeout musecs . liftIO . atomically . readTChan unregisterClient :: GundeckR -> UserId -> ClientId -> TestM (Response (Maybe BL.ByteString)) unregisterClient g uid cid = - delete $ - runGundeckR g - . zUser uid - . paths ["/i/clients", toByteString' cid] + delete + $ runGundeckR g + . zUser uid + . paths ["/i/clients", toByteString' cid] registerPushToken :: UserId -> PushToken -> TestM Token registerPushToken u t = do @@ -1062,7 +1075,7 @@ listPushTokens u = do (pure . pushTokens) (responseBody rs >>= decode) -listNotifications :: HasCallStack => UserId -> Maybe ClientId -> TestM [QueuedNotification] +listNotifications :: (HasCallStack) => UserId -> Maybe ClientId -> TestM [QueuedNotification] listNotifications u c = do rs <- getNotifications u c >= decode of @@ -1076,31 +1089,31 @@ listNotifications u c = do getNotifications :: UserId -> Maybe ClientId -> TestM (Response (Maybe BL.ByteString)) getNotifications u c = view tsGundeck >>= \gu -> - get $ - runGundeckR gu - . zUser u - . paths ["v3", "notifications"] - . maybe id (queryItem "client" . toByteString') c + get + $ runGundeckR gu + . zUser u + . paths ["v3", "notifications"] + . maybe id (queryItem "client" . toByteString') c getLastNotification :: UserId -> Maybe ClientId -> TestM (Response (Maybe BL.ByteString)) getLastNotification u c = view tsGundeck >>= \gu -> - get $ - runGundeckR gu - . zUser u - . paths ["notifications", "last"] - . maybe id (queryItem "client" . toByteString') c + get + $ runGundeckR gu + . zUser u + . paths ["notifications", "last"] + . maybe id (queryItem "client" . toByteString') c -sendPush :: HasCallStack => Push -> TestM () +sendPush :: (HasCallStack) => Push -> TestM () sendPush push = sendPushes [push] -sendPushes :: HasCallStack => [Push] -> TestM () +sendPushes :: (HasCallStack) => [Push] -> TestM () sendPushes push = do gu <- view tsGundeck post (runGundeckR gu . path "i/push/v2" . json push) !!! const 200 === statusCode buildPush :: - HasCallStack => + (HasCallStack) => UserId -> [(UserId, RecipientClients)] -> List1 Object -> @@ -1122,7 +1135,7 @@ gcmToken = TokenSpec GCM 16 appName apnsToken :: TokenSpec apnsToken = TokenSpec APNSSandbox 32 appName -randomToken :: MonadIO m => ClientId -> TokenSpec -> m PushToken +randomToken :: (MonadIO m) => ClientId -> TokenSpec -> m PushToken randomToken c ts = liftIO $ do tok <- (Token . T.decodeUtf8) Prelude.. B16.encode Prelude.<$> randomBytes (tSize ts) pure $ pushToken (trans ts) (tName ts) tok c @@ -1168,17 +1181,18 @@ randomUser = do toRecipients :: [UserId] -> Range 1 1024 (Set Recipient) toRecipients = unsafeRange . Set.fromList . map (`recipient` RouteAny) -randomConnId :: MonadIO m => m ConnId +randomConnId :: (MonadIO m) => m ConnId randomConnId = - liftIO $ - ConnId <$> do + liftIO + $ ConnId + <$> do r <- randomIO :: IO Word32 pure $ C.pack $ show r -randomClientId :: MonadIO m => m ClientId +randomClientId :: (MonadIO m) => m ClientId randomClientId = liftIO $ ClientId <$> (randomIO :: IO Word64) -randomBytes :: MonadIO m => Int -> m ByteString +randomBytes :: (MonadIO m) => Int -> m ByteString randomBytes n = liftIO $ BS.pack <$> replicateM n (randomIO :: IO Word8) textPayload :: Text -> List1 Object @@ -1193,7 +1207,7 @@ parseNotifications = responseBody >=> (^? key "notifications") >=> fromJSON' parseNotificationIds :: Response (Maybe BL.ByteString) -> Maybe [NotificationId] parseNotificationIds r = map (view queuedNotificationId) <$> parseNotifications r -fromJSON' :: FromJSON a => Value -> Maybe a +fromJSON' :: (FromJSON a) => Value -> Maybe a fromJSON' v = case fromJSON v of Success a -> Just a _ -> Nothing diff --git a/services/gundeck/test/integration/Main.hs b/services/gundeck/test/integration/Main.hs index 767f28a4ae4..3daac31fcef 100644 --- a/services/gundeck/test/integration/Main.hs +++ b/services/gundeck/test/integration/Main.hs @@ -76,10 +76,10 @@ instance IsOption ServiceConfigFile where ) runTests :: (String -> String -> TestTree) -> IO () -runTests run = defaultMainWithIngredients ings $ - askOption $ - \(ServiceConfigFile c) -> - askOption $ \(IntegrationConfigFile i) -> run c i +runTests run = defaultMainWithIngredients ings + $ askOption + $ \(ServiceConfigFile c) -> + askOption $ \(IntegrationConfigFile i) -> run c i where ings = includingOptions diff --git a/services/gundeck/test/integration/Util.hs b/services/gundeck/test/integration/Util.hs index 0bce9203d72..c8d63612d93 100644 --- a/services/gundeck/test/integration/Util.hs +++ b/services/gundeck/test/integration/Util.hs @@ -72,8 +72,8 @@ runTCPServer mhost port' server = withSocketsDo $ do listen sock 1024 pure sock loop clientThreads sock = forever $ do - E.bracketOnError (accept sock) (close . fst) $ - \(conn, _peer) -> do + E.bracketOnError (accept sock) (close . fst) + $ \(conn, _peer) -> do thread <- forkFinally (server conn) (const $ gracefulClose conn 5000) atomically $ modifyTVar clientThreads (thread :) cleanupClients :: TVar [ThreadId] -> Socket -> IO () diff --git a/services/gundeck/test/unit/Aws/Arn.hs b/services/gundeck/test/unit/Aws/Arn.hs index ca661c8d0de..9d20bfaeec0 100644 --- a/services/gundeck/test/unit/Aws/Arn.hs +++ b/services/gundeck/test/unit/Aws/Arn.hs @@ -22,7 +22,7 @@ tests = ] ] -realWorldArnTest :: HasCallStack => (String -> IO ()) -> Assertion +realWorldArnTest :: (HasCallStack) => (String -> IO ()) -> Assertion realWorldArnTest step = do step "Given an ARN from a test environment" let arnText :: Text = "arn:aws:sns:eu-central-1:091205192927:endpoint/GCM/sven-test-782078216207/ded226c7-45b8-3f6c-9e89-f253340bbb60" @@ -39,7 +39,7 @@ realWorldArnTest step = do step "Expect values to be de-serialized correctly" (toText arnData) @?= arnText -madeUpArnTest :: HasCallStack => (String -> IO ()) -> Assertion +madeUpArnTest :: (HasCallStack) => (String -> IO ()) -> Assertion madeUpArnTest step = do step "Given an ARN with data to cover untested cases" let arnText :: Text = "arn:aws:sns:us-east-2:000000000001:endpoint/APNS/nodash-000000000002/8ffd8d14-db06-4f3a-a3bb-08264b9dbfb0" diff --git a/services/gundeck/test/unit/DelayQueue.hs b/services/gundeck/test/unit/DelayQueue.hs index c9557dcea63..bd4291ec789 100644 --- a/services/gundeck/test/unit/DelayQueue.hs +++ b/services/gundeck/test/unit/DelayQueue.hs @@ -41,9 +41,12 @@ enqueueLimitProp (Positive l) = ioProperty $ do q <- DelayQueue.new (Clock (pure 1)) (Delay 1) (Limit l) r <- forM [1 .. l + 1] $ \(i :: Int) -> DelayQueue.enqueue q i i l' <- DelayQueue.length q - pure $ - r == replicate l True ++ [False] - && l' == l + pure + $ r + == replicate l True + ++ [False] + && l' + == l enqueueUniqueProp :: Positive Int -> Property enqueueUniqueProp (Positive n) = ioProperty $ do diff --git a/services/gundeck/test/unit/Json.hs b/services/gundeck/test/unit/Json.hs index d502874e32f..54b9b25861f 100644 --- a/services/gundeck/test/unit/Json.hs +++ b/services/gundeck/test/unit/Json.hs @@ -34,8 +34,8 @@ tests :: TestTree tests = testGroup "JSON" - [ testProperty "push/recipient" $ - forAll genRecipient serialiseOkProp, + [ testProperty "push/recipient" + $ forAll genRecipient serialiseOkProp, testGroup "BulkPush" [ testCase "PushTarget example" $ do @@ -61,11 +61,14 @@ tests = serialiseOkProp :: Recipient -> Property serialiseOkProp r = - property $ - let r' = decode (encode r) - in (view recipientId <$> r') == Just (view recipientId r) - && (view recipientRoute <$> r') == Just (view recipientRoute r) - && (view recipientClients <$> r') == Just (view recipientClients r) + property + $ let r' = decode (encode r) + in (view recipientId <$> r') + == Just (view recipientId r) + && (view recipientRoute <$> r') + == Just (view recipientRoute r) + && (view recipientClients <$> r') + == Just (view recipientClients r) ----------------------------------------------------------------------------- -- Randomness @@ -107,7 +110,7 @@ genPushTarget = PushTarget <$> arbitrary <*> (ConnId <$> genAlphaNum) genObject :: Gen Object genObject = fromList <$> listOf ((,) <$> genAlphaNum <*> (String <$> genAlphaNum)) -genAlphaNum :: IsString s => Gen s +genAlphaNum :: (IsString s) => Gen s genAlphaNum = fromString <$> listOf (elements (['a' .. 'z'] <> ['A' .. 'Z'] <> ['0' .. '9'])) shortListOf :: Gen a -> Gen [a] diff --git a/services/gundeck/test/unit/Main.hs b/services/gundeck/test/unit/Main.hs index 332418beb38..ef8063dc097 100644 --- a/services/gundeck/test/unit/Main.hs +++ b/services/gundeck/test/unit/Main.hs @@ -38,11 +38,12 @@ import ThreadBudget qualified main :: IO () main = - withOpenSSL . defaultMain $ - testGroup + withOpenSSL + . defaultMain + $ testGroup "Main" - [ testCase "sitemap" $ - assertEqual + [ testCase "sitemap" + $ assertEqual "inconcistent sitemap" mempty (pathsConsistencyCheck . treeToPaths . compile $ Gundeck.API.sitemap), diff --git a/services/gundeck/test/unit/MockGundeck.hs b/services/gundeck/test/unit/MockGundeck.hs index 19d35241dbd..51d92aa9398 100644 --- a/services/gundeck/test/unit/MockGundeck.hs +++ b/services/gundeck/test/unit/MockGundeck.hs @@ -163,7 +163,8 @@ serializeFakeAddrEndpoint ((^. snsTopic) -> eptopic) = instance FromJSON MockEnv where parseJSON = withObject "MockEnv" $ \env -> MockEnv - <$> env Aeson..: "clientInfos" + <$> env + Aeson..: "clientInfos" instance FromJSON ClientInfo where parseJSON = withObject "ClientInfo" $ \cinfo -> @@ -199,11 +200,11 @@ mkFakeAddrEndpoint (epid, transport, app) = Aws.mkSnsArn Tokyo (Account "acc") e -- 2. web socket delivery will NOT work, native push token registered, push will succeed -- 3. web socket delivery will NOT work, native push token registered, push will fail -- 4. web socket delivery will NOT work, no native push token registered -genMockEnv :: HasCallStack => Gen MockEnv +genMockEnv :: (HasCallStack) => Gen MockEnv genMockEnv = do -- This function generates a 'ClientInfo' that corresponds to one of the -- four scenarios above - let genClientInfo :: HasCallStack => UserId -> ClientId -> Gen ClientInfo + let genClientInfo :: (HasCallStack) => UserId -> ClientId -> Gen ClientInfo genClientInfo uid cid = do _ciNativeAddress <- QC.oneof @@ -250,12 +251,13 @@ genMockEnv = do validateMockEnv env & either error (const $ pure env) -- Try to shrink a 'MockEnv' by removing some users from '_meClientInfos'. -shrinkMockEnv :: HasCallStack => MockEnv -> [MockEnv] +shrinkMockEnv :: (HasCallStack) => MockEnv -> [MockEnv] shrinkMockEnv (MockEnv cis) = - MockEnv . Map.fromList + MockEnv + . Map.fromList <$> filter (not . null) (shrinkList (const []) (Map.toList cis)) -validateMockEnv :: forall m. MonadError String m => MockEnv -> m () +validateMockEnv :: forall m. (MonadError String m) => MockEnv -> m () validateMockEnv env = do checkIdsInNativeAddresses where @@ -270,17 +272,17 @@ validateMockEnv env = do unless (uid == adr ^. addrUser && cid == adr ^. addrClient) $ do throwError (show (uid, cid, adr)) -genRecipients :: HasCallStack => Int -> MockEnv -> Gen [Recipient] +genRecipients :: (HasCallStack) => Int -> MockEnv -> Gen [Recipient] genRecipients numrcp env = do uids <- take numrcp <$> shuffle (allUsers env) genRecipient' env `mapM` uids -genRecipient :: HasCallStack => MockEnv -> Gen Recipient +genRecipient :: (HasCallStack) => MockEnv -> Gen Recipient genRecipient env = do uid <- QC.elements (allUsers env) genRecipient' env uid -genRecipient' :: HasCallStack => MockEnv -> UserId -> Gen Recipient +genRecipient' :: (HasCallStack) => MockEnv -> UserId -> Gen Recipient genRecipient' env uid = do route <- genRoute cids <- @@ -290,7 +292,7 @@ genRecipient' env uid = do ] pure $ Recipient uid route cids -genRoute :: HasCallStack => Gen Route +genRoute :: (HasCallStack) => Gen Route genRoute = QC.elements [minBound ..] genId :: Gen (Id a) @@ -301,7 +303,7 @@ genId = do genClientId :: Gen ClientId genClientId = ClientId <$> arbitrary -genProtoAddress :: HasCallStack => UserId -> ClientId -> Gen Address +genProtoAddress :: (HasCallStack) => UserId -> ClientId -> Gen Address genProtoAddress _addrUser _addrClient = do _addrTransport :: Transport <- QC.elements [minBound ..] arnEpId :: Text <- arbitrary @@ -314,7 +316,7 @@ genProtoAddress _addrUser _addrClient = do genPushes :: MockEnv -> Gen [Push] genPushes = listOf . genPush -genPush :: HasCallStack => MockEnv -> Gen Push +genPush :: (HasCallStack) => MockEnv -> Gen Push genPush env = do let alluids = allUsers env sender <- QC.elements alluids @@ -349,12 +351,12 @@ genPush env = do [ pure Nothing, genOriginConnId ] - pure $ - newPush (Just sender) rcps pload - & pushConnections .~ onlyPushToConnections - & pushOriginConnection .~ originConnection - & pushTransient .~ transient - & pushNativeIncludeOrigin .~ inclorigin + pure + $ newPush (Just sender) rcps pload + & pushConnections .~ onlyPushToConnections + & pushOriginConnection .~ originConnection + & pushTransient .~ transient + & pushNativeIncludeOrigin .~ inclorigin -- (not covered: pushNativeAps, pushNativePriority) @@ -370,17 +372,19 @@ dropSomeDevices = [ pure $ length cids, choose (1, max 1 (length cids - 1)) ] - RecipientClientsSome . unsafeList1 . take numdevs + RecipientClientsSome + . unsafeList1 + . take numdevs <$> QC.shuffle (toList cids) -shrinkPushes :: HasCallStack => [Push] -> [[Push]] +shrinkPushes :: (HasCallStack) => [Push] -> [[Push]] shrinkPushes = shrinkList shrinkPush where - shrinkPush :: HasCallStack => Push -> [Push] + shrinkPush :: (HasCallStack) => Push -> [Push] shrinkPush psh = (\rcps -> psh & pushRecipients .~ rcps) <$> shrinkRecipients (psh ^. pushRecipients) - shrinkRecipients :: HasCallStack => Range 1 1024 (Set Recipient) -> [Range 1 1024 (Set Recipient)] + shrinkRecipients :: (HasCallStack) => Range 1 1024 (Set Recipient) -> [Range 1 1024 (Set Recipient)] shrinkRecipients = fmap unsafeRange . map Set.fromList . filter (not . null) . shrinkList shrinkRecipient . Set.toList . fromRange - shrinkRecipient :: HasCallStack => Recipient -> [Recipient] + shrinkRecipient :: (HasCallStack) => Recipient -> [Recipient] shrinkRecipient _ = [] -- | See 'Payload'. @@ -400,7 +404,7 @@ genNotifs env = fmap uniqNotifs . listOf $ do where uniqNotifs = nubBy ((==) `on` (ntfId . fst)) -shrinkNotifs :: HasCallStack => [(Notification, [Presence])] -> [[(Notification, [Presence])]] +shrinkNotifs :: (HasCallStack) => [(Notification, [Presence])] -> [[(Notification, [Presence])]] shrinkNotifs = shrinkList (\(notif, prcs) -> (notif,) <$> shrinkList (const []) prcs) ---------------------------------------------------------------------- @@ -490,8 +494,9 @@ handlePushWS Push {..} = do let isOriginDevice = origin == (Just uid, Just cid) -- Condition 3: push to cid iff (a) listed in pushConnections or (b) pushConnections is empty. let isWhitelisted = null _pushConnections || fakeConnId cid `elem` _pushConnections - when (isReachable && not isOriginDevice && isWhitelisted) $ - msWSQueue %= deliver (uid, cid) _pushPayload + when (isReachable && not isOriginDevice && isWhitelisted) + $ msWSQueue + %= deliver (uid, cid) _pushPayload where origin = (_pushOrigin, clientIdFromConnId <$> _pushOriginConnection) @@ -524,8 +529,9 @@ handlePushNative Push {..} = do not isOriginUser || (_pushNativeIncludeOrigin && not isOriginDevice) -- Condition 5: push to cid iff (a) listed in pushConnections or (b) pushConnections is empty. let isWhitelisted = null _pushConnections || fakeConnId cid `elem` _pushConnections - when (isNative && isReachable && isAllowedPerOriginRules && isWhitelisted) $ - msNativeQueue %= deliver (uid, cid) _pushPayload + when (isNative && isReachable && isAllowedPerOriginRules && isWhitelisted) + $ msNativeQueue + %= deliver (uid, cid) _pushPayload where origin = (_pushOrigin, clientIdFromConnId <$> _pushOriginConnection) @@ -608,9 +614,9 @@ mockPushNative :: mockPushNative (ntfPayload -> payload) _ addrs = do env <- ask forM_ addrs $ \addr -> do - when (nativeReachableAddr env addr) $ - msNativeQueue - %= deliver (addr ^. addrUser, addr ^. addrClient) payload + when (nativeReachableAddr env addr) + $ msNativeQueue + %= deliver (addr ^. addrUser, addr ^. addrClient) payload mockLookupAddresses :: (HasCallStack, m ~ MockGundeck) => @@ -636,11 +642,13 @@ mockBulkSend uri notifs = do (BulkPushRequest ntifs) -> mconcat $ (\(ntif, trgts) -> (ntif,) <$> trgts) <$> ntifs forM_ flat $ \(ntif, ptgt) -> do - when (getstatus ptgt == PushStatusOk) $ - msWSQueue - %= deliver (ptUserId ptgt, clientIdFromConnId $ ptConnId ptgt) (ntfPayload ntif) - pure . (uri,) . Right $ - BulkPushResponse + when (getstatus ptgt == PushStatusOk) + $ msWSQueue + %= deliver (ptUserId ptgt, clientIdFromConnId $ ptConnId ptgt) (ntfPayload ntif) + pure + . (uri,) + . Right + $ BulkPushResponse [(ntfId ntif, trgt, getstatus trgt) | (ntif, trgt) <- flat] mockOldSimpleWebPush :: @@ -698,20 +706,20 @@ mockOldSimpleWebPush notif tgts _senderid mconnid connWhitelist = do newtype Pretty a = Pretty a deriving (Eq, Ord) -instance Aeson.ToJSON a => Show (Pretty a) where +instance (Aeson.ToJSON a) => Show (Pretty a) where show (Pretty a) = cs $ Aeson.encodePretty a -shrinkPretty :: HasCallStack => (a -> [a]) -> Pretty a -> [Pretty a] +shrinkPretty :: (HasCallStack) => (a -> [a]) -> Pretty a -> [Pretty a] shrinkPretty shrnk (Pretty xs) = Pretty <$> shrnk xs -sublist1Of :: HasCallStack => [a] -> Gen (List1 a) +sublist1Of :: (HasCallStack) => [a] -> Gen (List1 a) sublist1Of [] = error "sublist1Of: empty list" sublist1Of xs = sublistOf xs >>= \case [] -> sublist1Of xs c : cc -> pure (list1 c cc) -unsafeList1 :: HasCallStack => [a] -> List1 a +unsafeList1 :: (HasCallStack) => [a] -> List1 a unsafeList1 [] = error "unsafeList1: empty list" unsafeList1 (x : xs) = list1 x xs @@ -737,13 +745,13 @@ mkWSStatus = do wsReachable :: MockEnv -> (UserId, ClientId) -> Bool wsReachable (MockEnv mp) (uid, cid) = - maybe False (^. ciWSReachable) $ - (Map.lookup uid >=> Map.lookup cid) mp + maybe False (^. ciWSReachable) + $ (Map.lookup uid >=> Map.lookup cid) mp nativeReachable :: MockEnv -> (UserId, ClientId) -> Bool nativeReachable (MockEnv mp) (uid, cid) = - maybe False (^. _2) $ - (Map.lookup uid >=> Map.lookup cid >=> (^. ciNativeAddress)) mp + maybe False (^. _2) + $ (Map.lookup uid >=> Map.lookup cid >=> (^. ciNativeAddress)) mp nativeReachableAddr :: MockEnv -> Address -> Bool nativeReachableAddr env addr = nativeReachable env (addr ^. addrUser, addr ^. addrClient) @@ -754,7 +762,7 @@ allUsers = fmap fst . allRecipients allRecipients :: MockEnv -> [(UserId, [ClientId])] allRecipients (MockEnv mp) = (_2 %~ Map.keys) <$> Map.toList mp -clientIdsOfUser :: HasCallStack => MockEnv -> UserId -> [ClientId] +clientIdsOfUser :: (HasCallStack) => MockEnv -> UserId -> [ClientId] clientIdsOfUser (MockEnv mp) uid = maybe (error "unknown UserId") Map.keys $ Map.lookup uid mp diff --git a/services/gundeck/test/unit/Native.hs b/services/gundeck/test/unit/Native.hs index 2e525f7cf1f..79252901ace 100644 --- a/services/gundeck/test/unit/Native.hs +++ b/services/gundeck/test/unit/Native.hs @@ -38,7 +38,8 @@ tests :: TestTree tests = testGroup "Native" - [ testProperty "serialise/ok" $ + [ testProperty "serialise/ok" + $ -- this may fail sporadically, but that's not a production issue. -- see . forAll genTransport serialiseOkProp @@ -103,8 +104,10 @@ data GcmData = GcmData instance FromJSON GcmData where parseJSON = withObject "GcmData" $ \o -> GcmData - <$> o .: "priority" - <*> o .: "data" + <$> o + .: "priority" + <*> o + .: "data" data ApnsData = ApnsData { apnsMeta :: !Object, @@ -115,8 +118,10 @@ data ApnsData = ApnsData instance FromJSON ApnsData where parseJSON = withObject "ApnsData" $ \o -> ApnsData - <$> o .: "aps" - <*> o .: "data" + <$> o + .: "aps" + <*> o + .: "data" newtype Bundle = NoticeBundle NotificationId deriving (Eq, Show) diff --git a/services/gundeck/test/unit/Push.hs b/services/gundeck/test/unit/Push.hs index 3214c72bdca..e27848eb092 100644 --- a/services/gundeck/test/unit/Push.hs +++ b/services/gundeck/test/unit/Push.hs @@ -55,8 +55,8 @@ webBulkPushProps plen@(Positive len) = mkEnv mkNotifs plen webBulkPushProp :: MockEnv -> Pretty [(Notification, [Presence])] -> Property webBulkPushProp env (Pretty notifs) = - counterexample "^ environment, notifications\n" $ - conjoin props + counterexample "^ environment, notifications\n" + $ conjoin props where (realout, realst) = runMockGundeck env $ Web.bulkPush notifs (mockout, mockst) = runMockGundeck env $ mockBulkPush notifs @@ -77,8 +77,8 @@ pushAllProps plen@(Positive len) = mkEnv mkPushes plen pushAllProp :: MockEnv -> Pretty [Push] -> Property pushAllProp env (Pretty pushes) = - counterexample "^ environment, pushes\n" $ - conjoin props + counterexample "^ environment, pushes\n" + $ conjoin props where ((), realst) = runMockGundeck env (pushAll pushes) ((), mockst) = runMockGundeck env (mockPushAll pushes) diff --git a/services/gundeck/test/unit/ThreadBudget.hs b/services/gundeck/test/unit/ThreadBudget.hs index 0627c91d436..7878a342b27 100644 --- a/services/gundeck/test/unit/ThreadBudget.hs +++ b/services/gundeck/test/unit/ThreadBudget.hs @@ -119,7 +119,7 @@ delay' :: (MonadCatch m, MonadIO m) => Int -> m () delay' microsecs = threadDelay microsecs `catch` \AsyncCancelled -> pure () burstActions :: - HasCallStack => + (HasCallStack) => ThreadBudgetState -> LogHistory -> MilliSeconds -> @@ -133,9 +133,9 @@ burstActions tbs logHistory howlong (NumberOfThreads howmany) = do -- likely to find weird race conditions. mkWatcher :: ThreadBudgetState -> LogHistory -> IO (Async ()) mkWatcher tbs logHistory = do - async $ - runReaderT (watchThreadBudgetState tbs 0.01) logHistory - `catch` \AsyncCancelled -> pure () + async + $ runReaderT (watchThreadBudgetState tbs 0.01) logHistory + `catch` \AsyncCancelled -> pure () ---------------------------------------------------------------------- -- TOC @@ -211,26 +211,26 @@ data Response r | MeasureResponse Int -- concrete running threads deriving (Show, Generic, Generic1, Rank2.Functor, Rank2.Foldable, Rank2.Traversable) -generator :: HasCallStack => Model Symbolic -> Maybe (Gen (Command Symbolic)) +generator :: (HasCallStack) => Model Symbolic -> Maybe (Gen (Command Symbolic)) generator (Model Nothing) = Just $ Init <$> arbitrary generator (Model (Just st)) = - Just $ - oneof + Just + $ oneof [ Run st <$> arbitrary <*> arbitrary, Wait st <$> arbitrary, pure $ Measure st ] -shrinker :: HasCallStack => Model Symbolic -> Command Symbolic -> [Command Symbolic] +shrinker :: (HasCallStack) => Model Symbolic -> Command Symbolic -> [Command Symbolic] shrinker _ (Init _) = [] shrinker _ (Run st n m) = Wait st (MilliSeconds 1) : (Run st <$> shrink n <*> shrink m) shrinker _ (Wait st n) = Wait st <$> shrink n shrinker _ (Measure _) = [] -initModel :: HasCallStack => Model r +initModel :: (HasCallStack) => Model r initModel = Model Nothing -semantics :: HasCallStack => Command Concrete -> IO (Response Concrete) +semantics :: (HasCallStack) => Command Concrete -> IO (Response Concrete) semantics (Init (NumberOfThreads limit)) = do tbs <- mkThreadBudgetState (MaxConcurrentNativePushes (Just limit) (Just limit)) @@ -254,17 +254,17 @@ semantics (Measure (opaque -> (tbs, _, _))) = concreteRunning <- budgetSpent tbs pure (MeasureResponse concreteRunning) -transition :: HasCallStack => Model r -> Command r -> Response r -> Model r +transition :: (HasCallStack) => Model r -> Command r -> Response r -> Model r transition (Model Nothing) (Init _) (InitResponse st) = Model (Just st) transition (Model (Just st)) Run {} RunResponse = Model (Just st) transition (Model (Just st)) Wait {} WaitResponse = Model (Just st) transition (Model (Just st)) Measure {} MeasureResponse {} = Model (Just st) transition _ _ _ = error "impossible." -precondition :: HasCallStack => Model Symbolic -> Command Symbolic -> Logic +precondition :: (HasCallStack) => Model Symbolic -> Command Symbolic -> Logic precondition _ _ = Top -postcondition :: HasCallStack => Model Concrete -> Command Concrete -> Response Concrete -> Logic +postcondition :: (HasCallStack) => Model Concrete -> Command Concrete -> Response Concrete -> Logic postcondition (Model Nothing) Init {} InitResponse {} = Top postcondition (Model (Just _)) Run {} RunResponse {} = Top postcondition (Model (Just _)) Wait {} WaitResponse {} = Top @@ -284,7 +284,7 @@ postcondition model@(Model (Just _)) cmd@Measure {} resp@(MeasureResponse concre postcondition m c r = error $ "impossible: " <> show (m, c, r) -mock :: HasCallStack => Model Symbolic -> Command Symbolic -> GenSym (Response Symbolic) +mock :: (HasCallStack) => Model Symbolic -> Command Symbolic -> GenSym (Response Symbolic) mock (Model Nothing) (Init _) = InitResponse <$> genSym mock (Model (Just _)) Run {} = pure RunResponse @@ -316,7 +316,7 @@ sm = -- | Remove resources created by the concrete 'STM.Commands', namely watcher and budgeted -- async threads. -shutdown :: Model Concrete -> MonadIO m => m () +shutdown :: Model Concrete -> (MonadIO m) => m () shutdown (Model Nothing) = pure () shutdown (Model (Just (opaque -> (tbs, watcher, _)))) = liftIO $ do cancelAllThreads tbs diff --git a/services/proxy/src/Proxy/API/Public.hs b/services/proxy/src/Proxy/API/Public.hs index de0bf2ccdd1..a1c522b29e5 100644 --- a/services/proxy/src/Proxy/API/Public.hs +++ b/services/proxy/src/Proxy/API/Public.hs @@ -121,16 +121,19 @@ spotifyToken rq = do req = baseReq {Client.requestHeaders = hdr} mgr <- view manager res <- liftIO $ recovering x2 [handler] $ const (Client.httpLbs (Req.lbytes b req) mgr) - when (isError (Client.responseStatus res)) $ - debug $ - msg (val "unexpected upstream response") - ~~ "upstream" .= val "spotify::token" - ~~ "status" .= S (Client.responseStatus res) - ~~ "body" .= B.take 256 (Client.responseBody res) - pure $ - plain (Client.responseBody res) - & setStatus (Client.responseStatus res) - . maybeHeader hContentType res + when (isError (Client.responseStatus res)) + $ debug + $ msg (val "unexpected upstream response") + ~~ "upstream" + .= val "spotify::token" + ~~ "status" + .= S (Client.responseStatus res) + ~~ "body" + .= B.take 256 (Client.responseBody res) + pure + $ plain (Client.responseBody res) + & setStatus (Client.responseStatus res) + . maybeHeader hContentType res where baseReq = Req.method POST @@ -146,16 +149,19 @@ soundcloudResolve url = do let req = Req.queryItem "client_id" s . Req.queryItem "url" url $ baseReq mgr <- view manager res <- liftIO $ recovering x2 [handler] $ const (Client.httpLbs req mgr) - when (isError (Client.responseStatus res)) $ - debug $ - msg (val "unexpected upstream response") - ~~ "upstream" .= val "soundcloud::resolve" - ~~ "status" .= S (Client.responseStatus res) - ~~ "body" .= B.take 256 (Client.responseBody res) - pure $ - plain (Client.responseBody res) - & setStatus (Client.responseStatus res) - . maybeHeader hContentType res + when (isError (Client.responseStatus res)) + $ debug + $ msg (val "unexpected upstream response") + ~~ "upstream" + .= val "soundcloud::resolve" + ~~ "status" + .= S (Client.responseStatus res) + ~~ "body" + .= B.take 256 (Client.responseBody res) + pure + $ plain (Client.responseBody res) + & setStatus (Client.responseStatus res) + . maybeHeader hContentType res where baseReq = Req.method GET @@ -169,16 +175,19 @@ soundcloudStream url = do e <- view secrets s <- liftIO $ Config.require e "secrets.soundcloud" req <- Req.noRedirect . Req.queryItem "client_id" s <$> Client.parseRequest (Text.unpack url) - unless (Client.secure req && Client.host req == "api.soundcloud.com") $ - failWith "insecure stream url" + unless (Client.secure req && Client.host req == "api.soundcloud.com") + $ failWith "insecure stream url" mgr <- view manager res <- liftIO $ recovering x2 [handler] $ const (Client.httpLbs req mgr) unless (status302 == Client.responseStatus res) $ do - debug $ - msg (val "unexpected upstream response") - ~~ "upstream" .= val "soundcloud::stream" - ~~ "status" .= S (Client.responseStatus res) - ~~ "body" .= B.take 256 (Client.responseBody res) + debug + $ msg (val "unexpected upstream response") + ~~ "upstream" + .= val "soundcloud::stream" + ~~ "status" + .= S (Client.responseStatus res) + ~~ "body" + .= B.take 256 (Client.responseBody res) failWith "unexpected upstream response" case Res.getHeader hLocation res of Nothing -> failWith "missing location header" @@ -187,7 +196,7 @@ soundcloudStream url = do x2 :: RetryPolicy x2 = exponentialBackoff 5000 <> limitRetries 2 -handler :: MonadIO m => RetryStatus -> Handler m Bool +handler :: (MonadIO m) => RetryStatus -> Handler m Bool handler = const . Handler $ \case Client.HttpExceptionRequest _ Client.NoResponseDataReceived -> pure True Client.HttpExceptionRequest _ Client.IncompleteHeaders -> pure True diff --git a/services/proxy/src/Proxy/Proxy.hs b/services/proxy/src/Proxy/Proxy.hs index cc7f6c5f8fc..16deb460272 100644 --- a/services/proxy/src/Proxy/Proxy.hs +++ b/services/proxy/src/Proxy/Proxy.hs @@ -65,9 +65,12 @@ lookupReqId l r = case lookup requestIdName (requestHeaders r) of Just rid -> pure $ RequestId rid Nothing -> do localRid <- RequestId . UUID.toASCIIBytes <$> UUID.nextRandom - Log.info l $ - "request-id" .= localRid - ~~ "method" .= requestMethod r - ~~ "path" .= rawPathInfo r + Log.info l + $ "request-id" + .= localRid + ~~ "method" + .= requestMethod r + ~~ "path" + .= rawPathInfo r ~~ msg (val "generated a new request id for local request") pure localRid diff --git a/services/spar/migrate-data/src/Spar/DataMigration/Options.hs b/services/spar/migrate-data/src/Spar/DataMigration/Options.hs index 6850ca92ecc..cb11179ea70 100644 --- a/services/spar/migrate-data/src/Spar/DataMigration/Options.hs +++ b/services/spar/migrate-data/src/Spar/DataMigration/Options.hs @@ -62,7 +62,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/services/spar/migrate-data/src/Spar/DataMigration/Run.hs b/services/spar/migrate-data/src/Spar/DataMigration/Run.hs index c41bd2d2ccf..371237a2411 100644 --- a/services/spar/migrate-data/src/Spar/DataMigration/Run.hs +++ b/services/spar/migrate-data/src/Spar/DataMigration/Run.hs @@ -88,12 +88,14 @@ runMigration :: Env -> Migration -> IO () runMigration env@Env {..} (Migration ver txt mig) = do info env $ "Running: [" <> show (migrationVersion ver) <> "] " <> Text.unpack txt mig env - unless (dryRun == DryRun) $ - persistVersion env ver txt =<< liftIO getCurrentTime + unless (dryRun == DryRun) + $ persistVersion env ver txt + =<< liftIO getCurrentTime latestMigrationVersion :: Env -> IO MigrationVersion latestMigrationVersion Env {..} = - MigrationVersion . maybe 0 fromIntegral + MigrationVersion + . maybe 0 fromIntegral <$> C.runClient sparCassandra (C.query1 cql (C.params C.LocalQuorum ())) @@ -103,8 +105,8 @@ latestMigrationVersion Env {..} = persistVersion :: Env -> MigrationVersion -> Text -> UTCTime -> IO () persistVersion Env {..} (MigrationVersion v) desc time = - C.runClient sparCassandra $ - C.write cql (C.params C.LocalQuorum (fromIntegral v, desc, time)) + C.runClient sparCassandra + $ C.write cql (C.params C.LocalQuorum (fromIntegral v, desc, time)) where cql :: C.QueryString C.W (Int32, Text, UTCTime) () cql = "insert into data_migration (id, version, descr, date) values (1,?,?,?)" diff --git a/services/spar/migrate-data/src/Spar/DataMigration/V2_UserV2.hs b/services/spar/migrate-data/src/Spar/DataMigration/V2_UserV2.hs index ac7d49efca6..9157a952396 100644 --- a/services/spar/migrate-data/src/Spar/DataMigration/V2_UserV2.hs +++ b/services/spar/migrate-data/src/Spar/DataMigration/V2_UserV2.hs @@ -68,7 +68,7 @@ type CollisionResolver = -- | Use this if you want to paginate without crashing newtype CqlSafe a = CqlSafe {unCqlSafe :: Either String a} -instance Cql a => Cql (CqlSafe a) where +instance (Cql a) => Cql (CqlSafe a) where ctype = Tagged $ untag (ctype @a) toCql _ = error "CqlSafe is not meant for serialization" fromCql val = @@ -82,8 +82,8 @@ migration = { version = MigrationVersion 2, text = "Migrate to spar.user_v2", action = \env -> - flip runReaderT env $ - case dryRun env of + flip runReaderT env + $ case dryRun env of DryRun -> performDryRun NoDryRun -> performMigration } @@ -91,16 +91,16 @@ migration = performDryRun :: EnvIO () performDryRun = do migMapInv <- collectMapping - runConduit $ - filterResolved combinedResolver migMapInv - .| C.sinkNull + runConduit + $ filterResolved combinedResolver migMapInv + .| C.sinkNull performMigration :: EnvIO () performMigration = do migMapInv <- collectMapping - runConduit $ - filterResolved combinedResolver migMapInv - .| CL.mapM_ insertNewRow + runConduit + $ filterResolved combinedResolver migMapInv + .| CL.mapM_ insertNewRow where insertNewRow :: NewRow -> EnvIO () insertNewRow newRow = do @@ -131,16 +131,16 @@ runBrig cl = do collectMapping :: EnvIO MigrationMapInverse collectMapping = do - runConduit $ - zipSources (CL.sourceList [(1 :: Int32) ..]) readOldRows - .| migrateRows - .| CC.foldl collect Map.empty + runConduit + $ zipSources (CL.sourceList [(1 :: Int32) ..]) readOldRows + .| migrateRows + .| CC.foldl collect Map.empty where readOldRows :: ConduitT () [OldRow] EnvIO () readOldRows = do pSize <- lift $ asks pageSize - transPipe runSpar $ - paginateC select (paramsP LocalQuorum () pSize) x5 + transPipe runSpar + $ paginateC select (paramsP LocalQuorum () pSize) x5 where select :: PrepQuery R () OldRow select = "SELECT issuer, sso_id, uid FROM user" @@ -208,9 +208,9 @@ resolveViaActivated _ input@(List2 old1 old2 rest) = do where isActivated :: UserId -> EnvIO Bool isActivated u = - runBrig $ - (== Just (Identity True)) - <$> retry x1 (query1 activatedSelect (params LocalQuorum (Identity u))) + runBrig + $ (== Just (Identity True)) + <$> retry x1 (query1 activatedSelect (params LocalQuorum (Identity u))) activatedSelect :: PrepQuery R (Identity UserId) (Identity Bool) activatedSelect = "SELECT activated FROM user WHERE id = ?" @@ -227,8 +227,9 @@ resolveViaAccessToken _ input@(List2 old1 old2 rest) = do where latestCookieExpiry :: UserId -> EnvIO (Maybe UTCTime) latestCookieExpiry uid = - runBrig $ - runIdentity <$$> query1 select (params LocalQuorum (Identity uid)) + runBrig + $ runIdentity + <$$> query1 select (params LocalQuorum (Identity uid)) where select :: PrepQuery R (Identity UserId) (Identity UTCTime) select = "SELECT expires FROM user_cookies WHERE user = ? ORDER BY expires DESC LIMIT 1" diff --git a/services/spar/src/Spar/Data.hs b/services/spar/src/Spar/Data.hs index ad8915c45c1..fc79c7dfb7b 100644 --- a/services/spar/src/Spar/Data.hs +++ b/services/spar/src/Spar/Data.hs @@ -72,13 +72,13 @@ mkEnv opts now = dataEnvMaxTTLAssertions = maxttlAuthresp opts } -mkTTLAuthnRequests :: MonadError TTLError m => Env -> UTCTime -> m (TTL "authreq") +mkTTLAuthnRequests :: (MonadError TTLError m) => Env -> UTCTime -> m (TTL "authreq") mkTTLAuthnRequests (Env now maxttl _) = mkTTL now maxttl -mkTTLAuthnRequestsNDT :: MonadError TTLError m => Env -> NominalDiffTime -> m (TTL "authreq") +mkTTLAuthnRequestsNDT :: (MonadError TTLError m) => Env -> NominalDiffTime -> m (TTL "authreq") mkTTLAuthnRequestsNDT (Env _ maxttl _) = mkTTLNDT maxttl -mkTTLAssertions :: MonadError TTLError m => Env -> UTCTime -> m (TTL "authresp") +mkTTLAssertions :: (MonadError TTLError m) => Env -> UTCTime -> m (TTL "authresp") mkTTLAssertions (Env now _ maxttl) = mkTTL now maxttl mkTTL :: (MonadError TTLError m, KnownSymbol a) => UTCTime -> TTL a -> UTCTime -> m (TTL a) @@ -87,9 +87,9 @@ mkTTL now maxttl endOfLife = mkTTLNDT maxttl $ endOfLife `diffUTCTime` now mkTTLNDT :: (MonadError TTLError m, KnownSymbol a) => TTL a -> NominalDiffTime -> m (TTL a) mkTTLNDT maxttl ttlNDT = if - | actualttl > maxttl -> throwError $ TTLTooLong (showTTL actualttl) (showTTL maxttl) - | actualttl <= 0 -> throwError $ TTLNegative (showTTL actualttl) - | otherwise -> pure actualttl + | actualttl > maxttl -> throwError $ TTLTooLong (showTTL actualttl) (showTTL maxttl) + | actualttl <= 0 -> throwError $ TTLNegative (showTTL actualttl) + | otherwise -> pure actualttl where actualttl = TTL . nominalDiffToSeconds $ ttlNDT diff --git a/services/spar/src/Spar/Error.hs b/services/spar/src/Spar/Error.hs index 8e3f516abdf..61f3985f3fb 100644 --- a/services/spar/src/Spar/Error.hs +++ b/services/spar/src/Spar/Error.hs @@ -68,7 +68,7 @@ type SparError = SAML.Error SparCustomError -- FUTUREWORK: This instance should probably be inside saml2-web-sso instead. instance Exception SparError -throwSpar :: MonadError SparError m => SparCustomError -> m a +throwSpar :: (MonadError SparError m) => SparCustomError -> m a throwSpar = throwError . SAML.CustomError data SparCustomError @@ -130,7 +130,7 @@ data IdpDbError | IdpNotFound -- like 'SparIdPNotFound', but a database consistency error. (should we consolidate something anyway?) deriving (Eq, Show) -sparToServerErrorWithLogging :: MonadIO m => Log.Logger -> SparError -> m ServerError +sparToServerErrorWithLogging :: (MonadIO m) => Log.Logger -> SparError -> m ServerError sparToServerErrorWithLogging logger err = do let errServant = sparToServerError err liftIO $ Wai.logError logger (Nothing :: Maybe Wai.Request) (servantToWaiError errServant) @@ -172,37 +172,37 @@ renderSparError (SAML.CustomError SparReAuthCodeAuthRequired) = Right $ Wai.mkEr renderSparError (SAML.CustomError SparCouldNotRetrieveCookie) = Right $ Wai.mkError status502 "bad-upstream" "Unable to get a cookie from an upstream server." renderSparError (SAML.CustomError (SparCassandraError msg)) = Right $ Wai.mkError status500 "server-error" msg -- TODO: should we be more specific here and make it 'db-error'? renderSparError (SAML.CustomError (SparCassandraTTLError ttlerr)) = - Right $ - Wai.mkError + Right + $ Wai.mkError status400 "ttl-error" (LText.pack $ show ttlerr) renderSparError (SAML.UnknownIdP msg) = Right $ Wai.mkError status404 "not-found" ("IdP not found: " <> msg) renderSparError (SAML.Forbidden msg) = Right $ Wai.mkError status403 "forbidden" ("Forbidden: " <> msg) renderSparError (SAML.BadSamlResponseBase64Error msg) = - Right $ - Wai.mkError status400 "bad-response-encoding" ("Bad response: base64 error: " <> msg) + Right + $ Wai.mkError status400 "bad-response-encoding" ("Bad response: base64 error: " <> msg) renderSparError (SAML.BadSamlResponseXmlError msg) = - Right $ - Wai.mkError status400 "bad-response-xml" ("Bad response: XML parse error: " <> msg) + Right + $ Wai.mkError status400 "bad-response-xml" ("Bad response: XML parse error: " <> msg) renderSparError (SAML.BadSamlResponseSamlError msg) = - Right $ - Wai.mkError status400 "bad-response-saml" ("Bad response: SAML parse error: " <> msg) + Right + $ Wai.mkError status400 "bad-response-saml" ("Bad response: SAML parse error: " <> msg) renderSparError SAML.BadSamlResponseFormFieldMissing = Right $ Wai.mkError status400 "bad-response-saml" "Bad response: SAMLResponse form field missing from HTTP body" renderSparError SAML.BadSamlResponseIssuerMissing = Right $ Wai.mkError status400 "bad-response-saml" "Bad response: no Issuer in AuthnResponse" renderSparError SAML.BadSamlResponseNoAssertions = Right $ Wai.mkError status400 "bad-response-saml" "Bad response: no assertions in AuthnResponse" renderSparError SAML.BadSamlResponseAssertionWithoutID = Right $ Wai.mkError status400 "bad-response-saml" "Bad response: assertion without ID" renderSparError (SAML.BadSamlResponseInvalidSignature msg) = - Right $ - Wai.mkError status400 "bad-response-signature" msg + Right + $ Wai.mkError status400 "bad-response-signature" msg renderSparError (SAML.CustomError (SparIdPNotFound "")) = Right $ Wai.mkError status404 "not-found" "Could not find IdP." renderSparError (SAML.CustomError (SparIdPNotFound msg)) = Right $ Wai.mkError status404 "not-found" ("Could not find IdP: " <> msg) renderSparError (SAML.CustomError SparSamlCredentialsNotFound) = Right $ Wai.mkError status404 "not-found" "Could not find SAML credentials, and auto-provisioning is disabled." renderSparError (SAML.CustomError SparMissingZUsr) = Right $ Wai.mkError status400 "client-error" "[header] 'Z-User' required" renderSparError (SAML.CustomError SparNotInTeam) = Right $ Wai.mkError status403 "no-team-member" "Requesting user is not a team member or not a member of this team." renderSparError (SAML.CustomError (SparNoPermission perm)) = - Right $ - Wai.mkError + Right + $ Wai.mkError status403 "insufficient-permissions" ("You need permission " <> perm <> ".") @@ -225,8 +225,8 @@ renderSparError (SAML.CustomError (IdpDbError IdpNonUnique)) = Right $ Wai.mkErr renderSparError (SAML.CustomError (IdpDbError IdpWrongTeam)) = Right $ Wai.mkError status409 "idp-wrong-team" "The IdP is not part of this team." renderSparError (SAML.CustomError (IdpDbError IdpNotFound)) = renderSparError (SAML.CustomError (SparIdPNotFound "")) -- Errors related to provisioning -renderSparError (SAML.CustomError (SparProvisioningMoreThanOneIdP msg)) = Right $ - Wai.mkError status400 "more-than-one-idp" do +renderSparError (SAML.CustomError (SparProvisioningMoreThanOneIdP msg)) = Right + $ Wai.mkError status400 "more-than-one-idp" do "Team can have at most one IdP configured: " <> case msg of ScimTokenAndSecondIdpForbidden -> "teams with SCIM tokens can only have at most one IdP" TwoIdpsAndScimTokenForbidden -> "SCIM tokens can only be created for a team with at most one IdP" diff --git a/services/spar/src/Spar/Intra/Brig.hs b/services/spar/src/Spar/Intra/Brig.hs index d2a97b56dcc..56cda0a6abe 100644 --- a/services/spar/src/Spar/Intra/Brig.hs +++ b/services/spar/src/Spar/Intra/Brig.hs @@ -119,10 +119,10 @@ createBrigUserSAML uref (Id buid) teamid name managedBy handle richInfo mLocale newUserSparRole = role } resp :: ResponseLBS <- - call $ - method POST - . path "/i/users/spar" - . json newUser + call + $ method POST + . path "/i/users/spar" + . json newUser if statusCode resp `elem` [200, 201] then userId . selfUser <$> parseResponse @SelfProfile "brig" resp else rethrow "brig" resp @@ -140,10 +140,10 @@ createBrigUserNoSAML :: createBrigUserNoSAML email uid teamid uname locale role = do let newUser = NewUserScimInvitation teamid uid locale uname email role resp :: ResponseLBS <- - call $ - method POST - . paths ["/i/teams", toByteString' teamid, "invitations"] - . json newUser + call + $ method POST + . paths ["/i/teams", toByteString' teamid, "invitations"] + . json newUser if statusCode resp `elem` [200, 201] then userId . accountUser <$> parseResponse @UserAccount "brig" resp @@ -152,12 +152,12 @@ createBrigUserNoSAML email uid teamid uname locale role = do updateEmail :: (HasCallStack, MonadSparToBrig m) => UserId -> Email -> m () updateEmail buid email = do resp <- - call $ - method PUT - . path "/i/self/email" - . header "Z-User" (toByteString' buid) - . query [("validate", Just "true")] - . json (EmailUpdate email) + call + $ method PUT + . path "/i/self/email" + . header "Z-User" (toByteString' buid) + . query [("validate", Just "true")] + . json (EmailUpdate email) case statusCode resp of 204 -> pure () 202 -> pure () @@ -167,25 +167,26 @@ updateEmail buid email = do getBrigUserAccount :: (HasCallStack, MonadSparToBrig m) => HavePendingInvitations -> UserId -> m (Maybe UserAccount) getBrigUserAccount havePending buid = do resp :: ResponseLBS <- - call $ - method GET - . paths ["/i/users"] - . query - [ ("ids", Just $ toByteString' buid), - ( "includePendingInvitations", - Just . toByteString' $ - case havePending of - WithPendingInvitations -> True - NoPendingInvitations -> False - ) - ] + call + $ method GET + . paths ["/i/users"] + . query + [ ("ids", Just $ toByteString' buid), + ( "includePendingInvitations", + Just + . toByteString' + $ case havePending of + WithPendingInvitations -> True + NoPendingInvitations -> False + ) + ] case statusCode resp of 200 -> parseResponse @[UserAccount] "brig" resp >>= \case [account] -> - pure $ - if userDeleted $ accountUser account + pure + $ if userDeleted $ accountUser account then Nothing else Just account _ -> pure Nothing @@ -199,11 +200,11 @@ getBrigUserAccount havePending buid = do getBrigUserByHandle :: (HasCallStack, MonadSparToBrig m) => Handle -> m (Maybe UserAccount) getBrigUserByHandle handle = do resp :: ResponseLBS <- - call $ - method GET - . path "/i/users" - . queryItem "handles" (toByteString' handle) - . queryItem "includePendingInvitations" "true" + call + $ method GET + . path "/i/users" + . queryItem "handles" (toByteString' handle) + . queryItem "includePendingInvitations" "true" case statusCode resp of 200 -> listToMaybe <$> parseResponse @[UserAccount] "brig" resp 404 -> pure Nothing @@ -212,11 +213,11 @@ getBrigUserByHandle handle = do getBrigUserByEmail :: (HasCallStack, MonadSparToBrig m) => Email -> m (Maybe UserAccount) getBrigUserByEmail email = do resp :: ResponseLBS <- - call $ - method GET - . path "/i/users" - . queryItem "email" (toByteString' email) - . queryItem "includePendingInvitations" "true" + call + $ method GET + . path "/i/users" + . queryItem "email" (toByteString' email) + . queryItem "includePendingInvitations" "true" case statusCode resp of 200 -> do macc <- listToMaybe <$> parseResponse @[UserAccount] "brig" resp @@ -231,10 +232,10 @@ getBrigUserByEmail email = do setBrigUserName :: (HasCallStack, MonadSparToBrig m) => UserId -> Name -> m () setBrigUserName buid (Name name) = do resp <- - call $ - method PUT - . paths ["/i/users", toByteString' buid, "name"] - . json (NameUpdate name) + call + $ method PUT + . paths ["/i/users", toByteString' buid, "name"] + . json (NameUpdate name) let sCode = statusCode resp if sCode < 300 then pure () @@ -249,10 +250,10 @@ setBrigUserName buid (Name name) = do setBrigUserHandle :: (HasCallStack, MonadSparToBrig m) => UserId -> Handle {- not 'HandleUpdate'! -} -> m () setBrigUserHandle buid handle = do resp <- - call $ - method PUT - . paths ["/i/users", toByteString' buid, "handle"] - . json (HandleUpdate (fromHandle handle)) + call + $ method PUT + . paths ["/i/users", toByteString' buid, "handle"] + . json (HandleUpdate (fromHandle handle)) case (statusCode resp, Wai.label <$> responseJsonMaybe @Wai.Error resp) of (200, Nothing) -> pure () @@ -264,21 +265,21 @@ setBrigUserHandle buid handle = do setBrigUserManagedBy :: (HasCallStack, MonadSparToBrig m) => UserId -> ManagedBy -> m () setBrigUserManagedBy buid managedBy = do resp <- - call $ - method PUT - . paths ["/i/users", toByteString' buid, "managed-by"] - . json (ManagedByUpdate managedBy) - unless (statusCode resp == 200) $ - rethrow "brig" resp + call + $ method PUT + . paths ["/i/users", toByteString' buid, "managed-by"] + . json (ManagedByUpdate managedBy) + unless (statusCode resp == 200) + $ rethrow "brig" resp -- | Set user's UserSSOId. setBrigUserVeid :: (HasCallStack, MonadSparToBrig m) => UserId -> ValidExternalId -> m () setBrigUserVeid buid veid = do resp <- - call $ - method PUT - . paths ["i", "users", toByteString' buid, "sso-id"] - . json (veidToUserSSOId veid) + call + $ method PUT + . paths ["i", "users", toByteString' buid, "sso-id"] + . json (veidToUserSSOId veid) case statusCode resp of 200 -> pure () _ -> rethrow "brig" resp @@ -288,37 +289,37 @@ setBrigUserVeid buid veid = do setBrigUserRichInfo :: (HasCallStack, MonadSparToBrig m) => UserId -> RichInfo -> m () setBrigUserRichInfo buid richInfo = do resp <- - call $ - method PUT - . paths ["i", "users", toByteString' buid, "rich-info"] - . json (RichInfoUpdate $ unRichInfo richInfo) - unless (statusCode resp == 200) $ - rethrow "brig" resp + call + $ method PUT + . paths ["i", "users", toByteString' buid, "rich-info"] + . json (RichInfoUpdate $ unRichInfo richInfo) + unless (statusCode resp == 200) + $ rethrow "brig" resp setBrigUserLocale :: (HasCallStack, MonadSparToBrig m) => UserId -> Maybe Locale -> m () setBrigUserLocale buid = \case Just locale -> do resp <- - call $ - method PUT - . paths ["i", "users", toByteString' buid, "locale"] - . json (LocaleUpdate locale) - unless (statusCode resp == 200) $ - rethrow "brig" resp + call + $ method PUT + . paths ["i", "users", toByteString' buid, "locale"] + . json (LocaleUpdate locale) + unless (statusCode resp == 200) + $ rethrow "brig" resp Nothing -> do resp <- - call $ - method DELETE - . paths ["i", "users", toByteString' buid, "locale"] - unless (statusCode resp == 200) $ - rethrow "brig" resp + call + $ method DELETE + . paths ["i", "users", toByteString' buid, "locale"] + unless (statusCode resp == 200) + $ rethrow "brig" resp getBrigUserRichInfo :: (HasCallStack, MonadSparToBrig m) => UserId -> m RichInfo getBrigUserRichInfo buid = do resp <- - call $ - method GET - . paths ["/i/users", toByteString' buid, "rich-info"] + call + $ method GET + . paths ["/i/users", toByteString' buid, "rich-info"] case statusCode resp of 200 -> parseResponse "brig" resp _ -> rethrow "brig" resp @@ -326,26 +327,26 @@ getBrigUserRichInfo buid = do checkHandleAvailable :: (HasCallStack, MonadSparToBrig m) => Handle -> m Bool checkHandleAvailable hnd = do resp <- - call $ - method HEAD - . paths ["/i/users/handles", toByteString' hnd] + call + $ method HEAD + . paths ["/i/users/handles", toByteString' hnd] let sCode = statusCode resp if - | sCode == 200 -> -- handle exists - pure False - | sCode == 404 -> -- handle not found - pure True - | otherwise -> - rethrow "brig" resp + | sCode == 200 -> -- handle exists + pure False + | sCode == 404 -> -- handle not found + pure True + | otherwise -> + rethrow "brig" resp -- | Call brig to delete a user. -- If the user wasn't deleted completely before, another deletion attempt will be made. deleteBrigUserInternal :: (HasCallStack, MonadSparToBrig m) => UserId -> m DeleteUserResult deleteBrigUserInternal buid = do resp <- - call $ - method DELETE - . paths ["/i/users", toByteString' buid] + call + $ method DELETE + . paths ["/i/users", toByteString' buid] case statusCode resp of 200 -> pure AccountAlreadyDeleted 202 -> pure AccountDeleted @@ -363,10 +364,10 @@ ensureReAuthorised :: ensureReAuthorised Nothing _ _ _ = throwSpar SparMissingZUsr ensureReAuthorised (Just uid) secret mbCode mbAction = do resp <- - call $ - method GET - . paths ["/i/users", toByteString' uid, "reauthenticate"] - . json (ReAuthUser secret mbCode mbAction) + call + $ method GET + . paths ["/i/users", toByteString' uid, "reauthenticate"] + . json (ReAuthUser secret mbCode mbAction) case (statusCode resp, errorLabel resp) of (200, _) -> pure () (403, Just "code-authentication-required") -> throwSpar SparReAuthCodeAuthRequired @@ -386,11 +387,11 @@ ssoLogin :: m SetCookie ssoLogin buid = do resp :: ResponseLBS <- - call $ - method POST - . path "/i/sso-login" - . json (SsoLogin buid Nothing) - . queryItem "persist" "true" + call + $ method POST + . path "/i/sso-login" + . json (SsoLogin buid Nothing) + . queryItem "persist" "true" if statusCode resp == 200 then respToCookie resp else rethrow "brig" resp @@ -418,10 +419,10 @@ getStatusMaybe uid = do setStatus :: (HasCallStack, MonadSparToBrig m) => UserId -> AccountStatus -> m () setStatus uid status = do resp <- - call $ - method PUT - . paths ["/i/users", toByteString' uid, "status"] - . json (AccountStatusUpdate status) + call + $ method PUT + . paths ["/i/users", toByteString' uid, "status"] + . json (AccountStatusUpdate status) case statusCode resp of 200 -> pure () _ -> rethrow "brig" resp diff --git a/services/spar/src/Spar/Intra/BrigApp.hs b/services/spar/src/Spar/Intra/BrigApp.hs index 97878fa990c..acca8893826 100644 --- a/services/spar/src/Spar/Intra/BrigApp.hs +++ b/services/spar/src/Spar/Intra/BrigApp.hs @@ -73,7 +73,7 @@ import Wire.API.User.Scim (ValidExternalId (..), runValidExternalIdEither) veidToUserSSOId :: ValidExternalId -> UserSSOId veidToUserSSOId = runValidExternalIdEither UserSSOId (UserScimExternalId . fromEmail) -veidFromUserSSOId :: MonadError String m => UserSSOId -> m ValidExternalId +veidFromUserSSOId :: (MonadError String m) => UserSSOId -> m ValidExternalId veidFromUserSSOId = \case UserSSOId uref -> case urefToEmail uref of @@ -93,7 +93,7 @@ veidFromUserSSOId = \case -- Note: the saml issuer is only needed in the case where a user has been invited via team -- settings and is now onboarded to saml/scim. If this case can safely be ruled out, it's ok -- to just set it to 'Nothing'. -veidFromBrigUser :: MonadError String m => User -> Maybe SAML.Issuer -> m ValidExternalId +veidFromBrigUser :: (MonadError String m) => User -> Maybe SAML.Issuer -> m ValidExternalId veidFromBrigUser usr mIssuer = case (userSSOId usr, userEmail usr, mIssuer) of (Just ssoid, _, _) -> veidFromUserSSOId ssoid (Nothing, Just email, Just issuer) -> pure $ EmailAndUref email (SAML.UserRef issuer (emailToSAMLNameID email)) diff --git a/services/spar/src/Spar/Intra/Galley.hs b/services/spar/src/Spar/Intra/Galley.hs index 03dc835df67..f5b513ab0c5 100644 --- a/services/spar/src/Spar/Intra/Galley.hs +++ b/services/spar/src/Spar/Intra/Galley.hs @@ -47,9 +47,9 @@ getTeamMembers :: m [TeamMember] getTeamMembers tid = do resp :: ResponseLBS <- - call $ - method GET - . paths ["i", "teams", toByteString' tid, "members"] + call + $ method GET + . paths ["i", "teams", toByteString' tid, "members"] if statusCode resp == 200 then (^. teamMembers) <$> parseResponse @TeamMemberList "galley" resp else rethrow "galley" resp @@ -62,9 +62,9 @@ getTeamMember :: m (Maybe TeamMember) getTeamMember tid uid = do resp :: ResponseLBS <- - call $ - method GET - . paths ["i", "teams", toByteString' tid, "members", toByteString' uid] + call + $ method GET + . paths ["i", "teams", toByteString' tid, "members", toByteString' uid] if statusCode resp == 200 then Just <$> parseResponse @TeamMember "galley" resp else @@ -81,9 +81,9 @@ assertHasPermission :: m () assertHasPermission tid perm uid = do resp <- - call $ - method GET - . paths ["i", "teams", toByteString' tid, "members", toByteString' uid] + call + $ method GET + . paths ["i", "teams", toByteString' tid, "members", toByteString' uid] case (statusCode resp, parseResponse @TeamMember "galley" resp) of (200, Right member) | hasPermission member perm -> pure () _ -> throwSpar (SparNoPermission (LText.pack $ show perm)) @@ -94,20 +94,21 @@ assertSSOEnabled :: m () assertSSOEnabled tid = do resp :: ResponseLBS <- - call $ - method GET - . paths ["i", "teams", toByteString' tid, "features", "sso"] - unless (statusCode resp == 200) $ - rethrow "galley" resp + call + $ method GET + . paths ["i", "teams", toByteString' tid, "features", "sso"] + unless (statusCode resp == 200) + $ rethrow "galley" resp ws :: WithStatus SSOConfig <- parseResponse "galley" resp - unless (wsStatus ws == FeatureStatusEnabled) $ - throwSpar SparSSODisabled + unless (wsStatus ws == FeatureStatusEnabled) + $ throwSpar SparSSODisabled isEmailValidationEnabledTeam :: (HasCallStack, MonadSparToGalley m) => TeamId -> m Bool isEmailValidationEnabledTeam tid = do resp <- call $ method GET . paths ["i", "teams", toByteString' tid, "features", "validateSAMLemails"] pure - ( statusCode resp == 200 + ( statusCode resp + == 200 && ( (wsStatus <$> responseJsonMaybe @(WithStatus ValidateSAMLEmailsConfig) resp) == Just FeatureStatusEnabled ) @@ -123,9 +124,9 @@ updateTeamMember :: updateTeamMember u tid role = do let reqBody = mkNewTeamMember u (rolePermissions role) Nothing rs <- - call $ - method PUT - . paths ["i", "teams", toByteString' tid, "members"] - . contentJson - . json reqBody + call + $ method PUT + . paths ["i", "teams", toByteString' tid, "members"] + . contentJson + . json reqBody print rs diff --git a/services/spar/src/Spar/Schema/V0.hs b/services/spar/src/Spar/Schema/V0.hs index 104d68b0b78..c238417ef70 100644 --- a/services/spar/src/Spar/Schema/V0.hs +++ b/services/spar/src/Spar/Schema/V0.hs @@ -27,8 +27,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 0 "Initial schema" $ do -- FUTUREWORK: in authreq, field req, we may be able to use UUID, because we can create those? - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists authreq ( req text @@ -36,8 +36,8 @@ migration = Migration 0 "Initial schema" $ do , primary key (req) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists authresp ( resp text @@ -45,8 +45,8 @@ migration = Migration 0 "Initial schema" $ do , primary key (resp) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists user ( issuer text @@ -55,8 +55,8 @@ migration = Migration 0 "Initial schema" $ do , primary key (issuer, sso_id) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists idp ( idp uuid @@ -68,8 +68,8 @@ migration = Migration 0 "Initial schema" $ do , PRIMARY KEY (idp) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists issuer_idp ( issuer text @@ -77,8 +77,8 @@ migration = Migration 0 "Initial schema" $ do , PRIMARY KEY (issuer) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists team_idp ( team uuid diff --git a/services/spar/src/Spar/Schema/V1.hs b/services/spar/src/Spar/Schema/V1.hs index 1b1c44ca753..c044803b4e6 100644 --- a/services/spar/src/Spar/Schema/V1.hs +++ b/services/spar/src/Spar/Schema/V1.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 1 "Add verdict table" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists verdict ( req text diff --git a/services/spar/src/Spar/Schema/V10.hs b/services/spar/src/Spar/Schema/V10.hs index 88513ec0e82..473b83d202f 100644 --- a/services/spar/src/Spar/Schema/V10.hs +++ b/services/spar/src/Spar/Schema/V10.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 10 "Add table for mapping scim external ids to brig user ids" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists scim_external_ids ( external text diff --git a/services/spar/src/Spar/Schema/V11.hs b/services/spar/src/Spar/Schema/V11.hs index 6cf2892f882..e0fb843544c 100644 --- a/services/spar/src/Spar/Schema/V11.hs +++ b/services/spar/src/Spar/Schema/V11.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 11 "Remove unused table" $ do - void $ - schema' + void + $ schema' [r| DROP TABLE scim_user; |] diff --git a/services/spar/src/Spar/Schema/V12.hs b/services/spar/src/Spar/Schema/V12.hs index b09d1491371..1d807f12ce1 100644 --- a/services/spar/src/Spar/Schema/V12.hs +++ b/services/spar/src/Spar/Schema/V12.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 12 "Add scim_external" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists scim_external ( team uuid, diff --git a/services/spar/src/Spar/Schema/V14.hs b/services/spar/src/Spar/Schema/V14.hs index 2a682243640..0574914686d 100644 --- a/services/spar/src/Spar/Schema/V14.hs +++ b/services/spar/src/Spar/Schema/V14.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 14 "Create table `user_v2`" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists user_v2 ( issuer text diff --git a/services/spar/src/Spar/Schema/V15.hs b/services/spar/src/Spar/Schema/V15.hs index 574c8df5b12..91eda6d1412 100644 --- a/services/spar/src/Spar/Schema/V15.hs +++ b/services/spar/src/Spar/Schema/V15.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 15 "Optionally index IdP by teamid (in addition to entityID); add idp api version." $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists issuer_idp_v2 ( issuer text @@ -36,8 +36,8 @@ migration = Migration 15 "Optionally index IdP by teamid (in addition to entityI , PRIMARY KEY (issuer, team) ) with compaction = {'class': 'LeveledCompactionStrategy'}; |] - void $ - schema' + void + $ schema' [r| ALTER TABLE idp ADD api_version int; |] diff --git a/services/spar/src/Spar/Schema/V16.hs b/services/spar/src/Spar/Schema/V16.hs index ed52742af2c..314ec2e5514 100644 --- a/services/spar/src/Spar/Schema/V16.hs +++ b/services/spar/src/Spar/Schema/V16.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 16 "Human readable name for IdP" $ do - void $ - schema' + void + $ schema' [r| ALTER TABLE idp ADD (handle text); |] diff --git a/services/spar/src/Spar/Schema/V17.hs b/services/spar/src/Spar/Schema/V17.hs index 10465ee3251..179cd5c9fba 100644 --- a/services/spar/src/Spar/Schema/V17.hs +++ b/services/spar/src/Spar/Schema/V17.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 17 "Remove table `scim_external_ids` (from db migration V10, deprecated in favor of `scim_external`, data migrated in `/services/spar/migrate-data/src/Spar/DataMigration/V1_ExternalIds.hs`)" $ do - void $ - schema' + void + $ schema' [r| DROP TABLE if exists scim_external_ids; |] diff --git a/services/spar/src/Spar/Schema/V18.hs b/services/spar/src/Spar/Schema/V18.hs index 89f3bde2137..89ab8cda50f 100644 --- a/services/spar/src/Spar/Schema/V18.hs +++ b/services/spar/src/Spar/Schema/V18.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 18 "A status field to manage user creation" $ do - void $ - schema' + void + $ schema' [r| ALTER TABLE scim_external ADD creation_status int; |] diff --git a/services/spar/src/Spar/Schema/V2.hs b/services/spar/src/Spar/Schema/V2.hs index ffb4d97416e..5ad3457e204 100644 --- a/services/spar/src/Spar/Schema/V2.hs +++ b/services/spar/src/Spar/Schema/V2.hs @@ -26,13 +26,13 @@ import Text.RawString.QQ migration :: Migration migration = Migration 2 "Add extra idp keys set" $ do - void $ - schema' + void + $ schema' [r| ALTER TABLE idp DROP metadata; |] - void $ - schema' + void + $ schema' [r| ALTER TABLE idp ADD extra_public_keys list; |] diff --git a/services/spar/src/Spar/Schema/V3.hs b/services/spar/src/Spar/Schema/V3.hs index 0bb754452b8..424b2f7fc5d 100644 --- a/services/spar/src/Spar/Schema/V3.hs +++ b/services/spar/src/Spar/Schema/V3.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 3 "DEPRECATED AS OF https://github.com/wireapp/wire-server/pull/2441" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists bind_cookie ( cookie text diff --git a/services/spar/src/Spar/Schema/V4.hs b/services/spar/src/Spar/Schema/V4.hs index 41f2b5bde20..5eb719a1437 100644 --- a/services/spar/src/Spar/Schema/V4.hs +++ b/services/spar/src/Spar/Schema/V4.hs @@ -40,8 +40,8 @@ migration = Migration 4 "Store SCIM authentication tokens" $ do -- -- 2. Each token can have an IdP associated with it; this will be the -- IdP used to authenticate the user. - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists team_provisioning_by_token ( token_ text @@ -55,8 +55,8 @@ migration = Migration 4 "Store SCIM authentication tokens" $ do |] -- We also need to be able to list all tokens belonging to a team (when -- displaying tokens on the team settings page). - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists team_provisioning_by_team ( token_ text diff --git a/services/spar/src/Spar/Schema/V5.hs b/services/spar/src/Spar/Schema/V5.hs index 66f7b22fcc7..d11e8b5728a 100644 --- a/services/spar/src/Spar/Schema/V5.hs +++ b/services/spar/src/Spar/Schema/V5.hs @@ -30,8 +30,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 5 "Store SCIM user blobs" $ do -- docs/developer/scim/storage.md {#DevScimStorageUsers} - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists scim_user ( id uuid diff --git a/services/spar/src/Spar/Schema/V6.hs b/services/spar/src/Spar/Schema/V6.hs index 7b5d0471b67..74ac759c281 100644 --- a/services/spar/src/Spar/Schema/V6.hs +++ b/services/spar/src/Spar/Schema/V6.hs @@ -29,8 +29,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 6 "Store raw XML metadata" $ do - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists idp_raw_metadata ( id uuid diff --git a/services/spar/src/Spar/Schema/V7.hs b/services/spar/src/Spar/Schema/V7.hs index 01a353b2711..e7ba5098b68 100644 --- a/services/spar/src/Spar/Schema/V7.hs +++ b/services/spar/src/Spar/Schema/V7.hs @@ -28,8 +28,8 @@ migration :: Migration migration = Migration 7 "Store default SSO code" $ do -- partition_key_always_default should always be "default". -- It exists so the row is always at a known partition. - void $ - schema' + void + $ schema' [r| CREATE TABLE if not exists default_idp ( partition_key_always_default text diff --git a/services/spar/src/Spar/Schema/V8.hs b/services/spar/src/Spar/Schema/V8.hs index f32e3d48d3c..24f7a8710e1 100644 --- a/services/spar/src/Spar/Schema/V8.hs +++ b/services/spar/src/Spar/Schema/V8.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 8 "Keep track of old issuers, replacement idps in the idp table" $ do - void $ - schema' + void + $ schema' [r| ALTER TABLE idp ADD (old_issuers list, replaced_by uuid); |] diff --git a/services/spar/src/Spar/Schema/V9.hs b/services/spar/src/Spar/Schema/V9.hs index e0751ce1851..cb8df8e34ba 100644 --- a/services/spar/src/Spar/Schema/V9.hs +++ b/services/spar/src/Spar/Schema/V9.hs @@ -26,8 +26,8 @@ import Text.RawString.QQ migration :: Migration migration = Migration 9 "As replacement for `scim_user`, add smaller table for storing time stamps only" $ do - void $ - schema' + void + $ schema' -- FUTUREWORK: https://github.com/zinfra/backend-issues/issues/1631 [r| CREATE TABLE if not exists scim_user_times diff --git a/services/spar/src/Spar/Scim.hs b/services/spar/src/Spar/Scim.hs index 0d66908bbe7..6f56dd59a75 100644 --- a/services/spar/src/Spar/Scim.hs +++ b/services/spar/src/Spar/Scim.hs @@ -156,8 +156,10 @@ apiScim = Left someException -> do -- We caught an exception that's not a Spar exception at all. It is wrapped into -- Scim.serverError. - throw . SAML.CustomError . SparScimError $ - Scim.serverError (T.pack (displayException someException)) + throw + . SAML.CustomError + . SparScimError + $ Scim.serverError (T.pack (displayException someException)) Right (Left err@(SAML.CustomError (SparScimError _))) -> -- We caught a 'SparScimError' exception. It is left as-is. throw err @@ -165,14 +167,19 @@ apiScim = -- We caught some other Spar exception. It is rendered and wrapped into a scim error -- with the same status and message, and no scim error type. err :: ServerError <- sparToServerErrorWithLogging sparError - throw . SAML.CustomError . SparScimError $ - Scim.ScimError + throw + . SAML.CustomError + . SparScimError + $ Scim.ScimError { schemas = [Scim.Schema.Error20], status = Scim.Status $ errHTTPCode err, scimType = Nothing, detail = - Just . T.decodeUtf8With lenientDecode . toStrict . errBody $ - err + Just + . T.decodeUtf8With lenientDecode + . toStrict + . errBody + $ err } Right (Right x) -> do -- No exceptions! Good. diff --git a/services/spar/src/Spar/Scim/Auth.hs b/services/spar/src/Spar/Scim/Auth.hs index 4ec989f9d4b..7a2f3ee59be 100644 --- a/services/spar/src/Spar/Scim/Auth.hs +++ b/services/spar/src/Spar/Scim/Auth.hs @@ -69,7 +69,7 @@ import Wire.Sem.Random (Random) import qualified Wire.Sem.Random as Random -- | An instance that tells @hscim@ how authentication should be done for SCIM routes. -instance Member ScimTokenStore r => Scim.Class.Auth.AuthDB SparTag (Sem r) where +instance (Member ScimTokenStore r) => Scim.Class.Auth.AuthDB SparTag (Sem r) where -- Validate and resolve a given token authCheck :: Maybe ScimToken -> Scim.ScimHandler (Sem r) ScimTokenInfo authCheck Nothing = @@ -126,14 +126,16 @@ createScimToken zusr Api.CreateScimToken {..} = do BrigAccess.ensureReAuthorised zusr createScimTokenPassword createScimTokenCode (Just User.CreateScimToken) tokenNumber <- length <$> ScimTokenStore.lookupByTeam teamid maxTokens <- inputs maxScimTokens - unless (tokenNumber < maxTokens) $ - throwSparSem E.SparProvisioningTokenLimitReached + unless (tokenNumber < maxTokens) + $ throwSparSem E.SparProvisioningTokenLimitReached idps <- IdPConfigStore.getConfigsByTeam teamid let caseOneOrNoIdP :: Maybe SAML.IdPId -> Sem r CreateScimTokenResponse caseOneOrNoIdP midpid = do token <- - ScimToken . T.decodeUtf8With lenientDecode . ES.encode + ScimToken + . T.decodeUtf8With lenientDecode + . ES.encode <$> Random.bytes 32 tokenid <- Random.scimTokenId -- FUTUREWORK(fisx): the fact that we're using @Now.get@ diff --git a/services/spar/src/Spar/Sem/AReqIDStore/Mem.hs b/services/spar/src/Spar/Sem/AReqIDStore/Mem.hs index 6768f59c308..1eda48c4450 100644 --- a/services/spar/src/Spar/Sem/AReqIDStore/Mem.hs +++ b/services/spar/src/Spar/Sem/AReqIDStore/Mem.hs @@ -32,11 +32,12 @@ import Wire.API.User.Saml (AReqId) import Wire.Sem.Now aReqIDStoreToMem :: - Member Now r => + (Member Now r) => Sem (AReqIDStore ': r) a -> Sem r (Map AReqId SAML.Time, a) -aReqIDStoreToMem = (runState mempty .) $ - reinterpret $ \case +aReqIDStoreToMem = (runState mempty .) + $ reinterpret + $ \case Store areqid ti -> modify $ M.insert areqid ti UnStore areqid -> modify $ M.delete areqid IsAlive areqid -> diff --git a/services/spar/src/Spar/Sem/AssIDStore/Mem.hs b/services/spar/src/Spar/Sem/AssIDStore/Mem.hs index 54dcca2d94d..896f282de82 100644 --- a/services/spar/src/Spar/Sem/AssIDStore/Mem.hs +++ b/services/spar/src/Spar/Sem/AssIDStore/Mem.hs @@ -32,11 +32,12 @@ import Wire.API.User.Saml (AssId) import Wire.Sem.Now assIdStoreToMem :: - Member Now r => + (Member Now r) => Sem (AssIDStore ': r) a -> Sem r (Map AssId SAML.Time, a) -assIdStoreToMem = (runState mempty .) $ - reinterpret $ \case +assIdStoreToMem = (runState mempty .) + $ reinterpret + $ \case Store assid ti -> modify $ M.insert assid ti UnStore assid -> modify $ M.delete assid IsAlive assid -> diff --git a/services/spar/src/Spar/Sem/BrigAccess/Http.hs b/services/spar/src/Spar/Sem/BrigAccess/Http.hs index a1e5f8d04be..b0eaa216798 100644 --- a/services/spar/src/Spar/Sem/BrigAccess/Http.hs +++ b/services/spar/src/Spar/Sem/BrigAccess/Http.hs @@ -41,8 +41,9 @@ brigAccessToHttp :: Sem (BrigAccess ': r) a -> Sem r a brigAccessToHttp mgr req = - interpret $ - viaRunHttp (RunHttpEnv mgr req) . \case + interpret + $ viaRunHttp (RunHttpEnv mgr req) + . \case CreateSAML u itlu itlt n m h ri ml r -> Intra.createBrigUserSAML u itlu itlt n m h ri ml r CreateNoSAML e uid itlt n ml r -> Intra.createBrigUserNoSAML e uid itlt n ml r UpdateEmail itlu e -> Intra.updateEmail itlu e diff --git a/services/spar/src/Spar/Sem/DefaultSsoCode/Cassandra.hs b/services/spar/src/Spar/Sem/DefaultSsoCode/Cassandra.hs index 5a4e845584c..5df1940ef88 100644 --- a/services/spar/src/Spar/Sem/DefaultSsoCode/Cassandra.hs +++ b/services/spar/src/Spar/Sem/DefaultSsoCode/Cassandra.hs @@ -37,8 +37,9 @@ defaultSsoCodeToCassandra :: Sem (DefaultSsoCode ': r) a -> Sem r a defaultSsoCodeToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Get -> getDefaultSsoCode Store ip -> storeDefaultSsoCode ip Delete -> deleteDefaultSsoCode diff --git a/services/spar/src/Spar/Sem/DefaultSsoCode/Mem.hs b/services/spar/src/Spar/Sem/DefaultSsoCode/Mem.hs index c684eaa1a66..36bffbcd394 100644 --- a/services/spar/src/Spar/Sem/DefaultSsoCode/Mem.hs +++ b/services/spar/src/Spar/Sem/DefaultSsoCode/Mem.hs @@ -29,8 +29,9 @@ import qualified SAML2.WebSSO as SAML import Spar.Sem.DefaultSsoCode (DefaultSsoCode (..)) defaultSsoCodeToMem :: Sem (DefaultSsoCode ': r) a -> Sem r (Maybe SAML.IdPId, a) -defaultSsoCodeToMem = (runState Nothing .) $ - reinterpret $ \case +defaultSsoCodeToMem = (runState Nothing .) + $ reinterpret + $ \case Get -> get Store ipi -> put $ Just ipi Delete -> put Nothing diff --git a/services/spar/src/Spar/Sem/DefaultSsoCode/Spec.hs b/services/spar/src/Spar/Sem/DefaultSsoCode/Spec.hs index d4dd4ad848d..50265e04b7f 100644 --- a/services/spar/src/Spar/Sem/DefaultSsoCode/Spec.hs +++ b/services/spar/src/Spar/Sem/DefaultSsoCode/Spec.hs @@ -30,7 +30,7 @@ import Test.Hspec.QuickCheck import Test.QuickCheck propsForInterpreter :: - PropConstraints r f => + (PropConstraints r f) => String -> (forall a. Sem r a -> IO (f a)) -> Spec @@ -48,23 +48,23 @@ propsForInterpreter interpreter lower = do -- A regular type synonym doesn't work due to dreaded impredicative -- polymorphism. class - (Arbitrary IdPId, CoArbitrary IdPId, Functor f, Member E.DefaultSsoCode r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Arbitrary IdPId, CoArbitrary IdPId, Functor f, Member E.DefaultSsoCode r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f instance - (Arbitrary IdPId, CoArbitrary IdPId, Functor f, Member E.DefaultSsoCode r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Arbitrary IdPId, CoArbitrary IdPId, Functor f, Member E.DefaultSsoCode r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f prop_storeGet :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe IdPId) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_storeGet = prepropLaw @'[E.DefaultSsoCode] $ do s <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store s E.get @@ -75,14 +75,14 @@ prop_storeGet = ) prop_getStore :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_getStore = prepropLaw @'[E.DefaultSsoCode] $ do - pure $ - simpleLaw + pure + $ simpleLaw ( do E.get >>= maybe (pure ()) E.store ) @@ -91,15 +91,15 @@ prop_getStore = ) prop_storeDelete :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_storeDelete = prepropLaw @'[E.DefaultSsoCode] $ do s <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store s E.delete @@ -109,15 +109,15 @@ prop_storeDelete = ) prop_deleteStore :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_deleteStore = prepropLaw @'[E.DefaultSsoCode] $ do s <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.delete E.store s @@ -127,7 +127,7 @@ prop_deleteStore = ) prop_storeStore :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -135,8 +135,8 @@ prop_storeStore = prepropLaw @'[E.DefaultSsoCode] $ do s <- arbitrary s' <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store s E.store s' @@ -146,14 +146,14 @@ prop_storeStore = ) prop_deleteDelete :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_deleteDelete = prepropLaw @'[E.DefaultSsoCode] $ do - pure $ - simpleLaw + pure + $ simpleLaw ( do E.delete E.delete @@ -163,14 +163,14 @@ prop_deleteDelete = ) prop_deleteGet :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe IdPId) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_deleteGet = prepropLaw @'[E.DefaultSsoCode] $ do - pure $ - simpleLaw + pure + $ simpleLaw ( do E.delete E.get diff --git a/services/spar/src/Spar/Sem/GalleyAccess/Http.hs b/services/spar/src/Spar/Sem/GalleyAccess/Http.hs index 793bac9c276..79dc92e5e28 100644 --- a/services/spar/src/Spar/Sem/GalleyAccess/Http.hs +++ b/services/spar/src/Spar/Sem/GalleyAccess/Http.hs @@ -43,8 +43,9 @@ galleyAccessToHttp :: Sem (GalleyAccess ': r) a -> Sem r a galleyAccessToHttp mgr req = - interpret $ - viaRunHttp (RunHttpEnv mgr req) . \case + interpret + $ viaRunHttp (RunHttpEnv mgr req) + . \case GetTeamMembers itlt -> Intra.getTeamMembers itlt GetTeamMember tid uid -> Intra.getTeamMember tid uid AssertHasPermission itlt perm itlu -> Intra.assertHasPermission itlt perm itlu diff --git a/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs b/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs index 56f60c6c4f3..761f24da0c9 100644 --- a/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs +++ b/services/spar/src/Spar/Sem/IdPConfigStore/Cassandra.hs @@ -47,8 +47,8 @@ idPToCassandra :: Sem (IdPConfigStore ': r) a -> Sem r a idPToCassandra = - interpret $ - \case + interpret + $ \case InsertConfig iw -> embed @m (runExceptT $ insertIdPConfig iw) >>= either throw pure NewHandle tid -> embed @m (runExceptT $ newIdPHandleForTeam tid) >>= either throw pure GetConfig i -> embed @m (runExceptT $ getIdPConfig i) >>= either throw pure @@ -112,8 +112,8 @@ insertIdPConfig idp = do failIfNot :: WireIdPAPIVersion -> IdP -> m () failIfNot expectedVersion idp' = do let actualVersion = fromMaybe defWireIdPAPIVersion $ idp' ^. SAML.idpExtraInfo . IP.apiVersion - unless (actualVersion == expectedVersion) $ - throwError InsertIdPConfigCannotMixApiVersions + unless (actualVersion == expectedVersion) + $ throwError InsertIdPConfigCannotMixApiVersions getAllIdPsByIssuerUnsafe issuer >>= mapM_ (failIfNot thisVersion) diff --git a/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs b/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs index a7f0ff7c4fb..106dac9e08c 100644 --- a/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs +++ b/services/spar/src/Spar/Sem/IdPConfigStore/Mem.hs @@ -105,8 +105,12 @@ getIdByIssuerWithTeamMaybe iss team mp = where fl :: IP.IdP -> Bool fl idp = - idp ^. SAML.idpMetadata . SAML.edIssuer == iss - && idp ^. SAML.idpExtraInfo . IP.team == team + idp + ^. SAML.idpMetadata + . SAML.edIssuer + == iss + && idp + ^. SAML.idpExtraInfo . IP.team == team getConfigsByTeam :: TeamId -> TypedState -> [IP.IdP] getConfigsByTeam team = diff --git a/services/spar/src/Spar/Sem/IdPRawMetadataStore/Cassandra.hs b/services/spar/src/Spar/Sem/IdPRawMetadataStore/Cassandra.hs index 91af9fb54a6..e97e774a2db 100644 --- a/services/spar/src/Spar/Sem/IdPRawMetadataStore/Cassandra.hs +++ b/services/spar/src/Spar/Sem/IdPRawMetadataStore/Cassandra.hs @@ -37,8 +37,9 @@ idpRawMetadataStoreToCassandra :: Sem (IdPRawMetadataStore ': r) a -> Sem r a idpRawMetadataStoreToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Store i t -> storeIdPRawMetadata i t Get i -> getIdPRawMetadata i Delete i -> deleteIdPRawMetadata i diff --git a/services/spar/src/Spar/Sem/IdPRawMetadataStore/Spec.hs b/services/spar/src/Spar/Sem/IdPRawMetadataStore/Spec.hs index f55560cf769..38027d32ada 100644 --- a/services/spar/src/Spar/Sem/IdPRawMetadataStore/Spec.hs +++ b/services/spar/src/Spar/Sem/IdPRawMetadataStore/Spec.hs @@ -30,15 +30,15 @@ import Test.Hspec.QuickCheck import Test.QuickCheck class - (Arbitrary IdPId, CoArbitrary IdPId, Arbitrary Text, CoArbitrary Text, Functor f, Member E.IdPRawMetadataStore r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Arbitrary IdPId, CoArbitrary IdPId, Arbitrary Text, CoArbitrary Text, Functor f, Member E.IdPRawMetadataStore r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f instance - (Arbitrary IdPId, CoArbitrary IdPId, Arbitrary Text, CoArbitrary Text, Functor f, Member E.IdPRawMetadataStore r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Arbitrary IdPId, CoArbitrary IdPId, Arbitrary Text, CoArbitrary Text, Functor f, Member E.IdPRawMetadataStore r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f prop_storeGetRaw :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe Text) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -47,8 +47,8 @@ prop_storeGetRaw = ( do idpid <- arbitrary t <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store idpid t E.get idpid @@ -60,7 +60,7 @@ prop_storeGetRaw = ) prop_storeStoreRaw :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe Text) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -70,8 +70,8 @@ prop_storeStoreRaw = idpid <- arbitrary t1 <- arbitrary t2 <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store idpid t1 E.store idpid t2 @@ -84,17 +84,17 @@ prop_storeStoreRaw = ) prop_storeDeleteRaw :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe Text) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property prop_storeDeleteRaw = - prepropLaw @'[E.IdPRawMetadataStore] $ - do + prepropLaw @'[E.IdPRawMetadataStore] + $ do idpid <- arbitrary t <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.store idpid t E.delete idpid @@ -106,7 +106,7 @@ prop_storeDeleteRaw = ) prop_deleteGetRaw :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe Text) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -115,8 +115,8 @@ prop_deleteGetRaw = ( do idpid <- arbitrary t <- arbitrary - pure $ - Law + pure + $ Law { lawLhs = do E.delete idpid E.get idpid, @@ -131,7 +131,7 @@ prop_deleteGetRaw = ) propsForInterpreter :: - PropConstraints r f => + (PropConstraints r f) => (forall x. f x -> x) -> (forall a. Sem r a -> IO (f a)) -> Spec diff --git a/services/spar/src/Spar/Sem/SAML2.hs b/services/spar/src/Spar/Sem/SAML2.hs index 1e7168370b8..f94c87fe020 100644 --- a/services/spar/src/Spar/Sem/SAML2.hs +++ b/services/spar/src/Spar/Sem/SAML2.hs @@ -50,7 +50,7 @@ data SAML2 m a where SAML2 m resp Meta :: Text -> m Issuer -> m URI -> SAML2 m SPMetadata ToggleCookie :: - KnownSymbol name => + (KnownSymbol name) => ByteString -> Maybe (Text, NominalDiffTime) -> SAML2 m (SimpleSetCookie name) diff --git a/services/spar/src/Spar/Sem/SAML2/Library.hs b/services/spar/src/Spar/Sem/SAML2/Library.hs index 67059ce4c85..6ffc3a29d2a 100644 --- a/services/spar/src/Spar/Sem/SAML2/Library.hs +++ b/services/spar/src/Spar/Sem/SAML2/Library.hs @@ -62,12 +62,13 @@ wrapMonadClientSPImpl action = . show @SomeException ) -instance Member (Final IO) r => Catch.MonadThrow (SPImpl r) where +instance (Member (Final IO) r) => Catch.MonadThrow (SPImpl r) where throwM = SPImpl . embedFinal . Catch.throwM @IO -instance Member (Final IO) r => Catch.MonadCatch (SPImpl r) where - catch (SPImpl m) handler = SPImpl $ - withStrategicToFinal @IO $ do +instance (Member (Final IO) r) => Catch.MonadCatch (SPImpl r) where + catch (SPImpl m) handler = SPImpl + $ withStrategicToFinal @IO + $ do m' <- runS m st <- getInitialStateS handler' <- bindS $ unSPImpl . handler @@ -76,21 +77,21 @@ instance Member (Final IO) r => Catch.MonadCatch (SPImpl r) where newtype SPImpl r a = SPImpl {unSPImpl :: Sem r a} deriving (Functor, Applicative, Monad) -instance Member (Input Opts) r => HasConfig (SPImpl r) where +instance (Member (Input Opts) r) => HasConfig (SPImpl r) where getConfig = SPImpl $ inputs saml instance - Member (Logger String) r => + (Member (Logger String) r) => HasLogger (SPImpl r) where logger lvl = SPImpl . Logger.log (Logger.samlFromLevel lvl) -instance Member (Embed IO) r => MonadIO (SPImpl r) where +instance (Member (Embed IO) r) => MonadIO (SPImpl r) where liftIO = SPImpl . embed @IO -instance Member (Embed IO) r => HasCreateUUID (SPImpl r) +instance (Member (Embed IO) r) => HasCreateUUID (SPImpl r) -instance Member (Embed IO) r => HasNow (SPImpl r) +instance (Member (Embed IO) r) => HasNow (SPImpl r) instance ( Member (Error SparError) r, @@ -130,7 +131,7 @@ instance Nothing -> IdPConfigStore.getIdPByIssuerV1 issuer Just team -> IdPConfigStore.getIdPByIssuerV2 issuer team -instance Member (Error SparError) r => MonadError SparError (SPImpl r) where +instance (Member (Error SparError) r) => MonadError SparError (SPImpl r) where throwError = SPImpl . throw catchError m handler = SPImpl $ catch (unSPImpl m) $ unSPImpl . handler diff --git a/services/spar/src/Spar/Sem/SAMLUserStore/Mem.hs b/services/spar/src/Spar/Sem/SAMLUserStore/Mem.hs index 131ae266814..78ff15ac194 100644 --- a/services/spar/src/Spar/Sem/SAMLUserStore/Mem.hs +++ b/services/spar/src/Spar/Sem/SAMLUserStore/Mem.hs @@ -41,8 +41,9 @@ instance Ord UserRefOrd where compare is is' <> compare ni ni' samlUserStoreToMem :: Sem (SAMLUserStore ': r) a -> Sem r (Map UserRefOrd UserId, a) -samlUserStoreToMem = (runState @(Map UserRefOrd UserId) mempty .) $ - reinterpret $ \case +samlUserStoreToMem = (runState @(Map UserRefOrd UserId) mempty .) + $ reinterpret + $ \case Insert ur uid -> modify $ M.insert (UserRefOrd ur) uid Get ur -> gets $ M.lookup $ UserRefOrd ur DeleteByIssuer is -> modify $ M.filterWithKey (\ref _ -> not $ eqIssuer is ref) diff --git a/services/spar/src/Spar/Sem/ScimExternalIdStore/Cassandra.hs b/services/spar/src/Spar/Sem/ScimExternalIdStore/Cassandra.hs index 73c192dafdf..09e72c05d56 100644 --- a/services/spar/src/Spar/Sem/ScimExternalIdStore/Cassandra.hs +++ b/services/spar/src/Spar/Sem/ScimExternalIdStore/Cassandra.hs @@ -39,8 +39,9 @@ scimExternalIdStoreToCassandra :: Sem (ScimExternalIdStore ': r) a -> Sem r a scimExternalIdStoreToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Insert tid em uid -> insertScimExternalId tid em uid Lookup tid em -> lookupScimExternalId tid em Delete tid em -> deleteScimExternalId tid em diff --git a/services/spar/src/Spar/Sem/ScimExternalIdStore/Mem.hs b/services/spar/src/Spar/Sem/ScimExternalIdStore/Mem.hs index 3af1a26437d..c628e53ea1c 100644 --- a/services/spar/src/Spar/Sem/ScimExternalIdStore/Mem.hs +++ b/services/spar/src/Spar/Sem/ScimExternalIdStore/Mem.hs @@ -35,8 +35,9 @@ import Wire.API.User (fromEmail) scimExternalIdStoreToMem :: Sem (ScimExternalIdStore ': r) a -> Sem r (Map (TeamId, Text) (UserId, Maybe ScimUserCreationStatus), a) -scimExternalIdStoreToMem = (runState mempty .) $ - reinterpret $ \case +scimExternalIdStoreToMem = (runState mempty .) + $ reinterpret + $ \case Insert tid em uid -> modify $ M.insert (tid, fromEmail em) (uid, Nothing) Lookup tid em -> fmap fst <$> gets (M.lookup (tid, fromEmail em)) Delete tid em -> modify $ M.delete (tid, fromEmail em) diff --git a/services/spar/src/Spar/Sem/ScimExternalIdStore/Spec.hs b/services/spar/src/Spar/Sem/ScimExternalIdStore/Spec.hs index 38ad7834c00..ee4baea8ebe 100644 --- a/services/spar/src/Spar/Sem/ScimExternalIdStore/Spec.hs +++ b/services/spar/src/Spar/Sem/ScimExternalIdStore/Spec.hs @@ -31,7 +31,7 @@ import Test.Hspec.QuickCheck import Test.QuickCheck propsForInterpreter :: - PropConstraints r f => + (PropConstraints r f) => String -> (forall a. f a -> a) -> (forall a. Sem r a -> IO (f a)) -> @@ -52,15 +52,15 @@ propsForInterpreter interpreter extract lower = do -- A regular type synonym doesn't work due to dreaded impredicative -- polymorphism. class - (Arbitrary UserId, CoArbitrary UserId, Arbitrary ScimUserCreationStatus, CoArbitrary ScimUserCreationStatus, Functor f, Member E.ScimExternalIdStore r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (Arbitrary UserId, CoArbitrary UserId, Arbitrary ScimUserCreationStatus, CoArbitrary ScimUserCreationStatus, Functor f, Member E.ScimExternalIdStore r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f instance - (CoArbitrary UserId, CoArbitrary ScimUserCreationStatus, Functor f, Member E.ScimExternalIdStore r, forall z. Show z => Show (f z), forall z. Eq z => Eq (f z)) => + (CoArbitrary UserId, CoArbitrary ScimUserCreationStatus, Functor f, Member E.ScimExternalIdStore r, forall z. (Show z) => Show (f z), forall z. (Eq z) => Eq (f z)) => PropConstraints r f prop_insertLookup :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe UserId) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -69,8 +69,8 @@ prop_insertLookup = tid <- arbitrary email <- arbitrary uid <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.insert tid email uid E.lookup tid email @@ -81,7 +81,7 @@ prop_insertLookup = ) prop_lookupInsert :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -89,8 +89,8 @@ prop_lookupInsert = prepropLaw @'[E.ScimExternalIdStore] $ do tid <- arbitrary email <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.lookup tid email >>= maybe (pure ()) (E.insert tid email) ) @@ -99,7 +99,7 @@ prop_lookupInsert = ) prop_insertDelete :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -108,8 +108,8 @@ prop_insertDelete = tid <- arbitrary email <- arbitrary uid <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.insert tid email uid E.delete tid email @@ -119,7 +119,7 @@ prop_insertDelete = ) prop_deleteInsert :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -128,8 +128,8 @@ prop_deleteInsert = tid <- arbitrary email <- arbitrary uid <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.delete tid email E.insert tid email uid @@ -139,7 +139,7 @@ prop_deleteInsert = ) prop_insertInsert :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe UserId) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -149,8 +149,8 @@ prop_insertInsert = email <- arbitrary uid <- arbitrary uid' <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.insert tid email uid E.insert tid email uid' @@ -162,7 +162,7 @@ prop_insertInsert = ) prop_deleteDelete :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f () -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -170,8 +170,8 @@ prop_deleteDelete = prepropLaw @'[E.ScimExternalIdStore] $ do tid <- arbitrary email <- arbitrary - pure $ - simpleLaw + pure + $ simpleLaw ( do E.delete tid email E.delete tid email @@ -181,7 +181,7 @@ prop_deleteDelete = ) prop_deleteLookup :: - PropConstraints r f => + (PropConstraints r f) => Maybe (f (Maybe UserId) -> String) -> (forall a. Sem r a -> IO (f a)) -> Property @@ -190,8 +190,8 @@ prop_deleteLookup = tid <- arbitrary email <- arbitrary uid <- arbitrary - pure $ - Law + pure + $ Law { lawLhs = do E.delete tid email E.lookup tid email, diff --git a/services/spar/src/Spar/Sem/ScimTokenStore/Mem.hs b/services/spar/src/Spar/Sem/ScimTokenStore/Mem.hs index 255d9a8e2ad..a18f62d246d 100644 --- a/services/spar/src/Spar/Sem/ScimTokenStore/Mem.hs +++ b/services/spar/src/Spar/Sem/ScimTokenStore/Mem.hs @@ -32,8 +32,9 @@ import Spar.Sem.ScimTokenStore scimTokenStoreToMem :: Sem (ScimTokenStore ': r) a -> Sem r (Map ScimToken ScimTokenInfo, a) -scimTokenStoreToMem = (runState mempty .) $ - reinterpret $ \case +scimTokenStoreToMem = (runState mempty .) + $ reinterpret + $ \case Insert st sti -> modify $ M.insert st sti Lookup st -> gets $ M.lookup st LookupByTeam tid -> gets $ filter ((== tid) . stiTeam) . M.elems diff --git a/services/spar/src/Spar/Sem/ScimUserTimesStore/Cassandra.hs b/services/spar/src/Spar/Sem/ScimUserTimesStore/Cassandra.hs index bd3c45cbce1..29c61b535aa 100644 --- a/services/spar/src/Spar/Sem/ScimUserTimesStore/Cassandra.hs +++ b/services/spar/src/Spar/Sem/ScimUserTimesStore/Cassandra.hs @@ -34,8 +34,9 @@ import Web.Scim.Schema.Meta (Meta (..), WithMeta (..)) scimUserTimesStoreToCassandra :: forall m r a. (MonadClient m, Member (Embed m) r) => Sem (ScimUserTimesStore ': r) a -> Sem r a scimUserTimesStoreToCassandra = - interpret $ - embed @m . \case + interpret + $ embed @m + . \case Write wm -> writeScimUserTimes wm Read uid -> readScimUserTimes uid ReadMulti uids -> readScimUserTimesMulti uids @@ -49,8 +50,9 @@ scimUserTimesStoreToCassandra = -- | Store creation and last-update time from the scim metadata under a user id. writeScimUserTimes :: (HasCallStack, MonadClient m) => WithMeta (WithId UserId a) -> m () writeScimUserTimes (WithMeta meta (WithId uid _)) = - retry x5 . write ins $ - params + retry x5 + . write ins + $ params LocalQuorum ( uid, toUTCTimeMillis $ created meta, diff --git a/services/spar/src/Spar/Sem/ScimUserTimesStore/Mem.hs b/services/spar/src/Spar/Sem/ScimUserTimesStore/Mem.hs index fa5f027d8a4..10ec19ac29e 100644 --- a/services/spar/src/Spar/Sem/ScimUserTimesStore/Mem.hs +++ b/services/spar/src/Spar/Sem/ScimUserTimesStore/Mem.hs @@ -35,8 +35,9 @@ import Web.Scim.Schema.Meta (WithMeta (WithMeta), created, lastModified) scimUserTimesStoreToMem :: Sem (ScimUserTimesStore ': r) a -> Sem r (Map UserId (UTCTimeMillis, UTCTimeMillis), a) -scimUserTimesStoreToMem = (runState mempty .) $ - reinterpret $ \case +scimUserTimesStoreToMem = (runState mempty .) + $ reinterpret + $ \case Write (WithMeta meta (WithId uid _)) -> modify $ M.insert uid (toUTCTimeMillis $ created meta, toUTCTimeMillis $ lastModified meta) Read uid -> gets $ M.lookup uid ReadMulti uids -> gets $ map (\(u, (a, b)) -> (u, a, b)) . filter ((`elem` uids) . fst) . M.toList diff --git a/services/spar/src/Spar/Sem/VerdictFormatStore/Mem.hs b/services/spar/src/Spar/Sem/VerdictFormatStore/Mem.hs index 322dfd6b509..4f759b83d8c 100644 --- a/services/spar/src/Spar/Sem/VerdictFormatStore/Mem.hs +++ b/services/spar/src/Spar/Sem/VerdictFormatStore/Mem.hs @@ -34,12 +34,13 @@ import Wire.Sem.Now (Now, boolTTL) import qualified Wire.Sem.Now as Now verdictFormatStoreToMem :: - Member Now r => + (Member Now r) => Sem (VerdictFormatStore ': r) a -> Sem r (Map AReqId (SAML.Time, VerdictFormat), a) verdictFormatStoreToMem = - (runState mempty .) $ - reinterpret $ \case + (runState mempty .) + $ reinterpret + $ \case Store ndt areqid vf -> do now <- SAML.Time <$> Now.get modify $ M.insert areqid (addTime ndt now, vf) diff --git a/services/spar/test-integration/Main.hs b/services/spar/test-integration/Main.hs index 3eefa283be5..e3b61ab6dcd 100644 --- a/services/spar/test-integration/Main.hs +++ b/services/spar/test-integration/Main.hs @@ -70,8 +70,8 @@ main = do hspecConfig :: IO Config hspecConfig = do junitConfig <- envJUnitConfig - pure $ - defaultConfig + pure + $ defaultConfig { configAvailableFormatters = ("junit", checksAndJUnitFormatter junitConfig) : configAvailableFormatters defaultConfig @@ -112,8 +112,8 @@ mkspecScim = do mkspecHscimAcceptance :: IO TestEnv -> (TestEnv -> IO ()) -> Spec mkspecHscimAcceptance mkenv _destroyenv = do - describe "hscim acceptance tests" $ - microsoftAzure @SparTag AcceptanceConfig {..} + describe "hscim acceptance tests" + $ microsoftAzure @SparTag AcceptanceConfig {..} where scimAppAndConfig = do env <- mkenv diff --git a/services/spar/test-integration/Test/MetricsSpec.hs b/services/spar/test-integration/Test/MetricsSpec.hs index b4417b01566..1892bc41c23 100644 --- a/services/spar/test-integration/Test/MetricsSpec.hs +++ b/services/spar/test-integration/Test/MetricsSpec.hs @@ -29,7 +29,7 @@ import Data.String.Conversions import Imports import Util -spec :: HasCallStack => SpecWith TestEnv +spec :: (HasCallStack) => SpecWith TestEnv spec = describe "metrics" . it "works" $ do spar <- asks (^. teSpar) let p1 = "/sso/metadata" diff --git a/services/spar/test-integration/Test/Spar/APISpec.hs b/services/spar/test-integration/Test/Spar/APISpec.hs index ea777758532..037194bea25 100644 --- a/services/spar/test-integration/Test/Spar/APISpec.hs +++ b/services/spar/test-integration/Test/Spar/APISpec.hs @@ -193,7 +193,7 @@ specInitiateLogin = do let uuid = cs $ UUID.toText UUID.nil get ((env ^. teSpar) . path (cs $ "/sso/initiate-login/" -/ uuid)) `shouldRespondWith` ((== 404) . statusCode) - let checkRespBody :: HasCallStack => ResponseLBS -> Bool + let checkRespBody :: (HasCallStack) => ResponseLBS -> Bool checkRespBody (responseBody -> Just (cs -> bdy)) = all (`isInfixOf` bdy) @@ -215,11 +215,11 @@ specFinalizeLogin :: SpecWith TestEnv specFinalizeLogin = do describe "POST /sso/finalize-login" $ do context "not granted" $ do - it "testRejectsSAMLResponseSayingAccessNotGranted - responds with a very peculiar 'forbidden' HTTP response" $ - testRejectsSAMLResponseSayingAccessNotGranted + it "testRejectsSAMLResponseSayingAccessNotGranted - responds with a very peculiar 'forbidden' HTTP response" + $ testRejectsSAMLResponseSayingAccessNotGranted context "access granted" $ do - let loginSuccess :: HasCallStack => ResponseLBS -> TestSpar () + let loginSuccess :: (HasCallStack) => ResponseLBS -> TestSpar () loginSuccess sparresp = liftIO $ do statusCode sparresp `shouldBe` 200 let bdy = maybe "" (cs @LByteString @String) (responseBody sparresp) @@ -229,7 +229,7 @@ specFinalizeLogin = do bdy `shouldContain` "window.opener.postMessage({type: 'AUTH_SUCCESS'}, receiverOrigin)" hasPersistentCookieHeader sparresp `shouldBe` Right () - let loginFailure :: HasCallStack => ResponseLBS -> TestSpar () + let loginFailure :: (HasCallStack) => ResponseLBS -> TestSpar () loginFailure sparresp = liftIO $ do statusCode sparresp `shouldBe` 200 let bdy = maybe "" (cs @LByteString @String) (responseBody sparresp) @@ -331,8 +331,8 @@ specFinalizeLogin = do loginSuccess =<< submitAuthnResponse teamid authnresp pure $ authnresp let newUserRef@(UserRef _ subj) = - either (error . show) (^. userRefL) $ - parseFromDocument (fromSignedAuthnResponse newUserAuthnResp) + either (error . show) (^. userRefL) + $ parseFromDocument (fromSignedAuthnResponse newUserAuthnResp) newUserId <- getUserIdViaRef newUserRef do @@ -342,21 +342,24 @@ specFinalizeLogin = do do env <- ask _ <- - call . get $ - ( (env ^. teGalley) + call + . get + $ ( (env ^. teGalley) + . header "Z-User" (toByteString' ownerid) + . header "Z-Connection" "fake" + . paths ["teams", toByteString' teamid, "members"] + . expect2xx + ) + void + . call + . delete + $ ( (env ^. teGalley) . header "Z-User" (toByteString' ownerid) . header "Z-Connection" "fake" - . paths ["teams", toByteString' teamid, "members"] + . paths ["teams", toByteString' teamid, "members", toByteString' newUserId] + . Bilge.json (newTeamMemberDeleteData (Just defPassword)) . expect2xx ) - void . call . delete $ - ( (env ^. teGalley) - . header "Z-User" (toByteString' ownerid) - . header "Z-Connection" "fake" - . paths ["teams", toByteString' teamid, "members", toByteString' newUserId] - . Bilge.json (newTeamMemberDeleteData (Just defPassword)) - . expect2xx - ) liftIO $ threadDelay 100000 -- make sure deletion is done. if we don't want to take -- the time, we should find another way to robustly -- confirm that deletion has completed in the background. @@ -393,7 +396,7 @@ specFinalizeLogin = do (idp, (_, privcreds)) <- registerTestIdPWithMeta ownerid spmeta <- getTestSPMetadata tid - let loginSuccess :: HasCallStack => ResponseLBS -> TestSpar () + let loginSuccess :: (HasCallStack) => ResponseLBS -> TestSpar () loginSuccess sparresp = liftIO $ do statusCode sparresp `shouldBe` 200 @@ -423,7 +426,7 @@ specFinalizeLogin = do mbId2 `shouldSatisfy` isJust mbId1 `shouldBe` mbId2 -testGetPutDelete :: HasCallStack => (SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> Http ResponseLBS) -> SpecWith TestEnv +testGetPutDelete :: (HasCallStack) => (SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> Http ResponseLBS) -> SpecWith TestEnv testGetPutDelete whichone = do context "unknown IdP" $ do it "responds with 'not found'" $ do @@ -816,7 +819,7 @@ specCRUDIdentityProvider = do liftIO $ requri `shouldBe` idpmeta' ^. edRequestURI describe "new certs" $ do let -- Create a team, idp, and update idp with 'sampleIdPCert2'. - initidp :: HasCallStack => TestSpar (IdP, SignPrivCreds, SignPrivCreds) + initidp :: (HasCallStack) => TestSpar (IdP, SignPrivCreds, SignPrivCreds) initidp = do env <- ask (owner, _tid) <- callCreateUserWithTeam @@ -828,7 +831,7 @@ specCRUDIdentityProvider = do pure (idp, oldPrivKey, newPrivKey) -- Sign authn response with a given private key (which may be the one matching -- 'sampleIdPCert2' or not), and check the status of spars response. - check :: HasCallStack => Bool -> Int -> String -> Either String () -> TestSpar () + check :: (HasCallStack) => Bool -> Int -> String -> Either String () -> TestSpar () check useNewPrivKey expectedStatus expectedHtmlTitle expectedCookie = do (idp, oldPrivKey, newPrivKey) <- initidp let tid = idp ^. idpExtraInfo . team @@ -984,7 +987,8 @@ specCRUDIdentityProvider = do issuer2 <- makeIssuer idp2 <- do let idpmeta2 = idpmeta1 & edIssuer .~ issuer2 - in call $ + in call + $ -- There are two mechanisms for re-aligning your team when your IdP metadata -- has changed: POST (create a new one, and mark it as replacing the old one), -- and PUT (updating the existing IdP's metadata). The reason for having two @@ -1043,7 +1047,7 @@ specCRUDIdentityProvider = do scimStoredUser <- createUser tok scimUser let checkScimSearch :: - HasCallStack => + (HasCallStack) => Scim.StoredUser SparTag -> Scim.User SparTag -> ReaderT TestEnv IO () @@ -1207,8 +1211,8 @@ specDeleteCornerCases = describe "delete corner cases" $ do (idp, (_, privcreds)) <- registerTestIdPWithMeta owner uname :: SAML.UnqualifiedNameID <- do suffix <- cs <$> replicateM 7 (getRandomR ('0', '9')) - either (error . show) pure $ - SAML.mkUNameIDEmail ("email_" <> suffix <> "@example.com") + either (error . show) pure + $ SAML.mkUNameIDEmail ("email_" <> suffix <> "@example.com") let uref = SAML.UserRef tenant subj subj = either (error . show) id $ SAML.mkNameID uname Nothing Nothing Nothing tenant = idp ^. SAML.idpMetadata . SAML.edIssuer @@ -1223,12 +1227,12 @@ specDeleteCornerCases = describe "delete corner cases" $ do (Just _) <- createViaSaml idp privcreds uref samlUserShouldSatisfy uref isJust where - samlUserShouldSatisfy :: HasCallStack => SAML.UserRef -> (Maybe UserId -> Bool) -> TestSpar () + samlUserShouldSatisfy :: (HasCallStack) => SAML.UserRef -> (Maybe UserId -> Bool) -> TestSpar () samlUserShouldSatisfy uref property = do muid <- getUserIdViaRef' uref liftIO $ muid `shouldSatisfy` property - createViaSamlResp :: HasCallStack => IdP -> SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS + createViaSamlResp :: (HasCallStack) => IdP -> SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS createViaSamlResp idp privCreds (SAML.UserRef _ subj) = do let tid = idp ^. idpExtraInfo . team authnReq <- negotiateAuthnRequest idp @@ -1238,7 +1242,7 @@ specDeleteCornerCases = describe "delete corner cases" $ do liftIO $ responseStatus createResp `shouldBe` status200 pure createResp - createViaSaml :: HasCallStack => IdP -> SignPrivCreds -> SAML.UserRef -> TestSpar (Maybe UserId) + createViaSaml :: (HasCallStack) => IdP -> SignPrivCreds -> SAML.UserRef -> TestSpar (Maybe UserId) createViaSaml idp privcreds uref = do resp <- createViaSamlResp idp privcreds uref liftIO $ do @@ -1265,8 +1269,8 @@ specScimAndSAML = do userref :: UserRef = UserRef tenant subject tenant :: Issuer = idp ^. idpMetadata . edIssuer subject :: NameID = - either (error . show) id $ - mkNameID subj Nothing Nothing Nothing + either (error . show) id + $ mkNameID subj Nothing Nothing Nothing -- UserRef maps onto correct UserId in spar (and back). userid' <- getUserIdViaRef' userref liftIO $ ('i', userid') `shouldBe` ('i', Just userid) @@ -1298,10 +1302,11 @@ specScimAndSAML = do liftIO $ userid'' `shouldBe` userid -- /self should contain the expected UserSSOId self :: ResponseLBS <- - call . get $ - (env ^. teBrig) - . path "/self" - . header "Z-User" (toByteString' userid'') + call + . get + $ (env ^. teBrig) + . path "/self" + . header "Z-User" (toByteString' userid'') selfbdy :: SelfProfile <- do bdy :: LByteString <- maybe (error "no self body") pure $ responseBody self @@ -1312,8 +1317,8 @@ specScimAndSAML = do (usr, subj) <- ScimT.randomScimUserWithSubject scimStoredUser <- ScimT.createUser tok usr let subjectWithQualifier :: NameID = - either (error . show) id $ - mkNameID subj (Just "https://federation.foobar.com/nidp/saml2/metadata") (Just "https://prod-nginz-https.wire.com/sso/finalize-login") Nothing + either (error . show) id + $ mkNameID subj (Just "https://federation.foobar.com/nidp/saml2/metadata") (Just "https://prod-nginz-https.wire.com/sso/finalize-login") Nothing authnreq <- negotiateAuthnRequest idp spmeta <- getTestSPMetadata (idp ^. idpExtraInfo . team) @@ -1398,7 +1403,7 @@ specAux :: SpecWith TestEnv specAux = do describe "test helper functions" $ do describe "createTeamMember" $ do - let check :: HasCallStack => Bool -> Int -> SpecWith TestEnv + let check :: (HasCallStack) => Bool -> Int -> SpecWith TestEnv check tryowner permsix = it ("works: tryowner == " <> show (tryowner, permsix)) $ do env <- ask @@ -1408,8 +1413,8 @@ specAux = do then pure undefined else call $ createTeamMember (env ^. teBrig) (env ^. teGalley) tid (permses !! permsix) rawResp <- - call $ - get + call + $ get ( (env ^. teBrig) . path "/self" . header "Z-User" (toByteString' $ if tryowner then owner else newmember) @@ -1509,7 +1514,7 @@ specSsoSettings = do -- TODO: what else needs to be tested, beyond the pending tests listed here? -- TODO: what tests can go to saml2-web-sso package? -getSsoidViaAuthResp :: HasCallStack => SignedAuthnResponse -> TestSpar UserSSOId +getSsoidViaAuthResp :: (HasCallStack) => SignedAuthnResponse -> TestSpar UserSSOId getSsoidViaAuthResp aresp = do parsed :: AuthnResponse <- either error pure . parseFromDocument $ fromSignedAuthnResponse aresp @@ -1517,8 +1522,9 @@ getSsoidViaAuthResp aresp = do specSparUserMigration :: SpecWith TestEnv specSparUserMigration = do - describe "online migration from spar.user to spar.user_v2" $ - it "online migration - user in legacy table can log in" $ do + describe "online migration from spar.user to spar.user_v2" + $ it "online migration - user in legacy table can log in" + $ do env <- ask (owner, tid) <- call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) @@ -1540,9 +1546,9 @@ specSparUserMigration = do client <- asks (^. teCql) let insert :: PrepQuery W (SAML.Issuer, SAML.NameID, UserId) () insert = "INSERT INTO user (issuer, sso_id, uid) VALUES (?, ?, ?)" - runClient client $ - retry x5 $ - write insert (params LocalQuorum (issuer, subject, memberUid)) + runClient client + $ retry x5 + $ write insert (params LocalQuorum (issuer, subject, memberUid)) mbUserId <- do authnreq <- negotiateAuthnRequest idp @@ -1604,11 +1610,11 @@ specReAuthSsoUserWithPassword = checkNumClients :: BrigReq -> UserId -> Int -> TestSpar () checkNumClients brig u expected = do r <- - call $ - get $ - brig - . path "clients" - . zUser u + call + $ get + $ brig + . path "clients" + . zUser u let actual = Vec.length <$> (preview _Array =<< responseJsonMaybe @Value r) lift $ actual `shouldBe` Just expected @@ -1623,12 +1629,12 @@ specReAuthSsoUserWithPassword = c <- responseJsonError =<< call - ( post $ - brig - . paths ["i", "clients", toByteString' uid] - . contentJson - . body (RequestBodyLBS $ encode new) - . expect2xx + ( post + $ brig + . paths ["i", "clients", toByteString' uid] + . contentJson + . body (RequestBodyLBS $ encode new) + . expect2xx ) pure $ clientId c @@ -1644,20 +1650,23 @@ specReAuthSsoUserWithPassword = deleteClient :: (MonadIO m, MonadReader TestEnv m) => BrigReq -> UserId -> ClientId -> Maybe Text -> Int -> m () deleteClient brig u c pw expectedStatus = - void $ - call $ - delete $ - brig - . paths ["clients", toByteString' c] - . zUser u - . zConn "conn" - . contentJson - . body payload - . expectStatus ((==) expectedStatus) + void + $ call + $ delete + $ brig + . paths ["clients", toByteString' c] + . zUser u + . zConn "conn" + . contentJson + . body payload + . expectStatus ((==) expectedStatus) where payload = - RequestBodyLBS . encode . object . maybeToList $ - fmap ("password" .=) pw + RequestBodyLBS + . encode + . object + . maybeToList + $ fmap ("password" .=) pw ---------------------------------------------------------------------- -- tests for bsi audit @@ -1781,8 +1790,8 @@ checkSamlFlow mkareq mkaresp submitaresp checkresp = do authnreq <- mkareq idp spmeta <- getTestSPMetadata teamid authnresp <- - runSimpleSP $ - mkaresp + runSimpleSP + $ mkaresp privcreds idp spmeta diff --git a/services/spar/test-integration/Test/Spar/AppSpec.hs b/services/spar/test-integration/Test/Spar/AppSpec.hs index ccc5d4ac103..ecbebff730f 100644 --- a/services/spar/test-integration/Test/Spar/AppSpec.hs +++ b/services/spar/test-integration/Test/Spar/AppSpec.hs @@ -141,7 +141,7 @@ mkAuthnReqMobile idpid = do -- fresh, iff the verdict is "granted" the user will be created during the call to -- 'Spar.verdictHandler'. requestAccessVerdict :: - HasCallStack => + (HasCallStack) => IdP -> -- | is the verdict granted? Bool -> @@ -167,8 +167,8 @@ requestAccessVerdict idp isGranted mkAuthnReq = do case authnreq of (SAML.FormRedirect _ req) -> do SAML.SignedAuthnResponse (XML.Document _ el _) <- - runSimpleSP $ - SAML.mkAuthnResponseWithSubj subject privKey idp spmeta req True + runSimpleSP + $ SAML.mkAuthnResponseWithSubj subject privKey idp spmeta req True either (error . show) pure $ SAML.parse [XML.NodeElement el] let verdict = if isGranted diff --git a/services/spar/test-integration/Test/Spar/Scim/AuthSpec.hs b/services/spar/test-integration/Test/Spar/Scim/AuthSpec.hs index 9247594fe87..c3c215f2ae4 100644 --- a/services/spar/test-integration/Test/Spar/Scim/AuthSpec.hs +++ b/services/spar/test-integration/Test/Spar/Scim/AuthSpec.hs @@ -138,8 +138,8 @@ testCreateTokenWithVerificationCode = do where requestVerificationCode :: BrigReq -> Email -> Public.VerificationAction -> TestSpar ResponseLBS requestVerificationCode brig email action = do - call $ - post (brig . paths ["verification-code", "send"] . contentJson . json (Public.SendVerificationCode action email)) + call + $ post (brig . paths ["verification-code", "send"] . contentJson . json (Public.SendVerificationCode action email)) unlockFeature :: GalleyReq -> TeamId -> TestSpar () unlockFeature galley tid = @@ -148,16 +148,16 @@ unlockFeature galley tid = setSndFactorPasswordChallengeStatus :: GalleyReq -> TeamId -> Public.FeatureStatus -> TestSpar () setSndFactorPasswordChallengeStatus galley tid status = do let js = RequestBodyLBS $ encode $ Public.WithStatusNoLock @Public.SndFactorPasswordChallengeConfig status Public.trivialConfig Public.FeatureTTLUnlimited - call $ - put (galley . paths ["i", "teams", toByteString' tid, "features", featureNameBS @Public.SndFactorPasswordChallengeConfig] . contentJson . body js) - !!! const 200 === statusCode + call + $ put (galley . paths ["i", "teams", toByteString' tid, "features", featureNameBS @Public.SndFactorPasswordChallengeConfig] . contentJson . body js) + !!! const 200 === statusCode getVerificationCode :: BrigReq -> UserId -> Public.VerificationAction -> TestSpar Code.Value getVerificationCode brig uid action = do resp <- - call $ - get (brig . paths ["i", "users", toByteString' uid, "verification-code", toByteString' action]) - >= deleteToken owner . stiId . createScimTokenResponseInfo + >>= deleteToken owner + . stiId + . createScimTokenResponseInfo addSomeIdP createToken owner (CreateScimToken "zwei" (Just defPassword) Nothing) - >>= deleteToken owner . stiId . createScimTokenResponseInfo + >>= deleteToken owner + . stiId + . createScimTokenResponseInfo addSomeIdP createToken_ owner (CreateScimToken "drei" (Just defPassword) Nothing) (env ^. teSpar) !!! checkErr 400 (Just "more-than-one-idp") @@ -228,8 +232,8 @@ testCreateTokenAuthorizesOnlyAdmins = do let mkUser :: Role -> TestSpar UserId mkUser role = do - runHttpT (env ^. teMgr) $ - createTeamMember + runHttpT (env ^. teMgr) + $ createTeamMember (env ^. teBrig) (env ^. teGalley) teamId @@ -316,9 +320,9 @@ testListTokens = do } -- Check that the token is on the list list <- scimTokenListTokens <$> listTokens owner - liftIO $ - map stiDescr list - `shouldBe` ["testListTokens / #1", "testListTokens / #2"] + liftIO + $ map stiDescr list + `shouldBe` ["testListTokens / #1", "testListTokens / #2"] testPlaintextTokensAreConverted :: TestSpar () testPlaintextTokensAreConverted = do diff --git a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs index 681c3ae0685..38af524a767 100644 --- a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs +++ b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs @@ -210,12 +210,12 @@ specImportToScimFromInvitation = check False check True where - createTeam :: HasCallStack => TestSpar (UserId, TeamId) + createTeam :: (HasCallStack) => TestSpar (UserId, TeamId) createTeam = do env <- ask call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) - invite :: HasCallStack => UserId -> TeamId -> TestSpar (UserId, Email) + invite :: (HasCallStack) => UserId -> TeamId -> TestSpar (UserId, Email) invite owner teamid = do env <- ask email <- randomEmail @@ -224,7 +224,7 @@ specImportToScimFromInvitation = emailInvited = fromMaybe (error "must have email") (userEmail memberInvited) pure (memberIdInvited, emailInvited) - addSamlIdP :: HasCallStack => UserId -> TestSpar (SAML.IdPConfig User.WireIdP, SAML.SignPrivCreds) + addSamlIdP :: (HasCallStack) => UserId -> TestSpar (SAML.IdPConfig User.WireIdP, SAML.SignPrivCreds) addSamlIdP userid = do env <- ask apiVersion <- view teWireIdPAPIVersion @@ -233,7 +233,7 @@ specImportToScimFromInvitation = pure (idp, privkey) reProvisionWithScim :: - HasCallStack => + (HasCallStack) => Bool -> Maybe (SAML.IdPConfig User.WireIdP) -> TeamId -> @@ -267,7 +267,7 @@ specImportToScimFromInvitation = (SAML.IdPConfig User.WireIdP, SAML.SignPrivCreds) -> Email -> UserId -> TestSpar () + signInWithSaml :: (HasCallStack) => (SAML.IdPConfig User.WireIdP, SAML.SignPrivCreds) -> Email -> UserId -> TestSpar () signInWithSaml (idp, privCreds) email userid = do let uref = SAML.UserRef tenant subj subj = emailToSAMLNameID email @@ -276,7 +276,7 @@ specImportToScimFromInvitation = liftIO $ mbUid `shouldBe` Just userid checkCsvDownload :: - HasCallStack => + (HasCallStack) => UserId -> TeamId -> SAML.IdPConfig User.WireIdP -> @@ -285,8 +285,9 @@ specImportToScimFromInvitation = checkCsvDownload ownerId teamId idp storedUsr = do g <- view teGalley resp <- - call $ - get (g . accept "text/csv" . paths ["teams", toByteString' teamId, "members/csv"] . zUser ownerId) pure fstUser _ -> error "expected exactly one user" -assertSparCassandraUref :: HasCallStack => (SAML.UserRef, Maybe UserId) -> TestSpar () +assertSparCassandraUref :: (HasCallStack) => (SAML.UserRef, Maybe UserId) -> TestSpar () assertSparCassandraUref (uref, urefAnswer) = do - liftIO . (`shouldBe` urefAnswer) + liftIO + . (`shouldBe` urefAnswer) =<< runSpar (SAMLUserStore.get uref) -assertSparCassandraScim :: HasCallStack => ((TeamId, Email), Maybe UserId) -> TestSpar () +assertSparCassandraScim :: (HasCallStack) => ((TeamId, Email), Maybe UserId) -> TestSpar () assertSparCassandraScim ((teamid, email), scimAnswer) = do - liftIO . (`shouldBe` scimAnswer) + liftIO + . (`shouldBe` scimAnswer) =<< runSpar (ScimExternalIdStore.lookup teamid email) assertBrigCassandra :: - HasCallStack => + (HasCallStack) => UserId -> SAML.UserRef -> Scim.User.User SparTag -> @@ -494,17 +497,17 @@ specCreateUser = describe "POST /Users" $ do it "rejects occupied handle" $ testCreateRejectsTakenHandle it "rejects occupied externalId (uref)" $ testCreateRejectsTakenExternalId True it "rejects occupied externalId (email)" $ testCreateRejectsTakenExternalId False - it "allows an occupied externalId when the IdP is different" $ - testCreateSameExternalIds + it "allows an occupied externalId when the IdP is different" + $ testCreateSameExternalIds it "provides a correct location in the 'meta' field" $ testLocation it "handles rich info correctly (this also tests put, get)" $ testRichInfo it "gives created user a valid 'SAML.UserRef' for SSO" $ testScimCreateVsUserRef it "attributes of {brig, scim, saml} user are mapped as documented" $ pending - it "writes all the stuff to all the places" $ - pendingWith "factor this out of the PUT tests we already wrote." + it "writes all the stuff to all the places" + $ pendingWith "factor this out of the PUT tests we already wrote." testCsvData :: - HasCallStack => + (HasCallStack) => TeamId -> UserId -> UserId -> @@ -516,8 +519,9 @@ testCsvData tid owner uid mbeid mbsaml hasissuer = do usersInCsv <- do g <- view teGalley resp <- - call $ - get (g . accept "text/csv" . paths ["teams", toByteString' tid, "members/csv"] . zUser owner) "" ('n', CsvExport.tExportSAMLNamedId export) `shouldBe` ('n', haveSubject) -decodeCSV :: Csv.FromNamedRecord a => LByteString -> [a] +decodeCSV :: (Csv.FromNamedRecord a) => LByteString -> [a] decodeCSV bstr = either (error "could not decode csv") (V.toList . snd) (Csv.decodeByName bstr) @@ -715,7 +719,7 @@ testCreateUserNoIdP = do where -- cloned from brig's integration tests - searchUser :: HasCallStack => BrigReq -> UserId -> Name -> Bool -> TestSpar () + searchUser :: (HasCallStack) => BrigReq -> UserId -> Name -> Bool -> TestSpar () searchUser brig searcherId searchTarget shouldSucceed = do refreshIndex brig aFewTimesAssert @@ -766,12 +770,14 @@ testCreateUserWithSamlIdP = do -- Check that this user is present in Brig and that Brig's view of the user -- matches SCIM's view of the user brigUser :: User <- - fmap responseJsonUnsafe . call . get $ - ( (env ^. teBrig) - . header "Z-User" (toByteString' userid) - . path "/self" - . expect2xx - ) + fmap responseJsonUnsafe + . call + . get + $ ( (env ^. teBrig) + . header "Z-User" (toByteString' userid) + . path "/self" + . expect2xx + ) brigUser `userShouldMatch` WrappedScimStoredUser scimStoredUser accStatus <- aFewTimes (runSpar $ BrigAccess.getStatus (userId brigUser)) (== Active) liftIO $ accStatus `shouldBe` Active @@ -779,7 +785,7 @@ testCreateUserWithSamlIdP = do let uid = userId brigUser eid = Scim.User.externalId user - sml :: HasCallStack => UserSSOId + sml :: (HasCallStack) => UserSSOId sml = fromJust $ ssoIdentity =<< userIdentity brigUser in testCsvData tid owner uid eid (Just sml) True @@ -809,12 +815,14 @@ testCreateUserWithSamlIdPWithPreferredLanguage mLocale mLocaleUpdate = do getBrigUser :: UserId -> TestSpar User getBrigUser userid = do env <- ask - fmap responseJsonUnsafe . call . get $ - ( (env ^. teBrig) - . header "Z-User" (toByteString' userid) - . path "/self" - . expect2xx - ) + fmap responseJsonUnsafe + . call + . get + $ ( (env ^. teBrig) + . header "Z-User" (toByteString' userid) + . path "/self" + . expect2xx + ) -- | Test that Wire-specific schemas are added to the SCIM user record, even if the schemas -- were not present in the original record during creation. @@ -825,9 +833,9 @@ testSchemaIsAdded = do (tok, _) <- registerIdPAndScimToken scimStoredUser <- createUser tok (user {Scim.User.schemas = []}) -- Check that the created user has the right schemas - liftIO $ - Scim.User.schemas (Scim.value (Scim.thing scimStoredUser)) - `shouldBe` userSchemas + liftIO + $ Scim.User.schemas (Scim.value (Scim.thing scimStoredUser)) + `shouldBe` userSchemas -- | Test that @externalId@ (for SSO login) is required when creating a user. testExternalIdIsRequired :: TestSpar () @@ -958,7 +966,7 @@ testRichInfo = do (tok, (owner, _, _)) <- registerIdPAndScimToken let -- validate response checkStoredUser :: - HasCallStack => + (HasCallStack) => Scim.UserC.StoredUser SparTag -> RichInfo -> TestSpar () @@ -967,7 +975,7 @@ testRichInfo = do `shouldBe` ScimUserExtra rinf -- validate server state after the fact probeUser :: - HasCallStack => + (HasCallStack) => UserId -> RichInfo -> TestSpar () @@ -977,8 +985,8 @@ testRichInfo = do checkStoredUser scimStoredUser' rinf -- get rich info end-point on brig yields correct rich info. resp <- - call $ - get + call + $ get ( brig . paths ["users", toByteString' uid, "rich-info"] . zUser owner @@ -1053,29 +1061,29 @@ testScimCreateVsUserRef = do tenant' = idp ^. SAML.idpMetadata . SAML.edIssuer createViaSamlFails idp privCreds uref' -samlUserShouldSatisfy :: HasCallStack => SAML.UserRef -> (Maybe UserId -> Bool) -> TestSpar () +samlUserShouldSatisfy :: (HasCallStack) => SAML.UserRef -> (Maybe UserId -> Bool) -> TestSpar () samlUserShouldSatisfy uref property = do muid <- getUserIdViaRef' uref liftIO $ muid `shouldSatisfy` property -createViaSamlResp :: HasCallStack => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS +createViaSamlResp :: (HasCallStack) => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar ResponseLBS createViaSamlResp idp privCreds (SAML.UserRef _ subj) = do authnReq <- negotiateAuthnRequest idp let tid = idp ^. SAML.idpExtraInfo . User.team spmeta <- getTestSPMetadata tid authnResp <- - runSimpleSP $ - SAML.mkAuthnResponseWithSubj subj privCreds idp spmeta authnReq True + runSimpleSP + $ SAML.mkAuthnResponseWithSubj subj privCreds idp spmeta authnReq True submitAuthnResponse tid authnResp IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar () +createViaSamlFails :: (HasCallStack) => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar () createViaSamlFails idp privCreds uref = do resp <- createViaSamlResp idp privCreds uref liftIO $ do maybe (error "no body") cs (responseBody resp) `shouldNotContain` "wire:sso:error:success" -createViaSaml :: HasCallStack => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar (Maybe UserId) +createViaSaml :: (HasCallStack) => IdP -> SAML.SignPrivCreds -> SAML.UserRef -> TestSpar (Maybe UserId) createViaSaml idp privCreds uref = do resp <- createViaSamlResp idp privCreds uref liftIO $ do @@ -1127,7 +1135,7 @@ testCreateUserTimeout = do Just inviteeCode <- call $ getInvitationCode brig tid (inInvitation inv) pure (scimStoredUser, inv, inviteeCode) - searchUser :: HasCallStack => Spar.Types.ScimToken -> Scim.User.User tag -> Email -> Bool -> TestSpar () + searchUser :: (HasCallStack) => Spar.Types.ScimToken -> Scim.User.User tag -> Email -> Bool -> TestSpar () searchUser tok scimUser email shouldSucceed = do let handle = fromJust . parseHandle . Scim.User.userName $ scimUser tryquery qry = @@ -1214,7 +1222,7 @@ testFindSamlAutoProvisionedUserMigratedWithEmailInTeamWithSSO = do Just brigUser' <- runSpar $ Intra.getBrigUser Intra.NoPendingInvitations memberIdWithSSO liftIO $ userManagedBy brigUser' `shouldBe` ManagedByScim where - veidToText :: MonadError String m => ValidExternalId -> m Text + veidToText :: (MonadError String m) => ValidExternalId -> m Text veidToText veid = runValidExternalIdEither (\(SAML.UserRef _ subj) -> maybe (throwError "bad uref from brig") (pure . CI.original) $ SAML.shortShowNameID subj) @@ -1318,7 +1326,7 @@ testFindNoDeletedUsers = do liftIO $ users'' `shouldSatisfy` all ((/= userid) . scimUserId) -- | Test that users are not listed if not in the team associated with the token. -testUserListFailsWithNotFoundIfOutsideTeam :: HasCallStack => TestSpar () +testUserListFailsWithNotFoundIfOutsideTeam :: (HasCallStack) => TestSpar () testUserListFailsWithNotFoundIfOutsideTeam = do user <- randomScimUser (tokTeamA, _) <- registerIdPAndScimToken @@ -1366,7 +1374,7 @@ testGetUser = do storedUser' <- getUser tok (scimUserId storedUser) liftIO $ storedUser' `shouldBe` storedUser -shouldBeManagedBy :: HasCallStack => UserId -> ManagedBy -> TestSpar () +shouldBeManagedBy :: (HasCallStack) => UserId -> ManagedBy -> TestSpar () shouldBeManagedBy uid flag = do managedBy <- maybe (error "user not found") userManagedBy <$> runSpar (Intra.getBrigUser Intra.WithPendingInvitations uid) liftIO $ managedBy `shouldBe` flag @@ -1507,12 +1515,12 @@ specUpdateUser = describe "PUT /Users/:id" $ do -- not reflected on the SCIM side. We can fix this by making brig -- actually the source of truth for SCIM SCIM then becomes a _view_; -- not a separate database. - it "does NOT mirror this in the scim user" $ - pendingWith + it "does NOT mirror this in the scim user" + $ pendingWith "this is arguably not great behavior, but i'm not sure \ \we want to implement synchronisation from brig to spar?" - it "updates to scim user will overwrite these updates" $ - pendingWith "that's probably what we want?" + it "updates to scim user will overwrite these updates" + $ pendingWith "that's probably what we want?" it "updates role" testUpdateUserRole -- | Tests that you can't unset your display name @@ -1678,7 +1686,7 @@ testUpdateExternalId withidp = do (_owner, tid) <- call $ createUserWithTeam (env ^. teBrig) (env ^. teGalley) (,Nothing,tid) <$> registerScimToken tid Nothing - let checkUpdate :: HasCallStack => Bool -> TestSpar () + let checkUpdate :: (HasCallStack) => Bool -> TestSpar () checkUpdate hasChanged {- is externalId updated with a different value, or with itself? -} = do -- Create a user via SCIM email <- randomEmail @@ -1689,8 +1697,9 @@ testUpdateExternalId withidp = do then call $ activateEmail brig email else registerUser brig tid email veid :: ValidExternalId <- - runSpar . runScimErrorUnsafe $ - mkValidExternalId midp (Scim.User.externalId user) + runSpar + . runScimErrorUnsafe + $ mkValidExternalId midp (Scim.User.externalId user) -- Overwrite the user with another randomly-generated user (only controlling externalId) otherEmail <- randomEmail user' <- do @@ -1703,8 +1712,9 @@ testUpdateExternalId withidp = do } randomScimUser <&> upd veid' <- - runSpar . runScimErrorUnsafe $ - mkValidExternalId midp (Scim.User.externalId user') + runSpar + . runScimErrorUnsafe + $ mkValidExternalId midp (Scim.User.externalId user') _ <- updateUser tok userid user' @@ -1736,8 +1746,9 @@ testUpdateExternalIdOfUnregisteredAccount = do storedUser <- createUser tok user let userid = scimUserId storedUser veid :: ValidExternalId <- - runSpar . runScimErrorUnsafe $ - mkValidExternalId Nothing (Scim.User.externalId user) + runSpar + . runScimErrorUnsafe + $ mkValidExternalId Nothing (Scim.User.externalId user) -- Overwrite the user with another randomly-generated user (only controlling externalId) -- And update the user before they have registered their account otherEmail <- randomEmail @@ -1745,8 +1756,9 @@ testUpdateExternalIdOfUnregisteredAccount = do let upd u = u {Scim.User.externalId = Just $ fromEmail otherEmail} randomScimUser <&> upd veid' <- - runSpar . runScimErrorUnsafe $ - mkValidExternalId Nothing (Scim.User.externalId user') + runSpar + . runScimErrorUnsafe + $ mkValidExternalId Nothing (Scim.User.externalId user') _ <- updateUser tok userid user' -- Now the user registers their account (via old email) registerUser brig tid email @@ -1776,9 +1788,9 @@ registerUser brig tid email = do let r = call $ get (brig . path "/i/teams/invitations/by-email" . queryItem "email" (toByteString' email)) inv <- responseJsonError =<< r Just (Locale (Language EN) Nothing)} brigUser `userShouldMatch` scimUserWithDefLocale @@ -1873,8 +1886,8 @@ specPatchUser = do storedUser <- createUser tok user let userid = scimUserId storedUser storedUser' <- - patchUser tok userid $ - PatchOp.PatchOp + patchUser tok userid + $ PatchOp.PatchOp [replaceAttrib "userName" userName] let user'' = Scim.value (Scim.thing storedUser') liftIO $ Scim.User.userName user'' `shouldBe` userName @@ -1912,8 +1925,8 @@ specPatchUser = do let userid = scimUserId storedUser let displayName = Scim.User.displayName user' storedUser' <- - patchUser tok userid $ - PatchOp.PatchOp + patchUser tok userid + $ PatchOp.PatchOp [replaceAttrib "displayName" displayName] let user'' = Scim.value (Scim.thing storedUser') liftIO $ Scim.User.displayName user'' `shouldBe` displayName @@ -1925,8 +1938,8 @@ specPatchUser = do let userid = scimUserId storedUser let externalId = Scim.User.externalId user' storedUser' <- - patchUser tok userid $ - PatchOp.PatchOp + patchUser tok userid + $ PatchOp.PatchOp [replaceAttrib "externalId" externalId] let user'' = Scim.value . Scim.thing $ storedUser' liftIO $ Scim.User.externalId user'' `shouldBe` externalId @@ -1944,8 +1957,8 @@ specPatchUser = do let userName = Scim.User.userName user' let displayName = Scim.User.displayName user' storedUser' <- - patchUser tok userid $ - PatchOp.PatchOp + patchUser tok userid + $ PatchOp.PatchOp [ replaceAttrib "externalId" externalId, replaceAttrib "userName" userName, replaceAttrib "displayName" displayName @@ -2097,9 +2110,9 @@ specDeleteUser = do aFewTimes (getUserIdViaRef' uref) isNothing scimUser <- aFewTimes (runSpar $ ScimUserTimesStore.read uid) isNothing - liftIO $ - (brigUser, samlUser, scimUser) - `shouldBe` (Nothing, Nothing, Nothing) + liftIO + $ (brigUser, samlUser, scimUser) + `shouldBe` (Nothing, Nothing, Nothing) it "should respond with 204 on first deletion, then 404" $ do (tok, _) <- registerIdPAndScimToken user <- randomScimUser @@ -2217,13 +2230,15 @@ specDeleteUser = do specAzureQuirks :: SpecWith TestEnv specAzureQuirks = do describe "Assert that we implement all azure quirks" $ do - context "with SAML IDP" $ - it "GET /Users?filter=randomField eq should return empty list; not error out" $ do + context "with SAML IDP" + $ it "GET /Users?filter=randomField eq should return empty list; not error out" + $ do (tok, (_, _, _)) <- registerIdPAndScimToken testUUIds tok - context "without SAML IdP" $ - it "GET /Users?filter=randomField eq should return empty list; not error out" $ do + context "without SAML IdP" + $ it "GET /Users?filter=randomField eq should return empty list; not error out" + $ do env <- ask let brig = env ^. teBrig galley = env ^. teGalley @@ -2243,7 +2258,7 @@ specAzureQuirks = do specEmailValidation :: SpecWith TestEnv specEmailValidation = do describe "email validation" $ do - let setup :: HasCallStack => Bool -> TestSpar (UserId, Email) + let setup :: (HasCallStack) => Bool -> TestSpar (UserId, Email) setup enabled = do (tok, (_ownerid, teamid, idp)) <- registerIdPAndScimToken if enabled @@ -2252,8 +2267,9 @@ specEmailValidation = do (user, email) <- randomScimUserWithEmail scimStoredUser <- createUser tok user veid <- - runSpar . runScimErrorUnsafe $ - mkValidExternalId (Just idp) (Scim.User.externalId . Scim.value . Scim.thing $ scimStoredUser) + runSpar + . runScimErrorUnsafe + $ mkValidExternalId (Just idp) (Scim.User.externalId . Scim.value . Scim.thing $ scimStoredUser) uid :: UserId <- getUserIdViaRef (veid ^?! veidUref) brig <- view teBrig @@ -2298,8 +2314,8 @@ testDeletedUsersFreeExternalIdNoIdp = do deleteUser_ (Just tok) (Just uid) spar !!! const 204 === statusCode - void $ - aFewTimes + void + $ aFewTimes (runSpar $ ScimExternalIdStore.lookup tid email) (== Nothing) @@ -2321,7 +2337,7 @@ specSCIMManaged = do let Right nameid = SAML.emailNameID $ fromEmail oldEmail (_, cky) <- loginCreatedSsoUser nameid idp privCreds sessiontok <- do - let decodeToken :: HasCallStack => ResponseLBS -> ZAuth.Token ZAuth.Access + let decodeToken :: (HasCallStack) => ResponseLBS -> ZAuth.Token ZAuth.Access decodeToken r = fromMaybe (error "invalid access_token") $ do x <- responseBody r t <- x ^? key "access_token" . _String @@ -2332,23 +2348,26 @@ specSCIMManaged = do do newEmail <- randomEmail - call $ - changeEmailBrigCreds brig cky sessiontok newEmail !!! do + call + $ changeEmailBrigCreds brig cky sessiontok newEmail + !!! do (fmap Wai.label . responseJsonEither @Wai.Error) === const (Right "managed-by-scim") statusCode === const 403 do handleTxt <- randomAlphaNum - call $ - changeHandleBrig brig uid handleTxt !!! do + call + $ changeHandleBrig brig uid handleTxt + !!! do (fmap Wai.label . responseJsonEither @Wai.Error) === const (Right "managed-by-scim") statusCode === const 403 do displayName <- Name <$> randomAlphaNum let uupd = UserUpdate (Just displayName) Nothing Nothing Nothing - call $ - updateProfileBrig brig uid uupd !!! do + call + $ updateProfileBrig brig uid uupd + !!! do (fmap Wai.label . responseJsonEither @Wai.Error) === const (Right "managed-by-scim") statusCode === const 403 it "created_on should be filled in CSV export" $ do @@ -2358,8 +2377,9 @@ specSCIMManaged = do scimStoredUser <- createUser tok user let _userid = scimUserId scimStoredUser resp <- - call $ - get (g . accept "text/csv" . paths ["teams", toByteString' tid, "members/csv"] . zUser owner) m Text + randomAlphaNum :: (MonadIO m) => m Text randomAlphaNum = liftIO $ do nrs <- replicateM 21 (randomRIO (97, 122)) -- a-z pure (cs (map chr nrs)) @@ -2407,13 +2427,14 @@ executeTeamUserSearch :: Maybe Text -> TestSpar [Search.TeamContact] executeTeamUserSearch brig teamid self mbSearchText = - call $ - get + call + $ get ( brig . paths ["/teams", toByteString' teamid, "search"] . zUser self . maybe id (queryItem "q" . encodeUtf8) mbSearchText ) - >= fmap Search.searchResults . responseJsonError + >= fmap Search.searchResults + . responseJsonError diff --git a/services/spar/test-integration/Util/Core.hs b/services/spar/test-integration/Util/Core.hs index 003035dd373..e720a3310fc 100644 --- a/services/spar/test-integration/Util/Core.hs +++ b/services/spar/test-integration/Util/Core.hs @@ -262,7 +262,7 @@ cliOptsParser = -- removed the mock idp functionality. if you want to re-introduce it, -- -- would be a good place to look for code to steal. -mkEnv :: HasCallStack => IntegrationConfig -> Opts -> IO TestEnv +mkEnv :: (HasCallStack) => IntegrationConfig -> Opts -> IO TestEnv mkEnv tstOpts opts = do mgr :: Manager <- newManager defaultManagerSettings sparCtxLogger <- Log.mkLogger (samlToLevel $ saml opts ^. SAML.cfgLogLevel) (logNetStrings opts) (logFormat opts) @@ -278,8 +278,8 @@ mkEnv tstOpts opts = do sparCtxHttpBrig = brig empty sparCtxHttpGalley = galley empty sparCtxRequestId = RequestId "" - pure $ - TestEnv + pure + $ TestEnv mgr cql brig @@ -290,11 +290,11 @@ mkEnv tstOpts opts = do tstOpts wireIdPAPIVersion -destroyEnv :: HasCallStack => TestEnv -> IO () +destroyEnv :: (HasCallStack) => TestEnv -> IO () destroyEnv _ = pure () it :: - HasCallStack => + (HasCallStack) => -- or, more generally: -- MonadIO m, Example (TestEnv -> m ()), Arg (TestEnv -> m ()) ~ TestEnv String -> @@ -303,7 +303,7 @@ it :: it msg bdy = Test.Hspec.it msg $ runReaderT bdy xit :: - HasCallStack => + (HasCallStack) => -- or, more generally: -- MonadIO m, Example (TestEnv -> m ()), Arg (TestEnv -> m ()) ~ TestEnv String -> @@ -324,8 +324,8 @@ pendingWith = liftIO . Test.Hspec.pendingWith aFewTimes :: TestSpar a -> (a -> Bool) -> TestSpar a aFewTimes action good = do env <- ask - liftIO $ - retrying + liftIO + $ retrying (exponentialBackoff 1000 <> limitRetries 11) (\_ -> pure . not . good) (\_ -> action `runReaderT` env) @@ -337,7 +337,7 @@ retryNUntil n good m = (const (pure . not . good)) (const m) -aFewTimesAssert :: HasCallStack => TestSpar a -> (a -> Bool) -> TestSpar () +aFewTimesAssert :: (HasCallStack) => TestSpar a -> (a -> Bool) -> TestSpar () aFewTimesAssert action good = do result <- aFewTimes action good good result `assert` pure () @@ -345,13 +345,13 @@ aFewTimesAssert action good = do aFewTimesRecover :: TestSpar a -> TestSpar a aFewTimesRecover action = do env <- ask - liftIO $ - recoverAll + liftIO + $ recoverAll (exponentialBackoff 1000 <> limitRetries 10) (\_ -> action `runReaderT` env) -- | Duplicate of 'Spar.Intra.getBrigUser'. -getUserBrig :: HasCallStack => UserId -> TestSpar (Maybe User) +getUserBrig :: (HasCallStack) => UserId -> TestSpar (Maybe User) getUserBrig uid = do env <- ask let req = @@ -362,8 +362,8 @@ getUserBrig uid = do case statusCode resp of 200 -> do let user = selfUser $ responseJsonUnsafe resp - pure $ - if userDeleted user + pure + $ if userDeleted user then Nothing else Just user 404 -> pure Nothing @@ -380,8 +380,9 @@ createUserWithTeamDisableSSO brg gly = do e <- randomEmail n <- UUID.toString <$> liftIO UUID.nextRandom let p = - RequestBodyLBS . Aeson.encode $ - object + RequestBodyLBS + . Aeson.encode + $ object [ "name" .= n, "email" .= fromEmail e, "password" .= defPassword, @@ -391,27 +392,28 @@ createUserWithTeamDisableSSO brg gly = do let (uid, Just tid) = (userId bdy, userTeam bdy) (team' : _) <- (^. Galley.teamListTeams) <$> getTeams uid gly () <- - Control.Exception.assert {- "Team ID in registration and team table do not match" -} (tid == team' ^. Galley.teamId) $ - pure () + Control.Exception.assert {- "Team ID in registration and team table do not match" -} (tid == team' ^. Galley.teamId) + $ pure () selfTeam <- userTeam . selfUser <$> getSelfProfile brg uid () <- - Control.Exception.assert {- "Team ID in self profile and team table do not match" -} (selfTeam == Just tid) $ - pure () + Control.Exception.assert {- "Team ID in self profile and team table do not match" -} (selfTeam == Just tid) + $ pure () pure (uid, tid) getSSOEnabledInternal :: (HasCallStack, MonadHttp m) => GalleyReq -> TeamId -> m ResponseLBS getSSOEnabledInternal gly tid = do - get $ - gly - . paths ["i", "teams", toByteString' tid, "features", "sso"] + get + $ gly + . paths ["i", "teams", toByteString' tid, "features", "sso"] putSSOEnabledInternal :: (HasCallStack, MonadHttp m, MonadIO m) => GalleyReq -> TeamId -> FeatureStatus -> m () putSSOEnabledInternal gly tid enabled = do - void . put $ - gly - . paths ["i", "teams", toByteString' tid, "features", "sso"] - . json (WithStatusNoLock @SSOConfig enabled trivialConfig FeatureTTLUnlimited) - . expect2xx + void + . put + $ gly + . paths ["i", "teams", toByteString' tid, "features", "sso"] + . json (WithStatusNoLock @SSOConfig enabled trivialConfig FeatureTTLUnlimited) + . expect2xx -- | cloned from `/services/brig/test/integration/API/Team/Util.hs`. inviteAndRegisterUser :: @@ -445,8 +447,9 @@ inviteAndRegisterUser brig u tid inviteeEmail = do -- acceptWithName :: User.Name -> User.Email -> User.InvitationCode -> RequestBody acceptWithName name email code = - RequestBodyLBS . Aeson.encode $ - object + RequestBodyLBS + . Aeson.encode + $ object [ "name" .= User.fromName name, "email" .= email, "password" .= defPassword, @@ -460,12 +463,12 @@ inviteAndRegisterUser brig u tid inviteeEmail = do TeamInvitation.InvitationRequest -> m ResponseLBS postInvitation t u' i = - post $ - brig - . paths ["teams", toByteString' t, "invitations"] - . contentJson - . body (RequestBodyLBS $ Aeson.encode i) - . zAuthAccess u' "conn" + post + $ brig + . paths ["teams", toByteString' t, "invitations"] + . contentJson + . body (RequestBodyLBS $ Aeson.encode i) + . zAuthAccess u' "conn" -- getInvitationCode :: (MonadIO m, MonadHttp m, HasCallStack) => @@ -519,8 +522,8 @@ addTeamMember :: NewTeamMember -> m () addTeamMember galleyreq tid mem = - void $ - post + void + $ post ( galleyreq . paths ["i", "teams", toByteString' tid, "members"] . contentJson @@ -547,8 +550,8 @@ deleteUserNoWait :: UserId -> m () deleteUserNoWait brigreq uid = - void $ - delete + void + $ delete ( brigreq . paths ["i", "users", toByteString' uid] . expect2xx @@ -556,19 +559,19 @@ deleteUserNoWait brigreq uid = -- | See also: 'nextSAMLID', 'nextUserRef'. The names are chosed to be consistent with -- 'UUID.nextRandom'. -nextWireId :: MonadIO m => m (Id a) +nextWireId :: (MonadIO m) => m (Id a) nextWireId = Id <$> liftIO UUID.nextRandom -nextWireIdP :: MonadIO m => WireIdPAPIVersion -> m WireIdP +nextWireIdP :: (MonadIO m) => WireIdPAPIVersion -> m WireIdP nextWireIdP version = WireIdP <$> iid <*> pure (Just version) <*> pure [] <*> pure Nothing <*> idpHandle where iid = Id <$> liftIO UUID.nextRandom idpHandle = iid <&> IdPHandle . pack . show -nextSAMLID :: MonadIO m => m (ID a) +nextSAMLID :: (MonadIO m) => m (ID a) nextSAMLID = mkID . UUID.toText <$> liftIO UUID.nextRandom -nextHandle :: MonadIO m => m Handle +nextHandle :: (MonadIO m) => m Handle nextHandle = liftIO $ fromJust . parseHandle . cs . show <$> randomRIO (0 :: Int, 13371137) -- | Generate a 'SAML.UserRef' subject. @@ -581,7 +584,7 @@ nextSubject = liftIO $ do _ -> error "nextSubject: impossible" either (error . show) pure $ SAML.mkNameID unameId Nothing Nothing Nothing -nextUserRef :: MonadIO m => m SAML.UserRef +nextUserRef :: (MonadIO m) => m SAML.UserRef nextUserRef = liftIO $ do tenant <- UUID.toText <$> UUID.nextRandom SAML.UserRef @@ -619,28 +622,28 @@ getTeams u gly = do ) pure $ responseJsonUnsafe r -getTeamMemberIds :: HasCallStack => UserId -> TeamId -> TestSpar [UserId] +getTeamMemberIds :: (HasCallStack) => UserId -> TeamId -> TestSpar [UserId] getTeamMemberIds usr tid = (^. Team.userId) <$$> getTeamMembers usr tid -getTeamMembers :: HasCallStack => UserId -> TeamId -> TestSpar [Member.TeamMember] +getTeamMembers :: (HasCallStack) => UserId -> TeamId -> TestSpar [Member.TeamMember] getTeamMembers usr tid = do gly <- view teGalley resp <- - call $ - get (gly . paths ["teams", toByteString' tid, "members"] . zUser usr) - UserId -> TeamId -> UserId -> TestSpar () +promoteTeamMember :: (HasCallStack) => UserId -> TeamId -> UserId -> TestSpar () promoteTeamMember usr tid memid = do gly <- view teGalley let bdy :: NewTeamMember bdy = Member.mkNewTeamMember memid fullPermissions Nothing - call $ - put (gly . paths ["teams", toByteString' tid, "members"] . zAuthAccess usr "conn" . json bdy) - !!! const 200 === statusCode + call + $ put (gly . paths ["teams", toByteString' tid, "members"] . zAuthAccess usr "conn" . json bdy) + !!! const 200 === statusCode getSelfProfile :: (HasCallStack, MonadHttp m, MonadIO m) => BrigReq -> UserId -> m SelfProfile getSelfProfile brg usr = do @@ -653,12 +656,12 @@ zAuthAccess u c = header "Z-Type" "access" . zUser u . zConn c newTeam :: Galley.BindingNewTeam newTeam = Galley.BindingNewTeam $ Galley.newNewTeam (unsafeRange "teamName") DefaultIcon -randomEmail :: MonadIO m => m Email +randomEmail :: (MonadIO m) => m Email randomEmail = do uid <- liftIO nextRandom pure $ Email ("success+" <> UUID.toText uid) "simulator.amazonses.com" -randomPhone :: MonadIO m => m Phone +randomPhone :: (MonadIO m) => m Phone randomPhone = liftIO $ do nrs <- map show <$> replicateM 14 (randomRIO (0, 9) :: IO Int) let phone = parsePhone . cs $ "+0" ++ concat nrs @@ -691,8 +694,9 @@ postUser :: postUser name haveEmail ssoid teamid brig_ = do email <- if haveEmail then Just <$> randomEmail else pure Nothing let p = - RequestBodyLBS . Aeson.encode $ - object + RequestBodyLBS + . Aeson.encode + $ object [ "name" .= name, "email" .= email, "password" .= defPassword, @@ -727,11 +731,11 @@ activate :: ActivationPair -> m ResponseLBS activate brig_ (k, c) = - get $ - brig_ - . path "activate" - . queryItem "key" (toByteString' k) - . queryItem "code" (toByteString' c) + get + $ brig_ + . path "activate" + . queryItem "key" (toByteString' k) + . queryItem "code" (toByteString' c) zUser :: UserId -> Request -> Request zUser = header "Z-User" . toByteString' @@ -749,7 +753,7 @@ endpointToSettings ep = Warp.settingsPort = fromIntegral $ ep ^. port } -endpointToURL :: MonadIO m => Endpoint -> Text -> m URI +endpointToURL :: (MonadIO m) => Endpoint -> Text -> m URI endpointToURL ep urlpath = either err pure url where url = parseURI' ("http://" <> urlhost <> ":" <> urlport) <&> (=/ urlpath) @@ -792,13 +796,14 @@ getTestSPMetadata :: (HasCallStack, MonadReader TestEnv m, MonadIO m) => TeamId getTestSPMetadata tid = do env <- ask resp <- - call . get $ - (env ^. teSpar) - . ( case env ^. teWireIdPAPIVersion of - WireIdPAPIV1 -> path "/sso/metadata" - WireIdPAPIV2 -> paths ["/sso/metadata", toByteString' tid] - ) - . expect2xx + call + . get + $ (env ^. teSpar) + . ( case env ^. teWireIdPAPIVersion of + WireIdPAPIV1 -> path "/sso/metadata" + WireIdPAPIV2 -> paths ["/sso/metadata", toByteString' tid] + ) + . expect2xx raw <- maybe (crash_ "no body") (pure . cs) $ responseBody resp either (crash_ . show) pure (SAML.decode raw) where @@ -835,7 +840,7 @@ registerTestIdPFrom metadata mgr owner spar = do liftIO . runHttpT mgr $ do callIdpCreate apiVer spar (Just owner) metadata -getCookie :: KnownSymbol name => proxy name -> ResponseLBS -> Either String (SAML.SimpleSetCookie name) +getCookie :: (KnownSymbol name) => proxy name -> ResponseLBS -> Either String (SAML.SimpleSetCookie name) getCookie proxy rsp = do web :: Web.SetCookie <- Web.parseSetCookie @@ -852,11 +857,12 @@ getCookie proxy rsp = do hasPersistentCookieHeader :: ResponseLBS -> Either String () hasPersistentCookieHeader rsp = do cky <- getCookie (Proxy @"zuid") rsp - when (isNothing . Web.setCookieExpires $ fromSimpleSetCookie cky) $ - Left $ - "expiration date should NOT empty: " <> show cky + when (isNothing . Web.setCookieExpires $ fromSimpleSetCookie cky) + $ Left + $ "expiration date should NOT empty: " + <> show cky -tryLogin :: HasCallStack => SignPrivCreds -> IdP -> NameID -> TestSpar SAML.UserRef +tryLogin :: (HasCallStack) => SignPrivCreds -> IdP -> NameID -> TestSpar SAML.UserRef tryLogin privkey idp userSubject = do env <- ask let tid = idp ^. idpExtraInfo . team @@ -868,10 +874,10 @@ tryLogin privkey idp userSubject = do statusCode sparresp `shouldBe` 200 let bdy = maybe "" (cs @LByteString @String) (responseBody sparresp) bdy `shouldContain` "wire:sso:success" - either (error . show) (pure . view userRefL) $ - SAML.parseFromDocument (fromSignedAuthnResponse idpresp) + either (error . show) (pure . view userRefL) + $ SAML.parseFromDocument (fromSignedAuthnResponse idpresp) -tryLoginFail :: HasCallStack => SignPrivCreds -> IdP -> NameID -> String -> TestSpar () +tryLoginFail :: (HasCallStack) => SignPrivCreds -> IdP -> NameID -> String -> TestSpar () tryLoginFail privkey idp userSubject bodyShouldContain = do env <- ask let tid = idp ^. idpExtraInfo . team @@ -898,8 +904,8 @@ negotiateAuthnRequest' :: negotiateAuthnRequest' idp modreq = do env <- ask resp :: ResponseLBS <- - call $ - get + call + $ get ( modreq . (env ^. teSpar) . paths (cs <$> ["sso", "initiate-login", idPIdToST $ idp ^. SAML.idpId]) @@ -963,24 +969,24 @@ loginCreatedSsoUser nameid idp privCreds = do let wireCookie = fromMaybe (error (show sparAuthnResp)) . lookup "Set-Cookie" $ responseHeaders sparAuthnResp accessResp :: ResponseLBS <- - call $ - post ((env ^. teBrig) . path "/access" . header "Cookie" wireCookie . expect2xx) + call + $ post ((env ^. teBrig) . path "/access" . header "Cookie" wireCookie . expect2xx) let uid :: UserId uid = Id . fromMaybe (error "bad user field in /access response body") . UUID.fromText $ uidRaw - uidRaw :: HasCallStack => Text + uidRaw :: (HasCallStack) => Text uidRaw = accessToken ^?! Aeson.key "user" . _String - accessToken :: HasCallStack => Aeson.Value + accessToken :: (HasCallStack) => Aeson.Value accessToken = tok where tok = - either (error . ("parse error in /access response body: " <>)) id $ - Aeson.eitherDecode raw + either (error . ("parse error in /access response body: " <>)) id + $ Aeson.eitherDecode raw raw = - fromMaybe (error "no body in /access response") $ - responseBody accessResp + fromMaybe (error "no body in /access response") + $ responseBody accessResp decodeCookie :: ResponseLBS -> Cookie decodeCookie = fromMaybe (error "missing zuid cookie") . Bilge.getCookie "zuid" @@ -997,7 +1003,7 @@ callAuthnReq sparreq_ idpid = assert test_parseAuthnReqResp $ do resp <- callAuthnReq' (sparreq_ . expect2xx) idpid either (err resp) pure $ parseAuthnReqResp (cs <$> responseBody resp) where - err :: forall n a. MonadIO n => ResponseLBS -> String -> n a + err :: forall n a. (MonadIO n) => ResponseLBS -> String -> n a err resp = liftIO . throwIO . ErrorCall . (<> ("; " <> show (responseBody resp))) test_parseAuthnReqResp :: Bool @@ -1009,44 +1015,50 @@ test_parseAuthnReqResp = isRight tst1 parseAuthnReqResp :: forall n. - MonadError String n => + (MonadError String n) => Maybe LText -> n (URI, SAML.AuthnRequest) parseAuthnReqResp Nothing = throwError "no response body" parseAuthnReqResp (Just raw) = do xml :: XML.Document <- - either (throwError . ("malformed html in response body: " <>) . show) pure $ - XML.parseText XML.def raw + either (throwError . ("malformed html in response body: " <>) . show) pure + $ XML.parseText XML.def raw reqUri :: URI <- safeHead "form" (XML.fromDocument xml XML.$// XML.element (XML.Name "form" (Just "http://www.w3.org/1999/xhtml") Nothing)) - >>= safeHead "action" . XML.attribute "action" + >>= safeHead "action" + . XML.attribute "action" >>= SAML.parseURI' reqBody :: SAML.AuthnRequest <- safeHead "input" (XML.fromDocument xml XML.$// XML.element (XML.Name "input" (Just "http://www.w3.org/1999/xhtml") Nothing)) - >>= safeHead "value" . XML.attribute "value" - >>= either (throwError . show) pure . EL.decode . cs - >>= either (throwError . show) pure . SAML.decodeElem . cs + >>= safeHead "value" + . XML.attribute "value" + >>= either (throwError . show) pure + . EL.decode + . cs + >>= either (throwError . show) pure + . SAML.decodeElem + . cs pure (reqUri, reqBody) safeHead :: forall n a. (MonadError String n) => String -> [a] -> n a safeHead _ (a : _) = pure a safeHead msg [] = throwError $ msg <> ": []" -callAuthnReq' :: MonadHttp m => SparReq -> SAML.IdPId -> m ResponseLBS +callAuthnReq' :: (MonadHttp m) => SparReq -> SAML.IdPId -> m ResponseLBS callAuthnReq' sparreq_ idpid = do get $ sparreq_ . path (cs $ "/sso/initiate-login/" -/ SAML.idPIdToST idpid) -callAuthnReqPrecheck' :: MonadHttp m => SparReq -> SAML.IdPId -> m ResponseLBS +callAuthnReqPrecheck' :: (MonadHttp m) => SparReq -> SAML.IdPId -> m ResponseLBS callAuthnReqPrecheck' sparreq_ idpid = do head $ sparreq_ . path (cs $ "/sso/initiate-login/" -/ SAML.idPIdToST idpid) callIdpGet :: (MonadIO m, MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m IdP callIdpGet sparreq_ muid idpid = do resp <- callIdpGet' (sparreq_ . expect2xx) muid idpid - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp -callIdpGet' :: MonadHttp m => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS +callIdpGet' :: (MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS callIdpGet' sparreq_ muid idpid = do get $ sparreq_ . maybe id zUser muid . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid) @@ -1055,25 +1067,25 @@ callIdpGetRaw sparreq_ muid idpid = do resp <- callIdpGetRaw' (sparreq_ . expect2xx) muid idpid maybe (liftIO . throwIO $ ErrorCall "Nothing") (pure . cs) (responseBody resp) -callIdpGetRaw' :: MonadHttp m => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS +callIdpGetRaw' :: (MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS callIdpGetRaw' sparreq_ muid idpid = do get $ sparreq_ . maybe id zUser muid . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid -/ "raw") callIdpGetAll :: (MonadIO m, MonadHttp m) => SparReq -> Maybe UserId -> m IdPList callIdpGetAll sparreq_ muid = do resp <- callIdpGetAll' (sparreq_ . expect2xx) muid - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither resp -callIdpGetAll' :: MonadHttp m => SparReq -> Maybe UserId -> m ResponseLBS +callIdpGetAll' :: (MonadHttp m) => SparReq -> Maybe UserId -> m ResponseLBS callIdpGetAll' sparreq_ muid = do get $ sparreq_ . maybe id zUser muid . path "/identity-providers" callIdpCreate :: (MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> SAML.IdPMetadata -> m IdP callIdpCreate apiversion sparreq_ muid metadata = do resp <- callIdpCreate' apiversion (sparreq_ . expect2xx) muid metadata - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp callIdpCreate' :: (MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> SAML.IdPMetadata -> m ResponseLBS callIdpCreate' apiversion sparreq_ muid metadata = do @@ -1081,37 +1093,37 @@ callIdpCreate' apiversion sparreq_ muid metadata = do -- `&api_version=v1` is implicit and can be omitted from the query, but we want to test -- both, and not spend extra time on it. liftIO $ randomRIO (True, False) - post $ - sparreq_ - . maybe id zUser muid - . path "/identity-providers/" - . ( case apiversion of - WireIdPAPIV1 -> Bilge.query [("api_version", Just "v1") | explicitQueryParam] - WireIdPAPIV2 -> Bilge.query [("api_version", Just "v2")] - ) - . body (RequestBodyLBS . LT.encodeUtf8 $ SAML.encode metadata) - . header "Content-Type" "application/xml" + post + $ sparreq_ + . maybe id zUser muid + . path "/identity-providers/" + . ( case apiversion of + WireIdPAPIV1 -> Bilge.query [("api_version", Just "v1") | explicitQueryParam] + WireIdPAPIV2 -> Bilge.query [("api_version", Just "v2")] + ) + . body (RequestBodyLBS . LT.encodeUtf8 $ SAML.encode metadata) + . header "Content-Type" "application/xml" callIdpCreateRaw :: (MonadIO m, MonadHttp m) => SparReq -> Maybe UserId -> ByteString -> LByteString -> m IdP callIdpCreateRaw sparreq_ muid ctyp metadata = do resp <- callIdpCreateRaw' (sparreq_ . expect2xx) muid ctyp metadata - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp -callIdpCreateRaw' :: MonadHttp m => SparReq -> Maybe UserId -> ByteString -> LByteString -> m ResponseLBS +callIdpCreateRaw' :: (MonadHttp m) => SparReq -> Maybe UserId -> ByteString -> LByteString -> m ResponseLBS callIdpCreateRaw' sparreq_ muid ctyp metadata = do - post $ - sparreq_ - . maybe id zUser muid - . path "/identity-providers/" - . body (RequestBodyLBS metadata) - . header "Content-Type" ctyp + post + $ sparreq_ + . maybe id zUser muid + . path "/identity-providers/" + . body (RequestBodyLBS metadata) + . header "Content-Type" ctyp callIdpCreateWithHandle :: (MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> SAML.IdPMetadata -> IdPHandle -> m IdP callIdpCreateWithHandle apiversion sparreq_ muid metadata idpHandle = do resp <- callIdpCreateWithHandle' apiversion (sparreq_ . expect2xx) muid metadata idpHandle - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp callIdpCreateWithHandle' :: (HasCallStack, MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> IdPMetadata -> IdPHandle -> m ResponseLBS callIdpCreateWithHandle' apiversion sparreq_ muid metadata idpHandle = do @@ -1123,22 +1135,22 @@ callIdpCreateWithHandle' apiversion sparreq_ muid metadata idpHandle = do case apiversion of WireIdPAPIV1 -> if explicitQueryParam then Just "v1" else Nothing WireIdPAPIV2 -> Just "v2" - post $ - sparreq_ - . maybe id zUser muid - . path "/identity-providers/" - . Bilge.query - [ ("api_version", versionParam), - ("handle", Just . cs . unIdPHandle $ idpHandle) - ] - . body (RequestBodyLBS . cs $ SAML.encode metadata) - . header "Content-Type" "application/xml" + post + $ sparreq_ + . maybe id zUser muid + . path "/identity-providers/" + . Bilge.query + [ ("api_version", versionParam), + ("handle", Just . cs . unIdPHandle $ idpHandle) + ] + . body (RequestBodyLBS . cs $ SAML.encode metadata) + . header "Content-Type" "application/xml" callIdpCreateReplace :: (MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> IdPMetadata -> IdPId -> m IdP callIdpCreateReplace apiversion sparreq_ muid metadata idpid = do resp <- callIdpCreateReplace' apiversion (sparreq_ . expect2xx) muid metadata idpid - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp callIdpCreateReplace' :: (HasCallStack, MonadIO m, MonadHttp m) => WireIdPAPIVersion -> SparReq -> Maybe UserId -> IdPMetadata -> IdPId -> m ResponseLBS callIdpCreateReplace' apiversion sparreq_ muid metadata idpid = do @@ -1146,97 +1158,99 @@ callIdpCreateReplace' apiversion sparreq_ muid metadata idpid = do -- `&api_version=v1` is implicit and can be omitted from the query, but we want to test -- both, and not spend extra time on it. liftIO $ randomRIO (True, False) - post $ - sparreq_ - . maybe id zUser muid - . path "/identity-providers/" - . Bilge.query - [ ( "api_version", - case apiversion of - WireIdPAPIV1 -> if explicitQueryParam then Just "v1" else Nothing - WireIdPAPIV2 -> Just "v2" - ), - ( "replaces", - Just . cs . idPIdToST $ idpid - ) - ] - . body (RequestBodyLBS . cs $ SAML.encode metadata) - . header "Content-Type" "application/xml" + post + $ sparreq_ + . maybe id zUser muid + . path "/identity-providers/" + . Bilge.query + [ ( "api_version", + case apiversion of + WireIdPAPIV1 -> if explicitQueryParam then Just "v1" else Nothing + WireIdPAPIV2 -> Just "v2" + ), + ( "replaces", + Just . cs . idPIdToST $ idpid + ) + ] + . body (RequestBodyLBS . cs $ SAML.encode metadata) + . header "Content-Type" "application/xml" callIdpUpdate' :: (Monad m, MonadIO m, MonadHttp m) => SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> m IdP callIdpUpdate' sparreq_ muid idpid metainfo = do resp <- callIdpUpdate (sparreq_ . expect2xx) muid idpid metainfo - either (liftIO . throwIO . ErrorCall . show) pure $ - responseJsonEither @IdP resp + either (liftIO . throwIO . ErrorCall . show) pure + $ responseJsonEither @IdP resp -callIdpUpdate :: MonadHttp m => SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> m ResponseLBS +callIdpUpdate :: (MonadHttp m) => SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> m ResponseLBS callIdpUpdate sparreq_ muid idpid (IdPMetadataValue metadata _) = do - put $ - sparreq_ - . maybe id zUser muid - . paths ["identity-providers", toByteString' $ idPIdToST idpid] - . body (RequestBodyLBS $ cs metadata) - . header "Content-Type" "application/xml" - -callIdpUpdateWithHandle :: MonadHttp m => SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> IdPHandle -> m ResponseLBS + put + $ sparreq_ + . maybe id zUser muid + . paths ["identity-providers", toByteString' $ idPIdToST idpid] + . body (RequestBodyLBS $ cs metadata) + . header "Content-Type" "application/xml" + +callIdpUpdateWithHandle :: (MonadHttp m) => SparReq -> Maybe UserId -> IdPId -> IdPMetadataInfo -> IdPHandle -> m ResponseLBS callIdpUpdateWithHandle sparreq_ muid idpid (IdPMetadataValue metadata _) idpHandle = do - put $ - sparreq_ - . maybe id zUser muid - . paths ["identity-providers", toByteString' $ idPIdToST idpid] - . Bilge.query [("handle", Just . cs . unIdPHandle $ idpHandle)] - . body (RequestBodyLBS $ cs metadata) - . header "Content-Type" "application/xml" + put + $ sparreq_ + . maybe id zUser muid + . paths ["identity-providers", toByteString' $ idPIdToST idpid] + . Bilge.query [("handle", Just . cs . unIdPHandle $ idpHandle)] + . body (RequestBodyLBS $ cs metadata) + . header "Content-Type" "application/xml" callIdpDelete :: (Functor m, MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m () callIdpDelete sparreq_ muid idpid = void $ callIdpDelete' (sparreq_ . expect2xx) muid idpid -callIdpDelete' :: MonadHttp m => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS +callIdpDelete' :: (MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS callIdpDelete' sparreq_ muid idpid = do - delete $ - sparreq_ - . maybe id zUser muid - . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid) + delete + $ sparreq_ + . maybe id zUser muid + . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid) -callIdpDeletePurge' :: MonadHttp m => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS +callIdpDeletePurge' :: (MonadHttp m) => SparReq -> Maybe UserId -> SAML.IdPId -> m ResponseLBS callIdpDeletePurge' sparreq_ muid idpid = do - delete $ - sparreq_ - . maybe id zUser muid - . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid) - . queryItem "purge" "true" + delete + $ sparreq_ + . maybe id zUser muid + . path (cs $ "/identity-providers/" -/ SAML.idPIdToST idpid) + . queryItem "purge" "true" -callGetDefaultSsoCode :: MonadHttp m => SparReq -> m ResponseLBS +callGetDefaultSsoCode :: (MonadHttp m) => SparReq -> m ResponseLBS callGetDefaultSsoCode sparreq_ = do - get $ - sparreq_ - . path "/sso/settings/" + get + $ sparreq_ + . path "/sso/settings/" -callSetDefaultSsoCode :: MonadHttp m => SparReq -> SAML.IdPId -> m ResponseLBS +callSetDefaultSsoCode :: (MonadHttp m) => SparReq -> SAML.IdPId -> m ResponseLBS callSetDefaultSsoCode sparreq_ ssoCode = do let settings = - RequestBodyLBS . Aeson.encode $ - object + RequestBodyLBS + . Aeson.encode + $ object [ "default_sso_code" .= (SAML.fromIdPId ssoCode :: UUID) ] - put $ - sparreq_ - . path "/i/sso/settings/" - . body settings - . header "Content-Type" "application/json" + put + $ sparreq_ + . path "/i/sso/settings/" + . body settings + . header "Content-Type" "application/json" -callDeleteDefaultSsoCode :: MonadHttp m => SparReq -> m ResponseLBS +callDeleteDefaultSsoCode :: (MonadHttp m) => SparReq -> m ResponseLBS callDeleteDefaultSsoCode sparreq_ = do let settings = - RequestBodyLBS . Aeson.encode $ - object + RequestBodyLBS + . Aeson.encode + $ object [ "default_sso_code" .= Aeson.Null ] - put $ - sparreq_ - . path "/i/sso/settings/" - . body settings - . header "Content-Type" "application/json" + put + $ sparreq_ + . path "/i/sso/settings/" + . body settings + . header "Content-Type" "application/json" -- helpers talking to spar's cassandra directly @@ -1244,8 +1258,8 @@ callDeleteDefaultSsoCode sparreq_ = do ssoToUidSpar :: (HasCallStack, MonadIO m, MonadReader TestEnv m) => TeamId -> UserSSOId -> m (Maybe UserId) ssoToUidSpar tid ssoid = do veid <- either (error . ("could not parse brig sso_id: " <>)) pure $ Intra.veidFromUserSSOId ssoid - runSpar $ - runValidExternalIdEither + runSpar + $ runValidExternalIdEither SAMLUserStore.get (ScimExternalIdStore.lookup tid) veid @@ -1274,10 +1288,10 @@ runSparE action = do ctx <- (^. teSparEnv) <$> ask liftIO $ runSparToIO ctx action -getSsoidViaSelf :: HasCallStack => UserId -> TestSpar UserSSOId +getSsoidViaSelf :: (HasCallStack) => UserId -> TestSpar UserSSOId getSsoidViaSelf uid = maybe (error "not found") pure =<< getSsoidViaSelf' uid -getSsoidViaSelf' :: HasCallStack => UserId -> TestSpar (Maybe UserSSOId) +getSsoidViaSelf' :: (HasCallStack) => UserId -> TestSpar (Maybe UserSSOId) getSsoidViaSelf' uid = do musr <- aFewTimes (runSpar $ Intra.getBrigUser Intra.NoPendingInvitations uid) isJust pure $ case userIdentity =<< musr of @@ -1287,21 +1301,21 @@ getSsoidViaSelf' uid = do Just (PhoneIdentity _) -> Nothing Nothing -> Nothing -getUserIdViaRef :: HasCallStack => UserRef -> TestSpar UserId +getUserIdViaRef :: (HasCallStack) => UserRef -> TestSpar UserId getUserIdViaRef uref = maybe (error "not found") pure =<< getUserIdViaRef' uref -getUserIdViaRef' :: HasCallStack => UserRef -> TestSpar (Maybe UserId) +getUserIdViaRef' :: (HasCallStack) => UserRef -> TestSpar (Maybe UserId) getUserIdViaRef' uref = do aFewTimes (runSpar $ SAMLUserStore.get uref) isJust -checkErr :: HasCallStack => Int -> Maybe TestErrorLabel -> Assertions () +checkErr :: (HasCallStack) => Int -> Maybe TestErrorLabel -> Assertions () checkErr status mlabel = do const status === statusCode case mlabel of Nothing -> pure () Just label -> const (Right label) === responseJsonEither -checkErrHspec :: HasCallStack => Int -> TestErrorLabel -> ResponseLBS -> Bool +checkErrHspec :: (HasCallStack) => Int -> TestErrorLabel -> ResponseLBS -> Bool checkErrHspec status label resp = status == statusCode resp && responseJsonEither resp == Right label -- | copied from brig integration tests @@ -1313,7 +1327,7 @@ stdInvitationRequest' :: Maybe User.Locale -> Maybe Role -> User.Email -> TeamIn stdInvitationRequest' loc role email = TeamInvitation.InvitationRequest loc role Nothing email Nothing -setRandomHandleBrig :: HasCallStack => UserId -> TestSpar () +setRandomHandleBrig :: (HasCallStack) => UserId -> TestSpar () setRandomHandleBrig uid = do env <- ask call (changeHandleBrig (env ^. teBrig) uid =<< liftIO randomHandle) @@ -1358,13 +1372,15 @@ updateProfileBrig brig uid uupd = updateTeamMemberRole :: (MonadReader TestEnv m, MonadIO m) => TeamId -> UserId -> UserId -> Role.Role -> m () updateTeamMemberRole tid adminUid targetUid role = do spar <- asks (^. teGalley) - void . call . put $ - spar - . zUser adminUid - . zConn "user" - . paths ["teams", toByteString' tid, "members"] - . json (Member.mkNewTeamMember targetUid (rolePermissions role) Nothing) - . expect2xx + void + . call + . put + $ spar + . zUser adminUid + . zConn "user" + . paths ["teams", toByteString' tid, "members"] + . json (Member.mkNewTeamMember targetUid (rolePermissions role) Nothing) + . expect2xx -- https://wearezeta.atlassian.net/browse/SQSERVICES-1279: change role after successful creation/activation. checkChangeRoleOfTeamMember :: TeamId -> UserId -> UserId -> TestSpar () @@ -1373,10 +1389,10 @@ checkChangeRoleOfTeamMember tid adminId targetId = forM_ [minBound ..] $ \role - [member'] <- filter ((== targetId) . (^. Member.userId)) <$> getTeamMembers adminId tid liftIO $ (member' ^. Member.permissions . to Member.permissionsRole) `shouldBe` Just role -eventually :: HasCallStack => TestSpar a -> TestSpar a +eventually :: (HasCallStack) => TestSpar a -> TestSpar a eventually = recoverAll (limitRetries 3 <> exponentialBackoff 100000) . const -getIdPByIssuer :: HasCallStack => Issuer -> TeamId -> TestSpar (Maybe IdP) +getIdPByIssuer :: (HasCallStack) => Issuer -> TeamId -> TestSpar (Maybe IdP) getIdPByIssuer issuer tid = do idpApiVersion <- view teWireIdPAPIVersion runSpar $ case idpApiVersion of diff --git a/services/spar/test-integration/Util/Email.hs b/services/spar/test-integration/Util/Email.hs index 13c8089284a..cc8dc94907c 100644 --- a/services/spar/test-integration/Util/Email.hs +++ b/services/spar/test-integration/Util/Email.hs @@ -60,21 +60,21 @@ changeEmailBrig brig usr newEmail = do where emailLogin :: Email -> Misc.PlainTextPassword6 -> Maybe Auth.CookieLabel -> Auth.Login emailLogin e pw cl = - Auth.PasswordLogin $ - Auth.PasswordLoginData (Auth.LoginByEmail e) pw cl Nothing + Auth.PasswordLogin + $ Auth.PasswordLoginData (Auth.LoginByEmail e) pw cl Nothing - login :: Auth.Login -> Auth.CookieType -> MonadHttp m => m ResponseLBS + login :: Auth.Login -> Auth.CookieType -> (MonadHttp m) => m ResponseLBS login l t = - post $ - brig - . path "/login" - . (if t == Auth.PersistentCookie then queryItem "persist" "true" else id) - . json l + post + $ brig + . path "/login" + . (if t == Auth.PersistentCookie then queryItem "persist" "true" else id) + . json l - decodeCookie :: HasCallStack => Response a -> Bilge.Cookie + decodeCookie :: (HasCallStack) => Response a -> Bilge.Cookie decodeCookie = fromMaybe (error "missing zuid cookie") . Bilge.getCookie "zuid" - decodeToken :: HasCallStack => Response (Maybe LByteString) -> ZAuth.Token ZAuth.Access + decodeToken :: (HasCallStack) => Response (Maybe LByteString) -> ZAuth.Token ZAuth.Access decodeToken r = fromMaybe (error "invalid access_token") $ do x <- responseBody r t <- x ^? key "access_token" . _String @@ -106,7 +106,7 @@ activateEmail :: (MonadCatch m, MonadIO m, HasCallStack) => BrigReq -> Email -> - MonadHttp m => m () + (MonadHttp m) => m () activateEmail brig email = do act <- getActivationCode brig (Left email) case act of @@ -120,20 +120,21 @@ failActivatingEmail :: (MonadCatch m, MonadIO m, HasCallStack) => BrigReq -> Email -> - MonadHttp m => m () + (MonadHttp m) => m () failActivatingEmail brig email = do act <- getActivationCode brig (Left email) liftIO $ assertEqual "there should be no pending activation" act Nothing checkEmail :: - HasCallStack => + (HasCallStack) => UserId -> Maybe Email -> TestSpar () checkEmail uid expectedEmail = do brig <- view teBrig - call $ - get (brig . path "/self" . zUser uid) !!! do + call + $ get (brig . path "/self" . zUser uid) + !!! do const 200 === statusCode const expectedEmail === (userEmail <=< responseJsonMaybe) @@ -143,11 +144,11 @@ activate :: ActivationPair -> m ResponseLBS activate brig (k, c) = - get $ - brig - . path "activate" - . queryItem "key" (toByteString' k) - . queryItem "code" (toByteString' c) + get + $ brig + . path "activate" + . queryItem "key" (toByteString' k) + . queryItem "code" (toByteString' c) getActivationCode :: (MonadCatch m, MonadHttp m, HasCallStack) => @@ -162,7 +163,7 @@ getActivationCode brig ep = do let acode = ActivationCode . Ascii.unsafeFromText <$> (lbs ^? key "code" . _String) pure $ (,) <$> akey <*> acode -setSamlEmailValidation :: HasCallStack => TeamId -> Feature.FeatureStatus -> TestSpar () +setSamlEmailValidation :: (HasCallStack) => TeamId -> Feature.FeatureStatus -> TestSpar () setSamlEmailValidation tid status = do galley <- view teGalley let req = put $ galley . paths p . json (Feature.WithStatusNoLock @Feature.ValidateSAMLEmailsConfig status Feature.trivialConfig Feature.FeatureTTLUnlimited) diff --git a/services/spar/test-integration/Util/Invitation.hs b/services/spar/test-integration/Util/Invitation.hs index 7bf394177f2..95d3063c2e2 100644 --- a/services/spar/test-integration/Util/Invitation.hs +++ b/services/spar/test-integration/Util/Invitation.hs @@ -37,12 +37,12 @@ import Util import Wire.API.Team.Invitation (Invitation (..)) import Wire.API.User -headInvitation404 :: HasCallStack => BrigReq -> Email -> Http () +headInvitation404 :: (HasCallStack) => BrigReq -> Email -> Http () headInvitation404 brig email = do Bilge.head (brig . path "/teams/invitations/by-email" . contentJson . queryItem "email" (toByteString' email)) !!! const 404 === statusCode -getInvitation :: HasCallStack => BrigReq -> Email -> Http Invitation +getInvitation :: (HasCallStack) => BrigReq -> Email -> Http Invitation getInvitation brig email = responseJsonUnsafe <$> Bilge.get @@ -70,19 +70,19 @@ getInvitationCode brig t ref = do let lbs = fromMaybe "" $ responseBody r pure $ fromByteString (maybe (error "No code?") encodeUtf8 (lbs ^? key "code" . _String)) -registerInvitation :: HasCallStack => Email -> Name -> InvitationCode -> Bool -> TestSpar () +registerInvitation :: (HasCallStack) => Email -> Name -> InvitationCode -> Bool -> TestSpar () registerInvitation email name inviteeCode shouldSucceed = do env <- ask let brig = env ^. teBrig - call $ - void $ - post - ( brig - . path "/register" - . contentJson - . json (acceptWithName name email inviteeCode) - ) - Email -> InvitationCode -> Aeson.Value acceptWithName name email code = diff --git a/services/spar/test-integration/Util/Types.hs b/services/spar/test-integration/Util/Types.hs index 777470f2bb2..d12d0ea5458 100644 --- a/services/spar/test-integration/Util/Types.hs +++ b/services/spar/test-integration/Util/Types.hs @@ -115,9 +115,11 @@ _unitTestTestErrorLabel :: IO () _unitTestTestErrorLabel = do let val :: Either String TestErrorLabel val = Aeson.eitherDecode "{\"code\":404,\"message\":\"Not found.\",\"label\":\"not-found\"}" - unless (val == Right "not-found") $ - throwIO . ErrorCall . show $ - val + unless (val == Right "not-found") + $ throwIO + . ErrorCall + . show + $ val -- | FUTUREWORK(fisx): we're running all tests for all constructors of `WireIdPAPIVersion`, -- which sometimes makes little sense. 'skipIdPAPIVersions' can be used to pend individual diff --git a/services/spar/test/Arbitrary.hs b/services/spar/test/Arbitrary.hs index bac29a685da..bc7cc42d9c2 100644 --- a/services/spar/test/Arbitrary.hs +++ b/services/spar/test/Arbitrary.hs @@ -110,7 +110,7 @@ instance CoArbitrary Time instance CoArbitrary Issuer where coarbitrary (Issuer ur) = coarbitrary $ show ur -instance CoArbitrary a => CoArbitrary (URIRef a) where +instance (CoArbitrary a) => CoArbitrary (URIRef a) where coarbitrary = coarbitrary . show instance CoArbitrary (IdPConfig WireIdP) diff --git a/services/spar/test/Test/Spar/APISpec.hs b/services/spar/test/Test/Spar/APISpec.hs index a82d00c40f6..022853ec2f8 100644 --- a/services/spar/test/Test/Spar/APISpec.hs +++ b/services/spar/test/Test/Spar/APISpec.hs @@ -44,12 +44,12 @@ spec = do let withoutRaw (IdPMetadataValue _ x) = x (withoutRaw <$> (Aeson.eitherDecode . Aeson.encode) val) `shouldBe` Right (withoutRaw val) describe "SsoSettings JSON instance" $ do - it "always has and requires the field default_sso_code" $ - property $ - \(ssoSettings :: SsoSettings) -> do - let object = Aeson.toJSON ssoSettings - let objectWithoutKey = Lens.over Aeson._Object (KeyMap.delete "default_sso_code") $ object - (KeyMap.lookup "default_sso_code" =<< Lens.preview Aeson._Object object) - `shouldSatisfy` isJust - Aeson.parseMaybe (Aeson.parseJSON @SsoSettings) objectWithoutKey - `shouldSatisfy` isNothing + it "always has and requires the field default_sso_code" + $ property + $ \(ssoSettings :: SsoSettings) -> do + let object = Aeson.toJSON ssoSettings + let objectWithoutKey = Lens.over Aeson._Object (KeyMap.delete "default_sso_code") $ object + (KeyMap.lookup "default_sso_code" =<< Lens.preview Aeson._Object object) + `shouldSatisfy` isJust + Aeson.parseMaybe (Aeson.parseJSON @SsoSettings) objectWithoutKey + `shouldSatisfy` isNothing diff --git a/services/spar/test/Test/Spar/DataSpec.hs b/services/spar/test/Test/Spar/DataSpec.hs index 61af59b7c9a..bf7c9b03dcf 100644 --- a/services/spar/test/Test/Spar/DataSpec.hs +++ b/services/spar/test/Test/Spar/DataSpec.hs @@ -37,16 +37,16 @@ spec = do addTime (ttlToNominalDiffTime $ TTL 3) (Time $ parsetm "1924-07-14T08:30:00Z") `shouldBe` Time (parsetm "1924-07-14T08:30:03Z") -check :: HasCallStack => Int -> Env -> String -> Either TTLError (TTL "authresp") -> Spec +check :: (HasCallStack) => Int -> Env -> String -> Either TTLError (TTL "authresp") -> Spec check testnumber env (parsetm -> endOfLife) expectttl = it (show testnumber) $ mkTTLAssertions env endOfLife `shouldBe` expectttl -parsetm :: HasCallStack => String -> UTCTime +parsetm :: (HasCallStack) => String -> UTCTime parsetm = fromJust . parseTimeM True defaultTimeLocale "%Y-%m-%dT%H:%M:%S%QZ" {-# HLINT ignore "Eta reduce" #-} -- For clarity -mkDataEnv :: HasCallStack => String -> TTL "authresp" -> Env +mkDataEnv :: (HasCallStack) => String -> TTL "authresp" -> Env mkDataEnv now maxttl = Env (parsetm now) diff --git a/services/spar/test/Test/Spar/Intra/BrigSpec.hs b/services/spar/test/Test/Spar/Intra/BrigSpec.hs index 769fc29387f..f64e1c17a08 100644 --- a/services/spar/test/Test/Spar/Intra/BrigSpec.hs +++ b/services/spar/test/Test/Spar/Intra/BrigSpec.hs @@ -42,11 +42,11 @@ spec = do it "example" $ do let have = - UrefOnly $ - UserRef + UrefOnly + $ UserRef (Issuer $ mkuri "http://wire.com/") - ( either (error . show) id $ - mkNameID (mkUNameIDTransient "V") (Just "kati") (Just "rolli") (Just "jaan") + ( either (error . show) id + $ mkNameID (mkUNameIDTransient "V") (Just "kati") (Just "rolli") (Just "jaan") ) want = UserSSOId (SAML.UserRef iss nam) iss :: SAML.Issuer = fromRight undefined $ SAML.decodeElem "http://wire.com/" @@ -55,11 +55,11 @@ spec = do veidFromUserSSOId want `shouldBe` Right have it "another example" $ do let have = - UrefOnly $ - UserRef + UrefOnly + $ UserRef (Issuer $ mkuri "http://wire.com/") - ( either (error . show) id $ - mkNameID (mkUNameIDPersistent "PWkS") (Just "hendrik") Nothing (Just "marye") + ( either (error . show) id + $ mkNameID (mkUNameIDPersistent "PWkS") (Just "hendrik") Nothing (Just "marye") ) want = UserSSOId (SAML.UserRef iss nam) iss :: SAML.Issuer = fromRight undefined $ SAML.decodeElem "http://wire.com/" @@ -68,5 +68,6 @@ spec = do veidToUserSSOId have `shouldBe` want veidFromUserSSOId want `shouldBe` Right have - it "roundtrips" . property $ - \(x :: ValidExternalId) -> (veidFromUserSSOId @(Either String) . veidToUserSSOId) x === Right x + it "roundtrips" + . property + $ \(x :: ValidExternalId) -> (veidFromUserSSOId @(Either String) . veidToUserSSOId) x === Right x diff --git a/services/spar/test/Test/Spar/Roundtrip/ByteString.hs b/services/spar/test/Test/Spar/Roundtrip/ByteString.hs index e26d1b1faae..d492921b227 100644 --- a/services/spar/test/Test/Spar/Roundtrip/ByteString.hs +++ b/services/spar/test/Test/Spar/Roundtrip/ByteString.hs @@ -32,5 +32,6 @@ testRoundTrip = it msg $ property trip where msg = show (typeRep @a) trip (v :: a) = - counterexample (show $ toByteString' v) $ - Just v === (fromByteString . toByteString') v + counterexample (show $ toByteString' v) + $ Just v + === (fromByteString . toByteString') v diff --git a/services/spar/test/Test/Spar/Scim/UserSpec.hs b/services/spar/test/Test/Spar/Scim/UserSpec.hs index 16dc0636a12..17f4323d7db 100644 --- a/services/spar/test/Test/Spar/Scim/UserSpec.hs +++ b/services/spar/test/Test/Spar/Scim/UserSpec.hs @@ -64,16 +64,17 @@ spec = describe "deleteScimUser" $ do deleteUserAndAssertDeletionInSpar :: forall (r :: EffectRow). - Members - '[ Logger (Msg -> Msg), - BrigAccess, - ScimExternalIdStore.ScimExternalIdStore, - ScimUserTimesStore, - SAMLUserStore, - IdPConfigStore, - Embed IO - ] - r => + ( Members + '[ Logger (Msg -> Msg), + BrigAccess, + ScimExternalIdStore.ScimExternalIdStore, + ScimUserTimesStore, + SAMLUserStore, + IdPConfigStore, + Embed IO + ] + r + ) => UserAccount -> ScimTokenInfo -> Sem r (Either ScimError ()) @@ -113,12 +114,12 @@ interpretWithBrigAccessMock mock = . ignoringState idPToMem . mock -ignoringState :: Functor f => (a -> f (c, b)) -> a -> f b +ignoringState :: (Functor f) => (a -> f (c, b)) -> a -> f b ignoringState f = fmap snd . f mockBrig :: forall (r :: EffectRow) a. - Member (Embed IO) r => + (Member (Embed IO) r) => (UserId -> Maybe UserAccount) -> DeleteUserResult -> Sem (BrigAccess ': r) a -> @@ -139,8 +140,8 @@ withActiveUser acc uid = someActiveUser :: ScimTokenInfo -> IO UserAccount someActiveUser tokenInfo = do user <- generate arbitrary - pure $ - UserAccount + pure + $ UserAccount { accountStatus = Active, accountUser = user diff --git a/services/spar/test/Test/Spar/ScimSpec.hs b/services/spar/test/Test/Spar/ScimSpec.hs index 936e2f4f99c..2636609b719 100644 --- a/services/spar/test/Test/Spar/ScimSpec.hs +++ b/services/spar/test/Test/Spar/ScimSpec.hs @@ -105,14 +105,15 @@ spec = describe "toScimStoredUser'" $ do Scim.lastModified = fromUTCTimeMillis now, Scim.version = Scim.Weak "ee3ebd2f5722d0b95e20ded809a81321b3810543457ca6ca459d822294c12c71", Scim.location = - Scim.URI . fromJust $ - Network.URI.parseURI + Scim.URI + . fromJust + $ Network.URI.parseURI "https://127.0.0.1/scim/v2/Users/90b5ee1c-088e-11e9-9a16-73f80f483813" } SAML.Time (toUTCTimeMillis -> now) = SAML.unsafeReadTime "1918-04-14T09:58:58.457Z" baseuri :: URI = - either (error . show) id $ - URI.ByteString.parseURI laxURIParserOptions "https://127.0.0.1/scim/v2/" + either (error . show) id + $ URI.ByteString.parseURI laxURIParserOptions "https://127.0.0.1/scim/v2/" uid = Id . fromJust . UUID.fromText $ "90b5ee1c-088e-11e9-9a16-73f80f483813" result :: ScimC.StoredUser SparTag result = toScimStoredUser' now now baseuri uid usr @@ -266,6 +267,7 @@ spec = describe "toScimStoredUser'" $ do f (normalizeLikeStored usr) `shouldBe` f usr normalizeLikeStored usr `shouldBe` usr - it "keeps (already normalized) user record intact (property)" . property $ - \(usr' :: Scim.User SparTag) -> counterexample (show usr') $ do + it "keeps (already normalized) user record intact (property)" + . property + $ \(usr' :: Scim.User SparTag) -> counterexample (show usr') $ do normalizeLikeStored usr' `shouldBe` usr' diff --git a/tools/db/assets/src/Assets/Lib.hs b/tools/db/assets/src/Assets/Lib.hs index 036b31ae6b8..1659c032995 100644 --- a/tools/db/assets/src/Assets/Lib.hs +++ b/tools/db/assets/src/Assets/Lib.hs @@ -61,7 +61,8 @@ sampleParser = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long "cassandra-keyspace" <> short 'k' @@ -98,16 +99,16 @@ selectUsersAll = "SELECT id, assets FROM user" readUsers :: ClientState -> ConduitM () [UserRow] IO () readUsers client = - transPipe (runClient client) $ - paginateC selectUsersAll (paramsP LocalQuorum () 500) x5 + transPipe (runClient client) + $ paginateC selectUsersAll (paramsP LocalQuorum () 500) x5 process :: ClientState -> IO Result process client = - runConduit $ - readUsers client - .| Conduit.mapM (\chunk -> hPutStr stderr "." $> chunk) - .| Conduit.concat - .| Conduit.foldMap checkAssets + runConduit + $ readUsers client + .| Conduit.mapM (\chunk -> hPutStr stderr "." $> chunk) + .| Conduit.concat + .| Conduit.foldMap checkAssets where isInvalid :: AssetText -> Bool isInvalid asset = isLeft $ runParser (parser :: Atto.Parser AssetKey) $ T.encodeUtf8 (txtAssetKey asset) @@ -151,7 +152,7 @@ instance Cql AssetText where 0 -> pure $! ImageAssetText k _ -> Left $ "unexpected user asset type: " ++ show t where - required :: Cql r => Text -> Either String r + required :: (Cql r) => Text -> Either String r required f = maybe (Left ("Asset: Missing required field '" ++ show f ++ "'")) diff --git a/tools/db/auto-whitelist/src/Options.hs b/tools/db/auto-whitelist/src/Options.hs index a429263d785..40fef1c7556 100644 --- a/tools/db/auto-whitelist/src/Options.hs +++ b/tools/db/auto-whitelist/src/Options.hs @@ -72,7 +72,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/auto-whitelist/src/Work.hs b/tools/db/auto-whitelist/src/Work.hs index b3976b6447b..ffbba2c38b7 100644 --- a/tools/db/auto-whitelist/src/Work.hs +++ b/tools/db/auto-whitelist/src/Work.hs @@ -61,11 +61,11 @@ doesServiceExist (pid, sid, _) = -- | Add the service to the whitelist whitelistService :: Logger -> (ProviderId, ServiceId, TeamId) -> Client () whitelistService l (pid, sid, tid) = do - Log.info l $ - Log.msg (Log.val "Whitelisting") - . Log.field "provider" (show pid) - . Log.field "service" (show sid) - . Log.field "team" (show tid) + Log.info l + $ Log.msg (Log.val "Whitelisting") + . Log.field "provider" (show pid) + . Log.field "service" (show sid) + . Log.field "team" (show tid) retry x5 . batch $ do setConsistency LocalQuorum setType BatchLogged diff --git a/tools/db/find-undead/src/Options.hs b/tools/db/find-undead/src/Options.hs index ea27268afc2..c6d9459148a 100644 --- a/tools/db/find-undead/src/Options.hs +++ b/tools/db/find-undead/src/Options.hs @@ -69,7 +69,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . Text.pack + <*> ( C.Keyspace + . Text.pack <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/find-undead/src/Work.hs b/tools/db/find-undead/src/Work.hs index 4803e7dfb24..f7d046c09ea 100644 --- a/tools/db/find-undead/src/Work.hs +++ b/tools/db/find-undead/src/Work.hs @@ -41,21 +41,21 @@ runCommand :: Logger -> ClientState -> ES.BHEnv -> String -> String -> IO () runCommand l cas es indexStr mappingStr = do let index = ES.IndexName $ Text.pack indexStr mapping = ES.MappingName $ Text.pack mappingStr - runConduit $ - transPipe (ES.runBH es) $ - getScrolled index mapping - .| C.iterM (logProgress l) - .| C.mapM - ( \uuids -> do - fromCas <- runClient cas $ usersInCassandra uuids - pure (uuids, fromCas) - ) - .| C.mapM_ (logDifference l) + runConduit + $ transPipe (ES.runBH es) + $ getScrolled index mapping + .| C.iterM (logProgress l) + .| C.mapM + ( \uuids -> do + fromCas <- runClient cas $ usersInCassandra uuids + pure (uuids, fromCas) + ) + .| C.mapM_ (logDifference l) ---------------------------------------------------------------------------- -- Queries -logProgress :: MonadIO m => Logger -> [UUID] -> m () +logProgress :: (MonadIO m) => Logger -> [UUID] -> m () logProgress l uuids = Log.info l $ Log.field "Progress" (show $ length uuids) logDifference :: Logger -> ([UUID], [(UUID, Maybe AccountStatus, Maybe (Writetime ()))]) -> ES.BH IO () @@ -67,12 +67,12 @@ logDifference l (uuidsFromES, fromCas) = do mapM_ (logUUID l "Deleted") deletedUuidsFromCas mapM_ (logUUID l "Extra" . (,Nothing,Nothing)) extraUuids -logUUID :: MonadIO m => Logger -> ByteString -> (UUID, Maybe AccountStatus, Maybe (Writetime ())) -> m () +logUUID :: (MonadIO m) => Logger -> ByteString -> (UUID, Maybe AccountStatus, Maybe (Writetime ())) -> m () logUUID l f (uuid, _, time) = - Log.info l $ - Log.msg f - . Log.field "uuid" (show uuid) - . Log.field "write time" (show $ writetimeToUTC <$> time) + Log.info l + $ Log.msg f + . Log.field "uuid" (show uuid) + . Log.field "write time" (show $ writetimeToUTC <$> time) getScrolled :: (ES.MonadBH m, MonadThrow m) => ES.IndexName -> ES.MappingName -> ConduitM () [UUID] m () getScrolled index mapping = processRes =<< lift (ES.getInitialScroll index mapping esSearch) @@ -101,7 +101,7 @@ esSearch = (ES.mkSearch Nothing (Just esFilter)) {ES.size = ES.Size chunkSize} extractHits :: ES.SearchResult User -> [User] extractHits = mapMaybe ES.hitSource . ES.hits . ES.searchHits -extractScrollId :: MonadThrow m => ES.SearchResult a -> m ES.ScrollId +extractScrollId :: (MonadThrow m) => ES.SearchResult a -> m ES.ScrollId extractScrollId res = maybe (throwM NoScrollId) pure (ES.scrollId res) usersInCassandra :: [UUID] -> Client [(UUID, Maybe AccountStatus, Maybe (Writetime ()))] diff --git a/tools/db/inconsistencies/src/DanglingHandles.hs b/tools/db/inconsistencies/src/DanglingHandles.hs index c6c7571169d..92782b90c62 100644 --- a/tools/db/inconsistencies/src/DanglingHandles.hs +++ b/tools/db/inconsistencies/src/DanglingHandles.hs @@ -40,36 +40,36 @@ import Wire.API.User qualified as WU runCommand :: Logger -> ClientState -> FilePath -> IO () runCommand l brig inconsistenciesFile = do - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (transPipe (runClient brig) getHandles) - .| C.mapM - ( \(i, userHandles) -> do - Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userHandles)))) - pure userHandles - ) - .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (\(handle, userId, claimTime) -> checkUser l brig handle userId claimTime False)) - .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) - .| sinkFile inconsistenciesFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (transPipe (runClient brig) getHandles) + .| C.mapM + ( \(i, userHandles) -> do + Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userHandles)))) + pure userHandles + ) + .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (\(handle, userId, claimTime) -> checkUser l brig handle userId claimTime False)) + .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) + .| sinkFile inconsistenciesFile examineHandles :: Logger -> ClientState -> FilePath -> FilePath -> Bool -> IO () examineHandles l brig handlesFile errorsFile fixClaim = do handles <- mapMaybe parseHandle . Text.lines <$> Text.readFile handlesFile - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (C.sourceList handles) - .| C.mapM - ( \(i, handle) -> do - when (i `mod` 100 == 0) $ - Log.info l (Log.field "handlesProcesses" i) - liftIO $ checkHandle l brig handle fixClaim - ) - .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) - .| sinkFile errorsFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (C.sourceList handles) + .| C.mapM + ( \(i, handle) -> do + when (i `mod` 100 == 0) + $ Log.info l (Log.field "handlesProcesses" i) + liftIO $ checkHandle l brig handle fixClaim + ) + .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) + .| sinkFile errorsFile pageSize :: Int32 pageSize = 1000 @@ -93,7 +93,7 @@ data WithWritetime a = WithWritetime } deriving (Generic) -instance Aeson.ToJSON a => Aeson.ToJSON (WithWritetime a) +instance (Aeson.ToJSON a) => Aeson.ToJSON (WithWritetime a) ---------------------------------------------------------------------------- -- Queries @@ -143,9 +143,9 @@ checkUser l brig claimedHandle userId handleClaimTime' fixClaim = do Nothing -> do let status = Nothing userHandle = Nothing - when fixClaim $ - runClient brig $ - freeHandle l claimedHandle + when fixClaim + $ runClient brig + $ freeHandle l claimedHandle pure . Just $ HandleInfo {..} Just (mStatus, mStatusWriteTime, mHandle, mHandleWriteTime) -> do let status = WithWritetime <$> mStatus <*> mStatusWriteTime @@ -157,8 +157,8 @@ checkUser l brig claimedHandle userId handleClaimTime' fixClaim = do handleError = mHandle /= Just claimedHandle if statusError || handleError then do - when fixClaim $ - runClient brig $ - freeHandle l claimedHandle + when fixClaim + $ runClient brig + $ freeHandle l claimedHandle pure . Just $ HandleInfo {..} else pure Nothing diff --git a/tools/db/inconsistencies/src/DanglingUserKeys.hs b/tools/db/inconsistencies/src/DanglingUserKeys.hs index 59f914fc686..b646434fc63 100644 --- a/tools/db/inconsistencies/src/DanglingUserKeys.hs +++ b/tools/db/inconsistencies/src/DanglingUserKeys.hs @@ -43,36 +43,36 @@ import Wire.API.User hiding (userEmail, userPhone) runCommand :: Logger -> ClientState -> FilePath -> IO () runCommand l brig inconsistenciesFile = do - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (transPipe (runClient brig) getKeys) - .| C.mapM - ( \(i, userKeys) -> do - Log.info l (Log.field "keys" (show ((i - 1) * pageSize + fromIntegral (length userKeys)))) - pure userKeys - ) - .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (\(key, uid, claimTime) -> checkUser l brig key uid claimTime False)) - .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) - .| sinkFile inconsistenciesFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (transPipe (runClient brig) getKeys) + .| C.mapM + ( \(i, userKeys) -> do + Log.info l (Log.field "keys" (show ((i - 1) * pageSize + fromIntegral (length userKeys)))) + pure userKeys + ) + .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (\(key, uid, claimTime) -> checkUser l brig key uid claimTime False)) + .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) + .| sinkFile inconsistenciesFile runRepair :: Logger -> ClientState -> FilePath -> FilePath -> Bool -> IO () runRepair l brig inputFile outputFile repairData = do keys <- mapMaybe parseKey . Text.lines <$> Text.readFile inputFile - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (C.sourceList keys) - .| C.mapM - ( \(i, key) -> do - when (i `mod` 100 == 0) $ - Log.info l (Log.field "keysProcesses" i) - liftIO $ checkKey l brig key repairData - ) - .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) - .| sinkFile outputFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (C.sourceList keys) + .| C.mapM + ( \(i, key) -> do + when (i `mod` 100 == 0) + $ Log.info l (Log.field "keysProcesses" i) + liftIO $ checkKey l brig key repairData + ) + .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) + .| sinkFile outputFile pageSize :: Int32 pageSize = 1000 @@ -97,7 +97,7 @@ data WithWritetime a = WithWritetime } deriving (Generic) -instance Aeson.ToJSON a => Aeson.ToJSON (WithWritetime a) +instance (Aeson.ToJSON a) => Aeson.ToJSON (WithWritetime a) ---------------------------------------------------------------------------- -- Queries @@ -183,9 +183,9 @@ checkUser l brig key uid time repairData = do userEmail = Nothing userPhone = Nothing inconsistencyCase = "2." - when repairData $ -- case 2. - runClient brig $ - freeUserKey l key + when repairData + $ runClient brig -- case 2. + $ freeUserKey l key pure . Just $ Inconsistency {userId = uid, ..} Just (mStatus, mStatusWriteTime, mEmail, mEmailWriteTime, mPhone, mPhoneWriteTime) -> do let status = WithWritetime <$> mStatus <*> mStatusWriteTime @@ -220,9 +220,9 @@ checkUser l brig key uid time repairData = do -- there is a valid matching user_key entry for a user in the user table; just *also* an extra entry that can be cleaned up (case 3.a.) Log.warn l (Log.msg (Log.val "Subcase 3a: entry can be repaired by removing entry") . Log.field "key" (keyText key)) let inconsistencyCase = "3.a." - when repairData $ - runClient brig $ - freeUserKey l key + when repairData + $ runClient brig + $ freeUserKey l key pure . Just $ Inconsistency {userId = uid, ..} else do let inconsistencyCase = "3.b." diff --git a/tools/db/inconsistencies/src/EmailLessUsers.hs b/tools/db/inconsistencies/src/EmailLessUsers.hs index 7aa277d7167..7d866a44e9f 100644 --- a/tools/db/inconsistencies/src/EmailLessUsers.hs +++ b/tools/db/inconsistencies/src/EmailLessUsers.hs @@ -43,36 +43,36 @@ import Wire.API.User hiding (userEmail) runCommand :: Logger -> ClientState -> FilePath -> IO () runCommand l brig inconsistenciesFile = do - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (transPipe (runClient brig) getUsers) - .| C.mapM - ( \(i, userDetails) -> do - Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userDetails)))) - pure $ mapMaybe userWithEmailAndStatus userDetails - ) - .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (checkUser l brig False)) - .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) - .| sinkFile inconsistenciesFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (transPipe (runClient brig) getUsers) + .| C.mapM + ( \(i, userDetails) -> do + Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userDetails)))) + pure $ mapMaybe userWithEmailAndStatus userDetails + ) + .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (checkUser l brig False)) + .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) + .| sinkFile inconsistenciesFile runRepair :: Logger -> ClientState -> FilePath -> FilePath -> Bool -> IO () runRepair l brig inputFile outputFile repairData = do inputLines :: [UserId] <- mapMaybe (eitherToMaybe . parseIdFromText) . Text.lines <$> Text.readFile inputFile - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (C.sourceList inputLines) - .| C.mapM - ( \(i, uid) -> do - when (i `mod` 100 == 0) $ - Log.info l (Log.field "linesProcessed" i) - liftIO $ repairUser l brig repairData uid - ) - .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) - .| sinkFile outputFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (C.sourceList inputLines) + .| C.mapM + ( \(i, uid) -> do + when (i `mod` 100 == 0) + $ Log.info l (Log.field "linesProcessed" i) + liftIO $ repairUser l brig repairData uid + ) + .| C.map ((<> "\n") . BS.toStrict . Aeson.encode) + .| sinkFile outputFile pageSize :: Int32 pageSize = 1000 @@ -96,7 +96,7 @@ data WithWritetime a = WithWritetime } deriving (Generic) -instance Aeson.ToJSON a => Aeson.ToJSON (WithWritetime a) +instance (Aeson.ToJSON a) => Aeson.ToJSON (WithWritetime a) ---------------------------------------------------------------------------- -- Queries diff --git a/tools/db/inconsistencies/src/HandleLessUsers.hs b/tools/db/inconsistencies/src/HandleLessUsers.hs index cec0d5f6948..455867d052f 100644 --- a/tools/db/inconsistencies/src/HandleLessUsers.hs +++ b/tools/db/inconsistencies/src/HandleLessUsers.hs @@ -38,19 +38,19 @@ import Wire.API.User (AccountStatus (..)) runCommand :: Logger -> ClientState -> FilePath -> IO () runCommand l brig inconsistenciesFile = do - runResourceT $ - runConduit $ - zipSources - (C.sourceList [(1 :: Int32) ..]) - (transPipe (runClient brig) getUsers) - .| C.mapM - ( \(i, userDetails) -> do - Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userDetails)))) - pure $ mapMaybe userWithHandleAndStatus userDetails - ) - .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (checkUser brig)) - .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) - .| sinkFile inconsistenciesFile + runResourceT + $ runConduit + $ zipSources + (C.sourceList [(1 :: Int32) ..]) + (transPipe (runClient brig) getUsers) + .| C.mapM + ( \(i, userDetails) -> do + Log.info l (Log.field "userIds" (show ((i - 1) * pageSize + fromIntegral (length userDetails)))) + pure $ mapMaybe userWithHandleAndStatus userDetails + ) + .| C.mapM (liftIO . pooledMapConcurrentlyN 48 (checkUser brig)) + .| C.map ((<> "\n") . BS.intercalate "\n" . map (BS.toStrict . Aeson.encode) . catMaybes) + .| sinkFile inconsistenciesFile pageSize :: Int32 pageSize = 1000 @@ -72,7 +72,7 @@ data WithWritetime a = WithWritetime } deriving (Generic) -instance Aeson.ToJSON a => Aeson.ToJSON (WithWritetime a) +instance (Aeson.ToJSON a) => Aeson.ToJSON (WithWritetime a) ---------------------------------------------------------------------------- -- Queries diff --git a/tools/db/inconsistencies/src/Options.hs b/tools/db/inconsistencies/src/Options.hs index 95f7e27e95f..ad501d217c7 100644 --- a/tools/db/inconsistencies/src/Options.hs +++ b/tools/db/inconsistencies/src/Options.hs @@ -49,8 +49,11 @@ optionsParser = (,) <$> commandParser <*> settingsParser commandParser :: Parser Command commandParser = - subparser $ - danglingHandlesCommand <> handleLessUsersCommand <> danglingKeysCommand <> missingEmailsCommand + subparser + $ danglingHandlesCommand + <> handleLessUsersCommand + <> danglingKeysCommand + <> missingEmailsCommand danglingHandlesCommand :: Mod CommandFields Command danglingHandlesCommand = command "dangling-handles" (info (DanglingHandles <$> optional (inputFileRepairParser "handles")) (progDesc "find handle which shouldn't be claimed")) @@ -124,7 +127,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . Text.pack + <*> ( C.Keyspace + . Text.pack <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/migrate-sso-feature-flag/src/Options.hs b/tools/db/migrate-sso-feature-flag/src/Options.hs index 94ef377e5d6..408b4b95589 100644 --- a/tools/db/migrate-sso-feature-flag/src/Options.hs +++ b/tools/db/migrate-sso-feature-flag/src/Options.hs @@ -75,7 +75,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/migrate-sso-feature-flag/src/Work.hs b/tools/db/migrate-sso-feature-flag/src/Work.hs index 36f5d5aba9b..1619f9d2d41 100644 --- a/tools/db/migrate-sso-feature-flag/src/Work.hs +++ b/tools/db/migrate-sso-feature-flag/src/Work.hs @@ -36,16 +36,16 @@ import Wire.API.Team.Feature runCommand :: Logger -> ClientState -> ClientState -> IO () runCommand l spar galley = do - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) (transPipe (runClient spar) getSsoTeams) - .| C.mapM - ( \(i, tids) -> do - Log.info l (Log.field "number of idps processed: " (show (i * pageSize))) - pure (runIdentity <$> tids) - ) - .| C.mapM_ (\tids -> runClient galley (writeSsoFlags tids)) + .| C.mapM + ( \(i, tids) -> do + Log.info l (Log.field "number of idps processed: " (show (i * pageSize))) + pure (runIdentity <$> tids) + ) + .| C.mapM_ (\tids -> runClient galley (writeSsoFlags tids)) pageSize :: Int32 pageSize = 1000 @@ -59,7 +59,7 @@ getSsoTeams = paginateC cql (paramsP LocalQuorum () pageSize) x5 writeSsoFlags :: [TeamId] -> Client () writeSsoFlags = mapM_ (`setSSOTeamConfig` FeatureStatusEnabled) where - setSSOTeamConfig :: MonadClient m => TeamId -> FeatureStatus -> m () + setSSOTeamConfig :: (MonadClient m) => TeamId -> FeatureStatus -> m () setSSOTeamConfig tid ssoTeamConfigStatus = do retry x5 $ write updateSSOTeamConfig (params LocalQuorum (ssoTeamConfigStatus, tid)) diff --git a/tools/db/move-team/src/Common.hs b/tools/db/move-team/src/Common.hs index 0b7f185f4e9..26a65089649 100644 --- a/tools/db/move-team/src/Common.hs +++ b/tools/db/move-team/src/Common.hs @@ -31,11 +31,11 @@ sourceJsonLines handle = .| C.linesUnboundedAscii .| mapC (either error id . eitherDecodeStrict) -sinkJsonLines :: ToJSON a => Handle -> ConduitT [a] Void IO () +sinkJsonLines :: (ToJSON a) => Handle -> ConduitT [a] Void IO () sinkJsonLines hd = C.mapM_ (mapM_ (LBS.hPutStr hd . (<> "\n") . encode)) -- FUTUREWORK: this is very slow. Look for alterantives. Maybe `batch` queries are faster. -sinkTableRows :: Tuple a => PrepQuery W a () -> ConduitM a Void Client () +sinkTableRows :: (Tuple a) => PrepQuery W a () -> ConduitM a Void Client () sinkTableRows insertQuery = go where go = do diff --git a/tools/db/move-team/src/Options.hs b/tools/db/move-team/src/Options.hs index f5d26ed767b..39d875ca00d 100644 --- a/tools/db/move-team/src/Options.hs +++ b/tools/db/move-team/src/Options.hs @@ -139,7 +139,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" @@ -149,5 +150,5 @@ cassandraSettingsParser ks = ) ) -parseUUID :: HasCallStack => String -> UUID +parseUUID :: (HasCallStack) => String -> UUID parseUUID = fromJust . Data.UUID.fromString diff --git a/tools/db/move-team/src/ParseSchema.hs b/tools/db/move-team/src/ParseSchema.hs index 47d7f6b1417..30c916f7b7b 100644 --- a/tools/db/move-team/src/ParseSchema.hs +++ b/tools/db/move-team/src/ParseSchema.hs @@ -96,10 +96,11 @@ betweenBrackets = between (lexeme "(") (lexeme ")") primaryKeyAtEndOfColumns :: Parser () primaryKeyAtEndOfColumns = do void $ lexeme "PRIMARY KEY" - void $ - lexeme $ - betweenBrackets $ - (void name' <|> nested) `sepBy1` lexeme "," + void + $ lexeme + $ betweenBrackets + $ (void name' <|> nested) + `sepBy1` lexeme "," where nested = void $ betweenBrackets $ name' `sepBy1` lexeme "," @@ -110,10 +111,10 @@ createTable = do void "." tn <- lexeme tablename cols <- - betweenBrackets $ - catMaybes - <$> ((Just <$> column) <|> (Nothing <$ primaryKeyAtEndOfColumns)) - `sepBy` lexeme "," + betweenBrackets + $ catMaybes + <$> ((Just <$> column) <|> (Nothing <$ primaryKeyAtEndOfColumns)) + `sepBy` lexeme "," noise pure (CreateTable ks tn cols) diff --git a/tools/db/move-team/src/Schema.hs b/tools/db/move-team/src/Schema.hs index fdf17e81cae..38a474d5839 100644 --- a/tools/db/move-team/src/Schema.hs +++ b/tools/db/move-team/src/Schema.hs @@ -45,24 +45,24 @@ selectBrigClients = "SELECT user, client, class, cookie, ip, label, lat, lon, mo readBrigClients :: Env -> [UserId] -> ConduitM () [RowBrigClients] IO () readBrigClients Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigClients (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigClients (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigClientsAll :: PrepQuery R () RowBrigClients selectBrigClientsAll = "SELECT user, client, class, cookie, ip, label, lat, lon, model, tstamp, type FROM clients" readBrigClientsAll :: Env -> ConduitM () [RowBrigClients] IO () readBrigClientsAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigClientsAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigClientsAll (paramsP LocalQuorum () envPageSize) x5 exportBrigClientsFull :: Env -> FilePath -> IO () exportBrigClientsFull env path = do putStrLn $ "Exporting " <> "brig.clients" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigClientsAll env - .| sinkJsonLines handle + runConduit + $ readBrigClientsAll env + .| sinkJsonLines handle insertBrigClients :: PrepQuery W RowBrigClients () insertBrigClients = @@ -75,9 +75,9 @@ importBrigClients Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.clients" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigClients) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigClients) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -91,24 +91,24 @@ selectBrigConnection = "SELECT left, right, conv, last_update, message, status F readBrigConnection :: Env -> [UserId] -> ConduitM () [RowBrigConnection] IO () readBrigConnection Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigConnection (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigConnection (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigConnectionAll :: PrepQuery R () RowBrigConnection selectBrigConnectionAll = "SELECT left, right, conv, last_update, message, status FROM connection" readBrigConnectionAll :: Env -> ConduitM () [RowBrigConnection] IO () readBrigConnectionAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigConnectionAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigConnectionAll (paramsP LocalQuorum () envPageSize) x5 exportBrigConnectionFull :: Env -> FilePath -> IO () exportBrigConnectionFull env path = do putStrLn $ "Exporting " <> "brig.connection" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigConnectionAll env - .| sinkJsonLines handle + runConduit + $ readBrigConnectionAll env + .| sinkJsonLines handle insertBrigConnection :: PrepQuery W RowBrigConnection () insertBrigConnection = @@ -121,9 +121,9 @@ importBrigConnection Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.connection" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigConnection) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigConnection) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -137,24 +137,24 @@ selectBrigLoginCodes = "SELECT user, code, retries, timeout FROM login_codes WHE readBrigLoginCodes :: Env -> [UserId] -> ConduitM () [RowBrigLoginCodes] IO () readBrigLoginCodes Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigLoginCodes (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigLoginCodes (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigLoginCodesAll :: PrepQuery R () RowBrigLoginCodes selectBrigLoginCodesAll = "SELECT user, code, retries, timeout FROM login_codes" readBrigLoginCodesAll :: Env -> ConduitM () [RowBrigLoginCodes] IO () readBrigLoginCodesAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigLoginCodesAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigLoginCodesAll (paramsP LocalQuorum () envPageSize) x5 exportBrigLoginCodesFull :: Env -> FilePath -> IO () exportBrigLoginCodesFull env path = do putStrLn $ "Exporting " <> "brig.login_codes" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigLoginCodesAll env - .| sinkJsonLines handle + runConduit + $ readBrigLoginCodesAll env + .| sinkJsonLines handle insertBrigLoginCodes :: PrepQuery W RowBrigLoginCodes () insertBrigLoginCodes = @@ -167,9 +167,9 @@ importBrigLoginCodes Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.login_codes" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigLoginCodes) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigLoginCodes) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -183,24 +183,24 @@ selectBrigPasswordReset = "SELECT key, code, retries, timeout, user FROM passwor readBrigPasswordReset :: Env -> [PasswordResetKey] -> ConduitM () [RowBrigPasswordReset] IO () readBrigPasswordReset Env {..} reset_keys = - transPipe (runClient envBrig) $ - paginateC selectBrigPasswordReset (paramsP LocalQuorum (pure reset_keys) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigPasswordReset (paramsP LocalQuorum (pure reset_keys) envPageSize) x5 selectBrigPasswordResetAll :: PrepQuery R () RowBrigPasswordReset selectBrigPasswordResetAll = "SELECT key, code, retries, timeout, user FROM password_reset" readBrigPasswordResetAll :: Env -> ConduitM () [RowBrigPasswordReset] IO () readBrigPasswordResetAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigPasswordResetAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigPasswordResetAll (paramsP LocalQuorum () envPageSize) x5 exportBrigPasswordResetFull :: Env -> FilePath -> IO () exportBrigPasswordResetFull env path = do putStrLn $ "Exporting " <> "brig.password_reset" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigPasswordResetAll env - .| sinkJsonLines handle + runConduit + $ readBrigPasswordResetAll env + .| sinkJsonLines handle insertBrigPasswordReset :: PrepQuery W RowBrigPasswordReset () insertBrigPasswordReset = @@ -213,9 +213,9 @@ importBrigPasswordReset Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.password_reset" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigPasswordReset) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigPasswordReset) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -229,24 +229,24 @@ selectBrigPrekeys = "SELECT user, client, key, data FROM prekeys WHERE user in ? readBrigPrekeys :: Env -> [UserId] -> ConduitM () [RowBrigPrekeys] IO () readBrigPrekeys Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigPrekeys (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigPrekeys (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigPrekeysAll :: PrepQuery R () RowBrigPrekeys selectBrigPrekeysAll = "SELECT user, client, key, data FROM prekeys" readBrigPrekeysAll :: Env -> ConduitM () [RowBrigPrekeys] IO () readBrigPrekeysAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigPrekeysAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigPrekeysAll (paramsP LocalQuorum () envPageSize) x5 exportBrigPrekeysFull :: Env -> FilePath -> IO () exportBrigPrekeysFull env path = do putStrLn $ "Exporting " <> "brig.prekeys" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigPrekeysAll env - .| sinkJsonLines handle + runConduit + $ readBrigPrekeysAll env + .| sinkJsonLines handle insertBrigPrekeys :: PrepQuery W RowBrigPrekeys () insertBrigPrekeys = @@ -259,9 +259,9 @@ importBrigPrekeys Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.prekeys" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigPrekeys) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigPrekeys) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -275,24 +275,24 @@ selectBrigProperties = "SELECT user, key, value FROM properties WHERE user in ?" readBrigProperties :: Env -> [UserId] -> ConduitM () [RowBrigProperties] IO () readBrigProperties Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigProperties (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigProperties (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigPropertiesAll :: PrepQuery R () RowBrigProperties selectBrigPropertiesAll = "SELECT user, key, value FROM properties" readBrigPropertiesAll :: Env -> ConduitM () [RowBrigProperties] IO () readBrigPropertiesAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigPropertiesAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigPropertiesAll (paramsP LocalQuorum () envPageSize) x5 exportBrigPropertiesFull :: Env -> FilePath -> IO () exportBrigPropertiesFull env path = do putStrLn $ "Exporting " <> "brig.properties" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigPropertiesAll env - .| sinkJsonLines handle + runConduit + $ readBrigPropertiesAll env + .| sinkJsonLines handle insertBrigProperties :: PrepQuery W RowBrigProperties () insertBrigProperties = @@ -305,9 +305,9 @@ importBrigProperties Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.properties" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigProperties) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigProperties) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -321,24 +321,24 @@ selectBrigRichInfo = "SELECT user, json FROM rich_info WHERE user in ?" readBrigRichInfo :: Env -> [UserId] -> ConduitM () [RowBrigRichInfo] IO () readBrigRichInfo Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigRichInfo (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigRichInfo (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigRichInfoAll :: PrepQuery R () RowBrigRichInfo selectBrigRichInfoAll = "SELECT user, json FROM rich_info" readBrigRichInfoAll :: Env -> ConduitM () [RowBrigRichInfo] IO () readBrigRichInfoAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigRichInfoAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigRichInfoAll (paramsP LocalQuorum () envPageSize) x5 exportBrigRichInfoFull :: Env -> FilePath -> IO () exportBrigRichInfoFull env path = do putStrLn $ "Exporting " <> "brig.rich_info" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigRichInfoAll env - .| sinkJsonLines handle + runConduit + $ readBrigRichInfoAll env + .| sinkJsonLines handle insertBrigRichInfo :: PrepQuery W RowBrigRichInfo () insertBrigRichInfo = @@ -351,9 +351,9 @@ importBrigRichInfo Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.rich_info" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigRichInfo) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigRichInfo) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -367,24 +367,24 @@ selectBrigUser = "SELECT id, accent, accent_id, activated, assets, country, emai readBrigUser :: Env -> [UserId] -> ConduitM () [RowBrigUser] IO () readBrigUser Env {..} uids = - transPipe (runClient envBrig) $ - paginateC selectBrigUser (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUser (paramsP LocalQuorum (pure uids) envPageSize) x5 selectBrigUserAll :: PrepQuery R () RowBrigUser selectBrigUserAll = "SELECT id, accent, accent_id, activated, assets, country, email, expires, handle, language, managed_by, name, password, phone, picture, provider, searchable, service, sso_id, status, team FROM user" readBrigUserAll :: Env -> ConduitM () [RowBrigUser] IO () readBrigUserAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigUserAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUserAll (paramsP LocalQuorum () envPageSize) x5 exportBrigUserFull :: Env -> FilePath -> IO () exportBrigUserFull env path = do putStrLn $ "Exporting " <> "brig.user" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigUserAll env - .| sinkJsonLines handle + runConduit + $ readBrigUserAll env + .| sinkJsonLines handle insertBrigUser :: PrepQuery W RowBrigUser () insertBrigUser = @@ -397,9 +397,9 @@ importBrigUser Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.user" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigUser) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigUser) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -413,24 +413,24 @@ selectBrigUserHandle = "SELECT handle, user FROM user_handle WHERE handle in ?" readBrigUserHandle :: Env -> [Handle] -> ConduitM () [RowBrigUserHandle] IO () readBrigUserHandle Env {..} handles = - transPipe (runClient envBrig) $ - paginateC selectBrigUserHandle (paramsP LocalQuorum (pure handles) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUserHandle (paramsP LocalQuorum (pure handles) envPageSize) x5 selectBrigUserHandleAll :: PrepQuery R () RowBrigUserHandle selectBrigUserHandleAll = "SELECT handle, user FROM user_handle" readBrigUserHandleAll :: Env -> ConduitM () [RowBrigUserHandle] IO () readBrigUserHandleAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigUserHandleAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUserHandleAll (paramsP LocalQuorum () envPageSize) x5 exportBrigUserHandleFull :: Env -> FilePath -> IO () exportBrigUserHandleFull env path = do putStrLn $ "Exporting " <> "brig.user_handle" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigUserHandleAll env - .| sinkJsonLines handle + runConduit + $ readBrigUserHandleAll env + .| sinkJsonLines handle insertBrigUserHandle :: PrepQuery W RowBrigUserHandle () insertBrigUserHandle = @@ -443,9 +443,9 @@ importBrigUserHandle Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.user_handle" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigUserHandle) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigUserHandle) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -459,24 +459,24 @@ selectBrigUserKeys = "SELECT key, user FROM user_keys WHERE key in ?" readBrigUserKeys :: Env -> [Int32] -> ConduitM () [RowBrigUserKeys] IO () readBrigUserKeys Env {..} keys = - transPipe (runClient envBrig) $ - paginateC selectBrigUserKeys (paramsP LocalQuorum (pure keys) envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUserKeys (paramsP LocalQuorum (pure keys) envPageSize) x5 selectBrigUserKeysAll :: PrepQuery R () RowBrigUserKeys selectBrigUserKeysAll = "SELECT key, user FROM user_keys" readBrigUserKeysAll :: Env -> ConduitM () [RowBrigUserKeys] IO () readBrigUserKeysAll Env {..} = - transPipe (runClient envBrig) $ - paginateC selectBrigUserKeysAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envBrig) + $ paginateC selectBrigUserKeysAll (paramsP LocalQuorum () envPageSize) x5 exportBrigUserKeysFull :: Env -> FilePath -> IO () exportBrigUserKeysFull env path = do putStrLn $ "Exporting " <> "brig.user_keys" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readBrigUserKeysAll env - .| sinkJsonLines handle + runConduit + $ readBrigUserKeysAll env + .| sinkJsonLines handle insertBrigUserKeys :: PrepQuery W RowBrigUserKeys () insertBrigUserKeys = @@ -489,9 +489,9 @@ importBrigUserKeys Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "brig.user_keys" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envBrig) (sinkTableRows insertBrigUserKeys) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envBrig) (sinkTableRows insertBrigUserKeys) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -505,24 +505,24 @@ selectGalleyBillingTeamMember = "SELECT team, user FROM billing_team_member WHER readGalleyBillingTeamMember :: Env -> TeamId -> ConduitM () [RowGalleyBillingTeamMember] IO () readGalleyBillingTeamMember Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyBillingTeamMember (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyBillingTeamMember (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyBillingTeamMemberAll :: PrepQuery R () RowGalleyBillingTeamMember selectGalleyBillingTeamMemberAll = "SELECT team, user FROM billing_team_member" readGalleyBillingTeamMemberAll :: Env -> ConduitM () [RowGalleyBillingTeamMember] IO () readGalleyBillingTeamMemberAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyBillingTeamMemberAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyBillingTeamMemberAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyBillingTeamMemberFull :: Env -> FilePath -> IO () exportGalleyBillingTeamMemberFull env path = do putStrLn $ "Exporting " <> "galley.billing_team_member" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyBillingTeamMemberAll env - .| sinkJsonLines handle + runConduit + $ readGalleyBillingTeamMemberAll env + .| sinkJsonLines handle insertGalleyBillingTeamMember :: PrepQuery W RowGalleyBillingTeamMember () insertGalleyBillingTeamMember = @@ -535,9 +535,9 @@ importGalleyBillingTeamMember Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.billing_team_member" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyBillingTeamMember) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyBillingTeamMember) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -551,24 +551,24 @@ selectGalleyClients = "SELECT user, clients FROM clients WHERE user in ?" readGalleyClients :: Env -> [UserId] -> ConduitM () [RowGalleyClients] IO () readGalleyClients Env {..} uids = - transPipe (runClient envGalley) $ - paginateC selectGalleyClients (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyClients (paramsP LocalQuorum (pure uids) envPageSize) x5 selectGalleyClientsAll :: PrepQuery R () RowGalleyClients selectGalleyClientsAll = "SELECT user, clients FROM clients" readGalleyClientsAll :: Env -> ConduitM () [RowGalleyClients] IO () readGalleyClientsAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyClientsAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyClientsAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyClientsFull :: Env -> FilePath -> IO () exportGalleyClientsFull env path = do putStrLn $ "Exporting " <> "galley.clients" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyClientsAll env - .| sinkJsonLines handle + runConduit + $ readGalleyClientsAll env + .| sinkJsonLines handle insertGalleyClients :: PrepQuery W RowGalleyClients () insertGalleyClients = @@ -581,9 +581,9 @@ importGalleyClients Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.clients" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyClients) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyClients) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -597,24 +597,24 @@ selectGalleyConversation = "SELECT conv, access, access_role, creator, deleted, readGalleyConversation :: Env -> [ConvId] -> ConduitM () [RowGalleyConversation] IO () readGalleyConversation Env {..} cids = - transPipe (runClient envGalley) $ - paginateC selectGalleyConversation (paramsP LocalQuorum (pure cids) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyConversation (paramsP LocalQuorum (pure cids) envPageSize) x5 selectGalleyConversationAll :: PrepQuery R () RowGalleyConversation selectGalleyConversationAll = "SELECT conv, access, access_role, creator, deleted, message_timer, name, receipt_mode, team, type FROM conversation" readGalleyConversationAll :: Env -> ConduitM () [RowGalleyConversation] IO () readGalleyConversationAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyConversationAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyConversationAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyConversationFull :: Env -> FilePath -> IO () exportGalleyConversationFull env path = do putStrLn $ "Exporting " <> "galley.conversation" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyConversationAll env - .| sinkJsonLines handle + runConduit + $ readGalleyConversationAll env + .| sinkJsonLines handle insertGalleyConversation :: PrepQuery W RowGalleyConversation () insertGalleyConversation = @@ -627,9 +627,9 @@ importGalleyConversation Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.conversation" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyConversation) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyConversation) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -643,24 +643,24 @@ selectGalleyMember = "SELECT conv, user, conversation_role, hidden, hidden_ref, readGalleyMember :: Env -> [ConvId] -> ConduitM () [RowGalleyMember] IO () readGalleyMember Env {..} cids = - transPipe (runClient envGalley) $ - paginateC selectGalleyMember (paramsP LocalQuorum (pure cids) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyMember (paramsP LocalQuorum (pure cids) envPageSize) x5 selectGalleyMemberAll :: PrepQuery R () RowGalleyMember selectGalleyMemberAll = "SELECT conv, user, conversation_role, hidden, hidden_ref, otr_archived, otr_archived_ref, otr_muted, otr_muted_ref, otr_muted_status, provider, service, status, user_remote_domain, user_remote_id FROM member" readGalleyMemberAll :: Env -> ConduitM () [RowGalleyMember] IO () readGalleyMemberAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyMemberAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyMemberAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyMemberFull :: Env -> FilePath -> IO () exportGalleyMemberFull env path = do putStrLn $ "Exporting " <> "galley.member" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyMemberAll env - .| sinkJsonLines handle + runConduit + $ readGalleyMemberAll env + .| sinkJsonLines handle insertGalleyMember :: PrepQuery W RowGalleyMember () insertGalleyMember = @@ -673,9 +673,9 @@ importGalleyMember Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.member" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyMember) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyMember) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -689,24 +689,24 @@ selectGalleyTeam = "SELECT team, binding, creator, deleted, icon, icon_key, name readGalleyTeam :: Env -> TeamId -> ConduitM () [RowGalleyTeam] IO () readGalleyTeam Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeam (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeam (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyTeamAll :: PrepQuery R () RowGalleyTeam selectGalleyTeamAll = "SELECT team, binding, creator, deleted, icon, icon_key, name, search_visibility, status FROM team" readGalleyTeamAll :: Env -> ConduitM () [RowGalleyTeam] IO () readGalleyTeamAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyTeamFull :: Env -> FilePath -> IO () exportGalleyTeamFull env path = do putStrLn $ "Exporting " <> "galley.team" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyTeamAll env - .| sinkJsonLines handle + runConduit + $ readGalleyTeamAll env + .| sinkJsonLines handle insertGalleyTeam :: PrepQuery W RowGalleyTeam () insertGalleyTeam = @@ -719,9 +719,9 @@ importGalleyTeam Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.team" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeam) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeam) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -735,24 +735,24 @@ selectGalleyTeamConv = "SELECT team, conv, managed FROM team_conv WHERE team = ? readGalleyTeamConv :: Env -> TeamId -> ConduitM () [RowGalleyTeamConv] IO () readGalleyTeamConv Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamConv (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamConv (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyTeamConvAll :: PrepQuery R () RowGalleyTeamConv selectGalleyTeamConvAll = "SELECT team, conv, managed FROM team_conv" readGalleyTeamConvAll :: Env -> ConduitM () [RowGalleyTeamConv] IO () readGalleyTeamConvAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamConvAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamConvAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyTeamConvFull :: Env -> FilePath -> IO () exportGalleyTeamConvFull env path = do putStrLn $ "Exporting " <> "galley.team_conv" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyTeamConvAll env - .| sinkJsonLines handle + runConduit + $ readGalleyTeamConvAll env + .| sinkJsonLines handle insertGalleyTeamConv :: PrepQuery W RowGalleyTeamConv () insertGalleyTeamConv = @@ -765,9 +765,9 @@ importGalleyTeamConv Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.team_conv" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamConv) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamConv) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -781,24 +781,24 @@ selectGalleyTeamFeatures = "SELECT team_id, app_lock_enforce, app_lock_inactivit readGalleyTeamFeatures :: Env -> TeamId -> ConduitM () [RowGalleyTeamFeatures] IO () readGalleyTeamFeatures Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamFeatures (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamFeatures (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyTeamFeaturesAll :: PrepQuery R () RowGalleyTeamFeatures selectGalleyTeamFeaturesAll = "SELECT team_id, app_lock_enforce, app_lock_inactivity_timeout_secs, app_lock_status, digital_signatures, legalhold_status, search_visibility_status, sso_status, validate_saml_emails FROM team_features" readGalleyTeamFeaturesAll :: Env -> ConduitM () [RowGalleyTeamFeatures] IO () readGalleyTeamFeaturesAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamFeaturesAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamFeaturesAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyTeamFeaturesFull :: Env -> FilePath -> IO () exportGalleyTeamFeaturesFull env path = do putStrLn $ "Exporting " <> "galley.team_features" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyTeamFeaturesAll env - .| sinkJsonLines handle + runConduit + $ readGalleyTeamFeaturesAll env + .| sinkJsonLines handle insertGalleyTeamFeatures :: PrepQuery W RowGalleyTeamFeatures () insertGalleyTeamFeatures = @@ -811,9 +811,9 @@ importGalleyTeamFeatures Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.team_features" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamFeatures) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamFeatures) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -827,24 +827,24 @@ selectGalleyTeamMember = "SELECT team, user, invited_at, invited_by, legalhold_s readGalleyTeamMember :: Env -> TeamId -> ConduitM () [RowGalleyTeamMember] IO () readGalleyTeamMember Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamMember (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamMember (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyTeamMemberAll :: PrepQuery R () RowGalleyTeamMember selectGalleyTeamMemberAll = "SELECT team, user, invited_at, invited_by, legalhold_status, perms FROM team_member" readGalleyTeamMemberAll :: Env -> ConduitM () [RowGalleyTeamMember] IO () readGalleyTeamMemberAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamMemberAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamMemberAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyTeamMemberFull :: Env -> FilePath -> IO () exportGalleyTeamMemberFull env path = do putStrLn $ "Exporting " <> "galley.team_member" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyTeamMemberAll env - .| sinkJsonLines handle + runConduit + $ readGalleyTeamMemberAll env + .| sinkJsonLines handle insertGalleyTeamMember :: PrepQuery W RowGalleyTeamMember () insertGalleyTeamMember = @@ -857,9 +857,9 @@ importGalleyTeamMember Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.team_member" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamMember) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamMember) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -873,24 +873,24 @@ selectGalleyTeamNotifications = "SELECT team, id, payload FROM team_notification readGalleyTeamNotifications :: Env -> TeamId -> ConduitM () [RowGalleyTeamNotifications] IO () readGalleyTeamNotifications Env {..} tid = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamNotifications (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamNotifications (paramsP LocalQuorum (pure tid) envPageSize) x5 selectGalleyTeamNotificationsAll :: PrepQuery R () RowGalleyTeamNotifications selectGalleyTeamNotificationsAll = "SELECT team, id, payload FROM team_notifications" readGalleyTeamNotificationsAll :: Env -> ConduitM () [RowGalleyTeamNotifications] IO () readGalleyTeamNotificationsAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyTeamNotificationsAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyTeamNotificationsAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyTeamNotificationsFull :: Env -> FilePath -> IO () exportGalleyTeamNotificationsFull env path = do putStrLn $ "Exporting " <> "galley.team_notifications" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyTeamNotificationsAll env - .| sinkJsonLines handle + runConduit + $ readGalleyTeamNotificationsAll env + .| sinkJsonLines handle insertGalleyTeamNotifications :: PrepQuery W RowGalleyTeamNotifications () insertGalleyTeamNotifications = @@ -903,9 +903,9 @@ importGalleyTeamNotifications Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.team_notifications" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamNotifications) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyTeamNotifications) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -919,24 +919,24 @@ selectGalleyUser = "SELECT user, conv, conv_remote_domain, conv_remote_id FROM u readGalleyUser :: Env -> [UserId] -> ConduitM () [RowGalleyUser] IO () readGalleyUser Env {..} uids = - transPipe (runClient envGalley) $ - paginateC selectGalleyUser (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyUser (paramsP LocalQuorum (pure uids) envPageSize) x5 selectGalleyUserAll :: PrepQuery R () RowGalleyUser selectGalleyUserAll = "SELECT user, conv, conv_remote_domain, conv_remote_id FROM user" readGalleyUserAll :: Env -> ConduitM () [RowGalleyUser] IO () readGalleyUserAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyUserAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyUserAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyUserFull :: Env -> FilePath -> IO () exportGalleyUserFull env path = do putStrLn $ "Exporting " <> "galley.user" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyUserAll env - .| sinkJsonLines handle + runConduit + $ readGalleyUserAll env + .| sinkJsonLines handle insertGalleyUser :: PrepQuery W RowGalleyUser () insertGalleyUser = @@ -949,9 +949,9 @@ importGalleyUser Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.user" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyUser) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyUser) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -965,24 +965,24 @@ selectGalleyUserTeam = "SELECT user, team FROM user_team WHERE user in ?" readGalleyUserTeam :: Env -> [UserId] -> ConduitM () [RowGalleyUserTeam] IO () readGalleyUserTeam Env {..} uids = - transPipe (runClient envGalley) $ - paginateC selectGalleyUserTeam (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyUserTeam (paramsP LocalQuorum (pure uids) envPageSize) x5 selectGalleyUserTeamAll :: PrepQuery R () RowGalleyUserTeam selectGalleyUserTeamAll = "SELECT user, team FROM user_team" readGalleyUserTeamAll :: Env -> ConduitM () [RowGalleyUserTeam] IO () readGalleyUserTeamAll Env {..} = - transPipe (runClient envGalley) $ - paginateC selectGalleyUserTeamAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGalley) + $ paginateC selectGalleyUserTeamAll (paramsP LocalQuorum () envPageSize) x5 exportGalleyUserTeamFull :: Env -> FilePath -> IO () exportGalleyUserTeamFull env path = do putStrLn $ "Exporting " <> "galley.user_team" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGalleyUserTeamAll env - .| sinkJsonLines handle + runConduit + $ readGalleyUserTeamAll env + .| sinkJsonLines handle insertGalleyUserTeam :: PrepQuery W RowGalleyUserTeam () insertGalleyUserTeam = @@ -995,9 +995,9 @@ importGalleyUserTeam Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "galley.user_team" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGalley) (sinkTableRows insertGalleyUserTeam) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGalley) (sinkTableRows insertGalleyUserTeam) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -1011,24 +1011,24 @@ selectGundeckNotifications = "SELECT user, id, clients, payload FROM notificatio readGundeckNotifications :: Env -> [UserId] -> ConduitM () [RowGundeckNotifications] IO () readGundeckNotifications Env {..} uids = - transPipe (runClient envGundeck) $ - paginateC selectGundeckNotifications (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envGundeck) + $ paginateC selectGundeckNotifications (paramsP LocalQuorum (pure uids) envPageSize) x5 selectGundeckNotificationsAll :: PrepQuery R () RowGundeckNotifications selectGundeckNotificationsAll = "SELECT user, id, clients, payload FROM notifications" readGundeckNotificationsAll :: Env -> ConduitM () [RowGundeckNotifications] IO () readGundeckNotificationsAll Env {..} = - transPipe (runClient envGundeck) $ - paginateC selectGundeckNotificationsAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envGundeck) + $ paginateC selectGundeckNotificationsAll (paramsP LocalQuorum () envPageSize) x5 exportGundeckNotificationsFull :: Env -> FilePath -> IO () exportGundeckNotificationsFull env path = do putStrLn $ "Exporting " <> "gundeck.notifications" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readGundeckNotificationsAll env - .| sinkJsonLines handle + runConduit + $ readGundeckNotificationsAll env + .| sinkJsonLines handle insertGundeckNotifications :: PrepQuery W RowGundeckNotifications () insertGundeckNotifications = @@ -1041,9 +1041,9 @@ importGundeckNotifications Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "gundeck.notifications" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envGundeck) (sinkTableRows insertGundeckNotifications) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envGundeck) (sinkTableRows insertGundeckNotifications) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -1057,24 +1057,24 @@ selectSparScimExternal = "SELECT team, external_id, user FROM scim_external WHER readSparScimExternal :: Env -> TeamId -> ConduitM () [RowSparScimExternal] IO () readSparScimExternal Env {..} tid = - transPipe (runClient envSpar) $ - paginateC selectSparScimExternal (paramsP LocalQuorum (pure tid) envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparScimExternal (paramsP LocalQuorum (pure tid) envPageSize) x5 selectSparScimExternalAll :: PrepQuery R () RowSparScimExternal selectSparScimExternalAll = "SELECT team, external_id, user FROM scim_external" readSparScimExternalAll :: Env -> ConduitM () [RowSparScimExternal] IO () readSparScimExternalAll Env {..} = - transPipe (runClient envSpar) $ - paginateC selectSparScimExternalAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparScimExternalAll (paramsP LocalQuorum () envPageSize) x5 exportSparScimExternalFull :: Env -> FilePath -> IO () exportSparScimExternalFull env path = do putStrLn $ "Exporting " <> "spar.scim_external" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readSparScimExternalAll env - .| sinkJsonLines handle + runConduit + $ readSparScimExternalAll env + .| sinkJsonLines handle insertSparScimExternal :: PrepQuery W RowSparScimExternal () insertSparScimExternal = @@ -1087,9 +1087,9 @@ importSparScimExternal Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "spar.scim_external" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envSpar) (sinkTableRows insertSparScimExternal) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envSpar) (sinkTableRows insertSparScimExternal) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -1103,24 +1103,24 @@ selectSparScimUserTimes = "SELECT uid, created_at, last_updated_at FROM scim_use readSparScimUserTimes :: Env -> [UserId] -> ConduitM () [RowSparScimUserTimes] IO () readSparScimUserTimes Env {..} uids = - transPipe (runClient envSpar) $ - paginateC selectSparScimUserTimes (paramsP LocalQuorum (pure uids) envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparScimUserTimes (paramsP LocalQuorum (pure uids) envPageSize) x5 selectSparScimUserTimesAll :: PrepQuery R () RowSparScimUserTimes selectSparScimUserTimesAll = "SELECT uid, created_at, last_updated_at FROM scim_user_times" readSparScimUserTimesAll :: Env -> ConduitM () [RowSparScimUserTimes] IO () readSparScimUserTimesAll Env {..} = - transPipe (runClient envSpar) $ - paginateC selectSparScimUserTimesAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparScimUserTimesAll (paramsP LocalQuorum () envPageSize) x5 exportSparScimUserTimesFull :: Env -> FilePath -> IO () exportSparScimUserTimesFull env path = do putStrLn $ "Exporting " <> "spar.scim_user_times" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readSparScimUserTimesAll env - .| sinkJsonLines handle + runConduit + $ readSparScimUserTimesAll env + .| sinkJsonLines handle insertSparScimUserTimes :: PrepQuery W RowSparScimUserTimes () insertSparScimUserTimes = @@ -1133,9 +1133,9 @@ importSparScimUserTimes Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "spar.scim_user_times" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envSpar) (sinkTableRows insertSparScimUserTimes) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envSpar) (sinkTableRows insertSparScimUserTimes) else do putStrLn $ "Skipping because not found: " <> path pure () @@ -1149,24 +1149,24 @@ selectSparUser = "SELECT issuer, sso_id, uid FROM user WHERE issuer in ?" readSparUser :: Env -> [Text] -> ConduitM () [RowSparUser] IO () readSparUser Env {..} issuer = - transPipe (runClient envSpar) $ - paginateC selectSparUser (paramsP LocalQuorum (pure issuer) envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparUser (paramsP LocalQuorum (pure issuer) envPageSize) x5 selectSparUserAll :: PrepQuery R () RowSparUser selectSparUserAll = "SELECT issuer, sso_id, uid FROM user" readSparUserAll :: Env -> ConduitM () [RowSparUser] IO () readSparUserAll Env {..} = - transPipe (runClient envSpar) $ - paginateC selectSparUserAll (paramsP LocalQuorum () envPageSize) x5 + transPipe (runClient envSpar) + $ paginateC selectSparUserAll (paramsP LocalQuorum () envPageSize) x5 exportSparUserFull :: Env -> FilePath -> IO () exportSparUserFull env path = do putStrLn $ "Exporting " <> "spar.user" <> " to " <> path withBinaryFile path WriteMode $ \handle -> - runConduit $ - readSparUserAll env - .| sinkJsonLines handle + runConduit + $ readSparUserAll env + .| sinkJsonLines handle insertSparUser :: PrepQuery W RowSparUser () insertSparUser = @@ -1179,9 +1179,9 @@ importSparUser Env {..} path = do then do putStrLn $ "Importing " <> path <> " to " <> "spar.user" withBinaryFile path ReadMode $ \handle -> - runConduit $ - sourceJsonLines handle - .| transPipe (runClient envSpar) (sinkTableRows insertSparUser) + runConduit + $ sourceJsonLines handle + .| transPipe (runClient envSpar) (sinkTableRows insertSparUser) else do putStrLn $ "Skipping because not found: " <> path pure () diff --git a/tools/db/move-team/src/Types.hs b/tools/db/move-team/src/Types.hs index 3c3cfe4d722..ca55d30e282 100644 --- a/tools/db/move-team/src/Types.hs +++ b/tools/db/move-team/src/Types.hs @@ -71,10 +71,10 @@ instance Cql AssetIgnoreData where toCql _ = error "AssetIgnoreData: you should not have any data of this" fromCql _ = pure AssetIgnoreData -instance ToJSON a => ToJSON (Cassandra.Set a) where +instance (ToJSON a) => ToJSON (Cassandra.Set a) where toJSON = toJSON . Cassandra.fromSet -instance FromJSON a => FromJSON (Cassandra.Set a) where +instance (FromJSON a) => FromJSON (Cassandra.Set a) where parseJSON = fmap Cassandra.Set . parseJSON instance ToJSON Blob where @@ -106,8 +106,8 @@ deriving instance FromJSON TimeUuid instance (ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n, ToJSON o, ToJSON p, ToJSON q, ToJSON r, ToJSON s, ToJSON t, ToJSON u) => ToJSON ((,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u) where toJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) = - Array $ - V.fromList + Array + $ V.fromList [ toJSON a, toJSON b, toJSON c, diff --git a/tools/db/move-team/src/Work.hs b/tools/db/move-team/src/Work.hs index b8a75722080..6eaac4c3757 100644 --- a/tools/db/move-team/src/Work.hs +++ b/tools/db/move-team/src/Work.hs @@ -86,12 +86,12 @@ runTeam env@Env {..} = do runGalleyTeamMembers :: Env -> IO () runGalleyTeamMembers env@Env {..} = IO.withBinaryFile (envTargetPath "galley.team_member") IO.WriteMode $ \outH -> - runConduit $ - zipSources + runConduit + $ zipSources (CL.sourceList [(1 :: Int32) ..]) (readGalleyTeamMember env envTeamId) - .| C.mapM (handleTeamMembers env) - .| sinkJsonLines outH + .| C.mapM (handleTeamMembers env) + .| sinkJsonLines outH handleTeamMembers :: Env -> (Int32, [RowGalleyTeamMember]) -> IO [RowGalleyTeamMember] handleTeamMembers env@Env {..} (i, members) = do @@ -116,12 +116,12 @@ handleTeamMembers env@Env {..} (i, members) = do runGalleyTeamConv :: Env -> IO () runGalleyTeamConv env@Env {..} = IO.withBinaryFile (envTargetPath "galley.team_conv") IO.WriteMode $ \outH -> - runConduit $ - zipSources + runConduit + $ zipSources (CL.sourceList [(1 :: Int32) ..]) (readGalleyTeamConv env envTeamId) - .| C.mapM (handleTeamConv env) - .| sinkJsonLines outH + .| C.mapM (handleTeamConv env) + .| sinkJsonLines outH handleTeamConv :: Env -> (Int32, [RowGalleyTeamConv]) -> IO [RowGalleyTeamConv] handleTeamConv env@Env {..} (i, convs) = do @@ -137,34 +137,34 @@ runFullScans env@Env {..} users = do haveId (Just uuid) = uuid `Set.member` users -- FUTUREWORK: this data likely won't work after the import on the new instance, and it's not needed. - appendJsonLines (envTargetPath "brig.password_reset") $ - readBrigPasswordResetAll env - .| mapC (filter (haveId . view _5)) + appendJsonLines (envTargetPath "brig.password_reset") + $ readBrigPasswordResetAll env + .| mapC (filter (haveId . view _5)) -- FUTUREWORK: no need to read this table, it can be populated from `brig.user` - appendJsonLines (envTargetPath "brig.user_handle") $ - readBrigUserHandleAll env - .| mapC (filter (haveId . view _2)) + appendJsonLines (envTargetPath "brig.user_handle") + $ readBrigUserHandleAll env + .| mapC (filter (haveId . view _2)) -- FUTUREWORK: no need to read this table, it can be populated from `brig.user` - appendJsonLines (envTargetPath "brig.user_keys") $ - readBrigUserKeysAll env - .| mapC (filter (haveId . view _2)) + appendJsonLines (envTargetPath "brig.user_keys") + $ readBrigUserKeysAll env + .| mapC (filter (haveId . view _2)) - appendJsonLines (envTargetPath "spar.user") $ - readSparUserAll env - .| mapC (filter (haveId . view _3)) + appendJsonLines (envTargetPath "spar.user") + $ readSparUserAll env + .| mapC (filter (haveId . view _3)) -appendJsonLines :: ToJSON a => FilePath -> ConduitM () [a] IO () -> IO () +appendJsonLines :: (ToJSON a) => FilePath -> ConduitM () [a] IO () -> IO () appendJsonLines path conduit = IO.withBinaryFile path IO.AppendMode $ \outH -> runConduit $ conduit .| sinkJsonLines outH readAllTeamUserIds :: Env -> IO (Set UUID) readAllTeamUserIds env@Env {..} = - runConduit $ - readGalleyTeamMember env envTeamId - .| foldSetUserIds + runConduit + $ readGalleyTeamMember env envTeamId + .| foldSetUserIds where foldSetUserIds :: ConduitM [RowGalleyTeamMember] Void IO (Set UUID) foldSetUserIds = C.foldl (foldl' insertUserId) Set.empty diff --git a/tools/db/phone-users/src/PhoneUsers/Lib.hs b/tools/db/phone-users/src/PhoneUsers/Lib.hs index 8c913b7a0bf..8bf816461ea 100644 --- a/tools/db/phone-users/src/PhoneUsers/Lib.hs +++ b/tools/db/phone-users/src/PhoneUsers/Lib.hs @@ -62,16 +62,16 @@ getConferenceCalling client tid = do process :: Log.Logger -> Maybe Int -> ClientState -> ClientState -> IO Result process logger limit brigClient galleyClient = - runConduit $ - readUsers brigClient - -- .| Conduit.mapM (\chunk -> SIO.hPutStr stderr "." $> chunk) - .| Conduit.concat - .| (maybe (Conduit.filter (const True)) Conduit.take limit) - .| Conduit.mapM (getUserInfo logger brigClient galleyClient) - .| forever (CL.isolate 10000 .| (Conduit.foldMap infoToResult >>= yield)) - .| Conduit.takeWhile ((> 0) . usersSearched) - .| CL.scan (<>) mempty - `fuseUpstream` Conduit.mapM_ (\r -> Log.info logger $ "intermediate_result" .= show r) + runConduit + $ readUsers brigClient + -- .| Conduit.mapM (\chunk -> SIO.hPutStr stderr "." $> chunk) + .| Conduit.concat + .| (maybe (Conduit.filter (const True)) Conduit.take limit) + .| Conduit.mapM (getUserInfo logger brigClient galleyClient) + .| forever (CL.isolate 10000 .| (Conduit.foldMap infoToResult >>= yield)) + .| Conduit.takeWhile ((> 0) . usersSearched) + .| CL.scan (<>) mempty + `fuseUpstream` Conduit.mapM_ (\r -> Log.info logger $ "intermediate_result" .= show r) getUserInfo :: Log.Logger -> ClientState -> ClientState -> UserRow -> IO UserInfo getUserInfo logger brigClient galleyClient ur = do @@ -95,15 +95,16 @@ getUserInfo logger brigClient galleyClient ur = do Nothing -> pure ActivePersonalUser Just tid -> do isPaying <- isPayingTeam galleyClient tid - pure $ - if isPaying + pure + $ if isPaying then ActiveTeamUser Free else ActiveTeamUser Paid - Log.info logger $ - "active_phone_user" .= show apu - ~~ "user_record" .= show ur - ~~ "last_active_timestamps" .= show lastActiveTimeStamps - ~~ Log.msg (Log.val "active phone user found") + Log.info logger + $ "active_phone_user" + .= show apu + ~~ "user_record" .= show ur + ~~ "last_active_timestamps" .= show lastActiveTimeStamps + ~~ Log.msg (Log.val "active phone user found") pure apu else pure InactiveLast90Days pure $ PhoneUser userInfo diff --git a/tools/db/phone-users/src/PhoneUsers/Types.hs b/tools/db/phone-users/src/PhoneUsers/Types.hs index fc60a3ee038..9a19a26f001 100644 --- a/tools/db/phone-users/src/PhoneUsers/Types.hs +++ b/tools/db/phone-users/src/PhoneUsers/Types.hs @@ -77,7 +77,8 @@ galleyCassandraParser = <> value 9043 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long "galley-cassandra-keyspace" <> metavar "STRING" @@ -105,7 +106,8 @@ brigCassandraParser = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long "brig-cassandra-keyspace" <> metavar "STRING" diff --git a/tools/db/repair-brig-clients-table/src/Options.hs b/tools/db/repair-brig-clients-table/src/Options.hs index 123c3943511..17aaa7dba81 100644 --- a/tools/db/repair-brig-clients-table/src/Options.hs +++ b/tools/db/repair-brig-clients-table/src/Options.hs @@ -58,11 +58,11 @@ settingsParser = dryRunParser :: Parser Bool dryRunParser = - flag False True $ - ( long ("dry-run") - <> help ("Just detect offending rows, don't change the db") - <> showDefault - ) + flag False True + $ ( long ("dry-run") + <> help ("Just detect offending rows, don't change the db") + <> showDefault + ) cassandraSettingsParser :: String -> Parser CassandraSettings cassandraSettingsParser ks = @@ -82,7 +82,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/repair-brig-clients-table/src/Work.hs b/tools/db/repair-brig-clients-table/src/Work.hs index 41eca357c92..3ceb4db008b 100644 --- a/tools/db/repair-brig-clients-table/src/Work.hs +++ b/tools/db/repair-brig-clients-table/src/Work.hs @@ -31,16 +31,16 @@ import System.Logger qualified as Log runCommand :: Bool -> Logger -> ClientState -> IO () runCommand dryRun l brig = - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) (transPipe (runClient brig) getClients) - .| C.mapM - ( \(i, rows) -> do - Log.info l (Log.field "number of clients processed: " (show (i * pageSize))) - pure rows - ) - .| C.mapM_ (\rows -> runClient brig (mapM_ (filterReportRemove dryRun l) rows)) + .| C.mapM + ( \(i, rows) -> do + Log.info l (Log.field "number of clients processed: " (show (i * pageSize))) + pure rows + ) + .| C.mapM_ (\rows -> runClient brig (mapM_ (filterReportRemove dryRun l) rows)) pageSize :: Int32 pageSize = 1000 @@ -75,7 +75,7 @@ filterReportRemove dryRun l row@(user, client, Nothing, Nothing, Nothing, Nothin rm user client Log.info l (Log.msg @Text "removed!") where - rm :: MonadClient m => UserId -> Text -> m () + rm :: (MonadClient m) => UserId -> Text -> m () rm uid cid = retry x5 $ write rmq (params LocalQuorum (uid, cid)) diff --git a/tools/db/repair-handles/src/Options.hs b/tools/db/repair-handles/src/Options.hs index 31d7228e7bf..714327df93c 100644 --- a/tools/db/repair-handles/src/Options.hs +++ b/tools/db/repair-handles/src/Options.hs @@ -35,7 +35,7 @@ settingsParser = <*> option auto (short 's' <> long "page-size" <> value 1000) <*> (Id . parseUUID <$> strArgument (metavar "TEAM-UUID")) -parseUUID :: HasCallStack => String -> UUID +parseUUID :: (HasCallStack) => String -> UUID parseUUID = fromJust . Data.UUID.fromString cassandraSettingsParser :: String -> Parser CassandraSettings @@ -56,7 +56,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( Keyspace . T.pack + <*> ( Keyspace + . T.pack <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/repair-handles/src/Work.hs b/tools/db/repair-handles/src/Work.hs index 70647a443d5..4bb63a9a0da 100644 --- a/tools/db/repair-handles/src/Work.hs +++ b/tools/db/repair-handles/src/Work.hs @@ -41,9 +41,9 @@ type HandleMap = Map UserId [Handle] readHandleMap :: Env -> IO HandleMap readHandleMap Env {..} = - runConduit $ - transPipe (runClient envBrig) (paginateC selectUserHandle (paramsP LocalQuorum () envPageSize) x1) - .| (C.foldM insertAndLog (Map.empty, 0) <&> fst) + runConduit + $ transPipe (runClient envBrig) (paginateC selectUserHandle (paramsP LocalQuorum () envPageSize) x1) + .| (C.foldM insertAndLog (Map.empty, 0) <&> fst) where selectUserHandle :: PrepQuery R () (Maybe UserId, Maybe Handle) selectUserHandle = "SELECT user, handle FROM user_handle" @@ -119,8 +119,8 @@ sourceActions Env {..} hmap = readUsersPage :: [UserId] -> IO [(UserId, Maybe Handle)] readUsersPage uids = - runClient envBrig $ - query selectUsers (params LocalQuorum (pure uids)) + runClient envBrig + $ query selectUsers (params LocalQuorum (pure uids)) selectUsers :: PrepQuery R (Identity [UserId]) (UserId, Maybe Handle) selectUsers = "SELECT id, handle FROM user WHERE id in ?" @@ -136,18 +136,18 @@ executeAction env = \case where setUserHandle :: Env -> UserId -> Handle -> IO () setUserHandle Env {..} uid handle = - runClient envBrig $ - Cas.write updateHandle $ - params LocalQuorum (handle, uid) + runClient envBrig + $ Cas.write updateHandle + $ params LocalQuorum (handle, uid) where updateHandle :: PrepQuery W (Handle, UserId) () updateHandle = {- `IF EXISTS`, but that requires benchmarking -} "UPDATE user SET handle = ? WHERE id = ?" removeHandle :: Env -> Handle -> IO () removeHandle Env {..} handle = - runClient envBrig $ - Cas.write deleteHandle $ - params LocalQuorum (pure handle) + runClient envBrig + $ Cas.write deleteHandle + $ params LocalQuorum (pure handle) where deleteHandle :: PrepQuery W (Identity Handle) () deleteHandle = "DELETE FROM user_handle WHERE handle = ?" @@ -157,35 +157,35 @@ runCommand env@Env {..} = do Log.info envLogger (Log.msg @Text "Loading all handles...") hmap <- readHandleMap env Log.info envLogger $ Log.msg @Text ("Processing team" <> (if envSettings ^. setDryRun then " (dry-run) " else " ") <> "...") - runConduit $ - sourceActions env hmap - .| C.iterM (handleAction env) - .| chunkify 100 - .| C.mapM_ (logSummary env) + runConduit + $ sourceActions env hmap + .| C.iterM (handleAction env) + .| chunkify 100 + .| C.mapM_ (logSummary env) Log.info envLogger $ Log.msg @Text "Done." where handleAction :: Env -> ActionResult -> IO () handleAction _env (Left err) = Log.err envLogger (Log.msg . show $ err) handleAction _env (Right action) = do Log.debug envLogger $ Log.msg (show $ action) - unless (envSettings ^. setDryRun) $ - executeAction env action + unless (envSettings ^. setDryRun) + $ executeAction env action logSummary :: Env -> [ActionResult] -> IO () logSummary _env results = do - Log.info envLogger $ - Log.msg $ - ("Action summary for batch" <> (if envSettings ^. setDryRun then " (dry-run) " else " ") <> ":\n") - <> T.intercalate - "\n" - ( let (nErrs, nReset, nSet, nNoOp) = foldl' tally (0, 0, 0, 0) results - in catMaybes - [ mark " error(!)" nErrs, - mark " reset original handle" nReset, - mark " set missing handle" nSet, - mark " do nothing" nNoOp - ] - ) + Log.info envLogger + $ Log.msg + $ ("Action summary for batch" <> (if envSettings ^. setDryRun then " (dry-run) " else " ") <> ":\n") + <> T.intercalate + "\n" + ( let (nErrs, nReset, nSet, nNoOp) = foldl' tally (0, 0, 0, 0) results + in catMaybes + [ mark " error(!)" nErrs, + mark " reset original handle" nReset, + mark " set missing handle" nSet, + mark " do nothing" nNoOp + ] + ) where mark :: Text -> Int -> Maybe Text mark msg n @@ -198,7 +198,7 @@ runCommand env@Env {..} = do tally (nErrs, nReset, nSet, nNoOp) (Right NoActionRequired {}) = (nErrs, nReset, nSet, nNoOp + 1) tally (nErrs, nReset, nSet, nNoOp) (Left _) = (nErrs + 1, nReset, nSet, nNoOp) - chunkify :: Monad m => Int -> ConduitT i [i] m () + chunkify :: (Monad m) => Int -> ConduitT i [i] m () chunkify n = void (C.map (: [])) .| C.chunksOfE n main :: IO () diff --git a/tools/db/service-backfill/src/Options.hs b/tools/db/service-backfill/src/Options.hs index a11d181a432..5def0624ed4 100644 --- a/tools/db/service-backfill/src/Options.hs +++ b/tools/db/service-backfill/src/Options.hs @@ -75,7 +75,8 @@ cassandraSettingsParser ks = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . view packed + <*> ( C.Keyspace + . view packed <$> strOption ( long ("cassandra-keyspace-" ++ ks) <> metavar "STRING" diff --git a/tools/db/service-backfill/src/Work.hs b/tools/db/service-backfill/src/Work.hs index 82ae367134e..f1067f58723 100644 --- a/tools/db/service-backfill/src/Work.hs +++ b/tools/db/service-backfill/src/Work.hs @@ -33,20 +33,20 @@ import UnliftIO.Async (pooledMapConcurrentlyN) runCommand :: Logger -> ClientState -> ClientState -> IO () runCommand l brig galley = - runConduit $ - zipSources + runConduit + $ zipSources (C.sourceList [(1 :: Int32) ..]) (transPipe (runClient galley) getUsers) - .| C.mapM - ( \(i, p) -> - Log.info l (Log.field "convs" (show (i * pageSize))) - >> pure p - ) - .| C.mapM (runClient galley . pooledMapConcurrentlyN 10 resolveBot) - .| C.concat - .| C.catMaybes - .| C.chunksOf 50 - .| C.mapM_ (runClient brig . writeBots) + .| C.mapM + ( \(i, p) -> + Log.info l (Log.field "convs" (show (i * pageSize))) + >> pure p + ) + .| C.mapM (runClient galley . pooledMapConcurrentlyN 10 resolveBot) + .| C.concat + .| C.catMaybes + .| C.chunksOf 50 + .| C.mapM_ (runClient brig . writeBots) pageSize :: Int32 pageSize = 1000 diff --git a/tools/fedcalls/src/Main.hs b/tools/fedcalls/src/Main.hs index 8c8775fa9a1..ad14e495706 100644 --- a/tools/fedcalls/src/Main.hs +++ b/tools/fedcalls/src/Main.hs @@ -103,7 +103,7 @@ filterCalls fedCall = <*> fmap pure (method fedCall) <*> pure (fedCalls fedCall) -parse :: HasFeds api => Proxy api -> [MakesCallTo] +parse :: (HasFeds api) => Proxy api -> [MakesCallTo] parse p = do fedCallM <- evalState (getFedCalls p) mempty fedCallI <- maybeToList $ filterCalls fedCallM diff --git a/tools/mlsstats/src/MlsStats/Options.hs b/tools/mlsstats/src/MlsStats/Options.hs index 251d9117eb7..30b564f91a8 100644 --- a/tools/mlsstats/src/MlsStats/Options.hs +++ b/tools/mlsstats/src/MlsStats/Options.hs @@ -81,7 +81,8 @@ cassandraSettingsParser = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . Text.pack + <*> ( C.Keyspace + . Text.pack <$> strOption ( long "brig-cassandra-keyspace" <> metavar "STRING" @@ -105,7 +106,8 @@ cassandraSettingsParser = <> value 9042 <> showDefault ) - <*> ( C.Keyspace . Text.pack + <*> ( C.Keyspace + . Text.pack <$> strOption ( long "galley-cassandra-keyspace" <> metavar "STRING" diff --git a/tools/mlsstats/src/MlsStats/Run.hs b/tools/mlsstats/src/MlsStats/Run.hs index 803ea8a7bb5..e0a71bdf287 100644 --- a/tools/mlsstats/src/MlsStats/Run.hs +++ b/tools/mlsstats/src/MlsStats/Run.hs @@ -82,7 +82,8 @@ runCommand s3 galleyTables brigTables queryPageSize = do logger <- newLogger Debug stderr let service = setEndpoint (s3.endpoint ^. awsSecure) (s3.endpoint ^. awsHost) (s3.endpoint ^. awsPort) defaultService - & service_s3AddressingStyle .~ s3.addressingStyle + & service_s3AddressingStyle + .~ s3.addressingStyle env <- maybe id (\reg e -> (e :: Env) {region = Region' reg}) s3.region . (\e -> e {logger = logger}) @@ -101,7 +102,7 @@ runCommand s3 galleyTables brigTables queryPageSize = do upload "domain-user-client-group.csv" (domainUserClientGroup galleyTables queryPageSize) upload "user-conv.csv" (userConv galleyTables queryPageSize) -userClient :: MonadIO m => ClientState -> Int32 -> ConduitT () ByteString m () +userClient :: (MonadIO m) => ClientState -> Int32 -> ConduitT () ByteString m () userClient cassandra queryPageSize = do yield "user,client\r\n" ( transPipe @@ -114,7 +115,7 @@ userClient cassandra queryPageSize = do userClientCql :: PrepQuery R () (UserId, ClientId) userClientCql = "SELECT user, client FROM clients" -convGroupTeamProtocol :: MonadIO m => ClientState -> Int32 -> ConduitT () ByteString m () +convGroupTeamProtocol :: (MonadIO m) => ClientState -> Int32 -> ConduitT () ByteString m () convGroupTeamProtocol cassandra queryPageSize = do yield "conversation,group,team,protocol\r\n" ( transPipe @@ -143,7 +144,7 @@ convGroupTeamProtocol cassandra queryPageSize = do A.String s -> s _ -> "?" -domainUserClientGroup :: MonadIO m => ClientState -> Int32 -> ConduitT () ByteString m () +domainUserClientGroup :: (MonadIO m) => ClientState -> Int32 -> ConduitT () ByteString m () domainUserClientGroup cassandra queryPageSize = do yield "user_domain,user,client,group\r\n" ( transPipe @@ -166,7 +167,7 @@ domainUserClientGroup cassandra queryPageSize = do domainUserClientGroupCql :: PrepQuery R () (Domain, UserId, ClientId, GroupId) domainUserClientGroupCql = "SELECT user_domain, user, client, group_id FROM mls_group_member_client" -userConv :: MonadIO m => ClientState -> Int32 -> ConduitT () ByteString m () +userConv :: (MonadIO m) => ClientState -> Int32 -> ConduitT () ByteString m () userConv cassandra queryPageSize = do yield "user,conversation\r\n" ( transPipe @@ -195,19 +196,20 @@ uploadStream env bucket key stream = do Right resp -> pure resp let uploadId' = createMultipartResp ^. createMultipartUploadResponse_uploadId parts <- - runConduit $ - stream - .| chunksOfE chunkSize - .| uploadParts env bucket key uploadId' 0 - .| mapC (uncurry newCompletedPart) - .| sinkList - void $ - send env $ - newCompleteMultipartUpload bucket key uploadId' - & completeMultipartUpload_multipartUpload - ?~ ( newCompletedMultipartUpload - & completedMultipartUpload_parts .~ nonEmpty parts - ) + runConduit + $ stream + .| chunksOfE chunkSize + .| uploadParts env bucket key uploadId' 0 + .| mapC (uncurry newCompletedPart) + .| sinkList + void + $ send env + $ newCompleteMultipartUpload bucket key uploadId' + & completeMultipartUpload_multipartUpload + ?~ ( newCompletedMultipartUpload + & completedMultipartUpload_parts + .~ nonEmpty parts + ) where chunkSize = 5 * 1024 * 1024 @@ -236,8 +238,10 @@ instance Cql ProtocolTag where fromCql (CqlInt i) = do let i' = fromIntegral i - if i' < fromEnum @ProtocolTag minBound - || i' > fromEnum @ProtocolTag maxBound + if i' + < fromEnum @ProtocolTag minBound + || i' + > fromEnum @ProtocolTag maxBound then Left $ "unexpected protocol: " ++ show i else Right $ toEnum i' fromCql _ = Left "protocol: int expected" diff --git a/tools/rabbitmq-consumer/src/RabbitMQConsumer/Lib.hs b/tools/rabbitmq-consumer/src/RabbitMQConsumer/Lib.hs index c5fb64196c8..4ee97a6a76b 100644 --- a/tools/rabbitmq-consumer/src/RabbitMQConsumer/Lib.hs +++ b/tools/rabbitmq-consumer/src/RabbitMQConsumer/Lib.hs @@ -218,8 +218,8 @@ instance FromJSON Body where where bodyToValue :: BL.ByteString -> Value bodyToValue bs = - fromMaybe (String . TL.toStrict . TL.decodeUtf8 $ bs) $ - decode @Value bs + fromMaybe (String . TL.toStrict . TL.decodeUtf8 $ bs) + $ decode @Value bs -- | A variant of 'BackendNotification' with a FromJSON instance for the body field -- that converts its BL.ByteString content to a JSON value so that it can be pretty printed diff --git a/tools/rex/Main.hs b/tools/rex/Main.hs index 12e9ad777c9..34401a8037e 100644 --- a/tools/rex/Main.hs +++ b/tools/rex/Main.hs @@ -356,7 +356,7 @@ getPeerConnectivityStats lgr seed dom = do Log.warn lgr . msg $ "Peer " <> show addr <> ":" <> show port <> " unreachable: " <> show e -serveIO :: MonadIO m => Opts -> IO RegistrySample -> m () +serveIO :: (MonadIO m) => Opts -> IO RegistrySample -> m () serveIO opts runSample = liftIO $ runSettings diff --git a/tools/stern/src/Stern/API.hs b/tools/stern/src/Stern/API.hs index 154b861e8ab..6dd1ad9643b 100644 --- a/tools/stern/src/Stern/API.hs +++ b/tools/stern/src/Stern/API.hs @@ -268,11 +268,11 @@ deleteTeam :: TeamId -> Maybe Bool -> Maybe Email -> Handler NoContent deleteTeam givenTid (fromMaybe False -> False) (Just email) = do acc <- Intra.getUserProfilesByIdentity (Left email) >>= handleNoUser . listToMaybe userTid <- (Intra.getUserBindingTeam . userId . accountUser $ acc) >>= handleNoTeam - when (givenTid /= userTid) $ - throwE bindingTeamMismatch + when (givenTid /= userTid) + $ throwE bindingTeamMismatch tInfo <- Intra.getTeamInfo givenTid - unless (length (tiMembers tInfo) == 1) $ - throwE wrongMemberCount + unless (length (tiMembers tInfo) == 1) + $ throwE wrongMemberCount NoContent <$ Intra.deleteBindingTeam givenTid where handleNoUser = ifNothing (mkError status404 "no-user" "No such user with that email") @@ -409,17 +409,17 @@ updateTeamBillingInfo tid update = do setTeamBillingInfo :: TeamId -> TeamBillingInfo -> Handler TeamBillingInfo setTeamBillingInfo tid billingInfo = do current <- Intra.getTeamBillingInfo tid - when (isJust current) $ - throwE (mkError status403 "existing-team" "Cannot set info on existing team, use update instead") + when (isJust current) + $ throwE (mkError status403 "existing-team" "Cannot set info on existing team, use update instead") Intra.setTeamBillingInfo tid billingInfo getTeamBillingInfo tid getConsentLog :: Email -> Handler ConsentLogAndMarketo getConsentLog e = do acc <- listToMaybe <$> Intra.getUserProfilesByIdentity (Left e) - when (isJust acc) $ - throwE $ - mkError status403 "user-exists" "Trying to access consent log of existing user!" + when (isJust acc) + $ throwE + $ mkError status403 "user-exists" "Trying to access consent log of existing user!" ConsentLogAndMarketo <$> Intra.getEmailConsentLog e <*> Intra.getMarketoResult e @@ -454,22 +454,24 @@ getUserData uid mMaxConvs mMaxNotifs = do `catchE` (pure . String . T.pack . show) ) em - pure . UserMetaInfo . KeyMap.fromList $ - [ "account" .= account, - "cookies" .= cookies, - "connections" .= conns, - "conversations" .= convs, - "clients" .= clts, - "notifications" .= notfs, - "consent" .= consent, - "consent_log" .= consentLog, - "marketo" .= marketo, - "properties" .= properties - ] + pure + . UserMetaInfo + . KeyMap.fromList + $ [ "account" .= account, + "cookies" .= cookies, + "connections" .= conns, + "conversations" .= convs, + "clients" .= clts, + "notifications" .= notfs, + "consent" .= consent, + "consent_log" .= consentLog, + "marketo" .= marketo, + "properties" .= properties + ] -- Utilities -instance FromByteString a => Servant.FromHttpApiData [a] where +instance (FromByteString a) => Servant.FromHttpApiData [a] where parseUrlPiece = maybe (Left "not a list of a's") (Right . fromList) . fromByteString' diff --git a/tools/stern/src/Stern/API/Routes.hs b/tools/stern/src/Stern/API/Routes.hs index 55113e85177..2af100fddc7 100644 --- a/tools/stern/src/Stern/API/Routes.hs +++ b/tools/stern/src/Stern/API/Routes.hs @@ -473,10 +473,10 @@ type SwaggerDocsAPI = SwaggerSchemaUI "swagger-ui" "swagger.json" swaggerDocs :: Servant.Server SwaggerDocsAPI swaggerDocs = - swaggerSchemaUIServer $ - toOpenApi (Proxy @SternAPI) - & S.info . S.title .~ "Stern API" - & cleanupSwagger + swaggerSchemaUIServer + $ toOpenApi (Proxy @SternAPI) + & S.info . S.title .~ "Stern API" + & cleanupSwagger ---------------------------------------------------------------------- -- helpers @@ -495,17 +495,24 @@ data UserConnectionGroups = UserConnectionGroups instance Schema.ToSchema UserConnectionGroups where schema = - Schema.object "UserConnectionGroups" $ - UserConnectionGroups - <$> ucgAccepted Schema..= Schema.field "ucgAccepted" Schema.schema - <*> ucgSent Schema..= Schema.field "ucgSent" Schema.schema - <*> ucgPending Schema..= Schema.field "ucgPending" Schema.schema - <*> ucgBlocked Schema..= Schema.field "ucgBlocked" Schema.schema - <*> ucgIgnored Schema..= Schema.field "ucgIgnored" Schema.schema - <*> ucgMissingLegalholdConsent Schema..= Schema.field "ucgMissingLegalholdConsent" Schema.schema - <*> ucgTotal Schema..= Schema.field "ucgTotal" Schema.schema + Schema.object "UserConnectionGroups" + $ UserConnectionGroups + <$> ucgAccepted + Schema..= Schema.field "ucgAccepted" Schema.schema + <*> ucgSent + Schema..= Schema.field "ucgSent" Schema.schema + <*> ucgPending + Schema..= Schema.field "ucgPending" Schema.schema + <*> ucgBlocked + Schema..= Schema.field "ucgBlocked" Schema.schema + <*> ucgIgnored + Schema..= Schema.field "ucgIgnored" Schema.schema + <*> ucgMissingLegalholdConsent + Schema..= Schema.field "ucgMissingLegalholdConsent" Schema.schema + <*> ucgTotal + Schema..= Schema.field "ucgTotal" Schema.schema -doubleMaybeToEither :: Monad m => LText -> Maybe a -> Maybe b -> ExceptT Error m (Either a b) +doubleMaybeToEither :: (Monad m) => LText -> Maybe a -> Maybe b -> ExceptT Error m (Either a b) doubleMaybeToEither _ (Just a) Nothing = pure $ Left a doubleMaybeToEither _ Nothing (Just b) = pure $ Right b doubleMaybeToEither msg _ _ = throwE $ mkError status400 "either-params" ("Must use exactly one of two query params: " <> msg) diff --git a/tools/stern/src/Stern/App.hs b/tools/stern/src/Stern/App.hs index 6042f6b88c5..3a75f308748 100644 --- a/tools/stern/src/Stern/App.hs +++ b/tools/stern/src/Stern/App.hs @@ -89,7 +89,7 @@ deriving instance MonadUnliftIO App type App = AppT IO -instance MonadIO m => MonadLogger (AppT m) where +instance (MonadIO m) => MonadLogger (AppT m) where log l m = do g <- view applog r <- view requestId @@ -98,12 +98,12 @@ instance MonadIO m => MonadLogger (AppT m) where instance MonadLogger (ExceptT e App) where log l m = lift (LC.log l m) -instance MonadIO m => Bilge.MonadHttp (AppT m) where +instance (MonadIO m) => Bilge.MonadHttp (AppT m) where handleRequestWithCont req h = do m <- view httpManager liftIO $ Bilge.withResponse req m h -instance Monad m => HasRequestId (AppT m) where +instance (Monad m) => HasRequestId (AppT m) where getRequestId = view requestId instance HasRequestId (ExceptT e App) where diff --git a/tools/stern/src/Stern/Types.hs b/tools/stern/src/Stern/Types.hs index 24dde504caa..0cd62b3c41b 100644 --- a/tools/stern/src/Stern/Types.hs +++ b/tools/stern/src/Stern/Types.hs @@ -47,11 +47,14 @@ newtype TeamMemberInfo = TeamMemberInfo {tm :: TeamMember} instance S.ToSchema TeamMemberInfo where schema = - S.object "TeamMemberInfo" $ - TeamMemberInfo - <$> tm S..= teamMemberObjectSchema - <* ((`hasPermission` SetBilling) . tm) S..= S.field "can_update_billing" S.schema - <* ((`hasPermission` GetBilling) . tm) S..= S.field "can_view_billing" S.schema + S.object "TeamMemberInfo" + $ TeamMemberInfo + <$> tm + S..= teamMemberObjectSchema + <* ((`hasPermission` SetBilling) . tm) + S..= S.field "can_update_billing" S.schema + <* ((`hasPermission` GetBilling) . tm) + S..= S.field "can_view_billing" S.schema data TeamInfo = TeamInfo { tiData :: TeamData, @@ -62,10 +65,12 @@ data TeamInfo = TeamInfo instance S.ToSchema TeamInfo where schema = - S.object "TeamInfo" $ - TeamInfo - <$> tiData S..= S.field "info" S.schema - <*> tiMembers S..= S.field "members" (S.array S.schema) + S.object "TeamInfo" + $ TeamInfo + <$> tiData + S..= S.field "info" S.schema + <*> tiMembers + S..= S.field "members" (S.array S.schema) data TeamAdminInfo = TeamAdminInfo { taData :: TeamData, @@ -78,12 +83,16 @@ data TeamAdminInfo = TeamAdminInfo instance S.ToSchema TeamAdminInfo where schema = - S.object "TeamAdminInfo" $ - TeamAdminInfo - <$> taData S..= S.field "data" S.schema - <*> taOwners S..= S.field "owners" (S.array S.schema) - <*> taAdmins S..= S.field "admins" (S.array S.schema) - <*> taMembers S..= S.field "total_members" S.schema + S.object "TeamAdminInfo" + $ TeamAdminInfo + <$> taData + S..= S.field "data" S.schema + <*> taOwners + S..= S.field "owners" (S.array S.schema) + <*> taAdmins + S..= S.field "admins" (S.array S.schema) + <*> taMembers + S..= S.field "total_members" S.schema toAdminInfo :: TeamInfo -> TeamAdminInfo toAdminInfo (TeamInfo d members) = @@ -124,10 +133,13 @@ newtype ConsentLog = ConsentLog instance Swagger.ToSchema ConsentLog where declareNamedSchema _ = - pure . Swagger.NamedSchema (Just "ConsentLog") $ - mempty - & Swagger.type_ ?~ Swagger.OpenApiObject - & Swagger.description ?~ "(object structure is not specified in this schema)" + pure + . Swagger.NamedSchema (Just "ConsentLog") + $ mempty + & Swagger.type_ + ?~ Swagger.OpenApiObject + & Swagger.description + ?~ "(object structure is not specified in this schema)" newtype ConsentValue = ConsentValue { unConsentValue :: Object @@ -149,10 +161,13 @@ deriveJSON toJSONFieldName ''ConsentLogAndMarketo instance Swagger.ToSchema ConsentLogAndMarketo where declareNamedSchema _ = - pure . Swagger.NamedSchema (Just "ConsentLogAndMarketo") $ - mempty - & Swagger.type_ ?~ Swagger.OpenApiObject - & Swagger.description ?~ "(object structure is not specified in this schema)" + pure + . Swagger.NamedSchema (Just "ConsentLogAndMarketo") + $ mempty + & Swagger.type_ + ?~ Swagger.OpenApiObject + & Swagger.description + ?~ "(object structure is not specified in this schema)" newtype UserMetaInfo = UserMetaInfo { unUserMetaInfo :: Object @@ -161,10 +176,13 @@ newtype UserMetaInfo = UserMetaInfo instance Swagger.ToSchema UserMetaInfo where declareNamedSchema _ = - pure . Swagger.NamedSchema (Just "UserMetaInfo") $ - mempty - & Swagger.type_ ?~ Swagger.OpenApiObject - & Swagger.description ?~ "(object structure is not specified in this schema)" + pure + . Swagger.NamedSchema (Just "UserMetaInfo") + $ mempty + & Swagger.type_ + ?~ Swagger.OpenApiObject + & Swagger.description + ?~ "(object structure is not specified in this schema)" newtype InvoiceId = InvoiceId {unInvoiceId :: Text} deriving (Eq, Show, ToByteString, FromByteString, ToJSON, FromJSON) @@ -193,16 +211,24 @@ data TeamBillingInfo = TeamBillingInfo instance S.ToSchema TeamBillingInfo where schema = - S.object "TeamBillingInfo" $ - TeamBillingInfo - <$> tbiFirstname S..= S.field "firstname" S.schema - <*> tbiLastname S..= S.field "lastname" S.schema - <*> tbiStreet S..= S.field "street" S.schema - <*> tbiZip S..= S.field "zip" S.schema - <*> tbiCity S..= S.field "city" S.schema - <*> tbiCountry S..= S.field "country" S.schema - <*> tbiCompany S..= S.maybe_ (S.optField "company" S.schema) - <*> tbiState S..= S.maybe_ (S.optField "state" S.schema) + S.object "TeamBillingInfo" + $ TeamBillingInfo + <$> tbiFirstname + S..= S.field "firstname" S.schema + <*> tbiLastname + S..= S.field "lastname" S.schema + <*> tbiStreet + S..= S.field "street" S.schema + <*> tbiZip + S..= S.field "zip" S.schema + <*> tbiCity + S..= S.field "city" S.schema + <*> tbiCountry + S..= S.field "country" S.schema + <*> tbiCompany + S..= S.maybe_ (S.optField "company" S.schema) + <*> tbiState + S..= S.maybe_ (S.optField "state" S.schema) data TeamBillingInfoUpdate = TeamBillingInfoUpdate { tbiuFirstname :: Maybe (Range 1 256 Text), @@ -219,15 +245,23 @@ data TeamBillingInfoUpdate = TeamBillingInfoUpdate instance S.ToSchema TeamBillingInfoUpdate where schema = - S.object "TeamBillingInfoUpdate" $ - TeamBillingInfoUpdate - <$> tbiuFirstname S..= tbiuField "firstname" - <*> tbiuLastname S..= tbiuField "lastname" - <*> tbiuStreet S..= tbiuField "street" - <*> tbiuZip S..= tbiuField "zip" - <*> tbiuCity S..= tbiuField "city" - <*> tbiuCountry S..= tbiuField "country" - <*> tbiuCompany S..= tbiuField "company" - <*> tbiuState S..= tbiuField "state" + S.object "TeamBillingInfoUpdate" + $ TeamBillingInfoUpdate + <$> tbiuFirstname + S..= tbiuField "firstname" + <*> tbiuLastname + S..= tbiuField "lastname" + <*> tbiuStreet + S..= tbiuField "street" + <*> tbiuZip + S..= tbiuField "zip" + <*> tbiuCity + S..= tbiuField "city" + <*> tbiuCountry + S..= tbiuField "country" + <*> tbiuCompany + S..= tbiuField "company" + <*> tbiuState + S..= tbiuField "state" where tbiuField fnm = S.maybe_ (S.optField fnm S.schema) diff --git a/tools/stern/test/integration/Main.hs b/tools/stern/test/integration/Main.hs index 3acef76603c..d9b79409088 100644 --- a/tools/stern/test/integration/Main.hs +++ b/tools/stern/test/integration/Main.hs @@ -68,9 +68,9 @@ instance IsOption ServiceConfigFile where ) runTests :: (String -> TestTree) -> IO () -runTests run = defaultMainWithIngredients ings $ - askOption $ - \(ServiceConfigFile c) -> run c +runTests run = defaultMainWithIngredients ings + $ askOption + $ \(ServiceConfigFile c) -> run c where ings = includingOptions diff --git a/tools/stern/test/integration/Util.hs b/tools/stern/test/integration/Util.hs index acfa6afa731..78a46aaab71 100644 --- a/tools/stern/test/integration/Util.hs +++ b/tools/stern/test/integration/Util.hs @@ -54,7 +54,7 @@ import Wire.API.User as User eventually :: (MonadIO m, MonadMask m, MonadUnliftIO m) => m a -> m a eventually = recoverAll (limitRetries 7 <> exponentialBackoff 50000) . const -createTeamWithNMembers :: HasCallStack => Int -> TestM (UserId, TeamId, [UserId]) +createTeamWithNMembers :: (HasCallStack) => Int -> TestM (UserId, TeamId, [UserId]) createTeamWithNMembers n = do (owner, tid) <- createBindingTeam mems <- replicateM n $ do @@ -62,64 +62,64 @@ createTeamWithNMembers n = do pure (mem ^. Team.userId) pure (owner, tid, mems) -createBindingTeam :: HasCallStack => TestM (UserId, TeamId) +createBindingTeam :: (HasCallStack) => TestM (UserId, TeamId) createBindingTeam = do first User.userId <$> createBindingTeam' -createBindingTeam' :: HasCallStack => TestM (User, TeamId) +createBindingTeam' :: (HasCallStack) => TestM (User, TeamId) createBindingTeam' = do owner <- randomTeamCreator' refreshIndex pure (owner, fromMaybe (error "createBindingTeam: no team id") (owner.userTeam)) -randomTeamCreator' :: HasCallStack => TestM User +randomTeamCreator' :: (HasCallStack) => TestM User randomTeamCreator' = randomUser'' True True True -randomUser :: HasCallStack => TestM UserId +randomUser :: (HasCallStack) => TestM UserId randomUser = qUnqualified <$> randomUser' False True True -randomUser' :: HasCallStack => Bool -> Bool -> Bool -> TestM (Qualified UserId) +randomUser' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM (Qualified UserId) randomUser' isCreator hasPassword hasEmail = userQualifiedId <$> randomUser'' isCreator hasPassword hasEmail -randomUser'' :: HasCallStack => Bool -> Bool -> Bool -> TestM User +randomUser'' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM User randomUser'' isCreator hasPassword hasEmail = selfUser <$> randomUserProfile' isCreator hasPassword hasEmail -randomUserProfile' :: HasCallStack => Bool -> Bool -> Bool -> TestM SelfProfile +randomUserProfile' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM SelfProfile randomUserProfile' isCreator hasPassword hasEmail = randomUserProfile'' isCreator hasPassword hasEmail <&> fst -randomUserProfile'' :: HasCallStack => Bool -> Bool -> Bool -> TestM (SelfProfile, (Email, Phone)) +randomUserProfile'' :: (HasCallStack) => Bool -> Bool -> Bool -> TestM (SelfProfile, (Email, Phone)) randomUserProfile'' isCreator hasPassword hasEmail = do b <- view tsBrig e <- liftIO randomEmail p <- liftIO randomPhone let pl = - object $ - ["name" .= fromEmail e] - <> ["password" .= defPassword | hasPassword] - <> ["email" .= fromEmail e | hasEmail] - <> ["phone" .= fromPhone p] - <> ["team" .= BindingNewTeam (newNewTeam (unsafeRange "teamName") DefaultIcon) | isCreator] + object + $ ["name" .= fromEmail e] + <> ["password" .= defPassword | hasPassword] + <> ["email" .= fromEmail e | hasEmail] + <> ["phone" .= fromPhone p] + <> ["team" .= BindingNewTeam (newNewTeam (unsafeRange "teamName") DefaultIcon) | isCreator] (,(e, p)) . responseJsonUnsafe <$> (post (b . path "/i/users" . Bilge.json pl) m Phone +randomPhone :: (MonadIO m) => m Phone randomPhone = liftIO $ do nrs <- map show <$> replicateM 14 (randomRIO (0, 9) :: IO Int) let phone = parsePhone . Text.pack $ "+0" ++ concat nrs pure $ fromMaybe (error "Invalid random phone#") phone -randomEmailUser :: HasCallStack => TestM (UserId, Email) +randomEmailUser :: (HasCallStack) => TestM (UserId, Email) randomEmailUser = randomUserProfile'' False False True <&> bimap (User.userId . selfUser) fst -randomPhoneUser :: HasCallStack => TestM (UserId, Phone) +randomPhoneUser :: (HasCallStack) => TestM (UserId, Phone) randomPhoneUser = randomUserProfile'' False False True <&> bimap (User.userId . selfUser) snd -randomEmailPhoneUser :: HasCallStack => TestM (UserId, (Email, Phone)) +randomEmailPhoneUser :: (HasCallStack) => TestM (UserId, (Email, Phone)) randomEmailPhoneUser = randomUserProfile'' False False True <&> first (User.userId . selfUser) defPassword :: PlainTextPassword8 defPassword = plainTextPassword8Unsafe "topsecretdefaultpassword" -randomEmail :: MonadIO m => m Email +randomEmail :: (MonadIO m) => m Email randomEmail = do uid <- liftIO nextRandom pure $ Email ("success+" <> UUID.toText uid) "simulator.amazonses.com" @@ -135,7 +135,7 @@ setHandle uid h = do !!! do const 200 === statusCode -randomHandle :: MonadIO m => m Text +randomHandle :: (MonadIO m) => m Text randomHandle = liftIO $ do nrs <- replicateM 21 (randomRIO (97, 122)) -- a-z pure (Text.pack (map chr nrs)) @@ -145,10 +145,10 @@ refreshIndex = do brig <- view tsBrig post (brig . path "/i/index/refresh") !!! const 200 === statusCode -addUserToTeam :: HasCallStack => UserId -> TeamId -> TestM TeamMember +addUserToTeam :: (HasCallStack) => UserId -> TeamId -> TestM TeamMember addUserToTeam = addUserToTeamWithRole Nothing -addUserToTeamWithRole :: HasCallStack => Maybe Role -> UserId -> TeamId -> TestM TeamMember +addUserToTeamWithRole :: (HasCallStack) => Maybe Role -> UserId -> TeamId -> TestM TeamMember addUserToTeamWithRole role inviter tid = do (inv, rsp2) <- addUserToTeamWithRole' role inviter tid let invitee :: User = responseJsonUnsafe rsp2 @@ -160,7 +160,7 @@ addUserToTeamWithRole role inviter tid = do liftIO $ assertEqual "Wrong cookie" (Just "zuid") (setCookieName <$> zuid) pure mem -addUserToTeamWithRole' :: HasCallStack => Maybe Role -> UserId -> TeamId -> TestM (Invitation, ResponseLBS) +addUserToTeamWithRole' :: (HasCallStack) => Maybe Role -> UserId -> TeamId -> TestM (Invitation, ResponseLBS) addUserToTeamWithRole' role inviter tid = do brig <- view tsBrig inviteeEmail <- randomEmail @@ -179,15 +179,16 @@ addUserToTeamWithRole' role inviter tid = do acceptInviteBody :: Email -> InvitationCode -> RequestBody acceptInviteBody email code = - RequestBodyLBS . encode $ - object + RequestBodyLBS + . encode + $ object [ "name" .= Name "bob", "email" .= fromEmail email, "password" .= defPassword, "team_code" .= code ] -getInvitationCode :: HasCallStack => TeamId -> InvitationId -> TestM InvitationCode +getInvitationCode :: (HasCallStack) => TeamId -> InvitationId -> TestM InvitationCode getInvitationCode t ref = do brig <- view tsBrig let getm :: TestM (Maybe InvitationCode) @@ -211,12 +212,12 @@ getInvitationCode t ref = do postInvitation :: TeamId -> UserId -> InvitationRequest -> TestM ResponseLBS postInvitation t u i = do brig <- view tsBrig - post $ - brig - . paths ["teams", toByteString' t, "invitations"] - . contentJson - . body (RequestBodyLBS $ encode i) - . zAuthAccess u "conn" + post + $ brig + . paths ["teams", toByteString' t, "invitations"] + . contentJson + . body (RequestBodyLBS $ encode i) + . zAuthAccess u "conn" zAuthAccess :: UserId -> ByteString -> (Request -> Request) zAuthAccess u conn = @@ -233,7 +234,7 @@ zConn = header "Z-Connection" zType :: ByteString -> Request -> Request zType = header "Z-Type" -getTeamMember :: HasCallStack => UserId -> TeamId -> UserId -> TestM TeamMember +getTeamMember :: (HasCallStack) => UserId -> TeamId -> UserId -> TestM TeamMember getTeamMember getter tid gettee = do g <- view tsGalley getTeamMember' g getter tid gettee diff --git a/tools/test-stats/Main.hs b/tools/test-stats/Main.hs index 7c97134cbbb..5650b07e737 100644 --- a/tools/test-stats/Main.hs +++ b/tools/test-stats/Main.hs @@ -161,11 +161,11 @@ pushToPostgresql opts (reports, failedRuns, successfulRuns) = do conn "INSERT INTO test_case_runs (name, test_suite_run_id, failure_count, success_count) VALUES (?,?,?,?) RETURNING id" [(testCase, suiteRunId, report.failure, report.success)] - void $ - executeMany conn "INSERT INTO test_case_failures (test_case_run_id, failure_log) VALUES (?,?)" $ - map (testCaseRunId,) report.failureDesc + void + $ executeMany conn "INSERT INTO test_case_failures (test_case_run_id, failure_log) VALUES (?,?)" + $ map (testCaseRunId,) report.failureDesc void $ MonoidalMap.traverseWithKey saveTestCaseRun reports -extractId :: HasCallStack => [Only Int] -> IO Int +extractId :: (HasCallStack) => [Only Int] -> IO Int extractId [] = error $ "No ID returned by query" extractId (Only x : _) = pure x