Skip to content

Commit

Permalink
chore!: Target FsCodec 3.0.0-rc.14
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Nov 17, 2023
1 parent 551d321 commit 901ebf8
Show file tree
Hide file tree
Showing 29 changed files with 76 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<PropertyGroup>
<Authors>@jet @moneylion @bartelink @eiriktsarpalis and contributors</Authors>
<Company>Jet.com</Company>
<Description>Sleek, composable event sourcing componentry</Description>
<Description>Efficient event sourced decisions and data</Description>
<PackageProjectUrl>https://github.com/jet/equinox</PackageProjectUrl>
<PackageTags>eventsourcing eventstore fsharp fscodec cosmosdb dynamodb eventstoredb postgres sqlserver</PackageTags>
<PackageLicense>Apache-2.0</PackageLicense>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright © 2016-23</Copyright>

<WarningLevel>5</WarningLevel>
Expand Down
5 changes: 0 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions samples/Infrastructure/Store.fs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ module Sql =
| ConnectionString _ -> "Database connection string"
| Schema _ -> "Database schema name"
| Credentials _ -> "Database credentials"
| AutoCreate _ -> "AutoCreate schema"
| AutoCreate -> "AutoCreate schema"
| BatchSize _ -> "Maximum number of Events to request per batch. Default 500."
type Arguments(p : ParseResults<Parameters>) =
member _.ConnectionString = p.GetResult ConnectionString
Expand All @@ -304,7 +304,7 @@ module Sql =
member a.Usage = a |> function
| ConnectionString _ -> "Database connection string"
| Credentials _ -> "Database credentials"
| AutoCreate _ -> "AutoCreate schema"
| AutoCreate -> "AutoCreate schema"
| BatchSize _ -> "Maximum number of Events to request per batch. Default 500."
type Arguments(p : ParseResults<Parameters>) =
member _.ConnectionString = p.GetResult ConnectionString
Expand All @@ -331,7 +331,7 @@ module Sql =
| ConnectionString _ -> "Database connection string"
| Schema _ -> "Database schema name"
| Credentials _ -> "Database credentials"
| AutoCreate _ -> "AutoCreate schema"
| AutoCreate -> "AutoCreate schema"
| BatchSize _ -> "Maximum number of Events to request per batch. Default 500."
type Arguments(p : ParseResults<Parameters>) =
member _.ConnectionString = p.GetResult ConnectionString
Expand Down
6 changes: 3 additions & 3 deletions samples/Store/Domain.Tests/Domain.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-beta2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions samples/Store/Domain/Domain.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="6.0.7" ExcludeAssets="contentfiles" />

<PackageReference Include="FsCodec.NewtonsoftJson" Version="3.0.0-rc.13" />
<PackageReference Include="FsCodec.SystemTextJson" Version="3.0.0-rc.13" />
<PackageReference Include="FsCodec.NewtonsoftJson" Version="3.0.0-rc.14" />
<PackageReference Include="FsCodec.SystemTextJson" Version="3.0.0-rc.14" />

<ProjectReference Include="..\..\..\src\Equinox\Equinox.fsproj" />
</ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions samples/Store/Integration/CodecIntegration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions samples/Store/Integration/Integration.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-beta2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.0" />
<PackageReference Include="unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion samples/Tutorial/Tutorial.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="MinVer" Version="4.2.0" PrivateAssets="All" />
<PackageReference Include="FsCodec.SystemTextJson" Version="3.0.0-rc.13" />
<PackageReference Include="FsCodec.SystemTextJson" Version="3.0.0-rc.14" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.CosmosStore/CosmosStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,13 +1071,13 @@ type internal StoreCategory<'event, 'state, 'req>
checkUnfolds, compressUnfolds, mapUnfolds: Choice<unit, 'event[] -> '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<struct (StreamToken * 'state)> = 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<struct (StreamToken * 'state)> = 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
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.DynamoStore/DynamoStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<struct (StreamToken * 'state)> = 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 =
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.EventStore/EventStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.EventStoreDb/EventStoreDb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.MemoryStore/MemoryStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions src/Equinox.MessageDb/MessageDb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.SqlStreamStore/SqlStreamStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) }

[<AbstractClass>]
type ConnectorBase([<O; D(null)>]?readRetryPolicy, [<O; D(null)>]?writeRetryPolicy) =
Expand Down
6 changes: 3 additions & 3 deletions src/Equinox.Tests/Equinox.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox/Equinox.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- Also avoids Rider search finding stuff in FSharp.Core.xml -->
<PackageReference Include="FSharp.Core" Version="6.0.7"><ExcludeAssets>contentfiles</ExcludeAssets></PackageReference>

<PackageReference Include="FsCodec" Version="3.0.0-rc.13" />
<PackageReference Include="FsCodec" Version="3.0.0-rc.14" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />

Expand Down
6 changes: 3 additions & 3 deletions tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-beta2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-beta2" />
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc1" />
<PackageReference Include="JsonDiffPatch.Net" Version="2.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.0" />
<PackageReference Include="unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type Base64ZipUtf8Tests() =
else ser.Contains("\"d\":{") @>
let des = System.Text.Json.JsonSerializer.Deserialize<Core.Unfold>(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 @>

[<Theory; InlineData false; InlineData true>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-beta2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.0" />
<PackageReference Include="unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit 901ebf8

Please sign in to comment.