@atproto/bsky 0.0.251 → 0.0.253
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 +35 -0
- package/dist/api/age-assurance/const.js +19 -19
- package/dist/api/age-assurance/const.js.map +1 -1
- package/dist/kws.d.ts +8 -0
- package/dist/kws.d.ts.map +1 -1
- package/dist/kws.js +53 -4
- package/dist/kws.js.map +1 -1
- package/package.json +28 -23
- package/bin/migration-create.ts +0 -46
- package/buf.gen.yaml +0 -12
- package/proto/bsky.proto +0 -1907
- package/proto/courier.proto +0 -84
- package/proto/rolodex.proto +0 -116
- package/src/api/age-assurance/const.ts +0 -203
- package/src/api/age-assurance/index.ts +0 -34
- package/src/api/age-assurance/kws/age-verified.test.ts +0 -98
- package/src/api/age-assurance/kws/age-verified.ts +0 -81
- package/src/api/age-assurance/kws/const.ts +0 -33
- package/src/api/age-assurance/kws/external-payload.test.ts +0 -72
- package/src/api/age-assurance/kws/external-payload.ts +0 -149
- package/src/api/age-assurance/redirects/kws-age-verified.ts +0 -107
- package/src/api/age-assurance/stash.ts +0 -23
- package/src/api/age-assurance/types.ts +0 -10
- package/src/api/age-assurance/util.ts +0 -68
- package/src/api/age-assurance/webhooks/kws-age-verified.ts +0 -75
- package/src/api/app/bsky/actor/getProfile.ts +0 -106
- package/src/api/app/bsky/actor/getProfiles.ts +0 -99
- package/src/api/app/bsky/actor/getSuggestions.ts +0 -163
- package/src/api/app/bsky/actor/searchActors.ts +0 -171
- package/src/api/app/bsky/actor/searchActorsTypeahead.ts +0 -164
- package/src/api/app/bsky/ageassurance/begin.ts +0 -175
- package/src/api/app/bsky/ageassurance/getConfig.ts +0 -16
- package/src/api/app/bsky/ageassurance/getState.ts +0 -58
- package/src/api/app/bsky/bookmark/createBookmark.ts +0 -39
- package/src/api/app/bsky/bookmark/deleteBookmark.ts +0 -32
- package/src/api/app/bsky/bookmark/getBookmarks.ts +0 -97
- package/src/api/app/bsky/bookmark/util.ts +0 -13
- package/src/api/app/bsky/contact/dismissMatch.ts +0 -26
- package/src/api/app/bsky/contact/getMatches.ts +0 -111
- package/src/api/app/bsky/contact/getSyncStatus.ts +0 -38
- package/src/api/app/bsky/contact/importContacts.ts +0 -119
- package/src/api/app/bsky/contact/removeData.ts +0 -25
- package/src/api/app/bsky/contact/sendNotification.ts +0 -33
- package/src/api/app/bsky/contact/startPhoneVerification.ts +0 -26
- package/src/api/app/bsky/contact/util.ts +0 -92
- package/src/api/app/bsky/contact/verifyPhone.ts +0 -29
- package/src/api/app/bsky/draft/createDraft.ts +0 -45
- package/src/api/app/bsky/draft/deleteDraft.ts +0 -20
- package/src/api/app/bsky/draft/getDrafts.ts +0 -44
- package/src/api/app/bsky/draft/updateDraft.ts +0 -26
- package/src/api/app/bsky/embed/getEmbedExternalView.ts +0 -154
- package/src/api/app/bsky/feed/getActorFeeds.ts +0 -101
- package/src/api/app/bsky/feed/getActorLikes.ts +0 -128
- package/src/api/app/bsky/feed/getAuthorFeed.ts +0 -279
- package/src/api/app/bsky/feed/getFeed.ts +0 -282
- package/src/api/app/bsky/feed/getFeedGenerator.ts +0 -68
- package/src/api/app/bsky/feed/getFeedGenerators.ts +0 -86
- package/src/api/app/bsky/feed/getLikes.ts +0 -151
- package/src/api/app/bsky/feed/getListFeed.ts +0 -147
- package/src/api/app/bsky/feed/getPostThread.ts +0 -156
- package/src/api/app/bsky/feed/getPosts.ts +0 -100
- package/src/api/app/bsky/feed/getQuotes.ts +0 -122
- package/src/api/app/bsky/feed/getRepostedBy.ts +0 -121
- package/src/api/app/bsky/feed/getSuggestedFeeds.ts +0 -39
- package/src/api/app/bsky/feed/getTimeline.ts +0 -127
- package/src/api/app/bsky/feed/searchPosts.ts +0 -274
- package/src/api/app/bsky/feed/searchPostsV2.ts +0 -243
- package/src/api/app/bsky/graph/getActorStarterPacks.ts +0 -103
- package/src/api/app/bsky/graph/getBlocks.ts +0 -94
- package/src/api/app/bsky/graph/getFollowers.ts +0 -153
- package/src/api/app/bsky/graph/getFollows.ts +0 -151
- package/src/api/app/bsky/graph/getKnownFollowers.ts +0 -123
- package/src/api/app/bsky/graph/getList.ts +0 -152
- package/src/api/app/bsky/graph/getListBlocks.ts +0 -87
- package/src/api/app/bsky/graph/getListMutes.ts +0 -87
- package/src/api/app/bsky/graph/getLists.ts +0 -125
- package/src/api/app/bsky/graph/getListsWithMembership.ts +0 -146
- package/src/api/app/bsky/graph/getMutes.ts +0 -87
- package/src/api/app/bsky/graph/getRelationships.ts +0 -58
- package/src/api/app/bsky/graph/getStarterPack.ts +0 -82
- package/src/api/app/bsky/graph/getStarterPacks.ts +0 -86
- package/src/api/app/bsky/graph/getStarterPacksWithMembership.ts +0 -136
- package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +0 -171
- package/src/api/app/bsky/graph/muteActor.ts +0 -24
- package/src/api/app/bsky/graph/muteActorList.ts +0 -19
- package/src/api/app/bsky/graph/muteThread.ts +0 -19
- package/src/api/app/bsky/graph/searchStarterPacks.ts +0 -169
- package/src/api/app/bsky/graph/unmuteActor.ts +0 -21
- package/src/api/app/bsky/graph/unmuteActorList.ts +0 -19
- package/src/api/app/bsky/graph/unmuteThread.ts +0 -19
- package/src/api/app/bsky/labeler/getServices.ts +0 -41
- package/src/api/app/bsky/notification/getPreferences.ts +0 -49
- package/src/api/app/bsky/notification/getUnreadCount.ts +0 -83
- package/src/api/app/bsky/notification/listActivitySubscriptions.ts +0 -116
- package/src/api/app/bsky/notification/listNotifications.ts +0 -272
- package/src/api/app/bsky/notification/putActivitySubscription.ts +0 -69
- package/src/api/app/bsky/notification/putPreferences.ts +0 -17
- package/src/api/app/bsky/notification/putPreferencesV2.ts +0 -64
- package/src/api/app/bsky/notification/registerPush.ts +0 -40
- package/src/api/app/bsky/notification/unregisterPush.ts +0 -39
- package/src/api/app/bsky/notification/updateSeen.ts +0 -52
- package/src/api/app/bsky/notification/util.ts +0 -134
- package/src/api/app/bsky/unspecced/getAgeAssuranceState.ts +0 -48
- package/src/api/app/bsky/unspecced/getConfig.ts +0 -20
- package/src/api/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.ts +0 -162
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +0 -91
- package/src/api/app/bsky/unspecced/getPostThreadOtherV2.ts +0 -126
- package/src/api/app/bsky/unspecced/getPostThreadV2.ts +0 -148
- package/src/api/app/bsky/unspecced/getSuggestedFeeds.ts +0 -100
- package/src/api/app/bsky/unspecced/getSuggestedOnboardingUsers.ts +0 -143
- package/src/api/app/bsky/unspecced/getSuggestedStarterPacks.ts +0 -165
- package/src/api/app/bsky/unspecced/getSuggestedUsers.ts +0 -183
- package/src/api/app/bsky/unspecced/getSuggestedUsersForDiscover.ts +0 -175
- package/src/api/app/bsky/unspecced/getSuggestedUsersForExplore.ts +0 -178
- package/src/api/app/bsky/unspecced/getSuggestedUsersForSeeMore.ts +0 -178
- package/src/api/app/bsky/unspecced/getTaggedSuggestions.ts +0 -27
- package/src/api/app/bsky/unspecced/getTrendingTopics.ts +0 -96
- package/src/api/app/bsky/unspecced/getTrends.ts +0 -162
- package/src/api/app/bsky/unspecced/initAgeAssurance.ts +0 -150
- package/src/api/blob-dispatcher.ts +0 -41
- package/src/api/blob-resolver.ts +0 -401
- package/src/api/com/atproto/admin/getAccountInfos.ts +0 -49
- package/src/api/com/atproto/admin/getSubjectStatus.ts +0 -79
- package/src/api/com/atproto/admin/updateSubjectStatus.ts +0 -80
- package/src/api/com/atproto/identity/resolveHandle.ts +0 -19
- package/src/api/com/atproto/label/queryLabels.ts +0 -42
- package/src/api/com/atproto/repo/getRecord.ts +0 -44
- package/src/api/com/atproto/temp/fetchLabels.ts +0 -9
- package/src/api/external.ts +0 -15
- package/src/api/health.ts +0 -47
- package/src/api/index.ts +0 -216
- package/src/api/internal/bsky/actor/getProfiles.ts +0 -87
- package/src/api/kws/api.ts +0 -113
- package/src/api/kws/index.ts +0 -29
- package/src/api/kws/types.ts +0 -78
- package/src/api/kws/util.test.ts +0 -50
- package/src/api/kws/util.ts +0 -109
- package/src/api/kws/webhook.ts +0 -134
- package/src/api/sitemap.ts +0 -76
- package/src/api/util.ts +0 -45
- package/src/api/well-known.ts +0 -44
- package/src/auth-verifier.ts +0 -522
- package/src/bsync.ts +0 -41
- package/src/cache/read-through.ts +0 -157
- package/src/config.ts +0 -719
- package/src/context.ts +0 -143
- package/src/courier.ts +0 -41
- package/src/data-plane/client/hosts.ts +0 -103
- package/src/data-plane/client/index.ts +0 -125
- package/src/data-plane/client/util.test.ts +0 -29
- package/src/data-plane/client/util.ts +0 -74
- package/src/data-plane/index.ts +0 -2
- package/src/data-plane/server/background.ts +0 -66
- package/src/data-plane/server/bsync-subscription.ts +0 -590
- package/src/data-plane/server/db/database-schema.ts +0 -90
- package/src/data-plane/server/db/db.ts +0 -204
- package/src/data-plane/server/db/index.ts +0 -2
- package/src/data-plane/server/db/migrations/20230309T045948368Z-init.ts +0 -305
- package/src/data-plane/server/db/migrations/20230408T152211201Z-notification-init.ts +0 -25
- package/src/data-plane/server/db/migrations/20230417T210628672Z-moderation-init.ts +0 -127
- package/src/data-plane/server/db/migrations/20230420T211446071Z-did-cache.ts +0 -14
- package/src/data-plane/server/db/migrations/20230427T194702079Z-notif-record-index.ts +0 -14
- package/src/data-plane/server/db/migrations/20230605T144730094Z-post-profile-aggs.ts +0 -23
- package/src/data-plane/server/db/migrations/20230607T211442112Z-feed-generator-init.ts +0 -34
- package/src/data-plane/server/db/migrations/20230608T155101190Z-algo-whats-hot-view.ts +0 -85
- package/src/data-plane/server/db/migrations/20230608T201813132Z-mute-lists.ts +0 -78
- package/src/data-plane/server/db/migrations/20230608T205147239Z-mutes.ts +0 -15
- package/src/data-plane/server/db/migrations/20230609T153623961Z-blocks.ts +0 -33
- package/src/data-plane/server/db/migrations/20230609T232122649Z-actor-deletion-indexes.ts +0 -27
- package/src/data-plane/server/db/migrations/20230610T203555962Z-suggested-follows.ts +0 -13
- package/src/data-plane/server/db/migrations/20230611T215300060Z-actor-state.ts +0 -13
- package/src/data-plane/server/db/migrations/20230620T161134972Z-post-langs.ts +0 -9
- package/src/data-plane/server/db/migrations/20230627T212437895Z-optional-handle.ts +0 -15
- package/src/data-plane/server/db/migrations/20230629T220835893Z-remove-post-hierarchy.ts +0 -32
- package/src/data-plane/server/db/migrations/20230703T045536691Z-feed-and-label-indices.ts +0 -31
- package/src/data-plane/server/db/migrations/20230720T164800037Z-posts-cursor-idx.ts +0 -19
- package/src/data-plane/server/db/migrations/20230807T035309811Z-feed-item-delete-invite-for-user-idx.ts +0 -14
- package/src/data-plane/server/db/migrations/20230808T172902639Z-repo-rev.ts +0 -12
- package/src/data-plane/server/db/migrations/20230810T203349843Z-action-duration.ts +0 -23
- package/src/data-plane/server/db/migrations/20230817T195936007Z-native-notifications.ts +0 -16
- package/src/data-plane/server/db/migrations/20230830T205507322Z-suggested-feeds.ts +0 -13
- package/src/data-plane/server/db/migrations/20230904T211011773Z-block-lists.ts +0 -24
- package/src/data-plane/server/db/migrations/20230906T222220386Z-thread-gating.ts +0 -27
- package/src/data-plane/server/db/migrations/20230920T213858047Z-add-tags-to-post.ts +0 -9
- package/src/data-plane/server/db/migrations/20230929T192920807Z-record-cursor-indexes.ts +0 -40
- package/src/data-plane/server/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +0 -123
- package/src/data-plane/server/db/migrations/20231220T225126090Z-blob-takedowns.ts +0 -66
- package/src/data-plane/server/db/migrations/20240124T023719200Z-tagged-suggestions.ts +0 -15
- package/src/data-plane/server/db/migrations/20240226T225725627Z-labelers.ts +0 -27
- package/src/data-plane/server/db/migrations/20240530T170337073Z-account-deactivation.ts +0 -12
- package/src/data-plane/server/db/migrations/20240606T171229898Z-thread-mutes.ts +0 -15
- package/src/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.ts +0 -45
- package/src/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.ts +0 -25
- package/src/data-plane/server/db/migrations/20240723T220700077Z-quotes-post-aggs.ts +0 -12
- package/src/data-plane/server/db/migrations/20240723T220703655Z-quotes.ts +0 -28
- package/src/data-plane/server/db/migrations/20240801T193939827Z-post-gate.ts +0 -17
- package/src/data-plane/server/db/migrations/20240808T224251220Z-post-gate-flags.ts +0 -25
- package/src/data-plane/server/db/migrations/20240829T211238293Z-simplify-actor-sync.ts +0 -23
- package/src/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.ts +0 -17
- package/src/data-plane/server/db/migrations/20241114T153108102Z-add-starter-packs-name.ts +0 -19
- package/src/data-plane/server/db/migrations/20250116T222618297Z-post-embed-video.ts +0 -17
- package/src/data-plane/server/db/migrations/20250207T174822012Z-add-label-exp.ts +0 -9
- package/src/data-plane/server/db/migrations/20250404T163421487Z-verifications.ts +0 -39
- package/src/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.ts +0 -17
- package/src/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.ts +0 -9
- package/src/data-plane/server/db/migrations/20250602T190357447Z-add-private-data.ts +0 -22
- package/src/data-plane/server/db/migrations/20250611T140649895Z-add-activity-subscription.ts +0 -22
- package/src/data-plane/server/db/migrations/20250627T025331240Z-add-actor-age-assurance-columns.ts +0 -22
- package/src/data-plane/server/db/migrations/20250812T183735692Z-add-bookmarks.ts +0 -23
- package/src/data-plane/server/db/migrations/20250813T174955711Z-add-post-agg-bookmarks.ts +0 -12
- package/src/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.ts +0 -28
- package/src/data-plane/server/db/migrations/20260112T133951271Z-add-drafts.ts +0 -24
- package/src/data-plane/server/db/migrations/20260604T224952774Z-post-embed-gallery-image.ts +0 -19
- package/src/data-plane/server/db/migrations/index.ts +0 -60
- package/src/data-plane/server/db/migrations/provider.ts +0 -26
- package/src/data-plane/server/db/pagination.ts +0 -341
- package/src/data-plane/server/db/tables/activity-subscription.ts +0 -12
- package/src/data-plane/server/db/tables/actor-block.ts +0 -14
- package/src/data-plane/server/db/tables/actor-state.ts +0 -10
- package/src/data-plane/server/db/tables/actor-sync.ts +0 -9
- package/src/data-plane/server/db/tables/actor.ts +0 -19
- package/src/data-plane/server/db/tables/algo.ts +0 -11
- package/src/data-plane/server/db/tables/blob-takedown.ts +0 -9
- package/src/data-plane/server/db/tables/bookmark.ts +0 -11
- package/src/data-plane/server/db/tables/did-cache.ts +0 -13
- package/src/data-plane/server/db/tables/draft.ts +0 -11
- package/src/data-plane/server/db/tables/duplicate-record.ts +0 -12
- package/src/data-plane/server/db/tables/feed-generator.ts +0 -21
- package/src/data-plane/server/db/tables/feed-item.ts +0 -12
- package/src/data-plane/server/db/tables/follow.ts +0 -15
- package/src/data-plane/server/db/tables/label.ts +0 -13
- package/src/data-plane/server/db/tables/labeler.ts +0 -16
- package/src/data-plane/server/db/tables/like.ts +0 -18
- package/src/data-plane/server/db/tables/list-block.ts +0 -15
- package/src/data-plane/server/db/tables/list-item.ts +0 -16
- package/src/data-plane/server/db/tables/list-mute.ts +0 -9
- package/src/data-plane/server/db/tables/list.ts +0 -19
- package/src/data-plane/server/db/tables/mute.ts +0 -9
- package/src/data-plane/server/db/tables/notification-push-token.ts +0 -10
- package/src/data-plane/server/db/tables/notification.ts +0 -16
- package/src/data-plane/server/db/tables/post-agg.ts +0 -16
- package/src/data-plane/server/db/tables/post-embed.ts +0 -47
- package/src/data-plane/server/db/tables/post-gate.ts +0 -12
- package/src/data-plane/server/db/tables/post.ts +0 -28
- package/src/data-plane/server/db/tables/private-data.ts +0 -13
- package/src/data-plane/server/db/tables/profile-agg.ts +0 -14
- package/src/data-plane/server/db/tables/profile.ts +0 -17
- package/src/data-plane/server/db/tables/quote.ts +0 -15
- package/src/data-plane/server/db/tables/record.ts +0 -15
- package/src/data-plane/server/db/tables/repost.ts +0 -18
- package/src/data-plane/server/db/tables/starter-pack.ts +0 -17
- package/src/data-plane/server/db/tables/subscription.ts +0 -9
- package/src/data-plane/server/db/tables/suggested-feed.ts +0 -10
- package/src/data-plane/server/db/tables/suggested-follow.ts +0 -10
- package/src/data-plane/server/db/tables/tagged-suggestion.ts +0 -11
- package/src/data-plane/server/db/tables/thread-gate.ts +0 -12
- package/src/data-plane/server/db/tables/thread-mute.ts +0 -9
- package/src/data-plane/server/db/tables/verification.ts +0 -20
- package/src/data-plane/server/db/tables/view-param.ts +0 -12
- package/src/data-plane/server/db/types.ts +0 -12
- package/src/data-plane/server/db/util.ts +0 -67
- package/src/data-plane/server/index.ts +0 -44
- package/src/data-plane/server/indexing/index.ts +0 -458
- package/src/data-plane/server/indexing/plugins/block.ts +0 -84
- package/src/data-plane/server/indexing/plugins/chat-declaration.ts +0 -60
- package/src/data-plane/server/indexing/plugins/feed-generator.ts +0 -80
- package/src/data-plane/server/indexing/plugins/follow.ts +0 -132
- package/src/data-plane/server/indexing/plugins/germ-declaration.ts +0 -57
- package/src/data-plane/server/indexing/plugins/labeler.ts +0 -74
- package/src/data-plane/server/indexing/plugins/like.ts +0 -151
- package/src/data-plane/server/indexing/plugins/list-block.ts +0 -84
- package/src/data-plane/server/indexing/plugins/list-item.ts +0 -92
- package/src/data-plane/server/indexing/plugins/list.ts +0 -80
- package/src/data-plane/server/indexing/plugins/notif-declaration.ts +0 -57
- package/src/data-plane/server/indexing/plugins/post-gate.ts +0 -101
- package/src/data-plane/server/indexing/plugins/post.ts +0 -675
- package/src/data-plane/server/indexing/plugins/profile.ts +0 -90
- package/src/data-plane/server/indexing/plugins/repost.ts +0 -176
- package/src/data-plane/server/indexing/plugins/starter-pack.ts +0 -74
- package/src/data-plane/server/indexing/plugins/status.ts +0 -57
- package/src/data-plane/server/indexing/plugins/thread-gate.ts +0 -101
- package/src/data-plane/server/indexing/plugins/verification.ts +0 -113
- package/src/data-plane/server/indexing/processor.ts +0 -292
- package/src/data-plane/server/routes/activity-subscription.ts +0 -84
- package/src/data-plane/server/routes/blocks.ts +0 -127
- package/src/data-plane/server/routes/bookmarks.ts +0 -83
- package/src/data-plane/server/routes/drafts.ts +0 -37
- package/src/data-plane/server/routes/feed-gens.ts +0 -89
- package/src/data-plane/server/routes/feeds.ts +0 -176
- package/src/data-plane/server/routes/follows.ts +0 -141
- package/src/data-plane/server/routes/identity.ts +0 -59
- package/src/data-plane/server/routes/index.ts +0 -67
- package/src/data-plane/server/routes/interactions.ts +0 -120
- package/src/data-plane/server/routes/labels.ts +0 -55
- package/src/data-plane/server/routes/likes.ts +0 -92
- package/src/data-plane/server/routes/lists.ts +0 -88
- package/src/data-plane/server/routes/moderation.ts +0 -102
- package/src/data-plane/server/routes/mutes.ts +0 -195
- package/src/data-plane/server/routes/notifs.ts +0 -239
- package/src/data-plane/server/routes/profile.ts +0 -220
- package/src/data-plane/server/routes/quotes.ts +0 -32
- package/src/data-plane/server/routes/records.ts +0 -119
- package/src/data-plane/server/routes/relationships.ts +0 -174
- package/src/data-plane/server/routes/reposts.ts +0 -76
- package/src/data-plane/server/routes/search.ts +0 -181
- package/src/data-plane/server/routes/site-standard.ts +0 -12
- package/src/data-plane/server/routes/sitemap.ts +0 -43
- package/src/data-plane/server/routes/starter-packs.ts +0 -32
- package/src/data-plane/server/routes/suggestions.ts +0 -175
- package/src/data-plane/server/routes/sync.ts +0 -16
- package/src/data-plane/server/routes/threads.ts +0 -33
- package/src/data-plane/server/subscription.ts +0 -152
- package/src/data-plane/server/util.ts +0 -202
- package/src/error.ts +0 -12
- package/src/etcd.ts +0 -90
- package/src/feature-gates/README.md +0 -83
- package/src/feature-gates/gates.ts +0 -25
- package/src/feature-gates/index.ts +0 -235
- package/src/feature-gates/metrics.test.ts +0 -196
- package/src/feature-gates/metrics.ts +0 -107
- package/src/feature-gates/types.ts +0 -62
- package/src/feature-gates/utils.test.ts +0 -66
- package/src/feature-gates/utils.ts +0 -135
- package/src/hydration/actor.ts +0 -578
- package/src/hydration/external.test.ts +0 -281
- package/src/hydration/external.ts +0 -268
- package/src/hydration/feed.ts +0 -455
- package/src/hydration/graph.ts +0 -354
- package/src/hydration/hydrator.ts +0 -1835
- package/src/hydration/label.ts +0 -207
- package/src/hydration/util.ts +0 -199
- package/src/image/index.ts +0 -2
- package/src/image/invalidator.ts +0 -33
- package/src/image/logger.ts +0 -6
- package/src/image/server.ts +0 -228
- package/src/image/sharp.ts +0 -89
- package/src/image/uri.ts +0 -114
- package/src/image/util.ts +0 -41
- package/src/index.ts +0 -312
- package/src/kws.ts +0 -197
- package/src/logger.ts +0 -40
- package/src/pipeline.ts +0 -60
- package/src/redis.ts +0 -205
- package/src/rolodex.ts +0 -42
- package/src/stash.ts +0 -76
- package/src/util/debug.ts +0 -10
- package/src/util/http.ts +0 -42
- package/src/util/retry.ts +0 -10
- package/src/util/standard-site.test.ts +0 -423
- package/src/util/standard-site.ts +0 -196
- package/src/util/uris.ts +0 -38
- package/src/util.ts +0 -48
- package/src/views/index.ts +0 -2783
- package/src/views/threads-v2.ts +0 -510
- package/src/views/types.ts +0 -193
- package/src/views/util.ts +0 -114
- package/test.env +0 -2
- package/tests/__snapshots__/feed-generation.test.ts.snap +0 -2510
- package/tests/_util.ts +0 -292
- package/tests/admin/admin-auth.test.ts +0 -190
- package/tests/admin/moderation.test.ts +0 -222
- package/tests/auth.test.ts +0 -90
- package/tests/blob-resolver.test.ts +0 -125
- package/tests/data-plane/__snapshots__/indexing.test.ts.snap +0 -887
- package/tests/data-plane/db.test.ts +0 -189
- package/tests/data-plane/duplicate-records.test.ts +0 -156
- package/tests/data-plane/handle-invalidation.test.ts +0 -153
- package/tests/data-plane/indexing.test.ts +0 -827
- package/tests/data-plane/subscription.test.ts +0 -128
- package/tests/data-plane/thread-mutes.test.ts +0 -175
- package/tests/entryway-auth.test.ts +0 -177
- package/tests/etcd.test.ts +0 -302
- package/tests/feed-generation.test.ts +0 -965
- package/tests/hydration/util.test.ts +0 -119
- package/tests/image/server.test.ts +0 -97
- package/tests/image/sharp.test.ts +0 -199
- package/tests/image/uri.test.ts +0 -106
- package/tests/label-hydration.test.ts +0 -245
- package/tests/postgates.test.ts +0 -182
- package/tests/query-labels.test.ts +0 -85
- package/tests/redis-cache.test.ts +0 -230
- package/tests/seed/feed-hidden-replies.ts +0 -63
- package/tests/seed/get-suggested-starter-packs.ts +0 -64
- package/tests/seed/get-trends.ts +0 -71
- package/tests/seed/known-followers.ts +0 -111
- package/tests/seed/postgates.ts +0 -57
- package/tests/server.test.ts +0 -115
- package/tests/sitemap.test.ts +0 -75
- package/tests/stash.test.ts +0 -180
- package/tests/utils.test.ts +0 -36
- package/tests/views/__snapshots__/actor-search.test.ts.snap +0 -155
- package/tests/views/__snapshots__/author-feed.test.ts.snap +0 -6301
- package/tests/views/__snapshots__/block-lists.test.ts.snap +0 -690
- package/tests/views/__snapshots__/blocks.test.ts.snap +0 -462
- package/tests/views/__snapshots__/bookmarks.test.ts.snap +0 -379
- package/tests/views/__snapshots__/follows.test.ts.snap +0 -798
- package/tests/views/__snapshots__/labeler-service.test.ts.snap +0 -233
- package/tests/views/__snapshots__/likes.test.ts.snap +0 -124
- package/tests/views/__snapshots__/list-feed.test.ts.snap +0 -883
- package/tests/views/__snapshots__/lists.test.ts.snap +0 -650
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +0 -705
- package/tests/views/__snapshots__/mutes.test.ts.snap +0 -353
- package/tests/views/__snapshots__/notifications.test.ts.snap +0 -3074
- package/tests/views/__snapshots__/posts.test.ts.snap +0 -1019
- package/tests/views/__snapshots__/profile.test.ts.snap +0 -811
- package/tests/views/__snapshots__/quotes.test.ts.snap +0 -445
- package/tests/views/__snapshots__/reposts.test.ts.snap +0 -112
- package/tests/views/__snapshots__/starter-packs.test.ts.snap +0 -836
- package/tests/views/__snapshots__/thread-v2.test.ts.snap +0 -1298
- package/tests/views/__snapshots__/thread.test.ts.snap +0 -2051
- package/tests/views/__snapshots__/threadgating.test.ts.snap +0 -189
- package/tests/views/__snapshots__/timeline.test.ts.snap +0 -7252
- package/tests/views/account-deactivation.test.ts +0 -81
- package/tests/views/actor-likes.test.ts +0 -138
- package/tests/views/actor-search.test.ts +0 -261
- package/tests/views/age-assurance-v2.test.ts +0 -823
- package/tests/views/age-assurance.test.ts +0 -479
- package/tests/views/author-feed.test.ts +0 -694
- package/tests/views/block-lists.test.ts +0 -661
- package/tests/views/blocks.test.ts +0 -889
- package/tests/views/bookmarks.test.ts +0 -345
- package/tests/views/drafts.test.ts +0 -430
- package/tests/views/feed-hidden-replies.test.ts +0 -243
- package/tests/views/feed-view-post.test.ts +0 -501
- package/tests/views/follows.test.ts +0 -372
- package/tests/views/get-config.test.ts +0 -64
- package/tests/views/get-suggested-onboarding-users.test.ts +0 -193
- package/tests/views/get-suggested-starter-packs.test.ts +0 -137
- package/tests/views/get-trends.test.ts +0 -141
- package/tests/views/internal-actor.test.ts +0 -127
- package/tests/views/known-followers.test.ts +0 -193
- package/tests/views/labeler-service.test.ts +0 -242
- package/tests/views/labels-needs-review.test.ts +0 -316
- package/tests/views/labels-takedown.test.ts +0 -247
- package/tests/views/likes.test.ts +0 -192
- package/tests/views/list-feed.test.ts +0 -195
- package/tests/views/lists.test.ts +0 -412
- package/tests/views/mute-lists.test.ts +0 -509
- package/tests/views/mutes.test.ts +0 -308
- package/tests/views/notifications.test.ts +0 -1581
- package/tests/views/post-search.test.ts +0 -281
- package/tests/views/posts-debug.test.ts +0 -79
- package/tests/views/posts.test.ts +0 -427
- package/tests/views/profile-debug.test.ts +0 -75
- package/tests/views/profile.test.ts +0 -795
- package/tests/views/quotes.test.ts +0 -133
- package/tests/views/reposts.test.ts +0 -112
- package/tests/views/starter-packs.test.ts +0 -395
- package/tests/views/suggestions.test.ts +0 -145
- package/tests/views/thread-v2.test.ts +0 -2005
- package/tests/views/thread.test.ts +0 -637
- package/tests/views/threadgating.test.ts +0 -843
- package/tests/views/timeline.test.ts +0 -328
- package/tests/views/verification.test.ts +0 -296
- package/tsconfig.build.json +0 -10
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -7
- package/tsconfig.tests.json +0 -8
- package/vitest.config.ts +0 -10
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { mapDefined } from '@atproto/common'
|
|
2
|
-
import { DidString } from '@atproto/syntax'
|
|
3
|
-
import { Server } from '@atproto/xrpc-server'
|
|
4
|
-
import { AppContext } from '../../../../context.js'
|
|
5
|
-
import {
|
|
6
|
-
HydrateCtx,
|
|
7
|
-
HydrationState,
|
|
8
|
-
Hydrator,
|
|
9
|
-
} from '../../../../hydration/hydrator.js'
|
|
10
|
-
import { app } from '../../../../lexicons/index.js'
|
|
11
|
-
import {
|
|
12
|
-
HydrationFnInput,
|
|
13
|
-
SkeletonFnInput,
|
|
14
|
-
createPipeline,
|
|
15
|
-
noRules,
|
|
16
|
-
} from '../../../../pipeline.js'
|
|
17
|
-
import { ImportContactsMatch } from '../../../../proto/rolodex_pb.js'
|
|
18
|
-
import { RolodexClient } from '../../../../rolodex.js'
|
|
19
|
-
import { Views } from '../../../../views/index.js'
|
|
20
|
-
import { assertRolodexOrThrowUnimplemented, callRolodexClient } from './util.js'
|
|
21
|
-
|
|
22
|
-
export default function (server: Server, ctx: AppContext) {
|
|
23
|
-
const importContacts = createPipeline(
|
|
24
|
-
skeleton,
|
|
25
|
-
hydration,
|
|
26
|
-
noRules, //
|
|
27
|
-
presentation,
|
|
28
|
-
)
|
|
29
|
-
server.add(app.bsky.contact.importContacts, {
|
|
30
|
-
auth: ctx.authVerifier.standard,
|
|
31
|
-
handler: async ({ input, auth, req }) => {
|
|
32
|
-
assertRolodexOrThrowUnimplemented(ctx)
|
|
33
|
-
|
|
34
|
-
const viewer = auth.credentials.iss
|
|
35
|
-
const labelers = ctx.reqLabelers(req)
|
|
36
|
-
const hydrateCtx = await ctx.hydrator.createContext({
|
|
37
|
-
labelers,
|
|
38
|
-
viewer,
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const result = await importContacts({ ...input.body, hydrateCtx }, ctx)
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
encoding: 'application/json',
|
|
45
|
-
body: result,
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const skeleton = async (
|
|
52
|
-
input: SkeletonFnInput<Context, Params>,
|
|
53
|
-
): Promise<SkeletonState> => {
|
|
54
|
-
const { params, ctx } = input
|
|
55
|
-
const actor = params.hydrateCtx.viewer
|
|
56
|
-
const { matches } = await callRolodexClient(
|
|
57
|
-
ctx.rolodexClient.importContacts({
|
|
58
|
-
actor: params.hydrateCtx.viewer,
|
|
59
|
-
contacts: params.contacts,
|
|
60
|
-
token: params.token,
|
|
61
|
-
}),
|
|
62
|
-
)
|
|
63
|
-
return {
|
|
64
|
-
actor,
|
|
65
|
-
matches,
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const hydration = async (
|
|
70
|
-
input: HydrationFnInput<Context, Params, SkeletonState>,
|
|
71
|
-
) => {
|
|
72
|
-
const { ctx, params, skeleton } = input
|
|
73
|
-
const { matches } = skeleton
|
|
74
|
-
const subjects = matches.map((m) => m.subject as DidString)
|
|
75
|
-
return ctx.hydrator.hydrateProfiles(subjects, params.hydrateCtx)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const presentation = (input: {
|
|
79
|
-
ctx: Context
|
|
80
|
-
params: Params
|
|
81
|
-
skeleton: SkeletonState
|
|
82
|
-
hydration: HydrationState
|
|
83
|
-
}) => {
|
|
84
|
-
const { ctx, skeleton, hydration } = input
|
|
85
|
-
const matchesAndContactIndexes = mapDefined(
|
|
86
|
-
skeleton.matches,
|
|
87
|
-
({
|
|
88
|
-
subject,
|
|
89
|
-
inputIndex,
|
|
90
|
-
}): app.bsky.contact.defs.MatchAndContactIndex | undefined => {
|
|
91
|
-
const profile = ctx.views.profile(subject as DidString, hydration)
|
|
92
|
-
|
|
93
|
-
if (!profile) {
|
|
94
|
-
return undefined
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
contactIndex: inputIndex,
|
|
99
|
-
match: profile,
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
)
|
|
103
|
-
return { matchesAndContactIndexes }
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type Context = {
|
|
107
|
-
hydrator: Hydrator
|
|
108
|
-
rolodexClient: RolodexClient
|
|
109
|
-
views: Views
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
type Params = app.bsky.contact.importContacts.$InputBody & {
|
|
113
|
-
hydrateCtx: HydrateCtx & { viewer: string }
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
type SkeletonState = {
|
|
117
|
-
actor: string
|
|
118
|
-
matches: ImportContactsMatch[]
|
|
119
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Server } from '@atproto/xrpc-server'
|
|
2
|
-
import { AppContext } from '../../../../context.js'
|
|
3
|
-
import { app } from '../../../../lexicons/index.js'
|
|
4
|
-
import { assertRolodexOrThrowUnimplemented, callRolodexClient } from './util.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.contact.removeData, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ auth }) => {
|
|
10
|
-
assertRolodexOrThrowUnimplemented(ctx)
|
|
11
|
-
|
|
12
|
-
const actor = auth.credentials.iss
|
|
13
|
-
await callRolodexClient(
|
|
14
|
-
ctx.rolodexClient.removeData({
|
|
15
|
-
actor,
|
|
16
|
-
}),
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
encoding: 'application/json',
|
|
21
|
-
body: {},
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
})
|
|
25
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { TID } from '@atproto/common'
|
|
2
|
-
import { Server } from '@atproto/xrpc-server'
|
|
3
|
-
import { AppContext } from '../../../../context.js'
|
|
4
|
-
import { app } from '../../../../lexicons/index.js'
|
|
5
|
-
import { Namespaces } from '../../../../stash.js'
|
|
6
|
-
import { assertRolodexOrThrowUnimplemented } from './util.js'
|
|
7
|
-
|
|
8
|
-
export default function (server: Server, ctx: AppContext) {
|
|
9
|
-
server.add(app.bsky.contact.sendNotification, {
|
|
10
|
-
auth: ctx.authVerifier.role,
|
|
11
|
-
handler: async ({ input }) => {
|
|
12
|
-
// Assert rolodex even though we don't call it, it is a proxy to whether the app is configured with contact import support.
|
|
13
|
-
assertRolodexOrThrowUnimplemented(ctx)
|
|
14
|
-
|
|
15
|
-
const { from, to } = input.body
|
|
16
|
-
|
|
17
|
-
await ctx.stashClient.create({
|
|
18
|
-
actorDid: from,
|
|
19
|
-
namespace: Namespaces.AppBskyContactDefsNotification,
|
|
20
|
-
payload: {
|
|
21
|
-
from,
|
|
22
|
-
to,
|
|
23
|
-
} satisfies app.bsky.contact.defs.Notification,
|
|
24
|
-
key: TID.nextStr(),
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
encoding: 'application/json',
|
|
29
|
-
body: {},
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Server } from '@atproto/xrpc-server'
|
|
2
|
-
import { AppContext } from '../../../../context.js'
|
|
3
|
-
import { app } from '../../../../lexicons/index.js'
|
|
4
|
-
import { assertRolodexOrThrowUnimplemented, callRolodexClient } from './util.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.contact.startPhoneVerification, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ auth, input }) => {
|
|
10
|
-
assertRolodexOrThrowUnimplemented(ctx)
|
|
11
|
-
|
|
12
|
-
const actor = auth.credentials.iss
|
|
13
|
-
await callRolodexClient(
|
|
14
|
-
ctx.rolodexClient.startPhoneVerification({
|
|
15
|
-
actor,
|
|
16
|
-
phone: input.body.phone,
|
|
17
|
-
}),
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
encoding: 'application/json',
|
|
22
|
-
body: {},
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { ConnectError } from '@connectrpc/connect'
|
|
2
|
-
import {
|
|
3
|
-
InternalServerError,
|
|
4
|
-
InvalidRequestError,
|
|
5
|
-
MethodNotImplementedError,
|
|
6
|
-
} from '@atproto/xrpc-server'
|
|
7
|
-
import { AppContext } from '../../../../index.js'
|
|
8
|
-
import { RolodexClient } from '../../../../rolodex.js'
|
|
9
|
-
|
|
10
|
-
export function assertRolodexOrThrowUnimplemented(
|
|
11
|
-
ctx: AppContext,
|
|
12
|
-
): asserts ctx is AppContext & { rolodexClient: RolodexClient } {
|
|
13
|
-
if (!ctx.rolodexClient) {
|
|
14
|
-
throw new MethodNotImplementedError(
|
|
15
|
-
'This service is not configured to support contact imports.',
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Converts UPPERCASE_ERROR from Rolodex to PascalCase for XRPC.
|
|
22
|
-
*/
|
|
23
|
-
function convertErrorName(reason: string): string {
|
|
24
|
-
switch (reason) {
|
|
25
|
-
case 'INVALID_DID':
|
|
26
|
-
return 'InvalidDid'
|
|
27
|
-
case 'INVALID_LIMIT':
|
|
28
|
-
return 'InvalidLimit'
|
|
29
|
-
case 'INVALID_CURSOR':
|
|
30
|
-
return 'InvalidCursor'
|
|
31
|
-
case 'INVALID_CONTACTS':
|
|
32
|
-
return 'InvalidContacts'
|
|
33
|
-
case 'TOO_MANY_CONTACTS':
|
|
34
|
-
return 'TooManyContacts'
|
|
35
|
-
case 'INVALID_TOKEN':
|
|
36
|
-
return 'InvalidToken'
|
|
37
|
-
case 'RATE_LIMIT_EXCEEDED':
|
|
38
|
-
return 'RateLimitExceeded'
|
|
39
|
-
case 'INVALID_PHONE':
|
|
40
|
-
return 'InvalidPhone'
|
|
41
|
-
case 'INVALID_CODE':
|
|
42
|
-
return 'InvalidCode'
|
|
43
|
-
case 'INTERNAL_ERROR':
|
|
44
|
-
return 'InternalError'
|
|
45
|
-
default:
|
|
46
|
-
return reason
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Helper to call Rolodex client methods and translate RPC errors to XRPC
|
|
52
|
-
* errors.
|
|
53
|
-
*
|
|
54
|
-
* These `reason` values need to stay in sync with the Rolodex service
|
|
55
|
-
*/
|
|
56
|
-
export async function callRolodexClient<T>(caller: T) {
|
|
57
|
-
try {
|
|
58
|
-
return await caller
|
|
59
|
-
} catch (e) {
|
|
60
|
-
// might be something we want to handle
|
|
61
|
-
if (e instanceof ConnectError) {
|
|
62
|
-
/**
|
|
63
|
-
* https://connectrpc.com/docs/protocol#error-end-stream
|
|
64
|
-
*/
|
|
65
|
-
const details = e.details?.at(0) as
|
|
66
|
-
| {
|
|
67
|
-
debug: {
|
|
68
|
-
reason: string
|
|
69
|
-
message: string
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
| undefined
|
|
73
|
-
const reason = details?.debug?.reason // e.g. INVALID_DID
|
|
74
|
-
// Handle known error reasons
|
|
75
|
-
if (reason) {
|
|
76
|
-
const errorName = convertErrorName(reason)
|
|
77
|
-
// NOTE: Don't leak e.message to the response.
|
|
78
|
-
|
|
79
|
-
if (reason === 'INTERNAL_ERROR') {
|
|
80
|
-
throw new InternalServerError('Upstream error', errorName, {
|
|
81
|
-
cause: e,
|
|
82
|
-
})
|
|
83
|
-
} else {
|
|
84
|
-
throw new InvalidRequestError('An error occurred', errorName, {
|
|
85
|
-
cause: e,
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
throw e
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Server } from '@atproto/xrpc-server'
|
|
2
|
-
import { AppContext } from '../../../../context.js'
|
|
3
|
-
import { app } from '../../../../lexicons/index.js'
|
|
4
|
-
import { assertRolodexOrThrowUnimplemented, callRolodexClient } from './util.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.contact.verifyPhone, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ auth, input }) => {
|
|
10
|
-
assertRolodexOrThrowUnimplemented(ctx)
|
|
11
|
-
|
|
12
|
-
const actor = auth.credentials.iss
|
|
13
|
-
const res = await callRolodexClient(
|
|
14
|
-
ctx.rolodexClient.verifyPhone({
|
|
15
|
-
actor,
|
|
16
|
-
verificationCode: input.body.code,
|
|
17
|
-
phone: input.body.phone,
|
|
18
|
-
}),
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
encoding: 'application/json',
|
|
23
|
-
body: {
|
|
24
|
-
token: res.token,
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { TID } from '@atproto/common'
|
|
2
|
-
import { InvalidRequestError, Server } from '@atproto/xrpc-server'
|
|
3
|
-
import { AppContext } from '../../../../context.js'
|
|
4
|
-
import { app } from '../../../../lexicons/index.js'
|
|
5
|
-
import { Namespaces } from '../../../../stash.js'
|
|
6
|
-
|
|
7
|
-
export default function (server: Server, ctx: AppContext) {
|
|
8
|
-
server.add(app.bsky.draft.createDraft, {
|
|
9
|
-
auth: ctx.authVerifier.standard,
|
|
10
|
-
handler: async ({ input, auth }) => {
|
|
11
|
-
const actorDid = auth.credentials.iss
|
|
12
|
-
const { draft } = input.body
|
|
13
|
-
|
|
14
|
-
const res = await ctx.dataplane.getCountsForUsers({
|
|
15
|
-
dids: [actorDid],
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const draftsCount = res.drafts[0]
|
|
19
|
-
if (draftsCount >= ctx.cfg.draftsLimit) {
|
|
20
|
-
throw new InvalidRequestError(
|
|
21
|
-
`Drafts limit reached`,
|
|
22
|
-
'DraftLimitReached',
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const draftId = TID.nextStr()
|
|
27
|
-
const draftWithId: app.bsky.draft.defs.DraftWithId = {
|
|
28
|
-
id: draftId,
|
|
29
|
-
draft,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
await ctx.stashClient.create({
|
|
33
|
-
actorDid,
|
|
34
|
-
namespace: Namespaces.AppBskyDraftDefsDraftWithId,
|
|
35
|
-
payload: draftWithId,
|
|
36
|
-
key: draftId,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
encoding: 'application/json' as const,
|
|
41
|
-
body: { id: draftId },
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Server } from '@atproto/xrpc-server'
|
|
2
|
-
import { AppContext } from '../../../../context.js'
|
|
3
|
-
import { app } from '../../../../lexicons/index.js'
|
|
4
|
-
import { Namespaces } from '../../../../stash.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.draft.deleteDraft, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ input, auth }) => {
|
|
10
|
-
const actorDid = auth.credentials.iss
|
|
11
|
-
const { id } = input.body
|
|
12
|
-
|
|
13
|
-
await ctx.stashClient.delete({
|
|
14
|
-
actorDid,
|
|
15
|
-
namespace: Namespaces.AppBskyDraftDefsDraftWithId,
|
|
16
|
-
key: id,
|
|
17
|
-
})
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { DatetimeString, lexParse } from '@atproto/lex'
|
|
2
|
-
import { Server } from '@atproto/xrpc-server'
|
|
3
|
-
import { AppContext } from '../../../../context.js'
|
|
4
|
-
import { app } from '../../../../lexicons/index.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.draft.getDrafts, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ params, auth }) => {
|
|
10
|
-
const viewer = auth.credentials.iss
|
|
11
|
-
|
|
12
|
-
const { cursor, drafts } = await ctx.hydrator.dataplane.getActorDrafts({
|
|
13
|
-
actorDid: viewer,
|
|
14
|
-
limit: params.limit,
|
|
15
|
-
cursor: params.cursor,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const draftViews = drafts.map((d): app.bsky.draft.defs.DraftView => {
|
|
19
|
-
const jsonStr = Buffer.from(d.payload).toString('utf8')
|
|
20
|
-
const draftWithId = lexParse<app.bsky.draft.defs.DraftWithId>(jsonStr)
|
|
21
|
-
return {
|
|
22
|
-
id: draftWithId.id,
|
|
23
|
-
draft: draftWithId.draft,
|
|
24
|
-
// The date should always be present, but we avoid required fields on protobuf by convention,
|
|
25
|
-
// so requires a fallback value to please TS.
|
|
26
|
-
createdAt: (
|
|
27
|
-
d.createdAt?.toDate() ?? new Date(0)
|
|
28
|
-
).toISOString() as DatetimeString,
|
|
29
|
-
updatedAt: (
|
|
30
|
-
d.updatedAt?.toDate() ?? new Date(0)
|
|
31
|
-
).toISOString() as DatetimeString,
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
encoding: 'application/json',
|
|
37
|
-
body: {
|
|
38
|
-
cursor,
|
|
39
|
-
drafts: draftViews,
|
|
40
|
-
},
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Server } from '@atproto/xrpc-server'
|
|
2
|
-
import { AppContext } from '../../../../context.js'
|
|
3
|
-
import { app } from '../../../../lexicons/index.js'
|
|
4
|
-
import { Namespaces } from '../../../../stash.js'
|
|
5
|
-
|
|
6
|
-
export default function (server: Server, ctx: AppContext) {
|
|
7
|
-
server.add(app.bsky.draft.updateDraft, {
|
|
8
|
-
auth: ctx.authVerifier.standard,
|
|
9
|
-
handler: async ({ input, auth }) => {
|
|
10
|
-
const actorDid = auth.credentials.iss
|
|
11
|
-
const { draft: draftWithId } = input.body
|
|
12
|
-
|
|
13
|
-
// NOTE: update drafts does not enforce limits, because if it did, we would not allow updating when the limit is reached,
|
|
14
|
-
// which is not the desired behavior.
|
|
15
|
-
// But this means the consumer of the stash operations can't do an upsert behavior on update, and needs instead to drop non-existent
|
|
16
|
-
// drafts. This avoid misusing the update as a create that does not check limits.
|
|
17
|
-
|
|
18
|
-
await ctx.stashClient.update({
|
|
19
|
-
actorDid,
|
|
20
|
-
namespace: Namespaces.AppBskyDraftDefsDraftWithId,
|
|
21
|
-
payload: draftWithId satisfies app.bsky.draft.defs.DraftWithId,
|
|
22
|
-
key: draftWithId.id,
|
|
23
|
-
})
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { AtUriString, LexMap } from '@atproto/lex'
|
|
2
|
-
import { Server } from '@atproto/xrpc-server'
|
|
3
|
-
import { AppContext } from '../../../../context.js'
|
|
4
|
-
import {
|
|
5
|
-
SiteStandardDocuments,
|
|
6
|
-
SiteStandardPublications,
|
|
7
|
-
getSiteStandardRecordsFromHydrationMapsByDocumentUri,
|
|
8
|
-
} from '../../../../hydration/external.js'
|
|
9
|
-
import { HydrateCtx, Hydrator } from '../../../../hydration/hydrator.js'
|
|
10
|
-
import { app, com } from '../../../../lexicons/index.js'
|
|
11
|
-
import {
|
|
12
|
-
HydrationFnInput,
|
|
13
|
-
PresentationFnInput,
|
|
14
|
-
SkeletonFnInput,
|
|
15
|
-
createPipeline,
|
|
16
|
-
noRules,
|
|
17
|
-
} from '../../../../pipeline.js'
|
|
18
|
-
import { Views } from '../../../../views/index.js'
|
|
19
|
-
import { ExternalEmbedView, StrongRef } from '../../../../views/types.js'
|
|
20
|
-
import { resHeaders } from '../../../util.js'
|
|
21
|
-
|
|
22
|
-
export default function (server: Server, ctx: AppContext) {
|
|
23
|
-
const getEmbedExternalView = createPipeline(
|
|
24
|
-
skeleton,
|
|
25
|
-
hydration,
|
|
26
|
-
noRules,
|
|
27
|
-
presentation,
|
|
28
|
-
)
|
|
29
|
-
server.add(app.bsky.embed.getEmbedExternalView, {
|
|
30
|
-
auth: ctx.authVerifier.standardOptional,
|
|
31
|
-
handler: async ({ params, auth, req }) => {
|
|
32
|
-
const viewer = auth.credentials.iss
|
|
33
|
-
const labelers = ctx.reqLabelers(req)
|
|
34
|
-
const hydrateCtx = await ctx.hydrator.createContext({ labelers, viewer })
|
|
35
|
-
const result = await getEmbedExternalView({ ...params, hydrateCtx }, ctx)
|
|
36
|
-
return {
|
|
37
|
-
encoding: 'application/json',
|
|
38
|
-
body: result,
|
|
39
|
-
headers: resHeaders({ labelers: hydrateCtx.labelers }),
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const skeleton = async (
|
|
46
|
-
inputs: SkeletonFnInput<Context, Params>,
|
|
47
|
-
): Promise<Skeleton> => {
|
|
48
|
-
return { uris: inputs.params.uris as AtUriString[] }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const hydration = async (
|
|
52
|
-
inputs: HydrationFnInput<Context, Params, Skeleton>,
|
|
53
|
-
) => {
|
|
54
|
-
const { ctx, params, skeleton } = inputs
|
|
55
|
-
return ctx.hydrator.hydrateEmbedExternalViewFromUris(
|
|
56
|
-
skeleton.uris,
|
|
57
|
-
params.hydrateCtx,
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const presentation = (
|
|
62
|
-
inputs: PresentationFnInput<Context, Params, Skeleton>,
|
|
63
|
-
): Output => {
|
|
64
|
-
const { hydration } = inputs
|
|
65
|
-
const documents = hydration.siteStandardDocuments
|
|
66
|
-
const publications = hydration.siteStandardPublications
|
|
67
|
-
// Dispatch by record type. Today site.standard is the only kind we know
|
|
68
|
-
// how to render; future record types get their own branch.
|
|
69
|
-
if (
|
|
70
|
-
(documents && documents.size > 0) ||
|
|
71
|
-
(publications && publications.size > 0)
|
|
72
|
-
) {
|
|
73
|
-
return standardSitePresentation(inputs, documents, publications)
|
|
74
|
-
}
|
|
75
|
-
return {}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const standardSitePresentation = (
|
|
79
|
-
inputs: PresentationFnInput<Context, Params, Skeleton>,
|
|
80
|
-
documents: SiteStandardDocuments | undefined,
|
|
81
|
-
publications: SiteStandardPublications | undefined,
|
|
82
|
-
): Output => {
|
|
83
|
-
const { ctx, params, hydration } = inputs
|
|
84
|
-
|
|
85
|
-
// Pick the first hydrated doc, then pair it with the publication its
|
|
86
|
-
// `site` field points at (if any). Docs the dataplane auto-resolved a
|
|
87
|
-
// publication for end up matched; unrelated publications fall away.
|
|
88
|
-
const { document, publication } =
|
|
89
|
-
getSiteStandardRecordsFromHydrationMapsByDocumentUri(
|
|
90
|
-
documents,
|
|
91
|
-
publications,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
// Emit response refs/records only for the records we actually selected.
|
|
95
|
-
// Anything else (e.g. extra publications the dataplane returned) is
|
|
96
|
-
// intentionally excluded so the strongRefs Cardy writes onto the post
|
|
97
|
-
// match the view we built. Profiles are emitted in the same order as
|
|
98
|
-
// refs (one per slot) so consumers can match by index.
|
|
99
|
-
const associatedRefs: StrongRef[] = []
|
|
100
|
-
const associatedRecords: LexMap[] = []
|
|
101
|
-
for (const slot of [document, publication]) {
|
|
102
|
-
if (!slot) continue
|
|
103
|
-
associatedRefs.push(
|
|
104
|
-
com.atproto.repo.strongRef.$build({
|
|
105
|
-
uri: slot.ref.uri,
|
|
106
|
-
cid: slot.info.cid,
|
|
107
|
-
}),
|
|
108
|
-
)
|
|
109
|
-
associatedRecords.push(slot.info.record as LexMap)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!associatedRefs.length) return {}
|
|
113
|
-
|
|
114
|
-
const overlay = ctx.views.externalEmbedFromStandardSiteRecords({
|
|
115
|
-
document,
|
|
116
|
-
publication,
|
|
117
|
-
state: hydration,
|
|
118
|
-
assumedUrl: params.url,
|
|
119
|
-
})
|
|
120
|
-
// The view builder rejected the records (validation failed, or the pair
|
|
121
|
-
// didn't produce the title viewExternal requires). Return nothing — Cardy
|
|
122
|
-
// falls back to its own card render and doesn't write strongRefs to the
|
|
123
|
-
// post.
|
|
124
|
-
if (!overlay) return {}
|
|
125
|
-
|
|
126
|
-
const view = app.bsky.embed.external.view.$build({
|
|
127
|
-
external: {
|
|
128
|
-
...overlay,
|
|
129
|
-
uri: params.url,
|
|
130
|
-
associatedRefs,
|
|
131
|
-
},
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
return { view, associatedRefs, associatedRecords }
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
type Context = {
|
|
138
|
-
hydrator: Hydrator
|
|
139
|
-
views: Views
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
type Params = app.bsky.embed.getEmbedExternalView.$Params & {
|
|
143
|
-
hydrateCtx: HydrateCtx
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
type Skeleton = {
|
|
147
|
-
uris: AtUriString[]
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
type Output = {
|
|
151
|
-
view?: ExternalEmbedView
|
|
152
|
-
associatedRefs?: StrongRef[]
|
|
153
|
-
associatedRecords?: LexMap[]
|
|
154
|
-
}
|