Composable Atmosphere Constellation#
Composable Atmosphere Constellation is a Swift package for reading ATProtocol backlinks from Constellation.
It provides typed request and response models for blue.microcosm.links.getBacklinks, plus helpers that hydrate linked records from the author's PDS. Higher-level packages can use it to discover references across the network without coupling their own domain models to Constellation's raw response shape.
Product#
ComposableAtmosphereConstellation: Constellation backlink lexicon models, XRPC request helpers, typed record hydration, and small in-flight request coalescing utilities.
Installation#
Add the package to Package.swift:
.package(
url: "https://source.woody.fm/composable-atmosphere-constellation",
branch: "main"
)
Then depend on the library product:
.product(
name: "ComposableAtmosphereConstellation",
package: "composable-atmosphere-constellation"
)
This package depends on the base ATProto and XRPCClient products from swift-composable-atmosphere and explicitly opts out of its default TCA26 trait.
Usage#
Build a Constellation source from a collection and path:
import ATProto
import ComposableAtmosphereConstellation
let source = Constellation.BacklinkSource(
collection: "sh.tangled.repo.pull",
path: "target.repo"
)
Fetch backlinks for a DID or record URI:
import XRPCClient
guard let repo = DID("did:plc:repo") else {
return
}
let backlinks = try await XRPC.Client.liveValue.constellationGetBacklinks(
subject: repo,
source: source,
limit: 25
)
For typed record hydration, conform the referenced record value to Constellation.BacklinkedRecordValue and call constellationGetBacklinkedRecords.
Development#
Run the package checks with:
swift build && swift test