@atproto/bsky 0.3.13 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.js +1 -0
- package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js +1 -0
- package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
- package/dist/api/app/bsky/actor/getSuggestions.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getSuggestions.js +1 -0
- package/dist/api/app/bsky/actor/getSuggestions.js.map +1 -1
- package/dist/api/app/bsky/actor/searchActors.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActors.js +1 -0
- package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js +1 -0
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
- package/dist/api/app/bsky/bookmark/getBookmarks.d.ts.map +1 -1
- package/dist/api/app/bsky/bookmark/getBookmarks.js +1 -0
- package/dist/api/app/bsky/bookmark/getBookmarks.js.map +1 -1
- package/dist/api/app/bsky/contact/getMatches.d.ts.map +1 -1
- package/dist/api/app/bsky/contact/getMatches.js +1 -0
- package/dist/api/app/bsky/contact/getMatches.js.map +1 -1
- package/dist/api/app/bsky/contact/importContacts.d.ts.map +1 -1
- package/dist/api/app/bsky/contact/importContacts.js +1 -0
- package/dist/api/app/bsky/contact/importContacts.js.map +1 -1
- package/dist/api/app/bsky/feed/getActorFeeds.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getActorFeeds.js +5 -1
- package/dist/api/app/bsky/feed/getActorFeeds.js.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.js +1 -0
- package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js +1 -0
- package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +1 -0
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeedGenerator.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeedGenerator.js +5 -1
- package/dist/api/app/bsky/feed/getFeedGenerator.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeedGenerators.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeedGenerators.js +5 -1
- package/dist/api/app/bsky/feed/getFeedGenerators.js.map +1 -1
- package/dist/api/app/bsky/feed/getLikes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getLikes.js +1 -0
- package/dist/api/app/bsky/feed/getLikes.js.map +1 -1
- package/dist/api/app/bsky/feed/getListFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getListFeed.js +1 -0
- package/dist/api/app/bsky/feed/getListFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +1 -0
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/feed/getPosts.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPosts.js +5 -1
- package/dist/api/app/bsky/feed/getPosts.js.map +1 -1
- package/dist/api/app/bsky/feed/getQuotes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getQuotes.js +1 -0
- package/dist/api/app/bsky/feed/getQuotes.js.map +1 -1
- package/dist/api/app/bsky/feed/getRepostedBy.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getRepostedBy.js +1 -0
- package/dist/api/app/bsky/feed/getRepostedBy.js.map +1 -1
- package/dist/api/app/bsky/feed/getSuggestedFeeds.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getSuggestedFeeds.js +5 -1
- package/dist/api/app/bsky/feed/getSuggestedFeeds.js.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js +1 -0
- package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.js +1 -0
- package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
- package/dist/api/app/bsky/feed/searchPostsV2.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/searchPostsV2.js +1 -0
- package/dist/api/app/bsky/feed/searchPostsV2.js.map +1 -1
- package/dist/api/app/bsky/graph/getActorStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getActorStarterPacks.js +1 -0
- package/dist/api/app/bsky/graph/getActorStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/graph/getBlocks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getBlocks.js +5 -1
- package/dist/api/app/bsky/graph/getBlocks.js.map +1 -1
- package/dist/api/app/bsky/graph/getFollowers.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getFollowers.js +1 -0
- package/dist/api/app/bsky/graph/getFollowers.js.map +1 -1
- package/dist/api/app/bsky/graph/getFollows.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getFollows.js +1 -0
- package/dist/api/app/bsky/graph/getFollows.js.map +1 -1
- package/dist/api/app/bsky/graph/getKnownFollowers.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getKnownFollowers.js +1 -0
- package/dist/api/app/bsky/graph/getKnownFollowers.js.map +1 -1
- package/dist/api/app/bsky/graph/getList.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getList.js +1 -0
- package/dist/api/app/bsky/graph/getList.js.map +1 -1
- package/dist/api/app/bsky/graph/getListBlocks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getListBlocks.js +5 -1
- package/dist/api/app/bsky/graph/getListBlocks.js.map +1 -1
- package/dist/api/app/bsky/graph/getListMutes.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getListMutes.js +5 -1
- package/dist/api/app/bsky/graph/getListMutes.js.map +1 -1
- package/dist/api/app/bsky/graph/getLists.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getLists.js +1 -0
- package/dist/api/app/bsky/graph/getLists.js.map +1 -1
- package/dist/api/app/bsky/graph/getListsWithMembership.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getListsWithMembership.js +1 -0
- package/dist/api/app/bsky/graph/getListsWithMembership.js.map +1 -1
- package/dist/api/app/bsky/graph/getMutes.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getMutes.js +5 -1
- package/dist/api/app/bsky/graph/getMutes.js.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPack.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPack.js +1 -0
- package/dist/api/app/bsky/graph/getStarterPack.js.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPacks.js +1 -0
- package/dist/api/app/bsky/graph/getStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPacksWithMembership.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getStarterPacksWithMembership.js +1 -0
- package/dist/api/app/bsky/graph/getStarterPacksWithMembership.js.map +1 -1
- package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js +1 -0
- package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.js +1 -0
- package/dist/api/app/bsky/graph/searchStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacksV2.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacksV2.js +1 -0
- package/dist/api/app/bsky/graph/searchStarterPacksV2.js.map +1 -1
- package/dist/api/app/bsky/labeler/getServices.d.ts.map +1 -1
- package/dist/api/app/bsky/labeler/getServices.js +1 -0
- package/dist/api/app/bsky/labeler/getServices.js.map +1 -1
- package/dist/api/app/bsky/notification/getGroupedNotifications.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/getGroupedNotifications.js +41 -20
- package/dist/api/app/bsky/notification/getGroupedNotifications.js.map +1 -1
- package/dist/api/app/bsky/notification/grouping/algoGravity.d.ts +4 -3
- package/dist/api/app/bsky/notification/grouping/algoGravity.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/grouping/algoGravity.js +53 -42
- package/dist/api/app/bsky/notification/grouping/algoGravity.js.map +1 -1
- package/dist/api/app/bsky/notification/grouping/algoLookback.d.ts +4 -3
- package/dist/api/app/bsky/notification/grouping/algoLookback.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/grouping/algoLookback.js +56 -42
- package/dist/api/app/bsky/notification/grouping/algoLookback.js.map +1 -1
- package/dist/api/app/bsky/notification/grouping/grouping.d.ts +12 -2
- package/dist/api/app/bsky/notification/grouping/grouping.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/grouping/grouping.js +20 -6
- package/dist/api/app/bsky/notification/grouping/grouping.js.map +1 -1
- package/dist/api/app/bsky/notification/grouping/spotlight.d.ts +2 -2
- package/dist/api/app/bsky/notification/grouping/spotlight.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/grouping/spotlight.js +35 -22
- package/dist/api/app/bsky/notification/grouping/spotlight.js.map +1 -1
- package/dist/api/app/bsky/notification/listActivitySubscriptions.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/listActivitySubscriptions.js +1 -0
- package/dist/api/app/bsky/notification/listActivitySubscriptions.js.map +1 -1
- package/dist/api/app/bsky/notification/listNotifications.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/listNotifications.js +5 -1
- package/dist/api/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/api/app/bsky/unspecced/atmosphere-grouping.d.ts +16 -0
- package/dist/api/app/bsky/unspecced/atmosphere-grouping.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/atmosphere-grouping.js +124 -0
- package/dist/api/app/bsky/unspecced/atmosphere-grouping.js.map +1 -0
- package/dist/api/app/bsky/unspecced/atmosphere-hydration.d.ts +32 -0
- package/dist/api/app/bsky/unspecced/atmosphere-hydration.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/atmosphere-hydration.js +201 -0
- package/dist/api/app/bsky/unspecced/atmosphere-hydration.js.map +1 -0
- package/dist/api/app/bsky/unspecced/atmosphere-pagination.d.ts +6 -0
- package/dist/api/app/bsky/unspecced/atmosphere-pagination.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/atmosphere-pagination.js +164 -0
- package/dist/api/app/bsky/unspecced/atmosphere-pagination.js.map +1 -0
- package/dist/api/app/bsky/unspecced/getAtmosphereExploreTab.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getAtmosphereExploreTab.js +120 -55
- package/dist/api/app/bsky/unspecced/getAtmosphereExploreTab.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getAtmosphereTimeline.d.ts +4 -0
- package/dist/api/app/bsky/unspecced/getAtmosphereTimeline.d.ts.map +1 -0
- package/dist/api/app/bsky/unspecced/getAtmosphereTimeline.js +30 -0
- package/dist/api/app/bsky/unspecced/getAtmosphereTimeline.js.map +1 -0
- package/dist/api/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.js +4 -7
- package/dist/api/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js +1 -0
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.js +1 -0
- package/dist/api/app/bsky/unspecced/getPostThreadOtherV2.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getPostThreadV2.js +1 -0
- package/dist/api/app/bsky/unspecced/getPostThreadV2.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedFeeds.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedFeeds.js +4 -7
- package/dist/api/app/bsky/unspecced/getSuggestedFeeds.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedOnboardingUsers.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedOnboardingUsers.js +1 -0
- package/dist/api/app/bsky/unspecced/getSuggestedOnboardingUsers.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js +4 -7
- package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.js +2 -19
- package/dist/api/app/bsky/unspecced/getSuggestedUsers.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForDiscover.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForDiscover.js +1 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForDiscover.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForExplore.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForExplore.js +1 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForExplore.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForSeeMore.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForSeeMore.js +1 -0
- package/dist/api/app/bsky/unspecced/getSuggestedUsersForSeeMore.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getTrendingTopics.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getTrendingTopics.js +6 -2
- package/dist/api/app/bsky/unspecced/getTrendingTopics.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getTrends.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getTrends.js +6 -2
- package/dist/api/app/bsky/unspecced/getTrends.js.map +1 -1
- package/dist/api/blob-resolver.d.ts.map +1 -1
- package/dist/api/blob-resolver.js +9 -8
- package/dist/api/blob-resolver.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/bsky/actor/getProfiles.d.ts.map +1 -1
- package/dist/api/internal/bsky/actor/getProfiles.js +1 -0
- package/dist/api/internal/bsky/actor/getProfiles.js.map +1 -1
- package/dist/config.d.ts +2 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -16
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +0 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +0 -3
- package/dist/context.js.map +1 -1
- package/dist/feature-gates/gates.d.ts +0 -4
- package/dist/feature-gates/gates.d.ts.map +1 -1
- package/dist/feature-gates/gates.js +0 -4
- package/dist/feature-gates/gates.js.map +1 -1
- package/dist/hydration/external.d.ts +58 -45
- package/dist/hydration/external.d.ts.map +1 -1
- package/dist/hydration/external.js +134 -114
- package/dist/hydration/external.js.map +1 -1
- package/dist/hydration/hydrator.d.ts +15 -9
- package/dist/hydration/hydrator.d.ts.map +1 -1
- package/dist/hydration/hydrator.js +170 -210
- package/dist/hydration/hydrator.js.map +1 -1
- package/dist/image/server.d.ts.map +1 -1
- package/dist/image/server.js +12 -1
- package/dist/image/server.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -19
- package/dist/index.js.map +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts +29 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js +2 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.d.ts +3 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.d.ts.map +1 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.defs.d.ts +85 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.defs.d.ts.map +1 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.defs.js +29 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.defs.js.map +1 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.js +6 -0
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereTimeline.js.map +1 -0
- package/dist/lexicons/app/bsky/unspecced.d.ts +1 -0
- package/dist/lexicons/app/bsky/unspecced.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/unspecced.js +1 -0
- package/dist/lexicons/app/bsky/unspecced.js.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/emitEvent.defs.d.ts +2 -2
- package/dist/lexicons/tools/ozone/moderation/emitEvent.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/report/closeReports.defs.d.ts +1 -1
- package/dist/lexicons/tools/ozone/report/closeReports.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/report/closeReports.defs.js +1 -1
- package/dist/lexicons/tools/ozone/report/closeReports.defs.js.map +1 -1
- package/dist/telemetry/events.d.ts +14 -6
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/telemetry/events.js +40 -5
- package/dist/telemetry/events.js.map +1 -1
- package/dist/util/external/standard-site.d.ts +2 -3
- package/dist/util/external/standard-site.d.ts.map +1 -1
- package/dist/util/external/standard-site.js +2 -3
- package/dist/util/external/standard-site.js.map +1 -1
- package/dist/util/uris.d.ts +5 -2
- package/dist/util/uris.d.ts.map +1 -1
- package/dist/util/uris.js +14 -1
- package/dist/util/uris.js.map +1 -1
- package/dist/views/external.d.ts +5 -0
- package/dist/views/external.d.ts.map +1 -1
- package/dist/views/external.js +38 -11
- package/dist/views/external.js.map +1 -1
- package/dist/views/index.d.ts +2 -2
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +17 -11
- package/dist/views/index.js.map +1 -1
- package/package.json +13 -14
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type AtUriString, type DidString, type NsidString, type TypedLexMap } from '@atproto/lex';
|
|
2
2
|
import type { DataPlaneClient } from '../data-plane/client/index.js';
|
|
3
3
|
import { type ExternalHydrationRoot, type ExternalHydrationWork, type HydrationXrpcEndpoint } from '../telemetry/events.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type SiteStandardDocumentRecord, type SiteStandardPublicationRecord } from '../views/types.js';
|
|
5
5
|
import type { Actors } from './actor.js';
|
|
6
|
+
import type { Posts } from './feed.js';
|
|
6
7
|
import type { Labels } from './label.js';
|
|
7
8
|
import { HydrationMap, type ItemRef, type RecordInfo } from './util.js';
|
|
8
9
|
/** Generic record bodies are decoded, but not validated against a Lexicon. */
|
|
@@ -11,6 +12,8 @@ export type ExternalRecords = HydrationMap<AtUriString, ExternalRecord>;
|
|
|
11
12
|
/** Keyed by `genericRecordKey({ uri, cid })` to retain versions of a URI. */
|
|
12
13
|
export type ExternalRecordsByRef = HydrationMap<ExactRecordKey, ExternalRecord>;
|
|
13
14
|
export type ExternalRecordBacklinks = HydrationMap<AtUriString, AtUriString[]>;
|
|
15
|
+
/** Viewer subscription outcomes per publication; null means unknown. */
|
|
16
|
+
export type ExternalPublicationSubscriptions = HydrationMap<AtUriString, boolean>;
|
|
14
17
|
export type AtmosphereActivityItem = {
|
|
15
18
|
uri: AtUriString;
|
|
16
19
|
sortedAt: Date;
|
|
@@ -38,33 +41,56 @@ export type ExactRecordKey = string & {
|
|
|
38
41
|
};
|
|
39
42
|
export type SiteStandardDocument = RecordInfo<SiteStandardDocumentRecord>;
|
|
40
43
|
export type SiteStandardPublication = RecordInfo<SiteStandardPublicationRecord>;
|
|
44
|
+
export type ExternalHydrationLevel = 'basic' | 'detailed';
|
|
41
45
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
+
* Options for external hydration traversals. `hydration` picks one level for
|
|
47
|
+
* the whole traversal (default `'detailed'`): `'basic'` hydrates renderable
|
|
48
|
+
* content, moderation and aggregate backlink counts; `'detailed'` also samples
|
|
49
|
+
* social-preview backlinks and hydrates their records and participants.
|
|
50
|
+
* `publicationSubscriptions` opts an authenticated viewer into request-cached
|
|
51
|
+
* subscription discovery. The remaining fields are shared traversal state.
|
|
46
52
|
*/
|
|
47
|
-
export type
|
|
53
|
+
export type ExternalHydrationOptions = {
|
|
54
|
+
hydration?: ExternalHydrationLevel;
|
|
55
|
+
seenRecordKeys?: Set<string>;
|
|
56
|
+
hydrationPass?: number;
|
|
57
|
+
hydrationMetrics?: ExternalHydrationTracker;
|
|
58
|
+
publicationSubscriptions?: ExternalPublicationSubscriptions;
|
|
59
|
+
};
|
|
48
60
|
/**
|
|
49
|
-
*
|
|
61
|
+
* Per-collection sample limits. Basic hydration skips social previews,
|
|
62
|
+
* but keeps gallery items. Direct publication/photo references are singular.
|
|
50
63
|
*/
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
export declare const EXTERNAL_HYDRATION_LIMITS: {
|
|
65
|
+
readonly "site.standard.document": {
|
|
66
|
+
readonly recommendationPreviews: 3;
|
|
67
|
+
};
|
|
68
|
+
readonly "site.standard.publication": {
|
|
69
|
+
readonly subscriberPreviews: 3;
|
|
70
|
+
};
|
|
71
|
+
readonly "social.grain.gallery": {
|
|
72
|
+
readonly items: 10;
|
|
73
|
+
readonly favoritePreviews: 3;
|
|
74
|
+
};
|
|
55
75
|
};
|
|
76
|
+
/** Maximum in-flight backlink sample RPCs, not a dependency-count limit. */
|
|
77
|
+
export declare const MAX_CONCURRENT_BACKLINK_REQUESTS = 8;
|
|
78
|
+
/** Maximum logical batches per traversal, counting the root as pass 1. */
|
|
79
|
+
export declare const MAX_EXTERNAL_HYDRATION_PASSES = 8;
|
|
56
80
|
export declare class ExternalHydrator {
|
|
57
81
|
dataplane: DataPlaneClient;
|
|
58
|
-
static readonly MAX_BACKLINK_PREVIEWS = 3;
|
|
59
|
-
static readonly MAX_BACKLINK_GALLERY_ITEMS = 10;
|
|
60
|
-
static readonly MAX_BACKLINK_FANOUT = 8;
|
|
61
|
-
/** Hard cap on generic batches per traversal, counting the root as pass 1. */
|
|
62
|
-
static readonly MAX_EXTERNAL_HYDRATION_PASSES = 8;
|
|
63
82
|
/**
|
|
64
83
|
* Entries per generic record RPC. The dataplane rejects larger URI lookups;
|
|
65
84
|
* exact-ref lookups use the same bound defensively.
|
|
66
85
|
*/
|
|
67
86
|
static readonly MAX_RECORDS_PER_REQUEST = 100;
|
|
87
|
+
/**
|
|
88
|
+
* Target URIs per backlink-count RPC. The dataplane requires between 1 and
|
|
89
|
+
* 100; this is a separate limit from `MAX_RECORDS_PER_REQUEST`.
|
|
90
|
+
*/
|
|
91
|
+
static readonly MAX_BACKLINK_COUNT_TARGETS_PER_REQUEST = 100;
|
|
92
|
+
/** Target URIs per actor-backlink RPC, bounded by the dataplane. */
|
|
93
|
+
static readonly MAX_BACKLINK_ACTOR_TARGETS_PER_REQUEST = 100;
|
|
68
94
|
constructor(dataplane: DataPlaneClient);
|
|
69
95
|
/**
|
|
70
96
|
* Fetch exact record versions; unavailable records are represented by null.
|
|
@@ -83,7 +109,11 @@ export declare class ExternalHydrator {
|
|
|
83
109
|
limit?: number;
|
|
84
110
|
cursor?: string;
|
|
85
111
|
}): Promise<AtmosphereTimeline>;
|
|
86
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Fetch source-record counts, optionally restricted to one collection. Large
|
|
114
|
+
* inputs are fetched in sequential bounded requests; any failed request
|
|
115
|
+
* rejects the whole call.
|
|
116
|
+
*/
|
|
87
117
|
getAtmosphereBacklinkCounts(targetUris: AtUriString[], collection?: NsidString): Promise<ExternalRecordBacklinkCounts>;
|
|
88
118
|
/** Fetch a page of source records linking to a target. */
|
|
89
119
|
getAtmosphereBacklinks(targetUri: AtUriString, collection: NsidString, opts?: {
|
|
@@ -92,11 +122,6 @@ export declare class ExternalHydrator {
|
|
|
92
122
|
}): Promise<AtmosphereBacklinks>;
|
|
93
123
|
/** Fetch an actor's links per target, retaining the batch truncation flag. */
|
|
94
124
|
getAtmosphereBacklinksByActor(targetUris: AtUriString[], actorDid: DidString, collection: NsidString): Promise<AtmosphereBacklinksByActor>;
|
|
95
|
-
/**
|
|
96
|
-
* Fetch exact `site.standard.{document,publication}` versions. Does NOT
|
|
97
|
-
* resolve a document's publication; callers must pin it explicitly.
|
|
98
|
-
*/
|
|
99
|
-
getSiteStandardRecordsByRef(refs: ItemRef[], includeTakedowns?: boolean): Promise<SiteStandardRecords>;
|
|
100
125
|
}
|
|
101
126
|
/**
|
|
102
127
|
* Composes the lookup key for a ref: the bare URI for a latest-version lookup,
|
|
@@ -145,9 +170,10 @@ export type ExternalHydrationTracker = ExternalHydrationWork & {
|
|
|
145
170
|
* there is none. Only the owner reports, once, including on failure, with the
|
|
146
171
|
* context's XRPC endpoint (`'unknown'` if unset) and the traversal's wall time. A
|
|
147
172
|
* returned traversal is `capped` if it hit the pass limit, else `partial` if
|
|
148
|
-
* it recovered from a dependency failure. Owners that completed
|
|
149
|
-
*
|
|
150
|
-
* are.
|
|
173
|
+
* it recovered from a dependency failure. Owners that completed report when
|
|
174
|
+
* they scheduled a batch or inspected roots (even prehydrated or unavailable
|
|
175
|
+
* ones); only genuinely empty successful calls are not reported. Other
|
|
176
|
+
* outcomes always are.
|
|
151
177
|
*/
|
|
152
178
|
export declare function trackExternalHydration<T>(root: ExternalHydrationRoot, xrpcEndpoint: HydrationXrpcEndpoint | undefined, hydrationMetrics: ExternalHydrationTracker | undefined, fn: (hydrationMetrics: ExternalHydrationTracker) => Promise<T>): Promise<T>;
|
|
153
179
|
export type AssociatedSiteStandardRecord<T> = {
|
|
@@ -158,29 +184,16 @@ export type AssociatedSiteStandardRecord<T> = {
|
|
|
158
184
|
info: T;
|
|
159
185
|
};
|
|
160
186
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* that doesn't structurally agree is rejected, so downstream callers can
|
|
164
|
-
* trust the returned shape.
|
|
165
|
-
*
|
|
166
|
-
* Pairing rules:
|
|
167
|
-
* - Both slots referenced: `doc.site` must equal `publication.ref.uri`,
|
|
168
|
-
* else both come back `undefined`.
|
|
169
|
-
* - Doc with at-uri `site` referenced but no matching publication ref:
|
|
170
|
-
* reject the whole pairing (doc claims a publication that should have
|
|
171
|
-
* been pinned, but wasn't).
|
|
172
|
-
* - Loose doc (web-URL `site`) referenced: publication stays `undefined`.
|
|
173
|
-
* - Only a publication referenced: document stays `undefined`.
|
|
174
|
-
*
|
|
175
|
-
* Each returned slot carries the matching `ref` so callers can recover
|
|
176
|
-
* the owner DID for blob-cdn URL building, etc.
|
|
187
|
+
* Select one pinned embed root. Legacy publication-first pairs may put their
|
|
188
|
+
* document second; no other authored refs participate in hydration.
|
|
177
189
|
*/
|
|
178
|
-
export declare
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}[] | undefined, documents: SiteStandardDocuments | undefined, publications: SiteStandardPublications | undefined) => {
|
|
190
|
+
export declare function getExternalRootRef(refs: readonly Required<ItemRef>[] | undefined): Required<ItemRef> | undefined;
|
|
191
|
+
/** Select a pinned Standard.site root and its derived publication, if needed. */
|
|
192
|
+
export declare function getSiteStandardRecordsFromRefs(associatedRefs: readonly Required<ItemRef>[] | undefined, records: ExternalRecordsByRef | undefined, dependencies?: ExternalRecords): {
|
|
182
193
|
document: AssociatedSiteStandardRecord<SiteStandardDocument> | undefined;
|
|
183
194
|
publication: AssociatedSiteStandardRecord<SiteStandardPublication> | undefined;
|
|
184
195
|
};
|
|
196
|
+
/** Collect one root per post across all layers, deduped by exact ref. */
|
|
197
|
+
export declare const externalAssociatedRefsFromPosts: (...postLayers: Posts[]) => Required<ItemRef>[];
|
|
185
198
|
export {};
|
|
186
199
|
//# sourceMappingURL=external.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/hydration/external.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,KAAK,UAAU,EAEf,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/hydration/external.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,KAAK,UAAU,EAEf,KAAK,WAAW,EAIjB,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAMpE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE3B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAGnC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAQ,KAAK,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;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AM,+BAA+B,kBAC3B,KAAK,EAAE,KACrB,QAAQ,CAAC,OAAO,CAAC,EAenB,CAAA"}
|
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { chunkArray } from '@atproto/common';
|
|
3
|
-
import { isTypedLexMap, lexParseJsonBytes, } from '@atproto/lex';
|
|
3
|
+
import { isDidString, isTypedLexMap, lexParseJsonBytes, } from '@atproto/lex';
|
|
4
4
|
import { parseAtUriString } from '@atproto/syntax';
|
|
5
|
-
import { site } from '../lexicons/index.js';
|
|
6
|
-
import { hydrationLogger } from '../logger.js';
|
|
5
|
+
import { site, social } from '../lexicons/index.js';
|
|
7
6
|
import { RecordLookupStatus, } from '../proto/bsky_pb.js';
|
|
8
7
|
import { events, } from '../telemetry/events.js';
|
|
9
|
-
import { uriToDid } from '../util/uris.js';
|
|
8
|
+
import { recordUriOf, uriToDid } from '../util/uris.js';
|
|
9
|
+
import { isExternalEmbedType, isRecordWithMediaType, } from '../views/types.js';
|
|
10
10
|
import { HydrationMap, parseDate, safeTakedownRef, } from './util.js';
|
|
11
|
+
/**
|
|
12
|
+
* Per-collection sample limits. Basic hydration skips social previews,
|
|
13
|
+
* but keeps gallery items. Direct publication/photo references are singular.
|
|
14
|
+
*/
|
|
15
|
+
export const EXTERNAL_HYDRATION_LIMITS = {
|
|
16
|
+
[site.standard.document.$type]: { recommendationPreviews: 3 },
|
|
17
|
+
[site.standard.publication.$type]: { subscriberPreviews: 3 },
|
|
18
|
+
[social.grain.gallery.$type]: { items: 10, favoritePreviews: 3 },
|
|
19
|
+
};
|
|
20
|
+
/** Maximum in-flight backlink sample RPCs, not a dependency-count limit. */
|
|
21
|
+
export const MAX_CONCURRENT_BACKLINK_REQUESTS = 8;
|
|
22
|
+
/** Maximum logical batches per traversal, counting the root as pass 1. */
|
|
23
|
+
export const MAX_EXTERNAL_HYDRATION_PASSES = 8;
|
|
11
24
|
export class ExternalHydrator {
|
|
12
|
-
static { this.MAX_BACKLINK_PREVIEWS = 3; }
|
|
13
|
-
static { this.MAX_BACKLINK_GALLERY_ITEMS = 10; }
|
|
14
|
-
static { this.MAX_BACKLINK_FANOUT = 8; }
|
|
15
|
-
/** Hard cap on generic batches per traversal, counting the root as pass 1. */
|
|
16
|
-
static { this.MAX_EXTERNAL_HYDRATION_PASSES = 8; }
|
|
17
25
|
/**
|
|
18
26
|
* Entries per generic record RPC. The dataplane rejects larger URI lookups;
|
|
19
27
|
* exact-ref lookups use the same bound defensively.
|
|
20
28
|
*/
|
|
21
29
|
static { this.MAX_RECORDS_PER_REQUEST = 100; }
|
|
30
|
+
/**
|
|
31
|
+
* Target URIs per backlink-count RPC. The dataplane requires between 1 and
|
|
32
|
+
* 100; this is a separate limit from `MAX_RECORDS_PER_REQUEST`.
|
|
33
|
+
*/
|
|
34
|
+
static { this.MAX_BACKLINK_COUNT_TARGETS_PER_REQUEST = 100; }
|
|
35
|
+
/** Target URIs per actor-backlink RPC, bounded by the dataplane. */
|
|
36
|
+
static { this.MAX_BACKLINK_ACTOR_TARGETS_PER_REQUEST = 100; }
|
|
22
37
|
constructor(dataplane) {
|
|
23
38
|
this.dataplane = dataplane;
|
|
24
39
|
}
|
|
@@ -68,20 +83,24 @@ export class ExternalHydrator {
|
|
|
68
83
|
cursor: res.cursor || undefined,
|
|
69
84
|
};
|
|
70
85
|
}
|
|
71
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Fetch source-record counts, optionally restricted to one collection. Large
|
|
88
|
+
* inputs are fetched in sequential bounded requests; any failed request
|
|
89
|
+
* rejects the whole call.
|
|
90
|
+
*/
|
|
72
91
|
async getAtmosphereBacklinkCounts(targetUris, collection) {
|
|
73
92
|
const map = new HydrationMap();
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
for (const chunk of chunkArray(targetUris, ExternalHydrator.MAX_BACKLINK_COUNT_TARGETS_PER_REQUEST)) {
|
|
94
|
+
const res = await this.dataplane.getAtmosphereBacklinkCounts({
|
|
95
|
+
targetUris: chunk,
|
|
96
|
+
collection,
|
|
97
|
+
});
|
|
98
|
+
for (const result of res.results) {
|
|
99
|
+
map.set(result.targetUri, Object.fromEntries(Object.entries(result.counts).map(([nsid, count]) => [
|
|
100
|
+
nsid,
|
|
101
|
+
Number(count),
|
|
102
|
+
])));
|
|
103
|
+
}
|
|
85
104
|
}
|
|
86
105
|
return map;
|
|
87
106
|
}
|
|
@@ -115,21 +134,6 @@ export class ExternalHydrator {
|
|
|
115
134
|
}
|
|
116
135
|
return { backlinks, truncated: res.truncated };
|
|
117
136
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Fetch exact `site.standard.{document,publication}` versions. Does NOT
|
|
120
|
-
* resolve a document's publication; callers must pin it explicitly.
|
|
121
|
-
*/
|
|
122
|
-
async getSiteStandardRecordsByRef(refs, includeTakedowns = false) {
|
|
123
|
-
const ssRefs = refs.filter((ref) => !!ref.cid && siteStandardKind(ref.uri) !== undefined);
|
|
124
|
-
const out = emptySiteStandardRecords();
|
|
125
|
-
if (!ssRefs.length)
|
|
126
|
-
return out;
|
|
127
|
-
const records = await this.getRecordsByRef(ssRefs, includeTakedowns);
|
|
128
|
-
for (const [key, info] of records) {
|
|
129
|
-
setSiteStandardRecord(out, parseGenericRecordKey(key).uri, key, info);
|
|
130
|
-
}
|
|
131
|
-
return out;
|
|
132
|
-
}
|
|
133
137
|
}
|
|
134
138
|
export function genericRecordKey({ uri, cid }) {
|
|
135
139
|
if (cid === undefined)
|
|
@@ -180,9 +184,10 @@ export function actionExternalRecordTakedowns({ externalRecords, externalRecords
|
|
|
180
184
|
* there is none. Only the owner reports, once, including on failure, with the
|
|
181
185
|
* context's XRPC endpoint (`'unknown'` if unset) and the traversal's wall time. A
|
|
182
186
|
* returned traversal is `capped` if it hit the pass limit, else `partial` if
|
|
183
|
-
* it recovered from a dependency failure. Owners that completed
|
|
184
|
-
*
|
|
185
|
-
* are.
|
|
187
|
+
* it recovered from a dependency failure. Owners that completed report when
|
|
188
|
+
* they scheduled a batch or inspected roots (even prehydrated or unavailable
|
|
189
|
+
* ones); only genuinely empty successful calls are not reported. Other
|
|
190
|
+
* outcomes always are.
|
|
186
191
|
*/
|
|
187
192
|
export async function trackExternalHydration(root, xrpcEndpoint, hydrationMetrics, fn) {
|
|
188
193
|
if (hydrationMetrics)
|
|
@@ -207,7 +212,7 @@ export async function trackExternalHydration(root, xrpcEndpoint, hydrationMetric
|
|
|
207
212
|
return state;
|
|
208
213
|
}
|
|
209
214
|
finally {
|
|
210
|
-
if (owned.batches || outcome !== 'completed') {
|
|
215
|
+
if (owned.batches > 0 || owned.roots > 0 || outcome !== 'completed') {
|
|
211
216
|
events.externalHydrationTraversal({
|
|
212
217
|
xrpcEndpoint: xrpcEndpoint ?? 'unknown',
|
|
213
218
|
root,
|
|
@@ -251,10 +256,6 @@ function parseGenericRecord(result, includeTakedowns) {
|
|
|
251
256
|
takedownRef: safeTakedownRef(entry),
|
|
252
257
|
};
|
|
253
258
|
}
|
|
254
|
-
const emptySiteStandardRecords = () => ({
|
|
255
|
-
documents: new HydrationMap(),
|
|
256
|
-
publications: new HydrationMap(),
|
|
257
|
-
});
|
|
258
259
|
const siteStandardKind = (uri) => {
|
|
259
260
|
const parsed = parseAtUriString(uri);
|
|
260
261
|
if (!parsed.success)
|
|
@@ -277,82 +278,101 @@ const matchRecordInfo = (schema, info) => info && schema.$matches(info.record, {
|
|
|
277
278
|
? { ...info, record: info.record }
|
|
278
279
|
: null;
|
|
279
280
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
281
|
+
* Select one pinned embed root. Legacy publication-first pairs may put their
|
|
282
|
+
* document second; no other authored refs participate in hydration.
|
|
282
283
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
284
|
+
export function getExternalRootRef(refs) {
|
|
285
|
+
let root = refs?.[0];
|
|
286
|
+
if (!root)
|
|
287
|
+
return undefined;
|
|
288
|
+
if (siteStandardKind(root.uri) === 'publications') {
|
|
289
|
+
const second = refs?.[1];
|
|
290
|
+
if (second && siteStandardKind(second.uri) === 'documents')
|
|
291
|
+
root = second;
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
* - Only a publication referenced: document stays `undefined`.
|
|
307
|
-
*
|
|
308
|
-
* Each returned slot carries the matching `ref` so callers can recover
|
|
309
|
-
* the owner DID for blob-cdn URL building, etc.
|
|
310
|
-
*/
|
|
311
|
-
export const getSiteStandardRecordsFromHydrationMapsByRefs = (associatedRefs, documents, publications) => {
|
|
312
|
-
if (!associatedRefs?.length) {
|
|
313
|
-
return { document: undefined, publication: undefined };
|
|
293
|
+
return isHydratableAssociatedRef(root) ? root : undefined;
|
|
294
|
+
}
|
|
295
|
+
/** Select a pinned Standard.site root and its derived publication, if needed. */
|
|
296
|
+
export function getSiteStandardRecordsFromRefs(associatedRefs, records, dependencies) {
|
|
297
|
+
const empty = { document: undefined, publication: undefined };
|
|
298
|
+
const ref = getExternalRootRef(associatedRefs);
|
|
299
|
+
if (!ref)
|
|
300
|
+
return empty;
|
|
301
|
+
const info = records?.get(genericRecordKey(ref));
|
|
302
|
+
if (siteStandardKind(ref.uri) === 'publications') {
|
|
303
|
+
const publication = matchRecordInfo(site.standard.publication.main, info);
|
|
304
|
+
return publication
|
|
305
|
+
? { document: undefined, publication: { ref, info: publication } }
|
|
306
|
+
: empty;
|
|
314
307
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
document = { ref, info: hit };
|
|
325
|
-
}
|
|
326
|
-
if (!publication) {
|
|
327
|
-
const hit = publications?.get(key);
|
|
328
|
-
if (hit)
|
|
329
|
-
publication = { ref, info: hit };
|
|
330
|
-
}
|
|
331
|
-
if (document && publication)
|
|
332
|
-
break;
|
|
308
|
+
if (siteStandardKind(ref.uri) !== 'documents')
|
|
309
|
+
return empty;
|
|
310
|
+
const document = matchRecordInfo(site.standard.document.main, info);
|
|
311
|
+
if (!document)
|
|
312
|
+
return empty;
|
|
313
|
+
const documentSelection = { ref, info: document };
|
|
314
|
+
const docSite = document.record.site;
|
|
315
|
+
if (!docSite.startsWith('at://')) {
|
|
316
|
+
return { document: documentSelection, publication: undefined };
|
|
333
317
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
318
|
+
const uri = recordUriOf(docSite, site.standard.publication.$type);
|
|
319
|
+
if (!uri)
|
|
320
|
+
return empty;
|
|
321
|
+
const publication = matchRecordInfo(site.standard.publication.main, dependencies?.get(uri));
|
|
322
|
+
if (!publication)
|
|
323
|
+
return empty;
|
|
324
|
+
return {
|
|
325
|
+
document: documentSelection,
|
|
326
|
+
publication: { ref: { uri, cid: publication.cid }, info: publication },
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const externalAssociatedRefs = (post) => {
|
|
330
|
+
const embed = post?.embed;
|
|
331
|
+
if (!embed)
|
|
332
|
+
return [];
|
|
333
|
+
if (isExternalEmbedType(embed)) {
|
|
334
|
+
return embed.external.associatedRefs ?? [];
|
|
346
335
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
336
|
+
if (isRecordWithMediaType(embed) && isExternalEmbedType(embed.media)) {
|
|
337
|
+
return embed.media.external.associatedRefs ?? [];
|
|
338
|
+
}
|
|
339
|
+
return [];
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* An exact ref needs a nonempty CID and a complete record URI in a DID repo,
|
|
343
|
+
* so malformed refs are skipped instead of becoming latest lookups.
|
|
344
|
+
*/
|
|
345
|
+
const isHydratableAssociatedRef = (ref) => {
|
|
346
|
+
if (!ref.cid)
|
|
347
|
+
return false;
|
|
348
|
+
const parsed = parseAtUriString(ref.uri);
|
|
349
|
+
if (!parsed.success)
|
|
350
|
+
return false;
|
|
351
|
+
const { authority, collection, rkey, query, hash } = parsed.value;
|
|
352
|
+
return (isDidString(authority) &&
|
|
353
|
+
!!collection &&
|
|
354
|
+
!!rkey &&
|
|
355
|
+
query === undefined &&
|
|
356
|
+
hash === undefined);
|
|
357
|
+
};
|
|
358
|
+
/** Collect one root per post across all layers, deduped by exact ref. */
|
|
359
|
+
export const externalAssociatedRefsFromPosts = (...postLayers) => {
|
|
360
|
+
const seen = new Set();
|
|
361
|
+
const out = [];
|
|
362
|
+
for (const layer of postLayers) {
|
|
363
|
+
for (const item of layer.values()) {
|
|
364
|
+
if (!item)
|
|
365
|
+
continue;
|
|
366
|
+
const ref = getExternalRootRef(externalAssociatedRefs(item.record));
|
|
367
|
+
if (!ref)
|
|
368
|
+
continue;
|
|
369
|
+
const key = genericRecordKey(ref);
|
|
370
|
+
if (seen.has(key))
|
|
371
|
+
continue;
|
|
372
|
+
seen.add(key);
|
|
373
|
+
out.push({ uri: ref.uri, cid: ref.cid });
|
|
354
374
|
}
|
|
355
375
|
}
|
|
356
|
-
return
|
|
376
|
+
return out;
|
|
357
377
|
};
|
|
358
378
|
//# sourceMappingURL=external.js.map
|