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