@atproto/api 0.10.5 → 0.11.0-next
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/definitions/labels.json +191 -189
- package/dist/agent.d.ts +3 -1
- package/dist/bsky-agent.d.ts +6 -2
- package/dist/client/index.d.ts +94 -38
- package/dist/client/lexicons.d.ts +5091 -4833
- package/dist/client/types/app/bsky/actor/createScene.d.ts +32 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +23 -1
- package/dist/client/types/app/bsky/actor/ref.d.ts +28 -0
- package/dist/client/types/app/bsky/actor/search.d.ts +22 -0
- package/dist/client/types/app/bsky/actor/searchActor.d.ts +22 -0
- package/dist/client/types/app/bsky/actor/searchActorTypeahead.d.ts +20 -0
- package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +20 -0
- package/dist/client/types/app/bsky/actor/updateProfile.d.ts +47 -0
- package/dist/client/types/app/bsky/embed/record.d.ts +2 -1
- package/dist/client/types/app/bsky/feed/bookmarkFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +28 -0
- package/dist/client/types/app/bsky/feed/getBookmarkedFeeds.d.ts +21 -0
- package/dist/client/types/app/bsky/feed/getSavedFeeds.d.ts +21 -0
- package/dist/client/types/app/bsky/feed/getVotes.d.ts +36 -0
- package/dist/client/types/app/bsky/feed/saveFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/setVote.d.ts +25 -0
- package/dist/client/types/app/bsky/feed/trend.d.ts +9 -0
- package/dist/client/types/app/bsky/feed/unbookmarkFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +17 -0
- package/dist/client/types/app/bsky/feed/vote.d.ts +10 -0
- package/dist/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/assertMember.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/assertion.d.ts +10 -0
- package/dist/client/types/app/bsky/graph/confirmation.d.ts +11 -0
- package/dist/client/types/app/bsky/graph/getAssertions.d.ts +48 -0
- package/dist/client/types/app/bsky/graph/getMembers.d.ts +36 -0
- package/dist/client/types/app/bsky/graph/getMemberships.d.ts +36 -0
- package/dist/client/types/app/bsky/graph/mute.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/unmute.d.ts +17 -0
- package/dist/client/types/app/bsky/labeler/defs.d.ts +41 -0
- package/dist/client/types/app/bsky/labeler/getServices.d.ts +23 -0
- package/dist/client/types/app/bsky/labeler/service.d.ts +14 -0
- package/dist/client/types/app/bsky/moderation/defs.d.ts +41 -0
- package/dist/client/types/app/bsky/moderation/getService.d.ts +16 -0
- package/dist/client/types/app/bsky/moderation/getServices.d.ts +23 -0
- package/dist/client/types/app/bsky/moderation/service.d.ts +14 -0
- package/dist/client/types/app/bsky/notification/getCount.d.ts +17 -0
- package/dist/client/types/app/bsky/notification/list.d.ts +35 -0
- package/dist/client/types/app/bsky/system/actorScene.d.ts +1 -0
- package/dist/client/types/app/bsky/system/actorUser.d.ts +1 -0
- package/dist/client/types/app/bsky/system/declRef.d.ts +8 -0
- package/dist/client/types/app/bsky/system/declaration.d.ts +7 -0
- package/dist/client/types/app/bsky/unspecced/applyLabels.d.ts +18 -0
- package/dist/client/types/app/bsky/unspecced/getPopular.d.ts +22 -0
- package/dist/client/types/app/bsky/unspecced/getTimelineSkeleton.d.ts +24 -0
- package/dist/client/types/com/atproto/account/create.d.ts +41 -0
- package/dist/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
- package/dist/client/types/com/atproto/account/delete.d.ts +25 -0
- package/dist/client/types/com/atproto/account/get.d.ts +12 -0
- package/dist/client/types/com/atproto/account/requestDelete.d.ts +13 -0
- package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
- package/dist/client/types/com/atproto/account/resetPassword.d.ts +24 -0
- package/dist/client/types/com/atproto/admin/blob.d.ts +37 -0
- package/dist/client/types/com/atproto/admin/defs.d.ts +0 -304
- package/dist/client/types/com/atproto/admin/getInviteCodeUsage.d.ts +29 -0
- package/dist/client/types/com/atproto/admin/getModerationAction.d.ts +16 -0
- package/dist/client/types/com/atproto/admin/getModerationActions.d.ts +22 -0
- package/dist/client/types/com/atproto/admin/getModerationReport.d.ts +16 -0
- package/dist/client/types/com/atproto/admin/getModerationReports.d.ts +28 -0
- package/dist/client/types/com/atproto/admin/getSubjectState.d.ts +26 -0
- package/dist/client/types/com/atproto/admin/getUserAccountInfo.d.ts +16 -0
- package/dist/client/types/com/atproto/admin/moderationAction.d.ts +60 -0
- package/dist/client/types/com/atproto/admin/moderationReport.d.ts +37 -0
- package/dist/client/types/com/atproto/admin/rebaseRepo.d.ts +24 -0
- package/dist/client/types/com/atproto/admin/record.d.ts +43 -0
- package/dist/client/types/com/atproto/admin/repo.d.ts +45 -0
- package/dist/client/types/com/atproto/admin/resolveModerationReports.d.ts +22 -0
- package/dist/client/types/com/atproto/admin/reverseModerationAction.d.ts +22 -0
- package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +34 -0
- package/dist/client/types/com/atproto/admin/updateSubjectState.d.ts +32 -0
- package/dist/client/types/com/atproto/blob/upload.d.ts +19 -0
- package/dist/client/types/com/atproto/handle/resolve.d.ts +18 -0
- package/dist/client/types/com/atproto/handle/update.d.ts +17 -0
- package/dist/client/types/com/atproto/label/defs.d.ts +21 -0
- package/dist/client/types/com/atproto/repo/batchWrite.d.ts +46 -0
- package/dist/client/types/com/atproto/repo/describe.d.ts +22 -0
- package/dist/client/types/com/atproto/repo/rebaseRepo.d.ts +24 -0
- package/dist/client/types/com/atproto/repo/recordRef.d.ts +8 -0
- package/dist/client/types/com/atproto/repo/repoRef.d.ts +7 -0
- package/dist/client/types/com/atproto/repo/uploadRepo.d.ts +19 -0
- package/dist/client/types/com/atproto/report/create.d.ts +39 -0
- package/dist/client/types/com/atproto/report/reasonType.d.ts +3 -0
- package/dist/client/types/com/atproto/report/subject.d.ts +23 -0
- package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +27 -0
- package/dist/client/types/com/atproto/server/getUserInviteCodes.d.ts +31 -0
- package/dist/client/types/com/atproto/session/create.d.ts +29 -0
- package/dist/client/types/com/atproto/session/delete.d.ts +13 -0
- package/dist/client/types/com/atproto/session/get.d.ts +18 -0
- package/dist/client/types/com/atproto/session/refresh.d.ts +24 -0
- package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +20 -0
- package/dist/client/types/com/atproto/sync/getCurrent.d.ts +22 -0
- package/dist/client/types/com/atproto/sync/getRoot.d.ts +21 -0
- package/dist/client/types/com/atproto/sync/importRepo.d.ts +16 -0
- package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -0
- package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
- package/dist/client/types/com/atproto/temp/importRepo.d.ts +16 -0
- package/dist/client/types/com/atproto/temp/pushBlob.d.ts +15 -0
- package/dist/client/types/com/atproto/temp/transferAccount.d.ts +48 -0
- package/dist/client/types/com/atproto/temp/upgradeRepoVersion.d.ts +18 -0
- package/dist/client/types/tools/ozone/communication/createTemplate.d.ts +23 -0
- package/dist/client/types/tools/ozone/communication/defs.d.ts +14 -0
- package/dist/client/types/tools/ozone/communication/deleteTemplate.d.ts +17 -0
- package/dist/client/types/tools/ozone/communication/listTemplates.d.ts +18 -0
- package/dist/client/types/tools/ozone/communication/updateTemplate.d.ts +25 -0
- package/dist/client/types/tools/ozone/moderation/defs.d.ts +269 -0
- package/dist/client/types/tools/ozone/moderation/emitEvent.d.ts +34 -0
- package/dist/client/types/tools/ozone/moderation/getEvent.d.ts +16 -0
- package/dist/client/types/tools/ozone/moderation/getRecord.d.ts +20 -0
- package/dist/client/types/tools/ozone/moderation/getRepo.d.ts +19 -0
- package/dist/client/types/tools/ozone/moderation/queryEvents.d.ts +35 -0
- package/dist/client/types/tools/ozone/moderation/queryStatuses.d.ts +37 -0
- package/dist/client/types/tools/ozone/moderation/searchRepos.d.ts +23 -0
- package/dist/const.d.ts +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7865 -7922
- package/dist/index.js.map +3 -3
- package/dist/mocker.d.ts +57 -0
- package/dist/moderation/const/labels.d.ts +4 -2
- package/dist/moderation/decision.d.ts +26 -0
- package/dist/moderation/index.d.ts +10 -44
- package/dist/moderation/subjects/account.d.ts +2 -1
- package/dist/moderation/subjects/feed-generator.d.ts +2 -1
- package/dist/moderation/subjects/notification.d.ts +3 -0
- package/dist/moderation/subjects/post.d.ts +2 -1
- package/dist/moderation/subjects/profile.d.ts +2 -1
- package/dist/moderation/subjects/user-list.d.ts +2 -1
- package/dist/moderation/types.d.ts +47 -61
- package/dist/moderation/ui.d.ts +12 -0
- package/dist/moderation/util.d.ts +4 -8
- package/dist/session.d.ts +42 -0
- package/dist/src/client/index.d.ts +462 -0
- package/dist/src/client/lexicons.d.ts +2910 -0
- package/dist/src/client/schemas.d.ts +17 -0
- package/dist/src/client/types/app/bsky/actor/createScene.d.ts +32 -0
- package/dist/src/client/types/app/bsky/actor/getProfile.d.ts +36 -0
- package/dist/src/client/types/app/bsky/actor/getSuggestions.d.ts +36 -0
- package/dist/src/client/types/app/bsky/actor/profile.d.ts +15 -0
- package/dist/src/client/types/app/bsky/actor/ref.d.ts +14 -0
- package/dist/src/client/types/app/bsky/actor/search.d.ts +32 -0
- package/dist/src/client/types/app/bsky/actor/searchTypeahead.d.ts +28 -0
- package/dist/src/client/types/app/bsky/actor/updateProfile.d.ts +48 -0
- package/dist/src/client/types/app/bsky/badge.d.ts +22 -0
- package/dist/src/client/types/app/bsky/badgeAccept.d.ts +11 -0
- package/dist/src/client/types/app/bsky/badgeOffer.d.ts +11 -0
- package/dist/src/client/types/app/bsky/declaration.d.ts +6 -0
- package/dist/src/client/types/app/bsky/embed/external.d.ts +26 -0
- package/dist/src/client/types/app/bsky/embed/images.d.ts +23 -0
- package/dist/src/client/types/app/bsky/feed/embed.d.ts +36 -0
- package/dist/src/client/types/app/bsky/feed/feedViewPost.d.ts +26 -0
- package/dist/src/client/types/app/bsky/feed/getAuthorFeed.d.ts +22 -0
- package/dist/src/client/types/app/bsky/feed/getPostThread.d.ts +43 -0
- package/dist/src/client/types/app/bsky/feed/getRepostedBy.d.ts +35 -0
- package/dist/src/client/types/app/bsky/feed/getTimeline.d.ts +22 -0
- package/dist/src/client/types/app/bsky/feed/getVotes.d.ts +33 -0
- package/dist/src/client/types/app/bsky/feed/mediaEmbed.d.ts +18 -0
- package/dist/src/client/types/app/bsky/feed/post.d.ts +54 -0
- package/dist/src/client/types/app/bsky/feed/repost.d.ts +6 -0
- package/dist/src/client/types/app/bsky/feed/setVote.d.ts +25 -0
- package/dist/src/client/types/app/bsky/feed/trend.d.ts +6 -0
- package/dist/src/client/types/app/bsky/feed/vote.d.ts +7 -0
- package/dist/src/client/types/app/bsky/follow.d.ts +9 -0
- package/dist/src/client/types/app/bsky/getAuthorFeed.d.ts +56 -0
- package/dist/src/client/types/app/bsky/getBadgeMembers.d.ts +29 -0
- package/dist/src/client/types/app/bsky/getHomeFeed.d.ts +56 -0
- package/dist/src/client/types/app/bsky/getLikedBy.d.ts +29 -0
- package/dist/src/client/types/app/bsky/getNotificationCount.d.ts +16 -0
- package/dist/src/client/types/app/bsky/getNotifications.d.ts +33 -0
- package/dist/src/client/types/app/bsky/getPostThread.d.ts +55 -0
- package/dist/src/client/types/app/bsky/getProfile.d.ts +26 -0
- package/dist/src/client/types/app/bsky/getRepostedBy.d.ts +29 -0
- package/dist/src/client/types/app/bsky/getTimeline.d.ts +56 -0
- package/dist/src/client/types/app/bsky/getUserFollowers.d.ts +31 -0
- package/dist/src/client/types/app/bsky/getUserFollows.d.ts +31 -0
- package/dist/src/client/types/app/bsky/getUsersSearch.d.ts +26 -0
- package/dist/src/client/types/app/bsky/getUsersTypeahead.d.ts +22 -0
- package/dist/src/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
- package/dist/src/client/types/app/bsky/graph/assertMember.d.ts +1 -0
- package/dist/src/client/types/app/bsky/graph/assertion.d.ts +7 -0
- package/dist/src/client/types/app/bsky/graph/confirmation.d.ts +8 -0
- package/dist/src/client/types/app/bsky/graph/follow.d.ts +6 -0
- package/dist/src/client/types/app/bsky/graph/getAssertions.d.ts +43 -0
- package/dist/src/client/types/app/bsky/graph/getFollowers.d.ts +34 -0
- package/dist/src/client/types/app/bsky/graph/getFollows.d.ts +33 -0
- package/dist/src/client/types/app/bsky/graph/getMembers.d.ts +33 -0
- package/dist/src/client/types/app/bsky/graph/getMemberships.d.ts +33 -0
- package/dist/src/client/types/app/bsky/invite.d.ts +10 -0
- package/dist/src/client/types/app/bsky/inviteAccept.d.ts +14 -0
- package/dist/src/client/types/app/bsky/like.d.ts +10 -0
- package/dist/src/client/types/app/bsky/mediaEmbed.d.ts +15 -0
- package/dist/src/client/types/app/bsky/notification/getCount.d.ts +17 -0
- package/dist/src/client/types/app/bsky/notification/list.d.ts +32 -0
- package/dist/src/client/types/app/bsky/notification/updateSeen.d.ts +17 -0
- package/dist/src/client/types/app/bsky/post.d.ts +23 -0
- package/dist/src/client/types/app/bsky/postNotificationsSeen.d.ts +20 -0
- package/dist/src/client/types/app/bsky/profile.d.ts +5 -0
- package/dist/src/client/types/app/bsky/repost.d.ts +10 -0
- package/dist/src/client/types/app/bsky/system/actorScene.d.ts +1 -0
- package/dist/src/client/types/app/bsky/system/actorUser.d.ts +1 -0
- package/dist/src/client/types/app/bsky/system/declRef.d.ts +5 -0
- package/dist/src/client/types/app/bsky/system/declaration.d.ts +4 -0
- package/dist/src/client/types/app/bsky/updateProfile.d.ts +23 -0
- package/dist/src/client/types/com/atproto/account/create.d.ts +41 -0
- package/dist/src/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
- package/dist/src/client/types/com/atproto/account/delete.d.ts +13 -0
- package/dist/src/client/types/com/atproto/account/get.d.ts +12 -0
- package/dist/src/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
- package/dist/src/client/types/com/atproto/account/resetPassword.d.ts +24 -0
- package/dist/src/client/types/com/atproto/blob/upload.d.ts +19 -0
- package/dist/src/client/types/com/atproto/createAccount.d.ts +40 -0
- package/dist/src/client/types/com/atproto/createInviteCode.d.ts +20 -0
- package/dist/src/client/types/com/atproto/createSession.d.ts +24 -0
- package/dist/src/client/types/com/atproto/data/uploadFile.d.ts +19 -0
- package/dist/src/client/types/com/atproto/deleteAccount.d.ts +20 -0
- package/dist/src/client/types/com/atproto/deleteSession.d.ts +17 -0
- package/dist/src/client/types/com/atproto/getAccount.d.ts +16 -0
- package/dist/src/client/types/com/atproto/getAccountsConfig.d.ts +17 -0
- package/dist/src/client/types/com/atproto/getSession.d.ts +17 -0
- package/dist/src/client/types/com/atproto/handle/resolve.d.ts +18 -0
- package/dist/src/client/types/com/atproto/refreshSession.d.ts +20 -0
- package/dist/src/client/types/com/atproto/repo/batchWrite.d.ts +39 -0
- package/dist/src/client/types/com/atproto/repo/createRecord.d.ts +26 -0
- package/dist/src/client/types/com/atproto/repo/deleteRecord.d.ts +19 -0
- package/dist/src/client/types/com/atproto/repo/describe.d.ts +22 -0
- package/dist/src/client/types/com/atproto/repo/getRecord.d.ts +23 -0
- package/dist/src/client/types/com/atproto/repo/listRecords.d.ts +30 -0
- package/dist/src/client/types/com/atproto/repo/putRecord.d.ts +27 -0
- package/dist/src/client/types/com/atproto/repo/strongRef.d.ts +5 -0
- package/dist/src/client/types/com/atproto/repoBatchWrite.d.ts +36 -0
- package/dist/src/client/types/com/atproto/repoCreateRecord.d.ts +24 -0
- package/dist/src/client/types/com/atproto/repoDeleteRecord.d.ts +18 -0
- package/dist/src/client/types/com/atproto/repoDescribe.d.ts +21 -0
- package/dist/src/client/types/com/atproto/repoGetRecord.d.ts +22 -0
- package/dist/src/client/types/com/atproto/repoListRecords.d.ts +27 -0
- package/dist/src/client/types/com/atproto/repoPutRecord.d.ts +25 -0
- package/dist/src/client/types/com/atproto/requestAccountPasswordReset.d.ts +19 -0
- package/dist/src/client/types/com/atproto/resetAccountPassword.d.ts +26 -0
- package/dist/src/client/types/com/atproto/resolveHandle.d.ts +17 -0
- package/dist/src/client/types/com/atproto/resolveName.d.ts +17 -0
- package/dist/src/client/types/com/atproto/server/getAccountsConfig.d.ts +24 -0
- package/dist/src/client/types/com/atproto/session/create.d.ts +26 -0
- package/dist/src/client/types/com/atproto/session/delete.d.ts +13 -0
- package/dist/src/client/types/com/atproto/session/get.d.ts +18 -0
- package/dist/src/client/types/com/atproto/session/refresh.d.ts +21 -0
- package/dist/src/client/types/com/atproto/sync/getRepo.d.ts +15 -0
- package/dist/src/client/types/com/atproto/sync/getRoot.d.ts +18 -0
- package/dist/src/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
- package/dist/src/client/types/com/atproto/syncGetRepo.d.ts +15 -0
- package/dist/src/client/types/com/atproto/syncGetRoot.d.ts +17 -0
- package/dist/src/client/types/com/atproto/syncUpdateRepo.d.ts +15 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/schemas.d.ts +19 -0
- package/dist/src/session.d.ts +42 -0
- package/dist/src/types/app/bsky/acceptedBadge.d.ts +10 -0
- package/dist/src/types/app/bsky/badge.d.ts +22 -0
- package/dist/src/types/app/bsky/badgeAccept.d.ts +11 -0
- package/dist/src/types/app/bsky/badgeOffer.d.ts +11 -0
- package/dist/src/types/app/bsky/declaration.d.ts +6 -0
- package/dist/src/types/app/bsky/follow.d.ts +9 -0
- package/dist/src/types/app/bsky/getAuthorFeed.d.ts +56 -0
- package/dist/src/types/app/bsky/getBadgeMembers.d.ts +29 -0
- package/dist/src/types/app/bsky/getHomeFeed.d.ts +56 -0
- package/dist/src/types/app/bsky/getLikedBy.d.ts +29 -0
- package/dist/src/types/app/bsky/getNotificationCount.d.ts +16 -0
- package/dist/src/types/app/bsky/getNotifications.d.ts +33 -0
- package/dist/src/types/app/bsky/getPostThread.d.ts +55 -0
- package/dist/src/types/app/bsky/getProfile.d.ts +42 -0
- package/dist/src/types/app/bsky/getRepostedBy.d.ts +29 -0
- package/dist/src/types/app/bsky/getUserFollowers.d.ts +31 -0
- package/dist/src/types/app/bsky/getUserFollows.d.ts +31 -0
- package/dist/src/types/app/bsky/getUsersSearch.d.ts +26 -0
- package/dist/src/types/app/bsky/getUsersTypeahead.d.ts +22 -0
- package/dist/src/types/app/bsky/invite.d.ts +10 -0
- package/dist/src/types/app/bsky/inviteAccept.d.ts +14 -0
- package/dist/src/types/app/bsky/like.d.ts +10 -0
- package/dist/src/types/app/bsky/mediaEmbed.d.ts +15 -0
- package/dist/src/types/app/bsky/post.d.ts +23 -0
- package/dist/src/types/app/bsky/postNotificationsSeen.d.ts +19 -0
- package/dist/src/types/app/bsky/profile.d.ts +11 -0
- package/dist/src/types/app/bsky/repost.d.ts +10 -0
- package/dist/src/types/app/bsky/updateProfile.d.ts +27 -0
- package/dist/src/types/com/atproto/createAccount.d.ts +39 -0
- package/dist/src/types/com/atproto/createInviteCode.d.ts +19 -0
- package/dist/src/types/com/atproto/createSession.d.ts +23 -0
- package/dist/src/types/com/atproto/deleteAccount.d.ts +19 -0
- package/dist/src/types/com/atproto/deleteSession.d.ts +16 -0
- package/dist/src/types/com/atproto/getAccount.d.ts +19 -0
- package/dist/src/types/com/atproto/getAccountsConfig.d.ts +17 -0
- package/dist/src/types/com/atproto/getSession.d.ts +17 -0
- package/dist/src/types/com/atproto/refreshSession.d.ts +19 -0
- package/dist/src/types/com/atproto/repoBatchWrite.d.ts +35 -0
- package/dist/src/types/com/atproto/repoCreateRecord.d.ts +23 -0
- package/dist/src/types/com/atproto/repoDeleteRecord.d.ts +15 -0
- package/dist/src/types/com/atproto/repoDescribe.d.ts +21 -0
- package/dist/src/types/com/atproto/repoGetRecord.d.ts +22 -0
- package/dist/src/types/com/atproto/repoListRecords.d.ts +27 -0
- package/dist/src/types/com/atproto/repoPutRecord.d.ts +24 -0
- package/dist/src/types/com/atproto/requestAccountPasswordReset.d.ts +18 -0
- package/dist/src/types/com/atproto/resetAccountPassword.d.ts +25 -0
- package/dist/src/types/com/atproto/resolveName.d.ts +17 -0
- package/dist/src/types/com/atproto/syncGetRepo.d.ts +15 -0
- package/dist/src/types/com/atproto/syncGetRoot.d.ts +17 -0
- package/dist/src/types/com/atproto/syncUpdateRepo.d.ts +14 -0
- package/dist/src/types/todo/adx/createAccount.d.ts +36 -0
- package/dist/src/types/todo/adx/createInviteCode.d.ts +19 -0
- package/dist/src/types/todo/adx/createSession.d.ts +22 -0
- package/dist/src/types/todo/adx/deleteAccount.d.ts +19 -0
- package/dist/src/types/todo/adx/deleteSession.d.ts +19 -0
- package/dist/src/types/todo/adx/getAccount.d.ts +19 -0
- package/dist/src/types/todo/adx/getAccountsConfig.d.ts +17 -0
- package/dist/src/types/todo/adx/getSession.d.ts +17 -0
- package/dist/src/types/todo/adx/repoBatchWrite.d.ts +34 -0
- package/dist/src/types/todo/adx/repoCreateRecord.d.ts +22 -0
- package/dist/src/types/todo/adx/repoDeleteRecord.d.ts +15 -0
- package/dist/src/types/todo/adx/repoDescribe.d.ts +21 -0
- package/dist/src/types/todo/adx/repoGetRecord.d.ts +20 -0
- package/dist/src/types/todo/adx/repoListRecords.d.ts +25 -0
- package/dist/src/types/todo/adx/repoPutRecord.d.ts +23 -0
- package/dist/src/types/todo/adx/requestAccountPasswordReset.d.ts +18 -0
- package/dist/src/types/todo/adx/resetAccountPassword.d.ts +25 -0
- package/dist/src/types/todo/adx/resolveName.d.ts +17 -0
- package/dist/src/types/todo/adx/syncGetRepo.d.ts +15 -0
- package/dist/src/types/todo/adx/syncGetRoot.d.ts +17 -0
- package/dist/src/types/todo/adx/syncUpdateRepo.d.ts +14 -0
- package/dist/src/types/todo/social/badge.d.ts +23 -0
- package/dist/src/types/todo/social/follow.d.ts +5 -0
- package/dist/src/types/todo/social/getAuthorFeed.d.ts +55 -0
- package/dist/src/types/todo/social/getFeed.d.ts +55 -0
- package/dist/src/types/todo/social/getHomeFeed.d.ts +55 -0
- package/dist/src/types/todo/social/getLikedBy.d.ts +26 -0
- package/dist/src/types/todo/social/getNotificationCount.d.ts +16 -0
- package/dist/src/types/todo/social/getNotifications.d.ts +31 -0
- package/dist/src/types/todo/social/getPostThread.d.ts +54 -0
- package/dist/src/types/todo/social/getProfile.d.ts +40 -0
- package/dist/src/types/todo/social/getRepostedBy.d.ts +26 -0
- package/dist/src/types/todo/social/getUserFollowers.d.ts +30 -0
- package/dist/src/types/todo/social/getUserFollows.d.ts +30 -0
- package/dist/src/types/todo/social/like.d.ts +5 -0
- package/dist/src/types/todo/social/mediaEmbed.d.ts +15 -0
- package/dist/src/types/todo/social/post.d.ts +18 -0
- package/dist/src/types/todo/social/postNotificationsSeen.d.ts +19 -0
- package/dist/src/types/todo/social/profile.d.ts +10 -0
- package/dist/src/types/todo/social/repost.d.ts +5 -0
- package/dist/types.d.ts +2 -4
- package/docs/labels.md +22 -468
- package/docs/moderation.md +0 -2
- package/package.json +5 -5
- package/scripts/code/labels.mjs +17 -35
- package/scripts/docs/labels.mjs +8 -85
- package/scripts/generate-code.mjs +0 -1
- package/scripts/generate-docs.mjs +0 -2
- package/src/agent.ts +24 -4
- package/src/bsky-agent.ts +184 -24
- package/src/client/index.ts +292 -173
- package/src/client/lexicons.ts +6192 -5926
- package/src/client/types/app/bsky/actor/defs.ts +57 -1
- package/src/client/types/app/bsky/embed/record.ts +2 -0
- package/src/client/types/app/bsky/labeler/defs.ts +93 -0
- package/src/client/types/app/bsky/labeler/getServices.ts +41 -0
- package/src/client/types/app/bsky/labeler/service.ts +31 -0
- package/src/client/types/com/atproto/admin/defs.ts +0 -694
- package/src/client/types/com/atproto/label/defs.ts +74 -0
- package/src/client/types/{com/atproto/admin/createCommunicationTemplate.ts → tools/ozone/communication/createTemplate.ts} +2 -2
- package/src/client/types/tools/ozone/communication/defs.ts +35 -0
- package/src/client/types/{com/atproto/admin/listCommunicationTemplates.ts → tools/ozone/communication/listTemplates.ts} +2 -2
- package/src/client/types/{com/atproto/admin/updateCommunicationTemplate.ts → tools/ozone/communication/updateTemplate.ts} +2 -2
- package/src/client/types/tools/ozone/moderation/defs.ts +641 -0
- package/src/client/types/{com/atproto/admin/emitModerationEvent.ts → tools/ozone/moderation/emitEvent.ts} +15 -14
- package/src/client/types/{com/atproto/admin/getModerationEvent.ts → tools/ozone/moderation/getEvent.ts} +2 -2
- package/src/client/types/{com/atproto/admin → tools/ozone/moderation}/getRecord.ts +2 -2
- package/src/client/types/{com/atproto/admin → tools/ozone/moderation}/getRepo.ts +2 -2
- package/src/client/types/{com/atproto/admin/queryModerationEvents.ts → tools/ozone/moderation/queryEvents.ts} +3 -3
- package/src/client/types/{com/atproto/admin/queryModerationStatuses.ts → tools/ozone/moderation/queryStatuses.ts} +2 -2
- package/src/client/types/{com/atproto/admin → tools/ozone/moderation}/searchRepos.ts +2 -2
- package/src/const.ts +1 -0
- package/src/index.ts +3 -2
- package/src/mocker.ts +214 -0
- package/src/moderation/const/labels.ts +247 -847
- package/src/moderation/decision.ts +337 -0
- package/src/moderation/index.ts +38 -304
- package/src/moderation/subjects/account.ts +6 -10
- package/src/moderation/subjects/feed-generator.ts +3 -6
- package/src/moderation/subjects/notification.ts +19 -0
- package/src/moderation/subjects/post.ts +6 -10
- package/src/moderation/subjects/profile.ts +6 -11
- package/src/moderation/subjects/user-list.ts +3 -6
- package/src/moderation/types.ts +81 -77
- package/src/moderation/ui.ts +21 -0
- package/src/moderation/util.ts +82 -72
- package/src/types.ts +3 -10
- package/tests/agent.test.ts +20 -0
- package/tests/bsky-agent.test.ts +401 -98
- package/tests/moderation-behaviors.test.ts +969 -0
- package/tests/moderation-custom-labels.test.ts +358 -0
- package/tests/moderation-prefs.test.ts +276 -0
- package/tests/moderation.test.ts +303 -201
- package/tests/util/echo-server.ts +21 -0
- package/tests/util/index.ts +1 -154
- package/tests/util/moderation-behavior.ts +129 -55
- package/definitions/locale/en/label-groups.json +0 -38
- package/definitions/locale/en/labels.json +0 -394
- package/definitions/locale/en/proposed-label-groups.json +0 -38
- package/definitions/locale/en/proposed-labels.json +0 -632
- package/definitions/moderation-behaviors.d.ts +0 -50
- package/definitions/post-moderation-behaviors.json +0 -1222
- package/definitions/profile-moderation-behaviors.json +0 -597
- package/definitions/proposed-labels.json +0 -326
- package/docs/moderation-behaviors/posts.md +0 -1813
- package/docs/moderation-behaviors/profiles.md +0 -833
- package/scripts/code/label-groups.mjs +0 -68
- package/scripts/docs/post-moderation-behaviors.mjs +0 -117
- package/scripts/docs/profile-moderation-behaviors.mjs +0 -122
- package/src/moderation/accumulator.ts +0 -217
- package/src/moderation/const/label-groups.ts +0 -149
- package/src/moderation/subjects/quoted-post.ts +0 -80
- package/tests/post-moderation.test.ts +0 -46
- package/tests/profile-moderation.test.ts +0 -46
- /package/src/client/types/{com/atproto/admin/deleteCommunicationTemplate.ts → tools/ozone/communication/deleteTemplate.ts} +0 -0
package/scripts/docs/labels.mjs
CHANGED
|
@@ -11,26 +11,6 @@ const labelsDef = JSON.parse(
|
|
|
11
11
|
'utf8',
|
|
12
12
|
),
|
|
13
13
|
)
|
|
14
|
-
const labelGroupsEn = JSON.parse(
|
|
15
|
-
readFileSync(
|
|
16
|
-
join(
|
|
17
|
-
__dirname,
|
|
18
|
-
'..',
|
|
19
|
-
'..',
|
|
20
|
-
'definitions',
|
|
21
|
-
'locale',
|
|
22
|
-
'en',
|
|
23
|
-
'label-groups.json',
|
|
24
|
-
),
|
|
25
|
-
'utf8',
|
|
26
|
-
),
|
|
27
|
-
)
|
|
28
|
-
const labelsEn = JSON.parse(
|
|
29
|
-
readFileSync(
|
|
30
|
-
join(__dirname, '..', '..', 'definitions', 'locale', 'en', 'labels.json'),
|
|
31
|
-
'utf8',
|
|
32
|
-
),
|
|
33
|
-
)
|
|
34
14
|
|
|
35
15
|
writeFileSync(join(__dirname, '..', '..', 'docs', 'labels.md'), doc(), 'utf8')
|
|
36
16
|
|
|
@@ -54,11 +34,9 @@ The possible client interpretations for a label.
|
|
|
54
34
|
- <code>warn</code> Provide some form of warning on the content (see "On Warn" behavior).
|
|
55
35
|
- <code>hide</code> Remove the content from feeds and apply the warning when directly viewed.
|
|
56
36
|
|
|
57
|
-
Each label specifies which preferences it can support. If a label is not configurable, it must have only own supported preference.
|
|
58
|
-
|
|
59
37
|
### Configurable?
|
|
60
38
|
|
|
61
|
-
Non-configurable labels cannot have their preference changed by the user.
|
|
39
|
+
Non-configurable labels cannot have their preference changed by the user. If a label is not configurable, it must have only own supported preference.
|
|
62
40
|
|
|
63
41
|
### Flags
|
|
64
42
|
|
|
@@ -81,82 +59,27 @@ The kind of UI behavior used when a warning must be applied.
|
|
|
81
59
|
<table>
|
|
82
60
|
<tr>
|
|
83
61
|
<th>ID</th>
|
|
84
|
-
<th>Group</th>
|
|
85
|
-
<th>Preferences</th>
|
|
86
62
|
<th>Configurable</th>
|
|
87
63
|
<th>Flags</th>
|
|
88
64
|
<th>On Warn</th>
|
|
89
65
|
</tr>
|
|
90
66
|
${labelsRef()}
|
|
91
|
-
</table
|
|
92
|
-
|
|
93
|
-
## Label Group Descriptions
|
|
94
|
-
|
|
95
|
-
<table>
|
|
96
|
-
<tr>
|
|
97
|
-
<th>ID</th>
|
|
98
|
-
<th>Description</th>
|
|
99
|
-
</tr>
|
|
100
|
-
${labelGroupsDesc()}
|
|
101
|
-
</table>
|
|
102
|
-
|
|
103
|
-
## Label Descriptions
|
|
104
|
-
|
|
105
|
-
<table>
|
|
106
|
-
<tr>
|
|
107
|
-
<th>ID</th>
|
|
108
|
-
<th>Description</th>
|
|
109
|
-
</tr>
|
|
110
|
-
${labelsDesc()}
|
|
111
|
-
</table>
|
|
112
|
-
`
|
|
67
|
+
</table>`
|
|
113
68
|
}
|
|
114
69
|
|
|
115
70
|
function labelsRef() {
|
|
116
71
|
const lines = []
|
|
117
|
-
for (const
|
|
118
|
-
|
|
119
|
-
lines.push(stripIndent`
|
|
72
|
+
for (const label of labelsDef) {
|
|
73
|
+
lines.push(stripIndent`
|
|
120
74
|
<tr>
|
|
121
|
-
<td>${label.
|
|
122
|
-
<td>${
|
|
123
|
-
|
|
124
|
-
|
|
75
|
+
<td>${label.identifier}</td>
|
|
76
|
+
<td>${
|
|
77
|
+
label.configurable ? '✅' : `❌ (${label.fixedPreference})`
|
|
78
|
+
}</td>
|
|
125
79
|
<td>${label.flags.join(', ')}</td>
|
|
126
80
|
<td>${label.onwarn}</td>
|
|
127
81
|
</tr>
|
|
128
82
|
`)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return lines.join('\n')
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function labelGroupsDesc() {
|
|
135
|
-
const lines = []
|
|
136
|
-
for (const id in labelGroupsEn) {
|
|
137
|
-
lines.push(stripIndent`
|
|
138
|
-
<tr>
|
|
139
|
-
<td>${id}</td>
|
|
140
|
-
<td><code>general</code><br><strong>${labelGroupsEn[id].name}</strong><br>${labelGroupsEn[id].description}</td>
|
|
141
|
-
</tr>
|
|
142
|
-
`)
|
|
143
|
-
}
|
|
144
|
-
return lines.join('\n')
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function labelsDesc() {
|
|
148
|
-
const lines = []
|
|
149
|
-
for (const id in labelsEn) {
|
|
150
|
-
lines.push(stripIndent`
|
|
151
|
-
<tr>
|
|
152
|
-
<td>${id}</td>
|
|
153
|
-
<td>
|
|
154
|
-
<code>general</code><br><strong>${labelsEn[id].settings.name}</strong><br>${labelsEn[id].settings.description}<br><br>
|
|
155
|
-
<code>on an account</code><br><strong>${labelsEn[id].account.name}</strong><br>${labelsEn[id].account.description}<br><br>
|
|
156
|
-
<code>on content</code><br><strong>${labelsEn[id].content.name}</strong><br>${labelsEn[id].content.description}<br><br>
|
|
157
|
-
</td>
|
|
158
|
-
</tr>
|
|
159
|
-
`)
|
|
160
83
|
}
|
|
161
84
|
return lines.join('\n')
|
|
162
85
|
}
|
package/src/agent.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
AtpPersistSessionHandler,
|
|
19
19
|
AtpAgentOpts,
|
|
20
20
|
} from './types'
|
|
21
|
+
import { BSKY_MODSERVICE_DID } from './const'
|
|
21
22
|
|
|
22
23
|
const REFRESH_SESSION = 'com.atproto.server.refreshSession'
|
|
23
24
|
|
|
@@ -29,6 +30,7 @@ export class AtpAgent {
|
|
|
29
30
|
service: URL
|
|
30
31
|
api: AtpServiceClient
|
|
31
32
|
session?: AtpSessionData
|
|
33
|
+
labelersHeader: string[] = [BSKY_MODSERVICE_DID]
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* The PDS URL, driven by the did doc. May be undefined.
|
|
@@ -81,6 +83,15 @@ export class AtpAgent {
|
|
|
81
83
|
this._persistSession = handler
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Configures the moderation services to be applied on requests.
|
|
88
|
+
* NOTE: this is called automatically by getPreferences() and the relevant moderation config
|
|
89
|
+
* methods in BskyAgent instances.
|
|
90
|
+
*/
|
|
91
|
+
configureLabelersHeader(labelerDids: string[]) {
|
|
92
|
+
this.labelersHeader = labelerDids
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
/**
|
|
85
96
|
* Create a new account and hydrate its session in this agent.
|
|
86
97
|
*/
|
|
@@ -194,13 +205,22 @@ export class AtpAgent {
|
|
|
194
205
|
/**
|
|
195
206
|
* Internal helper to add authorization headers to requests.
|
|
196
207
|
*/
|
|
197
|
-
private
|
|
208
|
+
private _addHeaders(reqHeaders: Record<string, string>) {
|
|
198
209
|
if (!reqHeaders.authorization && this.session?.accessJwt) {
|
|
199
|
-
|
|
210
|
+
reqHeaders = {
|
|
200
211
|
...reqHeaders,
|
|
201
212
|
authorization: `Bearer ${this.session.accessJwt}`,
|
|
202
213
|
}
|
|
203
214
|
}
|
|
215
|
+
if (this.labelersHeader.length) {
|
|
216
|
+
reqHeaders = {
|
|
217
|
+
...reqHeaders,
|
|
218
|
+
'atproto-labelers': this.labelersHeader
|
|
219
|
+
.filter((str) => str.startsWith('did:'))
|
|
220
|
+
.slice(0, 10)
|
|
221
|
+
.join(','),
|
|
222
|
+
}
|
|
223
|
+
}
|
|
204
224
|
return reqHeaders
|
|
205
225
|
}
|
|
206
226
|
|
|
@@ -224,7 +244,7 @@ export class AtpAgent {
|
|
|
224
244
|
let res = await AtpAgent.fetch(
|
|
225
245
|
reqUri,
|
|
226
246
|
reqMethod,
|
|
227
|
-
this.
|
|
247
|
+
this._addHeaders(reqHeaders),
|
|
228
248
|
reqBody,
|
|
229
249
|
)
|
|
230
250
|
|
|
@@ -237,7 +257,7 @@ export class AtpAgent {
|
|
|
237
257
|
res = await AtpAgent.fetch(
|
|
238
258
|
reqUri,
|
|
239
259
|
reqMethod,
|
|
240
|
-
this.
|
|
260
|
+
this._addHeaders(reqHeaders),
|
|
241
261
|
reqBody,
|
|
242
262
|
)
|
|
243
263
|
}
|
package/src/bsky-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AtUri } from '@atproto/syntax'
|
|
1
|
+
import { AtUri, ensureValidDid } from '@atproto/syntax'
|
|
2
2
|
import { AtpAgent } from './agent'
|
|
3
3
|
import {
|
|
4
4
|
AppBskyFeedPost,
|
|
@@ -8,11 +8,13 @@ import {
|
|
|
8
8
|
} from './client'
|
|
9
9
|
import {
|
|
10
10
|
BskyPreferences,
|
|
11
|
-
BskyLabelPreference,
|
|
12
11
|
BskyFeedViewPreference,
|
|
13
12
|
BskyThreadViewPreference,
|
|
14
13
|
BskyInterestsPreference,
|
|
15
14
|
} from './types'
|
|
15
|
+
import { LabelPreference } from './moderation/types'
|
|
16
|
+
import { BSKY_MODSERVICE_DID } from './const'
|
|
17
|
+
import { DEFAULT_LABEL_SETTINGS } from './moderation/const/labels'
|
|
16
18
|
import { sanitizeMutedWordValue } from './util'
|
|
17
19
|
|
|
18
20
|
const FEED_VIEW_PREF_DEFAULTS = {
|
|
@@ -98,6 +100,9 @@ export class BskyAgent extends AtpAgent {
|
|
|
98
100
|
(params, opts) =>
|
|
99
101
|
this.api.app.bsky.notification.getUnreadCount(params, opts)
|
|
100
102
|
|
|
103
|
+
getLabelers: typeof this.api.app.bsky.labeler.getServices = (params, opts) =>
|
|
104
|
+
this.api.app.bsky.labeler.getServices(params, opts)
|
|
105
|
+
|
|
101
106
|
async post(
|
|
102
107
|
record: Partial<AppBskyFeedPost.Record> &
|
|
103
108
|
Omit<AppBskyFeedPost.Record, 'createdAt'>,
|
|
@@ -322,8 +327,11 @@ export class BskyAgent extends AtpAgent {
|
|
|
322
327
|
},
|
|
323
328
|
},
|
|
324
329
|
threadViewPrefs: { ...THREAD_VIEW_PREF_DEFAULTS },
|
|
325
|
-
|
|
326
|
-
|
|
330
|
+
moderationPrefs: {
|
|
331
|
+
adultContentEnabled: false,
|
|
332
|
+
labels: { ...DEFAULT_LABEL_SETTINGS },
|
|
333
|
+
mods: [],
|
|
334
|
+
},
|
|
327
335
|
birthDate: undefined,
|
|
328
336
|
interests: {
|
|
329
337
|
tags: [],
|
|
@@ -332,33 +340,42 @@ export class BskyAgent extends AtpAgent {
|
|
|
332
340
|
hiddenPosts: [],
|
|
333
341
|
}
|
|
334
342
|
const res = await this.app.bsky.actor.getPreferences({})
|
|
343
|
+
const labelPrefs: AppBskyActorDefs.ContentLabelPref[] = []
|
|
335
344
|
for (const pref of res.data.preferences) {
|
|
336
345
|
if (
|
|
337
346
|
AppBskyActorDefs.isAdultContentPref(pref) &&
|
|
338
347
|
AppBskyActorDefs.validateAdultContentPref(pref).success
|
|
339
348
|
) {
|
|
340
|
-
|
|
349
|
+
// adult content preferences
|
|
350
|
+
prefs.moderationPrefs.adultContentEnabled = pref.enabled
|
|
341
351
|
} else if (
|
|
342
352
|
AppBskyActorDefs.isContentLabelPref(pref) &&
|
|
343
|
-
AppBskyActorDefs.
|
|
353
|
+
AppBskyActorDefs.validateContentLabelPref(pref).success
|
|
344
354
|
) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
355
|
+
// content label preference
|
|
356
|
+
const adjustedPref = adjustLegacyContentLabelPref(pref)
|
|
357
|
+
labelPrefs.push(adjustedPref)
|
|
358
|
+
} else if (
|
|
359
|
+
AppBskyActorDefs.isModsPref(pref) &&
|
|
360
|
+
AppBskyActorDefs.validateModsPref(pref).success
|
|
361
|
+
) {
|
|
362
|
+
// mods preferences
|
|
363
|
+
prefs.moderationPrefs.mods = pref.mods.map((mod) => ({
|
|
364
|
+
...mod,
|
|
365
|
+
labels: {},
|
|
366
|
+
}))
|
|
352
367
|
} else if (
|
|
353
368
|
AppBskyActorDefs.isSavedFeedsPref(pref) &&
|
|
354
369
|
AppBskyActorDefs.validateSavedFeedsPref(pref).success
|
|
355
370
|
) {
|
|
371
|
+
// saved and pinned feeds
|
|
356
372
|
prefs.feeds.saved = pref.saved
|
|
357
373
|
prefs.feeds.pinned = pref.pinned
|
|
358
374
|
} else if (
|
|
359
375
|
AppBskyActorDefs.isPersonalDetailsPref(pref) &&
|
|
360
376
|
AppBskyActorDefs.validatePersonalDetailsPref(pref).success
|
|
361
377
|
) {
|
|
378
|
+
// birth date (irl)
|
|
362
379
|
if (pref.birthDate) {
|
|
363
380
|
prefs.birthDate = new Date(pref.birthDate)
|
|
364
381
|
}
|
|
@@ -366,6 +383,7 @@ export class BskyAgent extends AtpAgent {
|
|
|
366
383
|
AppBskyActorDefs.isFeedViewPref(pref) &&
|
|
367
384
|
AppBskyActorDefs.validateFeedViewPref(pref).success
|
|
368
385
|
) {
|
|
386
|
+
// feed view preferences
|
|
369
387
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
370
388
|
const { $type, feed, ...v } = pref
|
|
371
389
|
prefs.feedViewPrefs[pref.feed] = { ...FEED_VIEW_PREF_DEFAULTS, ...v }
|
|
@@ -373,6 +391,7 @@ export class BskyAgent extends AtpAgent {
|
|
|
373
391
|
AppBskyActorDefs.isThreadViewPref(pref) &&
|
|
374
392
|
AppBskyActorDefs.validateThreadViewPref(pref).success
|
|
375
393
|
) {
|
|
394
|
+
// thread view preferences
|
|
376
395
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
377
396
|
const { $type, ...v } = pref
|
|
378
397
|
prefs.threadViewPrefs = { ...prefs.threadViewPrefs, ...v }
|
|
@@ -399,6 +418,35 @@ export class BskyAgent extends AtpAgent {
|
|
|
399
418
|
prefs.hiddenPosts = v.items
|
|
400
419
|
}
|
|
401
420
|
}
|
|
421
|
+
|
|
422
|
+
// ensure the bluesky moderation is configured
|
|
423
|
+
const bskyModeration = prefs.moderationPrefs.mods.find(
|
|
424
|
+
(modPref) => modPref.did === BSKY_MODSERVICE_DID,
|
|
425
|
+
)
|
|
426
|
+
if (!bskyModeration) {
|
|
427
|
+
prefs.moderationPrefs.mods.unshift({
|
|
428
|
+
did: BSKY_MODSERVICE_DID,
|
|
429
|
+
labels: {},
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// apply the label prefs
|
|
434
|
+
for (const pref of labelPrefs) {
|
|
435
|
+
if (pref.labelerDid) {
|
|
436
|
+
const mod = prefs.moderationPrefs.mods.find(
|
|
437
|
+
(mod) => mod.did === pref.labelerDid,
|
|
438
|
+
)
|
|
439
|
+
if (!mod) continue
|
|
440
|
+
mod.labels[pref.label] = pref.visibility as LabelPreference
|
|
441
|
+
} else {
|
|
442
|
+
prefs.moderationPrefs.labels[pref.label] =
|
|
443
|
+
pref.visibility as LabelPreference
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// automatically configure the client
|
|
448
|
+
this.configureLabelersHeader(prefsArrayToLabelerDids(res.data.preferences))
|
|
449
|
+
|
|
402
450
|
return prefs
|
|
403
451
|
}
|
|
404
452
|
|
|
@@ -458,18 +506,21 @@ export class BskyAgent extends AtpAgent {
|
|
|
458
506
|
})
|
|
459
507
|
}
|
|
460
508
|
|
|
461
|
-
async setContentLabelPref(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
509
|
+
async setContentLabelPref(
|
|
510
|
+
key: string,
|
|
511
|
+
value: LabelPreference,
|
|
512
|
+
labelerDid?: string,
|
|
513
|
+
) {
|
|
514
|
+
if (labelerDid) {
|
|
515
|
+
ensureValidDid(labelerDid)
|
|
465
516
|
}
|
|
466
|
-
|
|
467
517
|
await updatePreferences(this, (prefs: AppBskyActorDefs.Preferences) => {
|
|
468
518
|
let labelPref = prefs.findLast(
|
|
469
519
|
(pref) =>
|
|
470
520
|
AppBskyActorDefs.isContentLabelPref(pref) &&
|
|
471
|
-
AppBskyActorDefs.
|
|
472
|
-
pref.label === key
|
|
521
|
+
AppBskyActorDefs.validateContentLabelPref(pref).success &&
|
|
522
|
+
pref.label === key &&
|
|
523
|
+
pref.labelerDid === labelerDid,
|
|
473
524
|
)
|
|
474
525
|
if (labelPref) {
|
|
475
526
|
labelPref.visibility = value
|
|
@@ -477,18 +528,80 @@ export class BskyAgent extends AtpAgent {
|
|
|
477
528
|
labelPref = {
|
|
478
529
|
$type: 'app.bsky.actor.defs#contentLabelPref',
|
|
479
530
|
label: key,
|
|
531
|
+
labelerDid,
|
|
480
532
|
visibility: value,
|
|
481
533
|
}
|
|
482
534
|
}
|
|
483
535
|
return prefs
|
|
484
536
|
.filter(
|
|
485
537
|
(pref) =>
|
|
486
|
-
!AppBskyActorDefs.isContentLabelPref(pref) ||
|
|
538
|
+
!AppBskyActorDefs.isContentLabelPref(pref) ||
|
|
539
|
+
!(pref.label === key && pref.labelerDid === labelerDid),
|
|
487
540
|
)
|
|
488
541
|
.concat([labelPref])
|
|
489
542
|
})
|
|
490
543
|
}
|
|
491
544
|
|
|
545
|
+
async addModService(did: string) {
|
|
546
|
+
const prefs = await updatePreferences(
|
|
547
|
+
this,
|
|
548
|
+
(prefs: AppBskyActorDefs.Preferences) => {
|
|
549
|
+
let modsPref = prefs.findLast(
|
|
550
|
+
(pref) =>
|
|
551
|
+
AppBskyActorDefs.isModsPref(pref) &&
|
|
552
|
+
AppBskyActorDefs.validateModsPref(pref).success,
|
|
553
|
+
)
|
|
554
|
+
if (!modsPref) {
|
|
555
|
+
modsPref = {
|
|
556
|
+
$type: 'app.bsky.actor.defs#modsPref',
|
|
557
|
+
mods: [],
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
if (AppBskyActorDefs.isModsPref(modsPref)) {
|
|
561
|
+
let modPrefItem = modsPref.mods.find((mod) => mod.did === did)
|
|
562
|
+
if (!modPrefItem) {
|
|
563
|
+
modPrefItem = {
|
|
564
|
+
did,
|
|
565
|
+
}
|
|
566
|
+
modsPref.mods.push(modPrefItem)
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return prefs
|
|
570
|
+
.filter((pref) => !AppBskyActorDefs.isModsPref(pref))
|
|
571
|
+
.concat([modsPref])
|
|
572
|
+
},
|
|
573
|
+
)
|
|
574
|
+
// automatically configure the client
|
|
575
|
+
this.configureLabelersHeader(prefsArrayToLabelerDids(prefs))
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async removeModService(did: string) {
|
|
579
|
+
const prefs = await updatePreferences(
|
|
580
|
+
this,
|
|
581
|
+
(prefs: AppBskyActorDefs.Preferences) => {
|
|
582
|
+
let modsPref = prefs.findLast(
|
|
583
|
+
(pref) =>
|
|
584
|
+
AppBskyActorDefs.isModsPref(pref) &&
|
|
585
|
+
AppBskyActorDefs.validateModsPref(pref).success,
|
|
586
|
+
)
|
|
587
|
+
if (!modsPref) {
|
|
588
|
+
modsPref = {
|
|
589
|
+
$type: 'app.bsky.actor.defs#modsPref',
|
|
590
|
+
mods: [],
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (AppBskyActorDefs.isModsPref(modsPref)) {
|
|
594
|
+
modsPref.mods = modsPref.mods.filter((mod) => mod.did !== did)
|
|
595
|
+
}
|
|
596
|
+
return prefs
|
|
597
|
+
.filter((pref) => !AppBskyActorDefs.isModsPref(pref))
|
|
598
|
+
.concat([modsPref])
|
|
599
|
+
},
|
|
600
|
+
)
|
|
601
|
+
// automatically configure the client
|
|
602
|
+
this.configureLabelersHeader(prefsArrayToLabelerDids(prefs))
|
|
603
|
+
}
|
|
604
|
+
|
|
492
605
|
async setPersonalDetails({
|
|
493
606
|
birthDate,
|
|
494
607
|
}: {
|
|
@@ -621,7 +734,7 @@ export class BskyAgent extends AtpAgent {
|
|
|
621
734
|
|
|
622
735
|
async updateMutedWord(mutedWord: AppBskyActorDefs.MutedWord) {
|
|
623
736
|
await updatePreferences(this, (prefs: AppBskyActorDefs.Preferences) => {
|
|
624
|
-
|
|
737
|
+
const mutedWordsPref = prefs.findLast(
|
|
625
738
|
(pref) =>
|
|
626
739
|
AppBskyActorDefs.isMutedWordsPref(pref) &&
|
|
627
740
|
AppBskyActorDefs.validateMutedWordsPref(pref).success,
|
|
@@ -646,7 +759,7 @@ export class BskyAgent extends AtpAgent {
|
|
|
646
759
|
|
|
647
760
|
async removeMutedWord(mutedWord: AppBskyActorDefs.MutedWord) {
|
|
648
761
|
await updatePreferences(this, (prefs: AppBskyActorDefs.Preferences) => {
|
|
649
|
-
|
|
762
|
+
const mutedWordsPref = prefs.findLast(
|
|
650
763
|
(pref) =>
|
|
651
764
|
AppBskyActorDefs.isMutedWordsPref(pref) &&
|
|
652
765
|
AppBskyActorDefs.validateMutedWordsPref(pref).success,
|
|
@@ -696,11 +809,12 @@ async function updatePreferences(
|
|
|
696
809
|
const res = await agent.app.bsky.actor.getPreferences({})
|
|
697
810
|
const newPrefs = cb(res.data.preferences)
|
|
698
811
|
if (newPrefs === false) {
|
|
699
|
-
return
|
|
812
|
+
return res.data.preferences
|
|
700
813
|
}
|
|
701
814
|
await agent.app.bsky.actor.putPreferences({
|
|
702
815
|
preferences: newPrefs,
|
|
703
816
|
})
|
|
817
|
+
return newPrefs
|
|
704
818
|
}
|
|
705
819
|
|
|
706
820
|
/**
|
|
@@ -739,6 +853,52 @@ async function updateFeedPreferences(
|
|
|
739
853
|
return res
|
|
740
854
|
}
|
|
741
855
|
|
|
856
|
+
/**
|
|
857
|
+
* Helper to transform the legacy content preferences.
|
|
858
|
+
*/
|
|
859
|
+
function adjustLegacyContentLabelPref(
|
|
860
|
+
pref: AppBskyActorDefs.ContentLabelPref,
|
|
861
|
+
): AppBskyActorDefs.ContentLabelPref {
|
|
862
|
+
let label = pref.label
|
|
863
|
+
let visibility = pref.visibility
|
|
864
|
+
|
|
865
|
+
// adjust legacy values
|
|
866
|
+
if (visibility === 'show') {
|
|
867
|
+
visibility = 'ignore'
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// adjust legacy labels
|
|
871
|
+
if (label === 'nsfw') {
|
|
872
|
+
label = 'porn'
|
|
873
|
+
}
|
|
874
|
+
if (label === 'suggestive') {
|
|
875
|
+
label = 'sexual'
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
return { ...pref, label, visibility }
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* A helper to get the currently enabled labelers from the full preferences array
|
|
883
|
+
*/
|
|
884
|
+
function prefsArrayToLabelerDids(
|
|
885
|
+
prefs: AppBskyActorDefs.Preferences,
|
|
886
|
+
): string[] {
|
|
887
|
+
const modsPref = prefs.findLast(
|
|
888
|
+
(pref) =>
|
|
889
|
+
AppBskyActorDefs.isModsPref(pref) &&
|
|
890
|
+
AppBskyActorDefs.validateModsPref(pref).success,
|
|
891
|
+
)
|
|
892
|
+
let dids: string[] = []
|
|
893
|
+
if (modsPref) {
|
|
894
|
+
dids = (modsPref as AppBskyActorDefs.ModsPref).mods.map((mod) => mod.did)
|
|
895
|
+
}
|
|
896
|
+
if (!dids.includes(BSKY_MODSERVICE_DID)) {
|
|
897
|
+
dids.unshift(BSKY_MODSERVICE_DID)
|
|
898
|
+
}
|
|
899
|
+
return dids
|
|
900
|
+
}
|
|
901
|
+
|
|
742
902
|
async function updateHiddenPost(
|
|
743
903
|
agent: BskyAgent,
|
|
744
904
|
postUri: string,
|