Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ let package:Package = .init(
],
dependencies: [
.package(url: "https://github.com/tayloraswift/swift-bson", .upToNextMinor(
from: "0.8.0")),
from: "0.9.0")),
.package(url: "https://github.com/tayloraswift/swift-dom", .upToNextMinor(
from: "1.1.0")),
.package(url: "https://github.com/tayloraswift/swift-grammar", .upToNextMinor(
from: "0.4.0")),
.package(url: "https://github.com/tayloraswift/swift-hash", .upToNextMinor(
from: "0.7.1")),
.package(url: "https://github.com/tayloraswift/swift-ip", .upToNextMinor(
from: "0.3.1")),
from: "0.3.2")),
.package(url: "https://github.com/tayloraswift/swift-json", .upToNextMinor(
from: "1.1.0")),
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
from: "0.29.0")),
from: "0.29.1")),
.package(url: "https://github.com/tayloraswift/swift-png", .upToNextMinor(
from: "4.4.8")),
.package(url: "https://github.com/tayloraswift/swift-ucf", .upToNextMinor(
Expand Down
6 changes: 3 additions & 3 deletions Sources/SymbolGraphs/Declarations/Availability (ext).swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Availability
import BSON

extension Availability:BSONDocumentDecodable
extension Availability:BSONKeyspaceDecodable
{
@inlinable public
init(bson:BSON.DocumentDecoder<CodingKey>) throws
init(bson:consuming BSON.KeyspaceDecoder<CodingKey>) throws
{
self.init()

for field:BSON.FieldDecoder<CodingKey> in bson
while let field:BSON.FieldDecoder<CodingKey> = try bson[+]
{
switch field.key.domain
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Availability
import BSON

extension Availability
{
/// Represents an ``Availability.AnyDomain`` in the BSON ABI. This has a
/// single-character raw value, for storage efficiency, and is not intended
/// to be human-readable.
@frozen public
struct CodingKey:Equatable, Hashable, Sendable
struct CodingKey:BSON.Keyspace
{
public
let domain:AnyDomain
Expand Down
2 changes: 1 addition & 1 deletion Sources/SymbolGraphs/Metadata/SHA1 (ext).swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension SHA1:@retroactive BSONBinaryDecodable
}
else
{
throw BSON.ShapeError.init(invalid: bson.bytes.count, expected: .length(20))
throw BSON.BinaryShapeError.init(invalid: bson.bytes.count, expected: .size(20))
}
}
}
11 changes: 4 additions & 7 deletions Sources/UnidocDB/Editions/Unidoc.EditionPlacementQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ extension Unidoc.EditionPlacementQuery:Mongo.PipelineQuery
$0[Unidoc.EditionMetadata[.name]] = refname
}

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Unidoc.EditionPlacement.CodingKey.self]
{
$0[Unidoc.EditionPlacement[.edition]] = Mongo.Pipeline.ROOT
$0[.edition] = Mongo.Pipeline.ROOT
}
}
$0[new]
Expand All @@ -59,12 +59,9 @@ extension Unidoc.EditionPlacementQuery:Mongo.PipelineQuery

$0[stage: .limit] = 1

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Unidoc.EditionPlacement.CodingKey.self]
{
$0[Unidoc.EditionPlacement[.coordinate]] = .expr
{
$0[.add] = (Unidoc.EditionMetadata[.version], 1)
}
$0[.coordinate] { $0[.add] = (Unidoc.EditionMetadata[.version], 1) }
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions Sources/UnidocDB/Packages/Unidoc.AutoincrementQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ extension Unidoc.AutoincrementQuery:Mongo.PipelineQuery
{
$0[Aliases.Element[.id]] = self.symbol
}
pipeline[stage: .replaceWith] = .init
pipeline[stage: .replaceWith, using: Output.CodingKey.self]
{
$0[Output[.id]] = Aliases.Element[.coordinate]
$0[.id] = Aliases.Element[.coordinate]
}
pipeline[stage: .lookup]
{
Expand All @@ -58,12 +58,9 @@ extension Unidoc.AutoincrementQuery:Mongo.PipelineQuery

$0[stage: .limit] = 1

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Output.CodingKey.self]
{
$0[Output[.id]] = .expr
{
$0[.add] = (Aliases.Element[.coordinate], 1)
}
$0[.id] { $0[.add] = (Aliases.Element[.coordinate], 1) }
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions Sources/UnidocDB/Sitemaps/Unidoc.SitemapIndexQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ extension Unidoc.SitemapIndexQuery:Mongo.PipelineQuery

pipeline[stage: .unwind] = Unidoc.SitemapIndexEntry[.symbol]

pipeline[stage: .replaceWith] = .init
pipeline[stage: .replaceWith, using: Unidoc.SitemapIndexEntry.CodingKey.self]
{
$0[Unidoc.SitemapIndexEntry[.modified]] = Unidoc.Sitemap[.modified]
$0[Unidoc.SitemapIndexEntry[.symbol]] =
Unidoc.SitemapIndexEntry[.symbol] / Unidoc.PackageMetadata[.symbol]
$0[.modified] = Unidoc.Sitemap[.modified]
$0[.symbol] = Unidoc.SitemapIndexEntry[.symbol] / Unidoc.PackageMetadata[.symbol]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension Unidoc.PinDependenciesQuery:Mongo.PipelineQuery
let patch:Mongo.AnyKeyPath = "_patch"

// We are only interested in the coordinate value stored in the alias documents.
pipeline[stage: .replaceWith] = .init
pipeline[stage: .replaceWith]
{
$0[Output[.package]] = Unidoc.PackageAlias[.id]
$0[coordinate] = Unidoc.PackageAlias[.coordinate]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ extension Unidoc.PackagesCrawledQuery:Mongo.PipelineQuery
}
}

pipeline[stage: .replaceWith] = .init
pipeline[stage: .replaceWith, using: Date.CodingKey.self]
{
$0[Date[.window]] = Mongo.Pipeline.ROOT
$0[.window] = Mongo.Pipeline.ROOT
}

let count:Mongo.AnyKeyPath = "_count"
Expand Down
6 changes: 3 additions & 3 deletions Sources/UnidocQueries/Mongo.PipelineEncoder (ext).swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extension Mongo.PipelineEncoder

$0[stage: .limit] = limit

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith]
{
$0[edition] = Mongo.Pipeline.ROOT
}
Expand Down Expand Up @@ -141,7 +141,7 @@ extension Mongo.PipelineEncoder

$0[stage: .limit] = limit

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith]
{
$0[edition] = Mongo.Pipeline.ROOT
}
Expand Down Expand Up @@ -178,7 +178,7 @@ extension Mongo.PipelineEncoder
$0[.foreignField] = Unidoc.Snapshot[.id]
$0[.pipeline]
{
$0[stage: .replaceWith] = .init(Unidoc.VersionState.Graph.CodingKey.self)
$0[stage: .replaceWith, using: Unidoc.VersionState.Graph.CodingKey.self]
{
$0[.id] = Unidoc.Snapshot[.id]
$0[.inlineBytes] = .expr
Expand Down
4 changes: 2 additions & 2 deletions Sources/UnidocQueries/Packages/Unidoc.PackagesQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ extension Unidoc.PackagesQuery:Mongo.PipelineQuery
{
self.package.extend(pipeline: &pipeline)

pipeline[stage: .replaceWith] = .init
pipeline[stage: .replaceWith, using: Unidoc.EditionOutput.CodingKey.self]
{
$0[Unidoc.EditionOutput[.package]] = Mongo.Pipeline.ROOT
$0[.package] = Mongo.Pipeline.ROOT
}

pipeline.loadEdition(matching: .latest(.release),
Expand Down
4 changes: 2 additions & 2 deletions Sources/UnidocQueries/Packages/Unidoc.RealmQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ extension Unidoc.RealmQuery:Unidoc.AliasingQuery
$0[.foreignField] = Unidoc.PackageMetadata[.realm]
$0[.pipeline]
{
$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Unidoc.EditionOutput.CodingKey.self]
{
$0[Unidoc.EditionOutput[.package]] = Mongo.Pipeline.ROOT
$0[.package] = Mongo.Pipeline.ROOT
}

$0.loadEdition(matching: .latest(.release),
Expand Down
4 changes: 2 additions & 2 deletions Sources/UnidocQueries/Users/Unidoc.UserPropertyQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ extension Unidoc.UserPropertyQuery:Mongo.PipelineQuery
{
$0[.packages]
{
$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Unidoc.EditionOutput.CodingKey.self]
{
$0[Unidoc.EditionOutput[.package]] = Mongo.Pipeline.ROOT
$0[.package] = Mongo.Pipeline.ROOT
}

$0.loadEdition(matching: .latest(.release),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension Unidoc.RefStateDirectQuery:Mongo.PipelineQuery
{
$0[Unidoc.PackageMetadata[.id]] = self.package
}
pipeline[stage: .replaceWith] = .init(Unidoc.RefState.CodingKey.self)
pipeline[stage: .replaceWith, using: Unidoc.RefState.CodingKey.self]
{
$0[.package] = Mongo.Pipeline.ROOT
}
Expand All @@ -56,9 +56,9 @@ extension Unidoc.RefStateDirectQuery:Mongo.PipelineQuery
$0[Unidoc.EditionMetadata[.id]] = id
}

$0[stage: .replaceWith] = .init
$0[stage: .replaceWith, using: Unidoc.VersionState.CodingKey.self]
{
$0[Unidoc.VersionState[.edition]] = Mongo.Pipeline.ROOT
$0[.edition] = Mongo.Pipeline.ROOT
}

$0.loadResources(associatedTo: Unidoc.VersionState[.edition] /
Expand Down
2 changes: 1 addition & 1 deletion Sources/UnidocRecords/Search/MD5 (ext).swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension MD5:@retroactive BSONBinaryDecodable
}
else
{
throw BSON.ShapeError.init(invalid: bson.bytes.count, expected: .length(16))
throw BSON.BinaryShapeError.init(invalid: bson.bytes.count, expected: .size(16))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ extension Unidoc.Stats.Coverage:ExpressibleByDictionaryLiteral
}
extension Unidoc.Stats.Coverage:Unidoc.StatsCounters,
BSONDocumentEncodable,
BSONDocumentDecodable
BSONKeyspaceDecodable
{
@frozen public
enum CodingKey:String, Sendable, CaseIterable
enum CodingKey:String, CaseIterable, BSON.Keyspace
{
case undocumented = "U"
case indirect = "I"
Expand Down
4 changes: 2 additions & 2 deletions Sources/UnidocRecords/Volumes/Stats/Unidoc.Stats.Decl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ extension Unidoc.Stats.Decl:ExpressibleByDictionaryLiteral
}
extension Unidoc.Stats.Decl:Unidoc.StatsCounters,
BSONDocumentEncodable,
BSONDocumentDecodable
BSONKeyspaceDecodable
{
@frozen public
enum CodingKey:String, Sendable, CaseIterable
enum CodingKey:String, CaseIterable, BSON.Keyspace
{
case typealiases = "T"
case structures = "V"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension Unidoc
public
protocol StatsCounters:ExpressibleByDictionaryLiteral where Value == Never
{
associatedtype CodingKey:RawRepresentable<String>, CaseIterable
associatedtype CodingKey:BSON.Keyspace, CaseIterable

static
subscript(key:CodingKey) -> WritableKeyPath<Self, Int> { get }
Expand Down Expand Up @@ -34,13 +34,13 @@ extension Unidoc.StatsCounters where Self:BSONDocumentEncodable
}
}
}
extension Unidoc.StatsCounters where Self:BSONDocumentDecodable
extension Unidoc.StatsCounters where Self:BSONKeyspaceDecodable
{
@inlinable public
init(bson:BSON.DocumentDecoder<CodingKey>) throws
init(bson:consuming BSON.KeyspaceDecoder<CodingKey>) throws
{
self = [:]
for field:BSON.FieldDecoder<CodingKey> in bson
while let field:BSON.FieldDecoder<CodingKey> = try bson[+]
{
self[keyPath: Self[field.key]] = try field.decode()
}
Expand Down