diff --git a/Directory.Build.props b/Directory.Build.props index 43edebd30..65515b6e1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,10 +2,10 @@ @jet @moneylion @bartelink @eiriktsarpalis and contributors Jet.com - Sleek, composable event sourcing componentry + Efficient event sourced decisions and data https://github.com/jet/equinox eventsourcing eventstore fsharp fscodec cosmosdb dynamodb eventstoredb postgres sqlserver - Apache-2.0 + Apache-2.0 Copyright © 2016-23 5 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c5a1961a6..5c1e97b25 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,11 +48,6 @@ jobs: pool: vmImage: 'macOS-latest' steps: - - task: UseDotNet@2 - displayName: 'Install .NET Core sdk' - inputs: - packageType: sdk - version: 6.x - script: dotnet test build.proj -v n displayName: dotnet test build.proj env: diff --git a/samples/Store/Domain.Tests/Domain.Tests.fsproj b/samples/Store/Domain.Tests/Domain.Tests.fsproj index 2dee0241b..4081e8e92 100644 --- a/samples/Store/Domain.Tests/Domain.Tests.fsproj +++ b/samples/Store/Domain.Tests/Domain.Tests.fsproj @@ -17,10 +17,10 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/samples/Store/Domain/Domain.fsproj b/samples/Store/Domain/Domain.fsproj index 9808cd2f6..36d696bd7 100644 --- a/samples/Store/Domain/Domain.fsproj +++ b/samples/Store/Domain/Domain.fsproj @@ -17,8 +17,8 @@ - - + + diff --git a/samples/Store/Integration/CodecIntegration.fs b/samples/Store/Integration/CodecIntegration.fs index e602229f8..3d3a010a3 100644 --- a/samples/Store/Integration/CodecIntegration.fs +++ b/samples/Store/Integration/CodecIntegration.fs @@ -28,12 +28,12 @@ type SimpleDu = interface IUnionContract let render = function - | EventA { id = id } -> sprintf """{"id":"%O"}""" id - | EventB { age = None } -> sprintf "{\"age\":null}" - | EventB { age = Some age } -> sprintf """{"age":%d}""" age - | EventC { value = I { i = i } } -> sprintf """{"value":{"case":"I","i":%d}}""" i - | EventC { value = S { maybeI = None } } -> sprintf """{"value":{"case":"S","maybeI":null}}""" - | EventC { value = S { maybeI = Some i } } -> sprintf """{"value":{"case":"S","maybeI":%d}}""" i + | EventA { id = id } -> $"""{{"id":"{id}"}}""" + | EventB { age = None } -> "{\"age\":null}" + | EventB { age = Some age } -> $"""{{"age":%d{age}}}""" + | EventC { value = I { i = i } } -> $"""{{"value":{{"case":"I","i":%d{i}}}}}""" + | EventC { value = S { maybeI = None } } -> """{"value":{"case":"S","maybeI":null}}""" + | EventC { value = S { maybeI = Some i } } -> $"""{{"value":{{"case":"S","maybeI":%d{i}}}}}""" | EventD -> null //| EventE i -> string i //| EventF s -> Newtonsoft.Json.JsonConvert.SerializeObject s @@ -46,5 +46,5 @@ let ``Can roundtrip, rendering correctly`` (x: SimpleDu) = let d = serialized.Data render x =! if d.IsEmpty then null else System.Text.Encoding.UTF8.GetString(d.Span) let adapted = FsCodec.Core.TimelineEvent.Create(-1L, serialized) - let deserialized = codec.TryDecode adapted |> ValueOption.get + let deserialized = codec.Decode adapted |> ValueOption.get deserialized =! x diff --git a/samples/Store/Integration/Integration.fsproj b/samples/Store/Integration/Integration.fsproj index 501d81d4e..a62376205 100644 --- a/samples/Store/Integration/Integration.fsproj +++ b/samples/Store/Integration/Integration.fsproj @@ -25,12 +25,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/samples/Tutorial/Tutorial.fsproj b/samples/Tutorial/Tutorial.fsproj index da41e3178..4600f5feb 100644 --- a/samples/Tutorial/Tutorial.fsproj +++ b/samples/Tutorial/Tutorial.fsproj @@ -28,7 +28,7 @@ - + diff --git a/src/Equinox.CosmosStore/CosmosStore.fs b/src/Equinox.CosmosStore/CosmosStore.fs index 86164f321..e0272effd 100644 --- a/src/Equinox.CosmosStore/CosmosStore.fs +++ b/src/Equinox.CosmosStore/CosmosStore.fs @@ -1071,13 +1071,13 @@ type internal StoreCategory<'event, 'state, 'req> checkUnfolds, compressUnfolds, mapUnfolds: Choice 'state -> 'event[], 'event[] -> 'state -> 'event[] * 'event[]>) = let fold s xs = (fold : Func<'state, 'event[], 'state>).Invoke(s, xs) let reload (log, streamName, (Token.Unpack pos as streamToken), state) preloaded ct: Task = task { - match! store.Reload(log, (streamName, pos), (codec.TryDecode, isOrigin), ct, ?preview = preloaded) with + match! store.Reload(log, (streamName, pos), (codec.Decode, isOrigin), ct, ?preview = preloaded) with | LoadFromTokenResult.Unchanged -> return struct (streamToken, state) | LoadFromTokenResult.Found (token', events) -> return token', fold state events } interface ICategory<'event, 'state, 'req> with member _.Empty = Token.create Position.fromKnownEmpty, initial member _.Load(log, _categoryName, _streamId, stream, _maxAge, _requireLeader, ct): Task = task { - let! token, events = store.Load(log, (stream, None), (codec.TryDecode, isOrigin), checkUnfolds, ct) + let! token, events = store.Load(log, (stream, None), (codec.Decode, isOrigin), checkUnfolds, ct) return struct (token, fold initial events) } member _.Sync(log, _categoryName, _streamId, streamName, req, (Token.Unpack pos as streamToken), state, events, ct) = task { let state' = fold state events diff --git a/src/Equinox.DynamoStore/DynamoStore.fs b/src/Equinox.DynamoStore/DynamoStore.fs index 6cb253eab..842c7255a 100644 --- a/src/Equinox.DynamoStore/DynamoStore.fs +++ b/src/Equinox.DynamoStore/DynamoStore.fs @@ -1119,13 +1119,13 @@ type internal StoreCategory<'event, 'state, 'req> let fold s xs = (fold : Func<'state, 'event[], 'state>).Invoke(s, xs) let fetch state f = task { let! token', events = f in return struct (token', fold state events) } let reload (log, streamNam, requireLeader, (Token.Unpack pos as streamToken), state) ct: Task = task { - match! store.Reload(log, (streamNam, pos), requireLeader, (codec.TryDecode, isOrigin), ct) with + match! store.Reload(log, (streamNam, pos), requireLeader, (codec.Decode, isOrigin), ct) with | LoadFromTokenResult.Unchanged -> return struct (streamToken, state) | LoadFromTokenResult.Found (token', events) -> return token', fold state events } interface ICategory<'event, 'state, 'req> with member _.Empty = Token.empty, initial member _.Load(log, _categoryName, _streamId, streamName, _maxAge, requireLeader, ct) = - fetch initial (store.Load(log, (streamName, None), requireLeader, (codec.TryDecode, isOrigin), checkUnfolds, ct)) + fetch initial (store.Load(log, (streamName, None), requireLeader, (codec.Decode, isOrigin), checkUnfolds, ct)) member _.Sync(log, _categoryName, _streamId, streamName, req, (Token.Unpack pos as streamToken), state, events, ct) = task { let state' = fold state events let exp, events, eventsEncoded, unfoldsEncoded = diff --git a/src/Equinox.EventStore/EventStore.fs b/src/Equinox.EventStore/EventStore.fs index 1220e86b9..9bdba4aa9 100755 --- a/src/Equinox.EventStore/EventStore.fs +++ b/src/Equinox.EventStore/EventStore.fs @@ -440,7 +440,7 @@ type private CompactionContext(eventsLen: int, capacityBeforeCompaction: int) = type private StoreCategory<'event, 'state, 'req>(context: EventStoreContext, codec: FsCodec.IEventCodec<_, _, 'req>, fold, initial, access) = let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) - let tryDecode (e: ResolvedEvent) = e |> UnionEncoderAdapters.encodedEventOfResolvedEvent |> codec.TryDecode + let tryDecode (e: ResolvedEvent) = e |> UnionEncoderAdapters.encodedEventOfResolvedEvent |> codec.Decode let isOrigin = match access with | AccessStrategy.Unoptimized | AccessStrategy.LatestKnownEvent -> fun _ -> true diff --git a/src/Equinox.EventStoreDb/EventStoreDb.fs b/src/Equinox.EventStoreDb/EventStoreDb.fs index 561b82935..966a486a8 100644 --- a/src/Equinox.EventStoreDb/EventStoreDb.fs +++ b/src/Equinox.EventStoreDb/EventStoreDb.fs @@ -382,7 +382,7 @@ type private CompactionContext(eventsLen: int, capacityBeforeCompaction: int) = type private StoreCategory<'event, 'state, 'req>(context: EventStoreContext, codec: FsCodec.IEventCodec<_, _, 'req>, fold, initial, access) = let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) - let tryDecode (e: ResolvedEvent) = e.Event |> ClientCodec.timelineEvent |> codec.TryDecode + let tryDecode (e: ResolvedEvent) = e.Event |> ClientCodec.timelineEvent |> codec.Decode let isOrigin = match access with | AccessStrategy.Unoptimized | AccessStrategy.LatestKnownEvent -> fun _ -> true diff --git a/src/Equinox.MemoryStore/MemoryStore.fs b/src/Equinox.MemoryStore/MemoryStore.fs index eef4a62c5..d108c205d 100644 --- a/src/Equinox.MemoryStore/MemoryStore.fs +++ b/src/Equinox.MemoryStore/MemoryStore.fs @@ -51,7 +51,7 @@ type VolatileStore<'Format>() = type private StoreCategory<'event, 'state, 'req, 'Format>(store: VolatileStore<'Format>, codec, fold, initial) = let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) let res version state events = struct ({ value = null; version = version; streamBytes = -1 }, fold state events) - let decode events = Array.chooseV (codec : FsCodec.IEventCodec<'event, 'Format, 'req>).TryDecode events + let decode events = Array.chooseV (codec : FsCodec.IEventCodec<'event, 'Format, 'req>).Decode events interface ICategory<'event, 'state, 'req> with member _.Empty = res 0 initial Array.empty member _.Load(_log, _categoryName, _streamId, streamName, _maxAge, _requireLeader, _ct) = task { diff --git a/src/Equinox.MessageDb/MessageDb.fs b/src/Equinox.MessageDb/MessageDb.fs index 39f20d57d..2020a4eee 100644 --- a/src/Equinox.MessageDb/MessageDb.fs +++ b/src/Equinox.MessageDb/MessageDb.fs @@ -377,16 +377,16 @@ type private StoreCategory<'event, 'state, 'req>(context: MessageDbContext, code let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) let loadAlgorithm log category streamId streamName requireLeader ct = match access with - | AccessStrategy.Unoptimized -> context.LoadBatched(log, streamName, requireLeader, codec.TryDecode, fold, initial, ct) - | AccessStrategy.LatestKnownEvent -> context.LoadLast(log, streamName, requireLeader, codec.TryDecode, fold, initial, ct) + | AccessStrategy.Unoptimized -> context.LoadBatched(log, streamName, requireLeader, codec.Decode, fold, initial, ct) + | AccessStrategy.LatestKnownEvent -> context.LoadLast(log, streamName, requireLeader, codec.Decode, fold, initial, ct) | AccessStrategy.AdjacentSnapshots (snapshotType, _) -> task { - match! context.LoadSnapshot(log, category, streamId, requireLeader, codec.TryDecode, snapshotType, ct) with + match! context.LoadSnapshot(log, category, streamId, requireLeader, codec.Decode, snapshotType, ct) with | ValueSome (pos, snapshotEvent) -> let state = fold initial [| snapshotEvent |] - let! token, state = context.Reload(log, streamName, requireLeader, pos, codec.TryDecode, fold, state, ct) + let! token, state = context.Reload(log, streamName, requireLeader, pos, codec.Decode, fold, state, ct) return struct(token, state) - | ValueNone -> return! context.LoadBatched(log, streamName, requireLeader, codec.TryDecode, fold, initial, ct) } - let reload (log, sn, leader, token, state) ct = context.Reload(log, sn, leader, token, codec.TryDecode, fold, state, ct) + | ValueNone -> return! context.LoadBatched(log, streamName, requireLeader, codec.Decode, fold, initial, ct) } + let reload (log, sn, leader, token, state) ct = context.Reload(log, sn, leader, token, codec.Decode, fold, state, ct) interface ICategory<'event, 'state, 'req> with member _.Empty = context.TokenEmpty, initial member _.Load(log, categoryName, streamId, streamName, _maxAge, requireLeader, ct) = diff --git a/src/Equinox.SqlStreamStore/SqlStreamStore.fs b/src/Equinox.SqlStreamStore/SqlStreamStore.fs index 695950345..a192d985c 100644 --- a/src/Equinox.SqlStreamStore/SqlStreamStore.fs +++ b/src/Equinox.SqlStreamStore/SqlStreamStore.fs @@ -416,7 +416,7 @@ type private CompactionContext(eventsLen: int, capacityBeforeCompaction: int) = type private StoreCategory<'event, 'state, 'req>(context: SqlStreamStoreContext, codec: FsCodec.IEventCodec<_, _, 'req>, fold, initial, access) = let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) - let tryDecode (e: ResolvedEvent) = e |> UnionEncoderAdapters.encodedEventOfResolvedEvent |> codec.TryDecode + let tryDecode (e: ResolvedEvent) = e |> UnionEncoderAdapters.encodedEventOfResolvedEvent |> codec.Decode let isOrigin = match access with | AccessStrategy.Unoptimized | AccessStrategy.LatestKnownEvent -> fun _ -> true @@ -464,7 +464,7 @@ type SqlStreamStoreCategory<'event, 'state, 'req> = | _ -> () { inherit Equinox.Category<'event, 'state, 'req>(name, StoreCategory<'event, 'state, 'req>(context, codec, fold, initial, access) - |> Caching.apply Token.isStale caching); __ = () }; val private __: unit // __ can be removed after Rider 2023.2 + |> Caching.apply Token.isStale caching) } [] type ConnectorBase([]?readRetryPolicy, []?writeRetryPolicy) = diff --git a/src/Equinox.Tests/Equinox.Tests.fsproj b/src/Equinox.Tests/Equinox.Tests.fsproj index 8d79a573e..a6de31860 100644 --- a/src/Equinox.Tests/Equinox.Tests.fsproj +++ b/src/Equinox.Tests/Equinox.Tests.fsproj @@ -14,10 +14,10 @@ - + - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Equinox/Equinox.fsproj b/src/Equinox/Equinox.fsproj index e1f18b2d1..32262ad2d 100644 --- a/src/Equinox/Equinox.fsproj +++ b/src/Equinox/Equinox.fsproj @@ -24,7 +24,7 @@ contentfiles - + diff --git a/tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj b/tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj index 9a6ae88e1..11493e0b4 100644 --- a/tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj +++ b/tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj @@ -16,11 +16,11 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.CosmosStore.Integration/Equinox.CosmosStore.Integration.fsproj b/tests/Equinox.CosmosStore.Integration/Equinox.CosmosStore.Integration.fsproj index cc76ab6de..c92182f4e 100644 --- a/tests/Equinox.CosmosStore.Integration/Equinox.CosmosStore.Integration.fsproj +++ b/tests/Equinox.CosmosStore.Integration/Equinox.CosmosStore.Integration.fsproj @@ -22,13 +22,13 @@ - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Equinox.CosmosStore.Integration/JsonConverterTests.fs b/tests/Equinox.CosmosStore.Integration/JsonConverterTests.fs index 1bb3d683b..81a2a8213 100644 --- a/tests/Equinox.CosmosStore.Integration/JsonConverterTests.fs +++ b/tests/Equinox.CosmosStore.Integration/JsonConverterTests.fs @@ -42,7 +42,7 @@ type Base64ZipUtf8Tests() = else ser.Contains("\"d\":{") @> let des = System.Text.Json.JsonSerializer.Deserialize(ser) let d = FsCodec.Core.TimelineEvent.Create(-1L, des.c, des.d) - let decoded = eventCodec.TryDecode d |> ValueOption.get + let decoded = eventCodec.Decode d |> ValueOption.get test <@ value = decoded @> [] diff --git a/tests/Equinox.DynamoStore.Integration/Equinox.DynamoStore.Integration.fsproj b/tests/Equinox.DynamoStore.Integration/Equinox.DynamoStore.Integration.fsproj index f629916d4..2e8f4184e 100644 --- a/tests/Equinox.DynamoStore.Integration/Equinox.DynamoStore.Integration.fsproj +++ b/tests/Equinox.DynamoStore.Integration/Equinox.DynamoStore.Integration.fsproj @@ -30,12 +30,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Equinox.EventStore.Integration/Equinox.EventStore.Integration.fsproj b/tests/Equinox.EventStore.Integration/Equinox.EventStore.Integration.fsproj index e3e48716c..b0ebbfa25 100644 --- a/tests/Equinox.EventStore.Integration/Equinox.EventStore.Integration.fsproj +++ b/tests/Equinox.EventStore.Integration/Equinox.EventStore.Integration.fsproj @@ -19,12 +19,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.EventStoreDb.Integration/Equinox.EventStoreDb.Integration.fsproj b/tests/Equinox.EventStoreDb.Integration/Equinox.EventStoreDb.Integration.fsproj index bc8655944..7423fa968 100644 --- a/tests/Equinox.EventStoreDb.Integration/Equinox.EventStoreDb.Integration.fsproj +++ b/tests/Equinox.EventStoreDb.Integration/Equinox.EventStoreDb.Integration.fsproj @@ -19,12 +19,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.MemoryStore.Integration/Equinox.MemoryStore.Integration.fsproj b/tests/Equinox.MemoryStore.Integration/Equinox.MemoryStore.Integration.fsproj index 6c9d1529d..5e20536ea 100644 --- a/tests/Equinox.MemoryStore.Integration/Equinox.MemoryStore.Integration.fsproj +++ b/tests/Equinox.MemoryStore.Integration/Equinox.MemoryStore.Integration.fsproj @@ -15,11 +15,11 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.MessageDb.Integration/Equinox.MessageDb.Integration.fsproj b/tests/Equinox.MessageDb.Integration/Equinox.MessageDb.Integration.fsproj index 5bc805578..0e2ae3124 100644 --- a/tests/Equinox.MessageDb.Integration/Equinox.MessageDb.Integration.fsproj +++ b/tests/Equinox.MessageDb.Integration/Equinox.MessageDb.Integration.fsproj @@ -19,14 +19,14 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.SqlStreamStore.MsSql.Integration/Equinox.SqlStreamStore.MsSql.Integration.fsproj b/tests/Equinox.SqlStreamStore.MsSql.Integration/Equinox.SqlStreamStore.MsSql.Integration.fsproj index e09672596..88b91a8a7 100644 --- a/tests/Equinox.SqlStreamStore.MsSql.Integration/Equinox.SqlStreamStore.MsSql.Integration.fsproj +++ b/tests/Equinox.SqlStreamStore.MsSql.Integration/Equinox.SqlStreamStore.MsSql.Integration.fsproj @@ -19,12 +19,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.SqlStreamStore.MySql.Integration/Equinox.SqlStreamStore.MySql.Integration.fsproj b/tests/Equinox.SqlStreamStore.MySql.Integration/Equinox.SqlStreamStore.MySql.Integration.fsproj index 358afa6fd..68ce2521e 100644 --- a/tests/Equinox.SqlStreamStore.MySql.Integration/Equinox.SqlStreamStore.MySql.Integration.fsproj +++ b/tests/Equinox.SqlStreamStore.MySql.Integration/Equinox.SqlStreamStore.MySql.Integration.fsproj @@ -19,12 +19,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers diff --git a/tests/Equinox.SqlStreamStore.Postgres.Integration/Equinox.SqlStreamStore.Postgres.Integration.fsproj b/tests/Equinox.SqlStreamStore.Postgres.Integration/Equinox.SqlStreamStore.Postgres.Integration.fsproj index 32589af2c..076023294 100644 --- a/tests/Equinox.SqlStreamStore.Postgres.Integration/Equinox.SqlStreamStore.Postgres.Integration.fsproj +++ b/tests/Equinox.SqlStreamStore.Postgres.Integration/Equinox.SqlStreamStore.Postgres.Integration.fsproj @@ -19,12 +19,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers