Compare commits
No commits in common. "1ed9fa7d22a04ad231a16a0880945d191f977665" and "f3799add8798cb593f657d62c8fbd1b7481bbf08" have entirely different histories.
1ed9fa7d22
...
f3799add87
2
elm.json
2
elm.json
|
@ -3,7 +3,7 @@
|
||||||
"name": "noordstar/elm-matrix-sdk-beta",
|
"name": "noordstar/elm-matrix-sdk-beta",
|
||||||
"summary": "Matrix SDK for instant communication. Unstable beta version for testing only.",
|
"summary": "Matrix SDK for instant communication. Unstable beta version for testing only.",
|
||||||
"license": "EUPL-1.1",
|
"license": "EUPL-1.1",
|
||||||
"version": "3.4.0",
|
"version": "3.3.1",
|
||||||
"exposed-modules": [
|
"exposed-modules": [
|
||||||
"Matrix",
|
"Matrix",
|
||||||
"Matrix.Event",
|
"Matrix.Event",
|
||||||
|
|
|
@ -13,6 +13,7 @@ This module looks for the right homeserver address.
|
||||||
|
|
||||||
import Internal.Api.Chain as C
|
import Internal.Api.Chain as C
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
|
import Internal.Config.Leaks as L
|
||||||
import Internal.Config.Log exposing (log)
|
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
|
||||||
|
|
|
@ -204,7 +204,7 @@ getEventCoderV1 =
|
||||||
[ "UnsignedData as described by the Matrix spec"
|
[ "UnsignedData as described by the Matrix spec"
|
||||||
, "https://spec.matrix.org/v1.10/client-server-api/#get_matrixclientv3roomsroomideventeventid"
|
, "https://spec.matrix.org/v1.10/client-server-api/#get_matrixclientv3roomsroomideventeventid"
|
||||||
]
|
]
|
||||||
, init = \a b c d -> Event.UnsignedData { age = a, membership = Nothing, prevContent = b, redactedBecause = c, transactionId = d }
|
, init = \a b c d -> Event.UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
|
||||||
}
|
}
|
||||||
(Json.field.optional.value
|
(Json.field.optional.value
|
||||||
{ fieldName = "age"
|
{ fieldName = "age"
|
||||||
|
|
|
@ -13,6 +13,7 @@ This module allows the user to log in using a username and password.
|
||||||
|
|
||||||
import Internal.Api.Api as A
|
import Internal.Api.Api as A
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
|
import Internal.Config.Leaks as L
|
||||||
import Internal.Config.Log exposing (log)
|
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
|
||||||
|
|
|
@ -13,6 +13,7 @@ This module helps send message events to rooms on the Matrix API.
|
||||||
|
|
||||||
import Internal.Api.Api as A
|
import Internal.Api.Api as A
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
|
import Internal.Config.Leaks as L
|
||||||
import Internal.Config.Log exposing (log)
|
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
|
||||||
|
|
|
@ -12,6 +12,7 @@ This API module represents the /sync endpoint on Matrix spec version v1.11.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import FastDict as Dict exposing (Dict)
|
import FastDict as Dict exposing (Dict)
|
||||||
|
import Internal.Api.Sync.V3 as PV
|
||||||
import Internal.Config.Log exposing (Log, log)
|
import Internal.Config.Log exposing (Log, log)
|
||||||
import Internal.Config.Text as Text
|
import Internal.Config.Text as Text
|
||||||
import Internal.Filter.Timeline exposing (Filter)
|
import Internal.Filter.Timeline exposing (Filter)
|
||||||
|
|
|
@ -29,7 +29,7 @@ will assume until overriden by the user.
|
||||||
-}
|
-}
|
||||||
currentVersion : String
|
currentVersion : String
|
||||||
currentVersion =
|
currentVersion =
|
||||||
"beta 3.4.0"
|
"beta 3.3.1"
|
||||||
|
|
||||||
|
|
||||||
{-| The default device name that is being communicated with the Matrix API.
|
{-| The default device name that is being communicated with the Matrix API.
|
||||||
|
|
|
@ -189,20 +189,21 @@ ipv6RightParser n =
|
||||||
|. P.symbol ":"
|
|. P.symbol ":"
|
||||||
|
|
||||||
|
|
||||||
|
{-| Convert an IPv6 address to a readable string format
|
||||||
|
-}
|
||||||
|
ipv6ToString : IPv6Address -> String
|
||||||
|
ipv6ToString { front, back } =
|
||||||
|
(if List.length front == 8 then
|
||||||
|
front
|
||||||
|
|
||||||
-- {-| Convert an IPv6 address to a readable string format
|
else if List.length back == 8 then
|
||||||
-- -}
|
back
|
||||||
-- ipv6ToString : IPv6Address -> String
|
|
||||||
-- ipv6ToString { front, back } =
|
else
|
||||||
-- (if List.length front == 8 then
|
List.concat [ front, [ "" ], back ]
|
||||||
-- front
|
)
|
||||||
-- else if List.length back == 8 then
|
|> List.intersperse ":"
|
||||||
-- back
|
|> String.concat
|
||||||
-- else
|
|
||||||
-- List.concat [ front, [ "" ], back ]
|
|
||||||
-- )
|
|
||||||
-- |> List.intersperse ":"
|
|
||||||
-- |> String.concat
|
|
||||||
|
|
||||||
|
|
||||||
portParser : Parser Int
|
portParser : Parser Int
|
||||||
|
|
|
@ -477,14 +477,13 @@ iddict (Coder old) =
|
||||||
Coder
|
Coder
|
||||||
{ encoder = Iddict.encode old.encoder
|
{ encoder = Iddict.encode old.encoder
|
||||||
, decoder =
|
, decoder =
|
||||||
Iddict.decoder old.decoder
|
D.andThen
|
||||||
|> D.map
|
(\( out, logs ) ->
|
||||||
(\out ->
|
D.succeed out
|
||||||
( Iddict.map (always Tuple.first) out
|
|> Iddict.decoder
|
||||||
, Iddict.values out
|
|> D.map (\o -> ( o, logs ))
|
||||||
|> List.concatMap Tuple.second
|
)
|
||||||
)
|
old.decoder
|
||||||
)
|
|
||||||
, docs = DocsIddict old.docs
|
, docs = DocsIddict old.docs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ import Internal.Config.Text as Text
|
||||||
import Internal.Tools.Hashdict as Hashdict exposing (Hashdict)
|
import Internal.Tools.Hashdict as Hashdict exposing (Hashdict)
|
||||||
import Internal.Tools.Json as Json
|
import Internal.Tools.Json as Json
|
||||||
import Internal.Tools.Timestamp as Timestamp exposing (Timestamp)
|
import Internal.Tools.Timestamp as Timestamp exposing (Timestamp)
|
||||||
|
import Json.Encode as E
|
||||||
import Set exposing (Set)
|
import Set exposing (Set)
|
||||||
import Time
|
import Time
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ import Internal.Values.Event as Event exposing (Event)
|
||||||
import Internal.Values.StateManager as StateManager exposing (StateManager)
|
import Internal.Values.StateManager as StateManager exposing (StateManager)
|
||||||
import Internal.Values.Timeline as Timeline exposing (Timeline)
|
import Internal.Values.Timeline as Timeline exposing (Timeline)
|
||||||
import Internal.Values.User exposing (User)
|
import Internal.Values.User exposing (User)
|
||||||
|
import Json.Encode as E
|
||||||
import Recursion
|
import Recursion
|
||||||
import Recursion.Fold
|
import Recursion.Fold
|
||||||
|
|
||||||
|
|
|
@ -678,21 +678,20 @@ mostRecentFrom filter timeline ptr =
|
||||||
{ ptr = ptr, visited = Set.empty }
|
{ ptr = ptr, visited = Set.empty }
|
||||||
|
|
||||||
|
|
||||||
|
{-| Recount the Timeline's amount of filled batches. Since the Timeline
|
||||||
-- {-| Recount the Timeline's amount of filled batches. Since the Timeline
|
automatically tracks the count on itself, this is generally exclusively used in
|
||||||
-- automatically tracks the count on itself, this is generally exclusively used in
|
specific scenarios like decoding JSON values.
|
||||||
-- specific scenarios like decoding JSON values.
|
-}
|
||||||
-- -}
|
recountFilledBatches : Timeline -> Timeline
|
||||||
-- recountFilledBatches : Timeline -> Timeline
|
recountFilledBatches (Timeline tl) =
|
||||||
-- recountFilledBatches (Timeline tl) =
|
Timeline
|
||||||
-- Timeline
|
{ tl
|
||||||
-- { tl
|
| filledBatches =
|
||||||
-- | filledBatches =
|
tl.batches
|
||||||
-- tl.batches
|
|> Iddict.values
|
||||||
-- |> Iddict.values
|
|> List.filter (\v -> v.events /= [])
|
||||||
-- |> List.filter (\v -> v.events /= [])
|
|> List.length
|
||||||
-- |> List.length
|
}
|
||||||
-- }
|
|
||||||
|
|
||||||
|
|
||||||
{-| Create a timeline with a single batch inserted. This batch is considered the
|
{-| Create a timeline with a single batch inserted. This batch is considered the
|
||||||
|
|
|
@ -3,7 +3,6 @@ module Internal.Values.Vault exposing
|
||||||
, VaultUpdate(..), update
|
, VaultUpdate(..), update
|
||||||
, rooms, fromRoomId, mapRoom, updateRoom
|
, rooms, fromRoomId, mapRoom, updateRoom
|
||||||
, getAccountData, setAccountData
|
, getAccountData, setAccountData
|
||||||
, coder
|
|
||||||
)
|
)
|
||||||
|
|
||||||
{-| This module hosts the Vault module. The Vault is the data type storing all
|
{-| This module hosts the Vault module. The Vault is the data type storing all
|
||||||
|
@ -31,11 +30,6 @@ Rooms are environments where people can have a conversation with each other.
|
||||||
|
|
||||||
@docs getAccountData, setAccountData
|
@docs getAccountData, setAccountData
|
||||||
|
|
||||||
|
|
||||||
## JSON
|
|
||||||
|
|
||||||
@docs coder
|
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import FastDict as Dict exposing (Dict)
|
import FastDict as Dict exposing (Dict)
|
||||||
|
@ -71,8 +65,6 @@ type VaultUpdate
|
||||||
| SetUser User
|
| SetUser User
|
||||||
|
|
||||||
|
|
||||||
{-| Convert a Vault to and from a JSON object.
|
|
||||||
-}
|
|
||||||
coder : Json.Coder Vault
|
coder : Json.Coder Vault
|
||||||
coder =
|
coder =
|
||||||
Json.object4
|
Json.object4
|
||||||
|
|
|
@ -5,6 +5,8 @@ import Fuzz exposing (Fuzzer)
|
||||||
import Internal.Config.Leaks as Leaks
|
import Internal.Config.Leaks as Leaks
|
||||||
import Internal.Tools.Hashdict as Hashdict
|
import Internal.Tools.Hashdict as Hashdict
|
||||||
import Internal.Values.Context as Context exposing (Context, Versions)
|
import Internal.Values.Context as Context exposing (Context, Versions)
|
||||||
|
import Json.Decode as D
|
||||||
|
import Json.Encode as E
|
||||||
import Set
|
import Set
|
||||||
import Test exposing (..)
|
import Test exposing (..)
|
||||||
import Test.Tools.Timestamp as TestTimestamp
|
import Test.Tools.Timestamp as TestTimestamp
|
||||||
|
@ -17,15 +19,12 @@ fuzzer =
|
||||||
maybeString =
|
maybeString =
|
||||||
Fuzz.maybe Fuzz.string
|
Fuzz.maybe Fuzz.string
|
||||||
in
|
in
|
||||||
Fuzz.map8 (\a b c d ( e, f ) ( g, h ) ( i, j ) ( k, l ) -> Context a b c d e f g h i j k l)
|
Fuzz.map8 (\a b c d e ( f, g ) ( h, i ) ( j, k ) -> Context a b c d e f g h i j k)
|
||||||
(Fuzz.constant <| Hashdict.empty .value)
|
(Fuzz.constant <| Hashdict.empty .value)
|
||||||
maybeString
|
maybeString
|
||||||
maybeString
|
maybeString
|
||||||
|
(Fuzz.maybe TestTimestamp.fuzzer)
|
||||||
maybeString
|
maybeString
|
||||||
(Fuzz.pair
|
|
||||||
(Fuzz.maybe TestTimestamp.fuzzer)
|
|
||||||
maybeString
|
|
||||||
)
|
|
||||||
(Fuzz.pair
|
(Fuzz.pair
|
||||||
maybeString
|
maybeString
|
||||||
Fuzz.string
|
Fuzz.string
|
||||||
|
|
|
@ -3,7 +3,10 @@ module Test.Values.Envelope exposing (..)
|
||||||
import Expect
|
import Expect
|
||||||
import Fuzz exposing (Fuzzer)
|
import Fuzz exposing (Fuzzer)
|
||||||
import Internal.Config.Default as Default
|
import Internal.Config.Default as Default
|
||||||
|
import Internal.Tools.Json as Json
|
||||||
import Internal.Values.Envelope as Envelope exposing (Envelope)
|
import Internal.Values.Envelope as Envelope exposing (Envelope)
|
||||||
|
import Json.Decode as D
|
||||||
|
import Json.Encode as E
|
||||||
import Test exposing (..)
|
import Test exposing (..)
|
||||||
import Test.Values.Context as TestContext
|
import Test.Values.Context as TestContext
|
||||||
import Test.Values.Settings as TestSettings
|
import Test.Values.Settings as TestSettings
|
||||||
|
|
|
@ -41,18 +41,16 @@ fuzzerState =
|
||||||
|
|
||||||
unsignedDataFuzzer : Fuzzer Event.UnsignedData
|
unsignedDataFuzzer : Fuzzer Event.UnsignedData
|
||||||
unsignedDataFuzzer =
|
unsignedDataFuzzer =
|
||||||
Fuzz.map5
|
Fuzz.map4
|
||||||
(\age memb prev redact trans ->
|
(\age prev redact trans ->
|
||||||
Event.UnsignedData
|
Event.UnsignedData
|
||||||
{ age = age
|
{ age = age
|
||||||
, membership = memb
|
|
||||||
, prevContent = prev
|
, prevContent = prev
|
||||||
, redactedBecause = redact
|
, redactedBecause = redact
|
||||||
, transactionId = trans
|
, transactionId = trans
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
(Fuzz.maybe Fuzz.int)
|
(Fuzz.maybe Fuzz.int)
|
||||||
(Fuzz.maybe Fuzz.string)
|
|
||||||
(Fuzz.maybe valueFuzzer)
|
(Fuzz.maybe valueFuzzer)
|
||||||
(Fuzz.maybe <| Fuzz.lazy (\_ -> fuzzer))
|
(Fuzz.maybe <| Fuzz.lazy (\_ -> fuzzer))
|
||||||
(Fuzz.maybe Fuzz.string)
|
(Fuzz.maybe Fuzz.string)
|
||||||
|
|
|
@ -4,6 +4,8 @@ import Fuzz exposing (Fuzzer)
|
||||||
import Internal.Values.Room as Room exposing (Room)
|
import Internal.Values.Room as Room exposing (Room)
|
||||||
import Json.Encode as E
|
import Json.Encode as E
|
||||||
import Test exposing (..)
|
import Test exposing (..)
|
||||||
|
import Test.Filter.Timeline as TestFilter
|
||||||
|
import Test.Values.Event as TestEvent
|
||||||
|
|
||||||
|
|
||||||
placeholderValue : E.Value
|
placeholderValue : E.Value
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Test exposing (..)
|
||||||
|
|
||||||
fuzzer : Fuzzer Settings
|
fuzzer : Fuzzer Settings
|
||||||
fuzzer =
|
fuzzer =
|
||||||
Fuzz.map5 Settings
|
Fuzz.map4 Settings
|
||||||
(Fuzz.oneOf
|
(Fuzz.oneOf
|
||||||
[ Fuzz.constant Default.currentVersion
|
[ Fuzz.constant Default.currentVersion
|
||||||
, Fuzz.string
|
, Fuzz.string
|
||||||
|
@ -22,7 +22,6 @@ fuzzer =
|
||||||
, Fuzz.string
|
, Fuzz.string
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
(Fuzz.maybe Fuzz.string)
|
|
||||||
(Fuzz.oneOf
|
(Fuzz.oneOf
|
||||||
[ Fuzz.constant Default.removePasswordOnLogin
|
[ Fuzz.constant Default.removePasswordOnLogin
|
||||||
, Fuzz.bool
|
, Fuzz.bool
|
||||||
|
|
|
@ -6,7 +6,6 @@ import Internal.Filter.Timeline as Filter
|
||||||
import Internal.Tools.Json as Json
|
import Internal.Tools.Json as Json
|
||||||
import Internal.Values.Timeline as Timeline exposing (Batch, Timeline)
|
import Internal.Values.Timeline as Timeline exposing (Batch, Timeline)
|
||||||
import Json.Decode as D
|
import Json.Decode as D
|
||||||
import Json.Encode as E
|
|
||||||
import Test exposing (..)
|
import Test exposing (..)
|
||||||
import Test.Filter.Timeline as TestFilter
|
import Test.Filter.Timeline as TestFilter
|
||||||
|
|
||||||
|
@ -251,8 +250,7 @@ suite =
|
||||||
(\timeline ->
|
(\timeline ->
|
||||||
timeline
|
timeline
|
||||||
|> Json.encode Timeline.coder
|
|> Json.encode Timeline.coder
|
||||||
|> E.encode 0
|
|> D.decodeValue (Json.decode Timeline.coder)
|
||||||
|> D.decodeString (Json.decode Timeline.coder)
|
|
||||||
|> Result.map Tuple.first
|
|> Result.map Tuple.first
|
||||||
|> Result.map (Timeline.mostRecentEvents Filter.pass)
|
|> Result.map (Timeline.mostRecentEvents Filter.pass)
|
||||||
|> Expect.equal (Ok <| Timeline.mostRecentEvents Filter.pass timeline)
|
|> Expect.equal (Ok <| Timeline.mostRecentEvents Filter.pass timeline)
|
||||||
|
|
Loading…
Reference in New Issue