README.md

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://tangled.org/woody.fm/composable-atmosphere-constellation",
  branch: "main"
)

Then depend on the library product:

.product(
  name: "ComposableAtmosphereConstellation",
  package: "composable-atmosphere-constellation"
)

The package depends on the published swift-atproto package for AT Protocol values and XRPC requests. Swift Package Manager resolves this dependency automatically.

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:

guard let repo = DID("did:plc:cqqtuv75m7e5s4uj6nw4czyu") 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 test --force-resolved-versions