@atproto/bsky 0.0.18 → 0.0.20
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 +18 -0
- package/dist/index.js +32 -10
- package/dist/index.js.map +2 -2
- package/dist/lexicon/lexicons.d.ts +4 -0
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +1 -0
- package/dist/services/moderation/index.d.ts +1 -0
- package/package.json +6 -6
- package/src/api/app/bsky/actor/getProfile.ts +17 -6
- package/src/api/app/bsky/feed/getAuthorFeed.ts +7 -0
- package/src/api/app/bsky/notification/listNotifications.ts +1 -1
- package/src/lexicon/lexicons.ts +5 -0
- package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +1 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +1 -0
- package/src/services/moderation/index.ts +12 -0
- package/tests/seeds/author-feed.ts +95 -0
- package/tests/views/__snapshots__/author-feed.test.ts.snap +10 -10
- package/tests/views/author-feed.test.ts +20 -2
- package/tests/views/notifications.test.ts +7 -0
- package/tests/views/profile.test.ts +46 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atproto/bsky
|
|
2
2
|
|
|
3
|
+
## 0.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`7dec9df3`](https://github.com/bluesky-social/atproto/commit/7dec9df3b583ee8c06c0c6a7e32c259820dc84a5)]:
|
|
8
|
+
- @atproto/api@0.7.3
|
|
9
|
+
|
|
10
|
+
## 0.0.19
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#1776](https://github.com/bluesky-social/atproto/pull/1776) [`ffe39aae`](https://github.com/bluesky-social/atproto/commit/ffe39aae8394394f73bbfaa9047a8b5818aa053a) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Integrate `posts_and_author_threads` filter into `getAuthorFeed` implementation.
|
|
15
|
+
|
|
16
|
+
- [#1776](https://github.com/bluesky-social/atproto/pull/1776) [`ffe39aae`](https://github.com/bluesky-social/atproto/commit/ffe39aae8394394f73bbfaa9047a8b5818aa053a) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Add `posts_and_author_threads` filter to `getAuthorFeed`
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`ffe39aae`](https://github.com/bluesky-social/atproto/commit/ffe39aae8394394f73bbfaa9047a8b5818aa053a)]:
|
|
19
|
+
- @atproto/api@0.7.2
|
|
20
|
+
|
|
3
21
|
## 0.0.18
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -119021,6 +119021,8 @@ var skeleton2 = async (params2, ctx) => {
|
|
|
119021
119021
|
feedItemsQb = feedItemsQb.where("type", "=", "post").whereExists((qb) => qb.selectFrom("post_embed_image").select("post_embed_image.postUri").whereRef("post_embed_image.postUri", "=", "feed_item.postUri"));
|
|
119022
119022
|
} else if (filter === "posts_no_replies") {
|
|
119023
119023
|
feedItemsQb = feedItemsQb.where((qb) => qb.where("post.replyParent", "is", null).orWhere("type", "=", "repost"));
|
|
119024
|
+
} else if (filter === "posts_and_author_threads") {
|
|
119025
|
+
feedItemsQb = feedItemsQb.where((qb) => qb.where("type", "=", "repost").orWhere("post.replyParent", "is", null).orWhere("post.replyRoot", "like", `at://${actorDid}/%`));
|
|
119024
119026
|
}
|
|
119025
119027
|
const keyset = new FeedKeyset(ref("feed_item.sortAt"), ref("feed_item.cid"));
|
|
119026
119028
|
feedItemsQb = paginate(feedItemsQb, {
|
|
@@ -124569,7 +124571,8 @@ var schemaDict = {
|
|
|
124569
124571
|
knownValues: [
|
|
124570
124572
|
"posts_with_replies",
|
|
124571
124573
|
"posts_no_replies",
|
|
124572
|
-
"posts_with_media"
|
|
124574
|
+
"posts_with_media",
|
|
124575
|
+
"posts_and_author_threads"
|
|
124573
124576
|
],
|
|
124574
124577
|
default: "posts_with_replies"
|
|
124575
124578
|
}
|
|
@@ -126313,6 +126316,10 @@ var schemaDict = {
|
|
|
126313
126316
|
type: "ref",
|
|
126314
126317
|
ref: "lex:app.bsky.notification.listNotifications#notification"
|
|
126315
126318
|
}
|
|
126319
|
+
},
|
|
126320
|
+
seenAt: {
|
|
126321
|
+
type: "string",
|
|
126322
|
+
format: "datetime"
|
|
126316
126323
|
}
|
|
126317
126324
|
}
|
|
126318
126325
|
}
|
|
@@ -129238,20 +129245,20 @@ var LABELS = {
|
|
|
129238
129245
|
strings: {
|
|
129239
129246
|
settings: {
|
|
129240
129247
|
en: {
|
|
129241
|
-
name: "
|
|
129242
|
-
description: "This user has requested that their
|
|
129248
|
+
name: "Sign-in Required",
|
|
129249
|
+
description: "This user has requested that their account only be shown to signed-in users."
|
|
129243
129250
|
}
|
|
129244
129251
|
},
|
|
129245
129252
|
account: {
|
|
129246
129253
|
en: {
|
|
129247
129254
|
name: "Sign-in Required",
|
|
129248
|
-
description: "This user has requested that their
|
|
129255
|
+
description: "This user has requested that their account only be shown to signed-in users."
|
|
129249
129256
|
}
|
|
129250
129257
|
},
|
|
129251
129258
|
content: {
|
|
129252
129259
|
en: {
|
|
129253
129260
|
name: "Sign-in Required",
|
|
129254
|
-
description: "This user has requested that their content only be shown to
|
|
129261
|
+
description: "This user has requested that their content only be shown to signed-in users."
|
|
129255
129262
|
}
|
|
129256
129263
|
}
|
|
129257
129264
|
}
|
|
@@ -135997,7 +136004,8 @@ var schemaDict2 = {
|
|
|
135997
136004
|
knownValues: [
|
|
135998
136005
|
"posts_with_replies",
|
|
135999
136006
|
"posts_no_replies",
|
|
136000
|
-
"posts_with_media"
|
|
136007
|
+
"posts_with_media",
|
|
136008
|
+
"posts_and_author_threads"
|
|
136001
136009
|
],
|
|
136002
136010
|
default: "posts_with_replies"
|
|
136003
136011
|
}
|
|
@@ -137741,6 +137749,10 @@ var schemaDict2 = {
|
|
|
137741
137749
|
type: "ref",
|
|
137742
137750
|
ref: "lex:app.bsky.notification.listNotifications#notification"
|
|
137743
137751
|
}
|
|
137752
|
+
},
|
|
137753
|
+
seenAt: {
|
|
137754
|
+
type: "string",
|
|
137755
|
+
format: "datetime"
|
|
137744
137756
|
}
|
|
137745
137757
|
}
|
|
137746
137758
|
}
|
|
@@ -138798,10 +138810,11 @@ function getProfile_default(server, ctx) {
|
|
|
138798
138810
|
handler: async ({ auth, params: params2, res }) => {
|
|
138799
138811
|
const db = ctx.db.getReplica();
|
|
138800
138812
|
const actorService = ctx.services.actor(db);
|
|
138813
|
+
const modService = ctx.services.moderation(ctx.db.getPrimary());
|
|
138801
138814
|
const viewer = "did" in auth.credentials ? auth.credentials.did : null;
|
|
138802
138815
|
const canViewTakendownProfile = auth.credentials.type === "role" && auth.credentials.triage;
|
|
138803
138816
|
const [result, repoRev] = await Promise.allSettled([
|
|
138804
|
-
getProfile({ ...params2, viewer, canViewTakendownProfile }, { db, actorService }),
|
|
138817
|
+
getProfile({ ...params2, viewer, canViewTakendownProfile }, { db, actorService, modService }),
|
|
138805
138818
|
actorService.getRepoRev(viewer)
|
|
138806
138819
|
]);
|
|
138807
138820
|
if (repoRev.status === "fulfilled") {
|
|
@@ -138818,14 +138831,19 @@ function getProfile_default(server, ctx) {
|
|
|
138818
138831
|
});
|
|
138819
138832
|
}
|
|
138820
138833
|
var skeleton11 = async (params2, ctx) => {
|
|
138821
|
-
const { actorService } = ctx;
|
|
138834
|
+
const { actorService, modService } = ctx;
|
|
138822
138835
|
const { canViewTakendownProfile } = params2;
|
|
138823
138836
|
const actor = await actorService.getActor(params2.actor, true);
|
|
138824
138837
|
if (!actor) {
|
|
138825
138838
|
throw new InvalidRequestError("Profile not found");
|
|
138826
138839
|
}
|
|
138827
138840
|
if (!canViewTakendownProfile && softDeleted(actor)) {
|
|
138828
|
-
|
|
138841
|
+
const isSuspended = await modService.isSubjectSuspended(actor.did);
|
|
138842
|
+
if (isSuspended) {
|
|
138843
|
+
throw new InvalidRequestError("Account has been temporarily suspended", "AccountTakedown");
|
|
138844
|
+
} else {
|
|
138845
|
+
throw new InvalidRequestError("Account has been taken down", "AccountTakedown");
|
|
138846
|
+
}
|
|
138829
138847
|
}
|
|
138830
138848
|
return { params: params2, actor };
|
|
138831
138849
|
};
|
|
@@ -140125,7 +140143,7 @@ var presentation19 = (state) => {
|
|
|
140125
140143
|
labels: [...recordLabels, ...recordSelfLabels]
|
|
140126
140144
|
};
|
|
140127
140145
|
});
|
|
140128
|
-
return { notifications, cursor };
|
|
140146
|
+
return { notifications, cursor, seenAt: lastSeenNotifs };
|
|
140129
140147
|
};
|
|
140130
140148
|
var getRecordMap = async (db, uris) => {
|
|
140131
140149
|
if (!uris.length)
|
|
@@ -145817,6 +145835,10 @@ var ModerationService = class {
|
|
|
145817
145835
|
const subjectsDueForReversal = await this.db.db.selectFrom("moderation_subject_status").where("suspendUntil", "<", new Date().toISOString()).orWhere("muteUntil", "<", new Date().toISOString()).selectAll().execute();
|
|
145818
145836
|
return subjectsDueForReversal;
|
|
145819
145837
|
}
|
|
145838
|
+
async isSubjectSuspended(did2) {
|
|
145839
|
+
const res = await this.db.db.selectFrom("moderation_subject_status").where("did", "=", did2).where("recordPath", "=", "").where("suspendUntil", ">", new Date().toISOString()).select("did").limit(1).executeTakeFirst();
|
|
145840
|
+
return !!res;
|
|
145841
|
+
}
|
|
145820
145842
|
async revertState({
|
|
145821
145843
|
createdBy,
|
|
145822
145844
|
createdAt,
|