Skip to content

Commit c8571a6

Browse files
committed
Release FsCodec.SystemTextJson 3.1.0-rc.3
1 parent 261b9a8 commit c8571a6

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/FsCodec.SystemTextJson/Encoding.fs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ open System.Text.Json
1010
/// Represents the body of an Event (or its Metadata), holding the encoded form of the buffer together with an enum value identifying the encoding scheme.
1111
/// Enables the decoding side to transparently inflate the data on loading without burdening the application layer with tracking the encoding scheme used.
1212
type Encoded = (struct(int * JsonElement))
13-
type BlobEncoded = FsCodec.EncodedBody
14-
15-
module Encoding =
16-
let [<Literal>] Direct = 0 // Assumed for all values not listed here
17-
let [<Literal>] Deflate = 1 // Deprecated encoding produced by versions pre 3.0.0-rc.13; no longer produced
18-
let [<Literal>] Brotli = 2 // Default encoding as of 3.0.0-rc.13
1913

2014
module private Impl =
2115

@@ -54,7 +48,7 @@ module private Impl =
5448
| Encoding.Brotli -> Encoding.Brotli, data.ToArray() |> blobToBase64StringJsonElement
5549
| _ -> Encoding.Direct, data |> InteropHelpers.Utf8ToJsonElement
5650
let decodeUtf8 = decode_ InteropHelpers.JsonElementToUtf8 (unpack ReadOnlyMemory<byte>)
57-
let toUtf8Encoded struct (encoding, data: JsonElement): BlobEncoded =
51+
let toUtf8Encoded struct (encoding, data: JsonElement): FsCodec.Encoded =
5852
match encoding, data.ValueKind with
5953
| Encoding.Deflate, JsonValueKind.String -> Encoding.Deflate, data.GetBytesFromBase64() |> ReadOnlyMemory
6054
| Encoding.Brotli, JsonValueKind.String -> Encoding.Brotli, data.GetBytesFromBase64() |> ReadOnlyMemory
@@ -95,9 +89,9 @@ type Encoding private () =
9589
Impl.directUtf8 x
9690
static member OfUtf8Compress(options, x: ReadOnlyMemory<byte>): Encoded =
9791
Impl.compressUtf8 options.minSize options.minGain x
98-
static member OfUtf8Encoded(x: BlobEncoded): Encoded =
92+
static member OfUtf8Encoded(x: FsCodec.Encoded): Encoded =
9993
Impl.ofUtf8Encoded x
100-
static member Utf8EncodedToJsonElement(x: BlobEncoded): JsonElement =
94+
static member Utf8EncodedToJsonElement(x: FsCodec.Encoded): JsonElement =
10195
Encoding.OfUtf8Encoded x |> Encoding.ToJsonElement
10296
static member ByteCount((_encoding, data): Encoded) =
10397
data.GetRawText() |> System.Text.Encoding.UTF8.GetByteCount
@@ -107,7 +101,7 @@ type Encoding private () =
107101
Impl.decode x
108102
static member ToUtf8(x: Encoded): ReadOnlyMemory<byte> =
109103
Impl.decodeUtf8 x
110-
static member ToEncodedUtf8(x: Encoded): BlobEncoded =
104+
static member ToEncodedUtf8(x: Encoded): FsCodec.Encoded =
111105
Impl.toUtf8Encoded x
112106
static member ToStream(ms: System.IO.Stream, x: Encoded) =
113107
Impl.decode_ (fun el -> JsonSerializer.Serialize(ms, el)) (fun dec -> dec ms) x
@@ -169,6 +163,6 @@ type Encoder private () =
169163

170164
/// <summary>Adapts an <c>IEventCodec</c> rendering to <c>int * ReadOnlyMemory&lt;byte&gt;</c> Event Bodies to encode to JsonElement, with the Decode side of the roundtrip not attempting to Compress.</summary>
171165
[<Extension>]
172-
static member Utf8AsJsonElement<'Event, 'Context>(native: IEventCodec<'Event, BlobEncoded, 'Context>)
166+
static member Utf8AsJsonElement<'Event, 'Context>(native: IEventCodec<'Event, FsCodec.Encoded, 'Context>)
173167
: IEventCodec<'Event, JsonElement, 'Context> =
174168
FsCodec.Core.EventCodec.mapBodies (Encoding.OfUtf8Encoded >> Encoding.ToJsonElement) (Encoding.OfJsonElement >> Encoding.ToEncodedUtf8) native

src/FsCodec.SystemTextJson/FsCodec.SystemTextJson.fsproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333
<ItemGroup>
3434
<ProjectReference Condition=" '$(Configuration)' == 'Debug' " Include="../FsCodec.Box/FsCodec.Box.fsproj" />
35-
<PackageReference Condition=" '$(Configuration)' == 'Release' " Include="FsCodec" Version="[3.1.0-rc.1, 4.0.0)" />
36-
<PackageReference Condition=" '$(Configuration)' == 'Release' " Include="FsCodec.Box" Version="[3.0.0, 4.0.0)" />
35+
<PackageReference Condition=" '$(Configuration)' == 'Release' " Include="FsCodec.Box" Version="[3.1.0-rc.3, 4.0.0)" />
3736
</ItemGroup>
3837

3938
</Project>

0 commit comments

Comments
 (0)