@atproto/bsky 0.0.19 → 0.0.21
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 +14 -0
- package/dist/index.js +22 -4
- package/dist/index.js.map +2 -2
- package/dist/lexicon/lexicons.d.ts +4 -0
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +1 -0
- package/dist/services/moderation/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/api/app/bsky/actor/getProfile.ts +17 -6
- package/src/api/app/bsky/notification/listNotifications.ts +1 -1
- package/src/lexicon/lexicons.ts +4 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +1 -0
- package/src/services/moderation/index.ts +12 -0
- package/tests/views/notifications.test.ts +7 -0
- package/tests/views/profile.test.ts +46 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atproto/bsky
|
|
2
2
|
|
|
3
|
+
## 0.0.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`8f3f43cb`](https://github.com/bluesky-social/atproto/commit/8f3f43cb40f79ff7c52f81290daec55cfb000093)]:
|
|
8
|
+
- @atproto/api@0.7.4
|
|
9
|
+
|
|
10
|
+
## 0.0.20
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`7dec9df3`](https://github.com/bluesky-social/atproto/commit/7dec9df3b583ee8c06c0c6a7e32c259820dc84a5)]:
|
|
15
|
+
- @atproto/api@0.7.3
|
|
16
|
+
|
|
3
17
|
## 0.0.19
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -126316,6 +126316,10 @@ var schemaDict = {
|
|
|
126316
126316
|
type: "ref",
|
|
126317
126317
|
ref: "lex:app.bsky.notification.listNotifications#notification"
|
|
126318
126318
|
}
|
|
126319
|
+
},
|
|
126320
|
+
seenAt: {
|
|
126321
|
+
type: "string",
|
|
126322
|
+
format: "datetime"
|
|
126319
126323
|
}
|
|
126320
126324
|
}
|
|
126321
126325
|
}
|
|
@@ -137745,6 +137749,10 @@ var schemaDict2 = {
|
|
|
137745
137749
|
type: "ref",
|
|
137746
137750
|
ref: "lex:app.bsky.notification.listNotifications#notification"
|
|
137747
137751
|
}
|
|
137752
|
+
},
|
|
137753
|
+
seenAt: {
|
|
137754
|
+
type: "string",
|
|
137755
|
+
format: "datetime"
|
|
137748
137756
|
}
|
|
137749
137757
|
}
|
|
137750
137758
|
}
|
|
@@ -138802,10 +138810,11 @@ function getProfile_default(server, ctx) {
|
|
|
138802
138810
|
handler: async ({ auth, params: params2, res }) => {
|
|
138803
138811
|
const db = ctx.db.getReplica();
|
|
138804
138812
|
const actorService = ctx.services.actor(db);
|
|
138813
|
+
const modService = ctx.services.moderation(ctx.db.getPrimary());
|
|
138805
138814
|
const viewer = "did" in auth.credentials ? auth.credentials.did : null;
|
|
138806
138815
|
const canViewTakendownProfile = auth.credentials.type === "role" && auth.credentials.triage;
|
|
138807
138816
|
const [result, repoRev] = await Promise.allSettled([
|
|
138808
|
-
getProfile({ ...params2, viewer, canViewTakendownProfile }, { db, actorService }),
|
|
138817
|
+
getProfile({ ...params2, viewer, canViewTakendownProfile }, { db, actorService, modService }),
|
|
138809
138818
|
actorService.getRepoRev(viewer)
|
|
138810
138819
|
]);
|
|
138811
138820
|
if (repoRev.status === "fulfilled") {
|
|
@@ -138822,14 +138831,19 @@ function getProfile_default(server, ctx) {
|
|
|
138822
138831
|
});
|
|
138823
138832
|
}
|
|
138824
138833
|
var skeleton11 = async (params2, ctx) => {
|
|
138825
|
-
const { actorService } = ctx;
|
|
138834
|
+
const { actorService, modService } = ctx;
|
|
138826
138835
|
const { canViewTakendownProfile } = params2;
|
|
138827
138836
|
const actor = await actorService.getActor(params2.actor, true);
|
|
138828
138837
|
if (!actor) {
|
|
138829
138838
|
throw new InvalidRequestError("Profile not found");
|
|
138830
138839
|
}
|
|
138831
138840
|
if (!canViewTakendownProfile && softDeleted(actor)) {
|
|
138832
|
-
|
|
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
|
+
}
|
|
138833
138847
|
}
|
|
138834
138848
|
return { params: params2, actor };
|
|
138835
138849
|
};
|
|
@@ -140129,7 +140143,7 @@ var presentation19 = (state) => {
|
|
|
140129
140143
|
labels: [...recordLabels, ...recordSelfLabels]
|
|
140130
140144
|
};
|
|
140131
140145
|
});
|
|
140132
|
-
return { notifications, cursor };
|
|
140146
|
+
return { notifications, cursor, seenAt: lastSeenNotifs };
|
|
140133
140147
|
};
|
|
140134
140148
|
var getRecordMap = async (db, uris) => {
|
|
140135
140149
|
if (!uris.length)
|
|
@@ -145821,6 +145835,10 @@ var ModerationService = class {
|
|
|
145821
145835
|
const subjectsDueForReversal = await this.db.db.selectFrom("moderation_subject_status").where("suspendUntil", "<", new Date().toISOString()).orWhere("muteUntil", "<", new Date().toISOString()).selectAll().execute();
|
|
145822
145836
|
return subjectsDueForReversal;
|
|
145823
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
|
+
}
|
|
145824
145842
|
async revertState({
|
|
145825
145843
|
createdBy,
|
|
145826
145844
|
createdAt,
|