import { type AtUriString, type DidString } from '@atproto/syntax'; import type { RawNotification } from '../api/app/bsky/notification/grouping/grouping.js'; import type { DataPlaneClient } from '../data-plane/client/index.js'; import type { FeatureGatesClient, ScopedFeatureGatesClient } from '../feature-gates/index.js'; import { app } from '../lexicons/index.js'; import type { BookmarkInfo, Notification } from '../proto/bsky_pb.js'; import { type HydrationXrpcEndpoint } from '../telemetry/events.js'; import type { ParsedLabelers } from '../util.js'; import { type ActivitySubscriptionStates, ActorHydrator, type Actors, type KnownFollowersStates, type KnownLikersStates, type ProfileAggs, type ProfileLinks, type ProfileViewerStates } from './actor.js'; import { type ExternalHydrationOptions, ExternalHydrator, type ExternalPublicationSubscriptions, type ExternalRecordBacklinkCounts, type ExternalRecordBacklinks, type ExternalRecords, type ExternalRecordsByRef } from './external.js'; import { type FeedGenAggs, type FeedGenViewerStates, type FeedGens, FeedHydrator, type FeedItem, type GetPostsHydrationOptions, type Likes, type Post, type PostAggs, type PostViewerStates, type Postgates, type Posts, type Reposts, type ThreadContexts, type Threadgates } from './feed.js'; import { type Follows, GraphHydrator, type ListAggs, type ListItems, type ListMembershipStates, type ListViewerStates, type Lists, type StarterPackAggs, type StarterPacks, type Verifications } from './graph.js'; import { LabelHydrator, type LabelerAggs, type LabelerViewerStates, type Labelers, Labels } from './label.js'; import { HydrationMap, type ItemRef, type RecordInfo } from './util.js'; export declare class HydrateCtx { private vals; labelers: ParsedLabelers; viewer: `did:${string}:${string}` | null; includeTakedowns: boolean | undefined; overrideIncludeTakedownsForActor: boolean | undefined; include3pBlocks: boolean | undefined; skipViewerBlocks: boolean | undefined; includeDebugField: boolean | undefined; features: ScopedFeatureGatesClient; xrpcEndpoint: `${string}.${string}.${string}` | undefined; constructor(vals: HydrateCtxVals); get skipCacheForViewer(): `did:${string}:${string}`[] | undefined; copy>(vals?: V): HydrateCtx & V; } export type HydrateCtxWithViewer = HydrateCtx & { viewer: string; }; export type HydrateCtxVals = { labelers: ParsedLabelers; viewer: DidString | null; includeTakedowns?: boolean; overrideIncludeTakedownsForActor?: boolean; include3pBlocks?: boolean; skipViewerBlocks?: boolean; includeDebugField?: boolean; features: ScopedFeatureGatesClient; /** Set by handlers from their method's `$lxm`, never from request input. */ xrpcEndpoint?: HydrationXrpcEndpoint; }; export type ListItemSubjectOptOuts = HydrationMap; export type HydrationState = { ctx?: HydrateCtx; actors?: Actors; profileViewers?: ProfileViewerStates; profileAggs?: ProfileAggs; posts?: Posts; postAggs?: PostAggs; postViewers?: PostViewerStates; threadContexts?: ThreadContexts; postBlocks?: PostBlocks; reposts?: Reposts; follows?: Follows; followBlocks?: FollowBlocks; threadgates?: Threadgates; postgates?: Postgates; lists?: Lists; listAggs?: ListAggs; listMemberships?: ListMembershipStates; listViewers?: ListViewerStates; listItems?: ListItems; listItemSubjectOptOuts?: ListItemSubjectOptOuts; likes?: Likes; likeBlocks?: LikeBlocks; labels?: Labels; feedgens?: FeedGens; feedgenViewers?: FeedGenViewerStates; feedgenAggs?: FeedGenAggs; starterPacks?: StarterPacks; starterPackAggs?: StarterPackAggs; profileLinks?: ProfileLinks; labelers?: Labelers; labelerViewers?: LabelerViewerStates; labelerAggs?: LabelerAggs; knownFollowers?: KnownFollowersStates; knownLikers?: KnownLikersStates; activitySubscriptions?: ActivitySubscriptionStates; bidirectionalBlocks?: BidirectionalBlocks; verifications?: Verifications; bookmarks?: Bookmarks; externalRecords?: ExternalRecords; externalRecordsByRef?: ExternalRecordsByRef; /** Available backlink source URIs per target, potentially from a partial page. */ externalRecordBacklinks?: ExternalRecordBacklinks; externalRecordBacklinkCounts?: ExternalRecordBacklinkCounts; externalPublicationSubscriptions?: ExternalPublicationSubscriptions; }; type HydrateKnownLikersOptions = { subjectUris: AtUriString[]; }; type HydratePostsOptions = Pick & { knownLikers?: HydrateKnownLikersOptions; skipReplyBlocks?: boolean; externalSeenRecordKeys?: Set; externalPublicationSubscriptions?: ExternalPublicationSubscriptions; }; type HydrateFeedItemsOptions = { /** * Hydrate known likers for the root post of each feed item, which is the * post itself when it does not reply to anything. Feed items only carry the * post URI, so the roots can only be resolved once the post records are * fetched, which is why this is a flag rather than a list of subjects. */ knownLikers?: boolean; }; export type HydrateProfilesOptions = { knownFollowersDids?: DidString[]; activitySubscriptions?: boolean; }; export type PostBlock = { embed: boolean; parent: boolean; root: boolean; }; export type PostBlocks = HydrationMap; export type LikeBlock = boolean; export type LikeBlocks = HydrationMap; export type FollowBlock = boolean; export type FollowBlocks = HydrationMap; export type BidirectionalBlocks = HydrationMap>; export type Bookmark = { ref?: { key: string; }; subjectUri: string; subjectCid: string; indexedAt?: Date; }; export type Bookmarks = HydrationMap>; /** * Additional config passed from `ServerConfig` to the `Hydrator` instance. * Values within this config object may be passed to other sub-hydrators. */ export type HydratorConfig = { debugFieldAllowedDids: Set; featureGatesClient: FeatureGatesClient; needsReviewTagSources?: readonly DidString[]; }; export declare class Hydrator { dataplane: DataPlaneClient; actor: ActorHydrator; external: ExternalHydrator; feed: FeedHydrator; graph: GraphHydrator; label: LabelHydrator; serviceLabelers: Set; config: HydratorConfig; constructor(dataplane: DataPlaneClient, serviceLabelers: readonly DidString[] | undefined, config: HydratorConfig); hydrateProfileViewers(dids: DidString[], ctx: HydrateCtx): Promise; hydrateProfiles(dids: DidString[], ctx: HydrateCtx, opts?: HydrateProfilesOptions): Promise; hydrateProfilesBasic(dids: DidString[], ctx: HydrateCtx, opts?: HydrateProfilesOptions): Promise; hydrateProfilesDetailed(dids: DidString[], ctx: HydrateCtx, opts?: HydrateProfilesOptions): Promise; private hydrateProfilesWorker; private hydrateProfileState; hydrateLists(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateListsBasic(uris: AtUriString[], ctx: HydrateCtx, opts?: { skipAuthors: boolean; }): Promise; hydrateListItems(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateListsMembership(uris: AtUriString[], did: DidString, ctx: HydrateCtx): Promise; hydratePosts(refs: { uri: AtUriString; }[], ctx: HydrateCtx, state?: HydrationState, options?: HydratePostsOptions): Promise; private hydratePostBlocks; hydrateFeedItems(items: FeedItem[], ctx: HydrateCtx, options?: HydrateFeedItemsOptions): Promise; /** * Hydrate the latest versions of external records, plus labels, profiles, and * their view dependencies. `hydrationPass` is the 1-based number of this * generic batch within the traversal (the root batch is pass 1); nested * batches continue the count. Nested passes share the caller's * `hydrationMetrics` tracker; without one, this call owns the traversal and * reports its totals. `options.hydration` (default `'detailed'`) applies to * the whole traversal and is propagated to every nested pass. */ hydrateEmbedExternalViewFromUris(uris: AtUriString[], ctx: HydrateCtx, options?: ExternalHydrationOptions): Promise; /** * Like `hydrateEmbedExternalViewFromUris`, but for exact record versions * pinned by strong refs. Roots land only in `externalRecordsByRef`; their * URI dependencies are hydrated as latest versions by the URI path. */ hydrateEmbedExternalViewFromRefs(refs: Required[], ctx: HydrateCtx, options?: ExternalHydrationOptions): Promise; private hydrateEmbedExternalView; /** * Discover view dependencies by URI collection and hydrate new URIs in a batch. * Returns additional state. Each input is inspected in the map matching its * identity: `(uri, cid)` refs in `externalRecordsByRef`, bare URIs in * `externalRecords`. Every pinned version is inspected, since versions of * one URI can reference different dependencies. * * `seenRecordKeys` prevents repeated lookups and cycles across nested passes, * but not a chain of distinct URIs; `MAX_EXTERNAL_HYDRATION_PASSES` bounds * that, as a guard against future association rules or unexpected expansion. * `hydrationPass` is the number of the generic batch that produced `state` * (1-based, default 1 for prehydrated state, which is treated as the root * batch); the next nested batch is `hydrationPass + 1`. `hydrationMetrics` * is shared as in `hydrateEmbedExternalViewFromUris`. `options.hydration` * (default `'detailed'`) decides, per collection, whether social-preview * samples are scheduled; backlink counts and content dependencies are * discovered at both levels. */ hydrateExternalViewDependencies(state: HydrationState, refs: ItemRef[], ctx: HydrateCtx, options?: ExternalHydrationOptions): Promise; private discoverExternalViewDependencies; hydrateThreadPosts(refs: ItemRef[], ctx: HydrateCtx, options?: Pick): Promise; private hydrateKnownLikers; hydrateFeedGens(uris: AtUriString[], // @TODO any way to get refs here? ctx: HydrateCtx): Promise; hydrateStarterPacksBasic(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateStarterPacks(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateLikes(authorDid: DidString, uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateReposts(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateNotifications(notifs: Notification[], ctx: HydrateCtx): Promise; hydrateGroupedNotifications(notifs: RawNotification[], ctx: HydrateCtx, opts?: { knownFollowersDids?: DidString[]; }): Promise; hydrateBookmarks(bookmarkInfos: BookmarkInfo[], ctx: HydrateCtx): Promise; hydrateFollows(uris: AtUriString[], ctx: HydrateCtx): Promise; hydrateBidirectionalBlocks(didMap: Map, // DID -> DID[] ctx: HydrateCtx): Promise; hydrateLabelers(dids: DidString[], ctx: HydrateCtx): Promise; getRecord(uri: AtUriString, includeTakedowns?: boolean): Promise | import("./feed.js").Repost | import("./graph.js").StarterPack | import("./actor.js").Status | import("./feed.js").Threadgate | Post | undefined>; createContext & { features?: ScopedFeatureGatesClient; }>(vals: V): Promise; resolveUri(uriStr: AtUriString): Promise; } /** * The link records a profile points to, in order. Only the first * MAX_PROFILE_LINKS are shown, and only links in the profile's own repo count. */ export declare const profileLinkUris: (dids: DidString[], actors: Actors | undefined) => AtUriString[]; export declare const mergeStates: (stateA: HydrationState, stateB: HydrationState) => HydrationState; export declare const mergeManyStates: (...states: HydrationState[]) => HydrationState; export {}; //# sourceMappingURL=hydrator.d.ts.map