import { AtUriString } from '@atproto/syntax'; import { DataPlaneClient } from '../data-plane/client/index.js'; import { SiteStandardDocumentRecord, SiteStandardPublicationRecord } from '../views/types.js'; import { HydrationMap, ItemRef, RecordInfo } from './util.js'; export type SiteStandardDocument = RecordInfo; export type SiteStandardPublication = RecordInfo; /** * Keyed by `${uri}@${cid}` — see `siteStandardRecordKey`. A single hydration * batch can pull more than one version of the same URI (different posts * pinning different cids), so the composite key is needed for O(1) * version-exact lookups. */ export type SiteStandardDocuments = HydrationMap; /** * Keyed by `${uri}@${cid}`. See `SiteStandardDocuments` for the rationale. */ export type SiteStandardPublications = HydrationMap; export type SiteStandardRecords = { documents: SiteStandardDocuments; publications: SiteStandardPublications; }; export type AssociatedSiteStandardRecord = { ref: { uri: AtUriString; cid: string; }; info: T; }; export declare class ExternalHydrator { dataplane: DataPlaneClient; constructor(dataplane: DataPlaneClient); getSiteStandardRecordsByRef(refs: ItemRef[], includeTakedowns?: boolean): Promise; getSiteStandardRecordsByURI(uris: AtUriString[], includeTakedowns?: boolean): Promise; } /** * Read-path resolution: caller pinned a set of `(uri, cid)` strongRefs in * the post at write time, and we honor those exact versions. Any pair * that doesn't structurally agree is rejected, so downstream callers can * trust the returned shape. * * Same observable contract as * `getSiteStandardRecordsFromHydrationMapsByDocumentUri` (the compose-path * sister) — both functions guarantee that a returned `(doc, pub)` pair * has matching site/uri, and reject orphan docs that claim a * non-hydrated publication. They differ only in how upstream availability * is asserted: this one trusts caller-supplied refs; the sister derives * everything from the dataplane response. * * Pairing rules: * - Both slots referenced: `doc.site` must equal `publication.ref.uri`, * else both come back `undefined`. * - Doc with at-uri `site` referenced but no matching publication ref: * reject the whole pairing (doc claims a publication that should have * been pinned, but wasn't). * - Loose doc (web-URL `site`) referenced: publication stays `undefined`. * - Only a publication referenced: document stays `undefined`. * * Each returned slot carries the matching `ref` so callers can recover * the owner DID for blob-cdn URL building, etc. */ export declare const getSiteStandardRecordsFromHydrationMapsByRefs: (associatedRefs: readonly { uri: AtUriString; cid: string; }[] | undefined, documents: SiteStandardDocuments | undefined, publications: SiteStandardPublications | undefined) => { document: AssociatedSiteStandardRecord | undefined; publication: AssociatedSiteStandardRecord | undefined; }; /** * Compose-path resolution: no caller-supplied refs — the dataplane * returned the latest version of each record (including any * publications it auto-resolved from a document's `site` field). Take * the first hydrated document and pair it with the publication its * `site` field points at. * * Same observable contract as * `getSiteStandardRecordsFromHydrationMapsByRefs` (the read-path * sister) — both functions guarantee that a returned `(doc, pub)` pair * has matching site/uri, and reject orphan docs that claim a * non-hydrated publication. They differ only in how upstream * availability is asserted: this one walks whatever was returned by the * dataplane; the sister checks against caller-supplied refs. * * Pairing rules: * - Doc with at-uri `site`: must find a hydrated publication at that * URI. If none was hydrated, the doc/publication chain is incomplete * and the function returns `undefined` for both slots; the doc alone * isn't useful without its source (can't verify the pub) * - Doc with web-URL `site` (loose): no publication. * - No doc hydrated: fall through to the first hydrated publication for * the publication-only resolution flow. */ export declare const getSiteStandardRecordsFromHydrationMapsByDocumentUri: (documents: SiteStandardDocuments | undefined, publications: SiteStandardPublications | undefined) => { document: AssociatedSiteStandardRecord | undefined; publication: AssociatedSiteStandardRecord | undefined; }; //# sourceMappingURL=external.d.ts.map