Update existing types & modules
parent
568afed458
commit
b6e4396138
|
@ -1,7 +1,7 @@
|
|||
module Internal.Api.Chain exposing
|
||||
( TaskChain, CompleteChain
|
||||
, IdemChain, toTask
|
||||
, fail, succeed
|
||||
, fail, succeed, andThen
|
||||
)
|
||||
|
||||
{-|
|
||||
|
@ -27,12 +27,12 @@ avoid leaking values passing through the API in unexpected ways.
|
|||
|
||||
## Operations
|
||||
|
||||
@docs fail, succeed
|
||||
@docs fail, succeed, andThen
|
||||
|
||||
-}
|
||||
|
||||
import Internal.Config.Log exposing (Log)
|
||||
import Internal.Values.Context as Context exposing (APIContext)
|
||||
import Internal.Values.Context exposing (APIContext)
|
||||
import Task
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Internal.Config.Leaks exposing
|
||||
( accessToken, baseUrl, transaction, versions
|
||||
( accessToken, baseUrl, field, transaction, versions
|
||||
, allLeaks
|
||||
)
|
||||
|
||||
|
@ -30,7 +30,7 @@ know 100% sure that the value isn't `Nothing`.
|
|||
|
||||
Just 5 |> Maybe.withDefault Leaks.number
|
||||
|
||||
@docs accessToken, baseUrl, transaction, versions
|
||||
@docs accessToken, baseUrl, field, transaction, versions
|
||||
|
||||
For safety purposes, all leaking values are stored in the following value:
|
||||
|
||||
|
@ -52,14 +52,15 @@ accessToken =
|
|||
-}
|
||||
allLeaks : Set String
|
||||
allLeaks =
|
||||
Set.union
|
||||
(Set.fromList versions)
|
||||
(Set.fromList
|
||||
Set.fromList
|
||||
[ accessToken
|
||||
, baseUrl
|
||||
, field
|
||||
, transaction
|
||||
, "elm-sdk-placeholder-versions-leaks" -- Old leaking value
|
||||
]
|
||||
)
|
||||
|> Set.union (Set.fromList versions.versions)
|
||||
|> Set.union versions.unstableFeatures
|
||||
|
||||
|
||||
{-| Placeholder base URL.
|
||||
|
@ -69,6 +70,13 @@ baseUrl =
|
|||
"elm-sdk-placeholder-baseurl-leaks.example.org"
|
||||
|
||||
|
||||
{-| Placeholder JSON field.
|
||||
-}
|
||||
field : String
|
||||
field =
|
||||
"elm-sdk-placeholder-json-field"
|
||||
|
||||
|
||||
{-| Placeholder transaction id.
|
||||
-}
|
||||
transaction : String
|
||||
|
@ -78,6 +86,8 @@ transaction =
|
|||
|
||||
{-| Placeholder versions list.
|
||||
-}
|
||||
versions : List String
|
||||
versions : { versions : List String, unstableFeatures : Set String }
|
||||
versions =
|
||||
[ "elm-sdk-placeholder-versions-leaks" ]
|
||||
{ versions = [ "elm-sdk-placeholder-versions-versions-leaks" ]
|
||||
, unstableFeatures = Set.singleton "elm-sdk-placeholder-versions-unstableFeatures-leaks"
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ fields :
|
|||
, password : Desc
|
||||
, refreshToken : Desc
|
||||
, username : Desc
|
||||
, serverName : Desc
|
||||
, transaction : Desc
|
||||
, versions : Desc
|
||||
}
|
||||
|
@ -342,6 +343,10 @@ fields =
|
|||
, username =
|
||||
[ "The username of the Matrix account."
|
||||
]
|
||||
, serverName =
|
||||
[ "The homeserver that the user is trying to communicate with."
|
||||
, "This name doesn't need to be the address. For example, the name might be `matrix.org` even though the homeserver is at a different location."
|
||||
]
|
||||
, transaction =
|
||||
[ "A unique identifier for a transaction initiated by the user."
|
||||
]
|
||||
|
|
|
@ -48,9 +48,11 @@ settings that can be adjusted manually.
|
|||
|
||||
-}
|
||||
|
||||
import Internal.Api.Request as Request
|
||||
import Internal.Config.Log exposing (Log)
|
||||
import Internal.Config.Text as Text
|
||||
import Internal.Tools.Json as Json
|
||||
import Internal.Values.Context as Context exposing (Context)
|
||||
import Internal.Values.Context as Context exposing (Context, Versions)
|
||||
import Internal.Values.Settings as Settings
|
||||
|
||||
|
||||
|
@ -70,10 +72,12 @@ type alias Envelope a =
|
|||
-}
|
||||
type EnvelopeUpdate a
|
||||
= ContentUpdate a
|
||||
| HttpRequest (Request.Request ( Request.Error, List Log ) ( EnvelopeUpdate a, List Log ))
|
||||
| More (List (EnvelopeUpdate a))
|
||||
| SetAccessToken String
|
||||
| SetBaseUrl String
|
||||
| SetRefreshToken String
|
||||
| SetVersions (List String)
|
||||
| SetVersions Versions
|
||||
|
||||
|
||||
{-| Settings value from
|
||||
|
@ -286,12 +290,18 @@ update updateContent eu ({ context } as data) =
|
|||
ContentUpdate v ->
|
||||
{ data | content = updateContent v data.content }
|
||||
|
||||
HttpRequest _ ->
|
||||
data
|
||||
|
||||
More items ->
|
||||
List.foldl (update updateContent) data items
|
||||
|
||||
SetAccessToken a ->
|
||||
{ data | context = { context | accessToken = Just a } }
|
||||
|
||||
SetBaseUrl b ->
|
||||
{ data | context = { context | baseUrl = Just b } }
|
||||
|
||||
SetRefreshToken r ->
|
||||
{ data | context = { context | refreshToken = Just r } }
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ based on new information provided by the Matrix API.
|
|||
-}
|
||||
type VaultUpdate
|
||||
= CreateRoomIfNotExists String
|
||||
| HttpRequest (Request.Request ( Request.Error, List Log ) ( VaultUpdate, List Log ))
|
||||
| MapRoom String Room.RoomUpdate
|
||||
| More (List VaultUpdate)
|
||||
| SetAccountData String Json.Value
|
||||
|
@ -129,11 +128,6 @@ update vu vault =
|
|||
(Maybe.withDefault (Room.init roomId) >> Maybe.Just)
|
||||
vault
|
||||
|
||||
-- The HTTP request currently isn't used anywhere other than for
|
||||
-- auditing the requests that the Vault is making
|
||||
HttpRequest _ ->
|
||||
vault
|
||||
|
||||
MapRoom roomId ru ->
|
||||
mapRoom roomId (Room.update ru) vault
|
||||
|
||||
|
|
Loading…
Reference in New Issue