Skip to content

Commit f1276d1

Browse files
authored
Merge pull request #395 from tayloraswift/keeping-up-with-the-kardashians
track updates to swift-bson and swift-nio
2 parents fb33210 + cb05a6d commit f1276d1

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

Package.resolved

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let package:Package = .init(
7979
],
8080
dependencies: [
8181
.package(url: "https://github.com/tayloraswift/swift-bson", .upToNextMinor(
82-
from: "0.6.0")),
82+
from: "0.8.0")),
8383
.package(url: "https://github.com/tayloraswift/swift-dom", .upToNextMinor(
8484
from: "1.1.0")),
8585
.package(url: "https://github.com/tayloraswift/swift-grammar", .upToNextMinor(
@@ -91,7 +91,7 @@ let package:Package = .init(
9191
.package(url: "https://github.com/tayloraswift/swift-json", .upToNextMinor(
9292
from: "1.1.0")),
9393
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
94-
from: "0.28.3")),
94+
from: "0.29.0")),
9595
.package(url: "https://github.com/tayloraswift/swift-png", .upToNextMinor(
9696
from: "4.4.8")),
9797
.package(url: "https://github.com/tayloraswift/swift-ucf", .upToNextMinor(

Sources/UnidocRecords/BSON.HomogenousFields.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension BSON
99
/// To defend against SQL injection, the `Key` type should never be allowed to contain null
1010
/// bytes.
1111
@frozen public
12-
struct HomogenousFields<Key, Value> where Key:RawRepresentable<String>, Key:Sendable
12+
struct HomogenousFields<Key, Value> where Key:Keyspace
1313
{
1414
public
1515
let ordered:[(key:Key, value:Value)]
@@ -40,21 +40,15 @@ extension BSON.HomogenousFields:ExpressibleByDictionaryLiteral
4040
self.init(ordered: dictionaryLiteral)
4141
}
4242
}
43-
extension BSON.HomogenousFields:BSONDecodable where Value:BSONDecodable
43+
extension BSON.HomogenousFields:BSONDecodable, BSONKeyspaceDecodable where Value:BSONDecodable
4444
{
4545
@inlinable public
46-
init(bson:BSON.AnyValue) throws
47-
{
48-
try self.init(bson: try .init(bson: consume bson))
49-
}
50-
@inlinable public
51-
init(bson:BSON.Document) throws
46+
init(bson:consuming BSON.KeyspaceDecoder<Key>) throws
5247
{
5348
var ordered:[(key:Key, value:Value)] = []
54-
try bson.parse
49+
while let field:BSON.FieldDecoder<Key> = try bson[+]
5550
{
56-
let field:BSON.FieldDecoder<Key> = .init(key: $0, value: $1)
57-
ordered.append(($0, try field.decode(to: Value.self)))
51+
ordered.append((field.key, try field.decode(to: Value.self)))
5852
}
5953
self.init(ordered: ordered)
6054
}

Sources/UnidocRecords/Volumes/Passages/Unidoc.Outline.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ extension Unidoc.Outline:BSONDocumentDecodable
100100
/// Note: need to handle legacy array encoding
101101
let id:Unidoc.Scalar? = try bson[.scalar]?.decode() ?? bson[.scalars]?.decode
102102
{
103-
try $0.shape.expect(length: 1)
104-
return try $0[0].decode()
103+
let first:Unidoc.Scalar = try $0[+].decode()
104+
try $0[+]?.decode(to: Never.self)
105+
return first
105106
}
106107
if let id:Unidoc.Scalar
107108
{

Sources/UnidocRecords/Volumes/Stats/Unidoc.Census.Interface.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import BSON
2+
13
extension Unidoc.Census
24
{
35
@frozen public
@@ -57,3 +59,6 @@ extension Unidoc.Census.Interface:RawRepresentable
5759
}
5860
}
5961
}
62+
extension Unidoc.Census.Interface:BSON.Keyspace
63+
{
64+
}

Sources/UnidocTesting/Mongo.DriverBootstrap (ext).swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension Mongo.DriverBootstrap
99
{
1010
MongoDB / ["unidoc-mongod"] /?
1111
{
12-
$0.executors = .shared(MultiThreadedEventLoopGroup.singleton)
12+
$0.executors = MultiThreadedEventLoopGroup.singleton
1313
$0.appname = "example app"
1414
}
1515
}

Sources/unidoc-linkerd/Main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extension Main:AsyncParsableCommand
5353

5454
let mongodb:Mongo.DriverBootstrap = MongoDB / [self.db.mongod] /?
5555
{
56-
$0.executors = .shared(MultiThreadedEventLoopGroup.singleton)
56+
$0.executors = MultiThreadedEventLoopGroup.singleton
5757
$0.appname = "unidoc-linkerd"
5858

5959
$0.connectionTimeout = .milliseconds(5_000)

Sources/unidoc-tools/Unidoc.PreviewCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extension Unidoc.PreviewCommand:AsyncParsableCommand
8181

8282
let mongodb:Mongo.DriverBootstrap = MongoDB / [self.db.mongod] /?
8383
{
84-
$0.executors = .shared(MultiThreadedEventLoopGroup.singleton)
84+
$0.executors = MultiThreadedEventLoopGroup.singleton
8585
$0.appname = "Unidoc Preview"
8686

8787
$0.connectionTimeout = .milliseconds(5_000)

0 commit comments

Comments
 (0)