@atproto/bsky 0.0.83 → 0.0.85
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 +26 -0
- package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js +25 -7
- package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js +3 -1
- package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.d.ts +4 -0
- package/dist/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.d.ts.map +1 -0
- package/dist/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.js +20 -0
- package/dist/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.js.map +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/index.js +2 -1
- package/dist/data-plane/server/db/migrations/index.js.map +1 -1
- package/dist/data-plane/server/db/tables/profile.d.ts +2 -0
- package/dist/data-plane/server/db/tables/profile.d.ts.map +1 -1
- package/dist/hydration/feed.d.ts +5 -0
- package/dist/hydration/feed.d.ts.map +1 -1
- package/dist/hydration/feed.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +36 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +47 -3
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +13 -2
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js +21 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts.map +1 -1
- package/dist/views/index.d.ts +4 -0
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +22 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +13 -13
- package/src/api/app/bsky/feed/getAuthorFeed.ts +32 -7
- package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +4 -1
- package/src/data-plane/server/db/migrations/20240831T134810923Z-pinned-posts.ts +17 -0
- package/src/data-plane/server/db/migrations/index.ts +1 -0
- package/src/data-plane/server/db/tables/profile.ts +2 -0
- package/src/hydration/feed.ts +9 -1
- package/src/lexicon/lexicons.ts +49 -3
- package/src/lexicon/types/app/bsky/actor/defs.ts +2 -0
- package/src/lexicon/types/app/bsky/actor/profile.ts +1 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +38 -2
- package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +1 -0
- package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
- package/src/lexicon/types/com/atproto/repo/getRecord.ts +1 -0
- package/src/views/index.ts +22 -2
- package/tests/views/__snapshots__/author-feed.test.ts.snap +2462 -0
- package/tests/views/author-feed.test.ts +176 -1
package/src/views/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
NotFoundPost,
|
|
17
17
|
PostView,
|
|
18
18
|
ReasonRepost,
|
|
19
|
+
ReasonPin,
|
|
19
20
|
ReplyRef,
|
|
20
21
|
ThreadViewPost,
|
|
21
22
|
ThreadgateView,
|
|
@@ -169,6 +170,7 @@ export class Views {
|
|
|
169
170
|
joinedViaStarterPack: actor.profile?.joinedViaStarterPack
|
|
170
171
|
? this.starterPackBasic(actor.profile.joinedViaStarterPack.uri, state)
|
|
171
172
|
: undefined,
|
|
173
|
+
pinnedPost: actor.profile?.pinnedPost,
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
@@ -606,6 +608,7 @@ export class Views {
|
|
|
606
608
|
threadMuted: viewer.threadMuted,
|
|
607
609
|
replyDisabled: this.userReplyDisabled(uri, state),
|
|
608
610
|
embeddingDisabled: this.userPostEmbeddingDisabled(uri, state),
|
|
611
|
+
pinned: this.viewerPinned(uri, state, authorDid),
|
|
609
612
|
}
|
|
610
613
|
: undefined,
|
|
611
614
|
labels,
|
|
@@ -620,8 +623,10 @@ export class Views {
|
|
|
620
623
|
state: HydrationState,
|
|
621
624
|
): FeedViewPost | undefined {
|
|
622
625
|
const postInfo = state.posts?.get(item.post.uri)
|
|
623
|
-
let reason: ReasonRepost | undefined
|
|
624
|
-
if (item.
|
|
626
|
+
let reason: ReasonRepost | ReasonPin | undefined
|
|
627
|
+
if (item.authorPinned) {
|
|
628
|
+
reason = this.reasonPin()
|
|
629
|
+
} else if (item.repost) {
|
|
625
630
|
const repost = state.reposts?.get(item.repost.uri)
|
|
626
631
|
if (!repost) return
|
|
627
632
|
if (repost.record.subject.uri !== item.post.uri) return
|
|
@@ -723,6 +728,12 @@ export class Views {
|
|
|
723
728
|
}
|
|
724
729
|
}
|
|
725
730
|
|
|
731
|
+
reasonPin() {
|
|
732
|
+
return {
|
|
733
|
+
$type: 'app.bsky.feed.defs#reasonPin',
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
726
737
|
// Threads
|
|
727
738
|
// ------------
|
|
728
739
|
|
|
@@ -1128,6 +1139,15 @@ export class Views {
|
|
|
1128
1139
|
return true
|
|
1129
1140
|
}
|
|
1130
1141
|
|
|
1142
|
+
viewerPinned(uri: string, state: HydrationState, authorDid: string) {
|
|
1143
|
+
if (!state.ctx?.viewer || state.ctx.viewer !== authorDid) return
|
|
1144
|
+
const actor = state.actors?.get(authorDid)
|
|
1145
|
+
if (!actor) return
|
|
1146
|
+
const pinnedPost = actor.profile?.pinnedPost
|
|
1147
|
+
if (!pinnedPost) return undefined
|
|
1148
|
+
return pinnedPost.uri === uri
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1131
1151
|
notification(
|
|
1132
1152
|
notif: Notification,
|
|
1133
1153
|
lastSeenAt: string | undefined,
|