@atproto/ozone 0.0.2
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 +8 -0
- package/LICENSE.txt +7 -0
- package/README.md +15 -0
- package/babel.config.js +3 -0
- package/bin/migration-create.ts +38 -0
- package/build.js +18 -0
- package/dist/api/admin/emitModerationEvent.d.ts +3 -0
- package/dist/api/admin/getModerationEvent.d.ts +3 -0
- package/dist/api/admin/getRecord.d.ts +3 -0
- package/dist/api/admin/getRepo.d.ts +3 -0
- package/dist/api/admin/queryModerationEvents.d.ts +3 -0
- package/dist/api/admin/queryModerationStatuses.d.ts +3 -0
- package/dist/api/admin/searchRepos.d.ts +3 -0
- package/dist/api/admin/util.d.ts +5 -0
- package/dist/api/com/atproto/admin/emitModerationEvent.d.ts +3 -0
- package/dist/api/com/atproto/admin/getModerationEvent.d.ts +3 -0
- package/dist/api/com/atproto/admin/getRecord.d.ts +3 -0
- package/dist/api/com/atproto/admin/getRepo.d.ts +3 -0
- package/dist/api/com/atproto/admin/queryModerationEvents.d.ts +3 -0
- package/dist/api/com/atproto/admin/queryModerationStatuses.d.ts +3 -0
- package/dist/api/com/atproto/admin/searchRepos.d.ts +3 -0
- package/dist/api/com/atproto/admin/util.d.ts +5 -0
- package/dist/api/com/atproto/moderation/createReport.d.ts +3 -0
- package/dist/api/com/atproto/moderation/util.d.ts +4 -0
- package/dist/api/com/atproto/temp/fetchLabels.d.ts +3 -0
- package/dist/api/health.d.ts +3 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/label/queryLabels.d.ts +3 -0
- package/dist/api/label/subscribeLabels.d.ts +3 -0
- package/dist/api/moderation/createReport.d.ts +3 -0
- package/dist/api/moderation/util.d.ts +4 -0
- package/dist/api/temp/fetchLabels.d.ts +3 -0
- package/dist/api/util.d.ts +2 -0
- package/dist/api/well-known.d.ts +3 -0
- package/dist/auth-verifier.d.ts +47 -0
- package/dist/auth.d.ts +81 -0
- package/dist/background.d.ts +13 -0
- package/dist/config/config.d.ts +30 -0
- package/dist/config/env.d.ts +19 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/secrets.d.ts +8 -0
- package/dist/config.d.ts +42 -0
- package/dist/context.d.ts +140 -0
- package/dist/daemon/config.d.ts +23 -0
- package/dist/daemon/context.d.ts +25 -0
- package/dist/daemon/event-pusher.d.ts +48 -0
- package/dist/daemon/event-reverser.d.ts +16 -0
- package/dist/daemon/index.d.ts +13 -0
- package/dist/db/index.d.ts +32 -0
- package/dist/db/index.js +33707 -0
- package/dist/db/index.js.map +7 -0
- package/dist/db/migrations/20231219T205730722Z-init.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/provider.d.ts +11 -0
- package/dist/db/pagination.d.ts +66 -0
- package/dist/db/schema/blob_push_event.d.ts +17 -0
- package/dist/db/schema/index.d.ts +10 -0
- package/dist/db/schema/label.d.ts +12 -0
- package/dist/db/schema/moderation_event.d.ts +22 -0
- package/dist/db/schema/moderation_subject_status.d.ts +25 -0
- package/dist/db/schema/record_push_event.d.ts +17 -0
- package/dist/db/schema/repo_push_event.d.ts +15 -0
- package/dist/db/types.d.ts +12 -0
- package/dist/error.d.ts +2 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +131818 -0
- package/dist/index.js.map +7 -0
- package/dist/lexicon/index.d.ts +372 -0
- package/dist/lexicon/lexicons.d.ts +7553 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +104 -0
- package/dist/lexicon/types/app/bsky/actor/getPreferences.d.ts +31 -0
- package/dist/lexicon/types/app/bsky/actor/getProfile.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/actor/getProfiles.d.ts +32 -0
- package/dist/lexicon/types/app/bsky/actor/getSuggestions.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts +15 -0
- package/dist/lexicon/types/app/bsky/actor/putPreferences.d.ts +26 -0
- package/dist/lexicon/types/app/bsky/actor/searchActors.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/actor/searchActorsTypeahead.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/embed/external.d.ts +31 -0
- package/dist/lexicon/types/app/bsky/embed/images.d.ts +37 -0
- package/dist/lexicon/types/app/bsky/embed/record.d.ts +54 -0
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts +24 -0
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +151 -0
- package/dist/lexicon/types/app/bsky/feed/describeFeedGenerator.d.ts +46 -0
- package/dist/lexicon/types/app/bsky/feed/generator.d.ts +18 -0
- package/dist/lexicon/types/app/bsky/feed/getActorFeeds.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/feed/getActorLikes.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +37 -0
- package/dist/lexicon/types/app/bsky/feed/getFeed.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/feed/getFeedGenerator.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/feed/getFeedGenerators.d.ts +32 -0
- package/dist/lexicon/types/app/bsky/feed/getFeedSkeleton.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/feed/getLikes.d.ts +47 -0
- package/dist/lexicon/types/app/bsky/feed/getListFeed.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/feed/getPostThread.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/feed/getPosts.d.ts +32 -0
- package/dist/lexicon/types/app/bsky/feed/getRepostedBy.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/feed/getSuggestedFeeds.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/feed/getTimeline.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/feed/like.d.ts +9 -0
- package/dist/lexicon/types/app/bsky/feed/post.d.ts +50 -0
- package/dist/lexicon/types/app/bsky/feed/repost.d.ts +9 -0
- package/dist/lexicon/types/app/bsky/feed/searchPosts.d.ts +37 -0
- package/dist/lexicon/types/app/bsky/feed/threadgate.d.ts +28 -0
- package/dist/lexicon/types/app/bsky/graph/block.d.ts +8 -0
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +47 -0
- package/dist/lexicon/types/app/bsky/graph/follow.d.ts +8 -0
- package/dist/lexicon/types/app/bsky/graph/getBlocks.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/graph/getFollowers.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/graph/getFollows.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/graph/getList.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/graph/getListBlocks.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/graph/getListMutes.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/graph/getLists.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/graph/getMutes.d.ts +34 -0
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +32 -0
- package/dist/lexicon/types/app/bsky/graph/list.d.ts +19 -0
- package/dist/lexicon/types/app/bsky/graph/listblock.d.ts +8 -0
- package/dist/lexicon/types/app/bsky/graph/listitem.d.ts +9 -0
- package/dist/lexicon/types/app/bsky/graph/muteActor.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/graph/muteActorList.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteActor.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteActorList.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/moderation/defs.d.ts +49 -0
- package/dist/lexicon/types/app/bsky/moderation/getService.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/moderation/getServices.d.ts +32 -0
- package/dist/lexicon/types/app/bsky/moderation/service.d.ts +17 -0
- package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts +31 -0
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +52 -0
- package/dist/lexicon/types/app/bsky/notification/registerPush.d.ts +28 -0
- package/dist/lexicon/types/app/bsky/notification/updateSeen.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/richtext/facet.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts +13 -0
- package/dist/lexicon/types/app/bsky/unspecced/getPopular.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.d.ts +35 -0
- package/dist/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.d.ts +37 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +319 -0
- package/dist/lexicon/types/com/atproto/admin/deleteAccount.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/admin/disableAccountInvites.d.ts +26 -0
- package/dist/lexicon/types/com/atproto/admin/disableInviteCodes.d.ts +26 -0
- package/dist/lexicon/types/com/atproto/admin/emitModerationEvent.d.ts +45 -0
- package/dist/lexicon/types/com/atproto/admin/enableAccountInvites.d.ts +26 -0
- package/dist/lexicon/types/com/atproto/admin/getAccountInfo.d.ts +29 -0
- package/dist/lexicon/types/com/atproto/admin/getAccountInfos.d.ts +32 -0
- package/dist/lexicon/types/com/atproto/admin/getInviteCodes.d.ts +35 -0
- package/dist/lexicon/types/com/atproto/admin/getModerationEvent.d.ts +29 -0
- package/dist/lexicon/types/com/atproto/admin/getRecord.d.ts +31 -0
- package/dist/lexicon/types/com/atproto/admin/getRepo.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/admin/queryModerationEvents.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/admin/queryModerationStatuses.d.ts +48 -0
- package/dist/lexicon/types/com/atproto/admin/searchRepos.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +40 -0
- package/dist/lexicon/types/com/atproto/admin/updateAccountEmail.d.ts +26 -0
- package/dist/lexicon/types/com/atproto/admin/updateAccountHandle.d.ts +26 -0
- package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts +46 -0
- package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts +31 -0
- package/dist/lexicon/types/com/atproto/identity/updateHandle.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/label/defs.d.ts +24 -0
- package/dist/lexicon/types/com/atproto/label/queryLabels.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/label/subscribeLabels.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/moderation/createReport.d.ts +52 -0
- package/dist/lexicon/types/com/atproto/moderation/defs.d.ts +8 -0
- package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +53 -0
- package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +43 -0
- package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/repo/describeRepo.d.ts +35 -0
- package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/repo/listRecords.d.ts +47 -0
- package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +44 -0
- package/dist/lexicon/types/com/atproto/repo/strongRef.d.ts +8 -0
- package/dist/lexicon/types/com/atproto/repo/uploadBlob.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/server/confirmEmail.d.ts +27 -0
- package/dist/lexicon/types/com/atproto/server/createAccount.d.ts +49 -0
- package/dist/lexicon/types/com/atproto/server/createAppPassword.d.ts +43 -0
- package/dist/lexicon/types/com/atproto/server/createInviteCode.d.ts +37 -0
- package/dist/lexicon/types/com/atproto/server/createInviteCodes.d.ts +46 -0
- package/dist/lexicon/types/com/atproto/server/createSession.d.ts +44 -0
- package/dist/lexicon/types/com/atproto/server/defs.d.ts +20 -0
- package/dist/lexicon/types/com/atproto/server/deleteAccount.d.ts +28 -0
- package/dist/lexicon/types/com/atproto/server/deleteSession.d.ts +19 -0
- package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +41 -0
- package/dist/lexicon/types/com/atproto/server/getAccountInviteCodes.d.ts +34 -0
- package/dist/lexicon/types/com/atproto/server/getSession.d.ts +34 -0
- package/dist/lexicon/types/com/atproto/server/listAppPasswords.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +35 -0
- package/dist/lexicon/types/com/atproto/server/requestAccountDelete.d.ts +19 -0
- package/dist/lexicon/types/com/atproto/server/requestEmailConfirmation.d.ts +19 -0
- package/dist/lexicon/types/com/atproto/server/requestEmailUpdate.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/server/requestPasswordReset.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/server/reserveSigningKey.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/server/resetPassword.d.ts +27 -0
- package/dist/lexicon/types/com/atproto/server/revokeAppPassword.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/server/updateEmail.d.ts +27 -0
- package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/sync/getCheckout.d.ts +29 -0
- package/dist/lexicon/types/com/atproto/sync/getHead.d.ts +32 -0
- package/dist/lexicon/types/com/atproto/sync/getLatestCommit.d.ts +33 -0
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +32 -0
- package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts +30 -0
- package/dist/lexicon/types/com/atproto/sync/listBlobs.d.ts +35 -0
- package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +42 -0
- package/dist/lexicon/types/com/atproto/sync/notifyOfUpdate.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/sync/requestCrawl.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +80 -0
- package/dist/lexicon/types/com/atproto/temp/fetchLabels.d.ts +33 -0
- package/dist/lexicon/types/com/atproto/temp/importRepo.d.ts +32 -0
- package/dist/lexicon/types/com/atproto/temp/pushBlob.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/temp/requestPhoneVerification.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/temp/transferAccount.d.ts +42 -0
- package/dist/lexicon/util.d.ts +2 -0
- package/dist/logger.d.ts +4 -0
- package/dist/mod-service/index.d.ts +155 -0
- package/dist/mod-service/status.d.ts +12 -0
- package/dist/mod-service/subject.d.ts +59 -0
- package/dist/mod-service/types.d.ts +19 -0
- package/dist/mod-service/views.d.ts +49 -0
- package/dist/sequencer/index.d.ts +2 -0
- package/dist/sequencer/outbox.d.ts +16 -0
- package/dist/sequencer/sequencer.d.ts +35 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/moderation/index.d.ts +144 -0
- package/dist/services/moderation/status.d.ts +12 -0
- package/dist/services/moderation/subject.d.ts +60 -0
- package/dist/services/moderation/types.d.ts +19 -0
- package/dist/services/moderation/views.d.ts +42 -0
- package/dist/services/types.d.ts +2 -0
- package/dist/util/date.d.ts +1 -0
- package/dist/util/debug.d.ts +1 -0
- package/dist/util/retry.d.ts +3 -0
- package/dist/util.d.ts +3 -0
- package/jest.config.js +6 -0
- package/package.json +67 -0
- package/src/api/admin/emitModerationEvent.ts +130 -0
- package/src/api/admin/getModerationEvent.ts +19 -0
- package/src/api/admin/getRecord.ts +34 -0
- package/src/api/admin/getRepo.ts +31 -0
- package/src/api/admin/queryModerationEvents.ts +40 -0
- package/src/api/admin/queryModerationStatuses.ts +57 -0
- package/src/api/admin/searchRepos.ts +42 -0
- package/src/api/admin/util.ts +54 -0
- package/src/api/health.ts +20 -0
- package/src/api/index.ts +28 -0
- package/src/api/moderation/createReport.ts +41 -0
- package/src/api/moderation/util.ts +65 -0
- package/src/api/temp/fetchLabels.ts +29 -0
- package/src/api/well-known.ts +35 -0
- package/src/auth.ts +147 -0
- package/src/background.ts +35 -0
- package/src/config/config.ts +84 -0
- package/src/config/env.ts +41 -0
- package/src/config/index.ts +3 -0
- package/src/config/secrets.ts +23 -0
- package/src/context.ts +180 -0
- package/src/daemon/context.ts +90 -0
- package/src/daemon/event-pusher.ts +296 -0
- package/src/daemon/event-reverser.ts +74 -0
- package/src/daemon/index.ts +33 -0
- package/src/db/index.ts +197 -0
- package/src/db/migrations/20231219T205730722Z-init.ts +164 -0
- package/src/db/migrations/index.ts +5 -0
- package/src/db/migrations/provider.ts +25 -0
- package/src/db/pagination.ts +216 -0
- package/src/db/schema/blob_push_event.ts +21 -0
- package/src/db/schema/index.ts +18 -0
- package/src/db/schema/label.ts +12 -0
- package/src/db/schema/moderation_event.ts +35 -0
- package/src/db/schema/moderation_subject_status.ts +32 -0
- package/src/db/schema/record_push_event.ts +21 -0
- package/src/db/schema/repo_push_event.ts +19 -0
- package/src/db/types.ts +15 -0
- package/src/error.ts +12 -0
- package/src/index.ts +102 -0
- package/src/lexicon/index.ts +1626 -0
- package/src/lexicon/lexicons.ts +8050 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +235 -0
- package/src/lexicon/types/app/bsky/actor/getPreferences.ts +44 -0
- package/src/lexicon/types/app/bsky/actor/getProfile.ts +41 -0
- package/src/lexicon/types/app/bsky/actor/getProfiles.ts +46 -0
- package/src/lexicon/types/app/bsky/actor/getSuggestions.ts +48 -0
- package/src/lexicon/types/app/bsky/actor/profile.ts +32 -0
- package/src/lexicon/types/app/bsky/actor/putPreferences.ts +39 -0
- package/src/lexicon/types/app/bsky/actor/searchActors.ts +52 -0
- package/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts +50 -0
- package/src/lexicon/types/app/bsky/embed/external.ts +82 -0
- package/src/lexicon/types/app/bsky/embed/images.ts +96 -0
- package/src/lexicon/types/app/bsky/embed/record.ts +120 -0
- package/src/lexicon/types/app/bsky/embed/recordWithMedia.ts +53 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +308 -0
- package/src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts +80 -0
- package/src/lexicon/types/app/bsky/feed/generator.ts +35 -0
- package/src/lexicon/types/app/bsky/feed/getActorFeeds.ts +49 -0
- package/src/lexicon/types/app/bsky/feed/getActorLikes.ts +50 -0
- package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +56 -0
- package/src/lexicon/types/app/bsky/feed/getFeed.ts +50 -0
- package/src/lexicon/types/app/bsky/feed/getFeedGenerator.ts +48 -0
- package/src/lexicon/types/app/bsky/feed/getFeedGenerators.ts +46 -0
- package/src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts +50 -0
- package/src/lexicon/types/app/bsky/feed/getLikes.ts +69 -0
- package/src/lexicon/types/app/bsky/feed/getListFeed.ts +50 -0
- package/src/lexicon/types/app/bsky/feed/getPostThread.ts +53 -0
- package/src/lexicon/types/app/bsky/feed/getPosts.ts +46 -0
- package/src/lexicon/types/app/bsky/feed/getRepostedBy.ts +52 -0
- package/src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts +48 -0
- package/src/lexicon/types/app/bsky/feed/getTimeline.ts +49 -0
- package/src/lexicon/types/app/bsky/feed/like.ts +26 -0
- package/src/lexicon/types/app/bsky/feed/post.ts +102 -0
- package/src/lexicon/types/app/bsky/feed/repost.ts +27 -0
- package/src/lexicon/types/app/bsky/feed/searchPosts.ts +54 -0
- package/src/lexicon/types/app/bsky/feed/threadgate.ts +84 -0
- package/src/lexicon/types/app/bsky/graph/block.ts +26 -0
- package/src/lexicon/types/app/bsky/graph/defs.ts +104 -0
- package/src/lexicon/types/app/bsky/graph/follow.ts +26 -0
- package/src/lexicon/types/app/bsky/graph/getBlocks.ts +48 -0
- package/src/lexicon/types/app/bsky/graph/getFollowers.ts +50 -0
- package/src/lexicon/types/app/bsky/graph/getFollows.ts +50 -0
- package/src/lexicon/types/app/bsky/graph/getList.ts +50 -0
- package/src/lexicon/types/app/bsky/graph/getListBlocks.ts +48 -0
- package/src/lexicon/types/app/bsky/graph/getListMutes.ts +48 -0
- package/src/lexicon/types/app/bsky/graph/getLists.ts +49 -0
- package/src/lexicon/types/app/bsky/graph/getMutes.ts +48 -0
- package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +46 -0
- package/src/lexicon/types/app/bsky/graph/list.ts +36 -0
- package/src/lexicon/types/app/bsky/graph/listblock.ts +26 -0
- package/src/lexicon/types/app/bsky/graph/listitem.ts +27 -0
- package/src/lexicon/types/app/bsky/graph/muteActor.ts +38 -0
- package/src/lexicon/types/app/bsky/graph/muteActorList.ts +38 -0
- package/src/lexicon/types/app/bsky/graph/unmuteActor.ts +38 -0
- package/src/lexicon/types/app/bsky/graph/unmuteActorList.ts +38 -0
- package/src/lexicon/types/app/bsky/notification/getUnreadCount.ts +45 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +87 -0
- package/src/lexicon/types/app/bsky/notification/registerPush.ts +41 -0
- package/src/lexicon/types/app/bsky/notification/updateSeen.ts +38 -0
- package/src/lexicon/types/app/bsky/richtext/facet.ts +97 -0
- package/src/lexicon/types/app/bsky/unspecced/defs.ts +41 -0
- package/src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts +49 -0
- package/src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts +49 -0
- package/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +56 -0
- package/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +54 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +719 -0
- package/src/lexicon/types/com/atproto/admin/deleteAccount.ts +38 -0
- package/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts +40 -0
- package/src/lexicon/types/com/atproto/admin/disableInviteCodes.ts +39 -0
- package/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts +66 -0
- package/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts +40 -0
- package/src/lexicon/types/com/atproto/admin/getAccountInfo.ts +41 -0
- package/src/lexicon/types/com/atproto/admin/getAccountInfos.ts +46 -0
- package/src/lexicon/types/com/atproto/admin/getInviteCodes.ts +49 -0
- package/src/lexicon/types/com/atproto/admin/getModerationEvent.ts +41 -0
- package/src/lexicon/types/com/atproto/admin/getRecord.ts +43 -0
- package/src/lexicon/types/com/atproto/admin/getRepo.ts +42 -0
- package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +54 -0
- package/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +56 -0
- package/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts +72 -0
- package/src/lexicon/types/com/atproto/admin/searchRepos.ts +51 -0
- package/src/lexicon/types/com/atproto/admin/sendEmail.ts +54 -0
- package/src/lexicon/types/com/atproto/admin/updateAccountEmail.ts +40 -0
- package/src/lexicon/types/com/atproto/admin/updateAccountHandle.ts +39 -0
- package/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts +61 -0
- package/src/lexicon/types/com/atproto/identity/resolveHandle.ts +46 -0
- package/src/lexicon/types/com/atproto/identity/updateHandle.ts +38 -0
- package/src/lexicon/types/com/atproto/label/defs.ts +73 -0
- package/src/lexicon/types/com/atproto/label/queryLabels.ts +52 -0
- package/src/lexicon/types/com/atproto/label/subscribeLabels.ts +67 -0
- package/src/lexicon/types/com/atproto/moderation/createReport.ts +65 -0
- package/src/lexicon/types/com/atproto/moderation/defs.ts +32 -0
- package/src/lexicon/types/com/atproto/repo/applyWrites.ts +103 -0
- package/src/lexicon/types/com/atproto/repo/createRecord.ts +62 -0
- package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +48 -0
- package/src/lexicon/types/com/atproto/repo/describeRepo.ts +50 -0
- package/src/lexicon/types/com/atproto/repo/getRecord.ts +54 -0
- package/src/lexicon/types/com/atproto/repo/listRecords.ts +77 -0
- package/src/lexicon/types/com/atproto/repo/putRecord.ts +64 -0
- package/src/lexicon/types/com/atproto/repo/strongRef.ts +26 -0
- package/src/lexicon/types/com/atproto/repo/uploadBlob.ts +47 -0
- package/src/lexicon/types/com/atproto/server/confirmEmail.ts +40 -0
- package/src/lexicon/types/com/atproto/server/createAccount.ts +69 -0
- package/src/lexicon/types/com/atproto/server/createAppPassword.ts +69 -0
- package/src/lexicon/types/com/atproto/server/createInviteCode.ts +50 -0
- package/src/lexicon/types/com/atproto/server/createInviteCodes.ts +72 -0
- package/src/lexicon/types/com/atproto/server/createSession.ts +58 -0
- package/src/lexicon/types/com/atproto/server/defs.ts +48 -0
- package/src/lexicon/types/com/atproto/server/deleteAccount.ts +41 -0
- package/src/lexicon/types/com/atproto/server/deleteSession.ts +31 -0
- package/src/lexicon/types/com/atproto/server/describeServer.ts +64 -0
- package/src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts +48 -0
- package/src/lexicon/types/com/atproto/server/getSession.ts +47 -0
- package/src/lexicon/types/com/atproto/server/listAppPasswords.ts +62 -0
- package/src/lexicon/types/com/atproto/server/refreshSession.ts +48 -0
- package/src/lexicon/types/com/atproto/server/requestAccountDelete.ts +31 -0
- package/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts +31 -0
- package/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts +43 -0
- package/src/lexicon/types/com/atproto/server/requestPasswordReset.ts +38 -0
- package/src/lexicon/types/com/atproto/server/reserveSigningKey.ts +51 -0
- package/src/lexicon/types/com/atproto/server/resetPassword.ts +40 -0
- package/src/lexicon/types/com/atproto/server/revokeAppPassword.ts +38 -0
- package/src/lexicon/types/com/atproto/server/updateEmail.ts +41 -0
- package/src/lexicon/types/com/atproto/sync/getBlob.ts +43 -0
- package/src/lexicon/types/com/atproto/sync/getBlocks.ts +42 -0
- package/src/lexicon/types/com/atproto/sync/getCheckout.ts +41 -0
- package/src/lexicon/types/com/atproto/sync/getHead.ts +47 -0
- package/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +48 -0
- package/src/lexicon/types/com/atproto/sync/getRecord.ts +45 -0
- package/src/lexicon/types/com/atproto/sync/getRepo.ts +43 -0
- package/src/lexicon/types/com/atproto/sync/listBlobs.ts +51 -0
- package/src/lexicon/types/com/atproto/sync/listRepos.ts +66 -0
- package/src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts +39 -0
- package/src/lexicon/types/com/atproto/sync/requestCrawl.ts +39 -0
- package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +161 -0
- package/src/lexicon/types/com/atproto/temp/fetchLabels.ts +47 -0
- package/src/lexicon/types/com/atproto/temp/importRepo.ts +45 -0
- package/src/lexicon/types/com/atproto/temp/pushBlob.ts +39 -0
- package/src/lexicon/types/com/atproto/temp/requestPhoneVerification.ts +38 -0
- package/src/lexicon/types/com/atproto/temp/transferAccount.ts +62 -0
- package/src/lexicon/util.ts +13 -0
- package/src/logger.ts +19 -0
- package/src/mod-service/index.ts +758 -0
- package/src/mod-service/status.ts +264 -0
- package/src/mod-service/subject.ts +136 -0
- package/src/mod-service/types.ts +32 -0
- package/src/mod-service/views.ts +531 -0
- package/src/util.ts +26 -0
- package/test.env +2 -0
- package/test.log +0 -0
- package/tests/__snapshots__/get-record.test.ts.snap +173 -0
- package/tests/__snapshots__/get-repo.test.ts.snap +57 -0
- package/tests/__snapshots__/moderation-events.test.ts.snap +168 -0
- package/tests/__snapshots__/moderation-statuses.test.ts.snap +64 -0
- package/tests/__snapshots__/moderation.test.ts.snap +55 -0
- package/tests/_util.ts +192 -0
- package/tests/db.test.ts +184 -0
- package/tests/get-record.test.ts +110 -0
- package/tests/get-repo.test.ts +131 -0
- package/tests/moderation-appeals.test.ts +269 -0
- package/tests/moderation-events.test.ts +220 -0
- package/tests/moderation-statuses.test.ts +144 -0
- package/tests/moderation.test.ts +961 -0
- package/tests/repo-search.test.ts +123 -0
- package/tests/server.test.ts +76 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/// <reference types="node/http" />
|
|
2
|
+
/// <reference types="pino-http" />
|
|
3
|
+
import { ValidationResult } from '@atproto/lexicon';
|
|
4
|
+
import { CID } from 'multiformats/cid';
|
|
5
|
+
import { HandlerAuth, ErrorFrame } from '@atproto/xrpc-server';
|
|
6
|
+
import { IncomingMessage } from 'http';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
cursor?: number;
|
|
9
|
+
}
|
|
10
|
+
export type OutputSchema = Commit | Handle | Migrate | Tombstone | Info | {
|
|
11
|
+
$type: string;
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
export type HandlerError = ErrorFrame<'FutureCursor' | 'ConsumerTooSlow'>;
|
|
15
|
+
export type HandlerOutput = HandlerError | OutputSchema;
|
|
16
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
17
|
+
auth: HA;
|
|
18
|
+
params: QueryParams;
|
|
19
|
+
req: IncomingMessage;
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
};
|
|
22
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => AsyncIterable<HandlerOutput>;
|
|
23
|
+
export interface Commit {
|
|
24
|
+
seq: number;
|
|
25
|
+
rebase: boolean;
|
|
26
|
+
tooBig: boolean;
|
|
27
|
+
repo: string;
|
|
28
|
+
commit: CID;
|
|
29
|
+
prev?: CID | null;
|
|
30
|
+
rev: string;
|
|
31
|
+
since: string | null;
|
|
32
|
+
blocks: Uint8Array;
|
|
33
|
+
ops: RepoOp[];
|
|
34
|
+
blobs: CID[];
|
|
35
|
+
time: string;
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export declare function isCommit(v: unknown): v is Commit;
|
|
39
|
+
export declare function validateCommit(v: unknown): ValidationResult;
|
|
40
|
+
export interface Handle {
|
|
41
|
+
seq: number;
|
|
42
|
+
did: string;
|
|
43
|
+
handle: string;
|
|
44
|
+
time: string;
|
|
45
|
+
[k: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
export declare function isHandle(v: unknown): v is Handle;
|
|
48
|
+
export declare function validateHandle(v: unknown): ValidationResult;
|
|
49
|
+
export interface Migrate {
|
|
50
|
+
seq: number;
|
|
51
|
+
did: string;
|
|
52
|
+
migrateTo: string | null;
|
|
53
|
+
time: string;
|
|
54
|
+
[k: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
export declare function isMigrate(v: unknown): v is Migrate;
|
|
57
|
+
export declare function validateMigrate(v: unknown): ValidationResult;
|
|
58
|
+
export interface Tombstone {
|
|
59
|
+
seq: number;
|
|
60
|
+
did: string;
|
|
61
|
+
time: string;
|
|
62
|
+
[k: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export declare function isTombstone(v: unknown): v is Tombstone;
|
|
65
|
+
export declare function validateTombstone(v: unknown): ValidationResult;
|
|
66
|
+
export interface Info {
|
|
67
|
+
name: 'OutdatedCursor' | (string & {});
|
|
68
|
+
message?: string;
|
|
69
|
+
[k: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
export declare function isInfo(v: unknown): v is Info;
|
|
72
|
+
export declare function validateInfo(v: unknown): ValidationResult;
|
|
73
|
+
export interface RepoOp {
|
|
74
|
+
action: 'create' | 'update' | 'delete' | (string & {});
|
|
75
|
+
path: string;
|
|
76
|
+
cid: CID | null;
|
|
77
|
+
[k: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
export declare function isRepoOp(v: unknown): v is RepoOp;
|
|
80
|
+
export declare function validateRepoOp(v: unknown): ValidationResult;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
import * as ComAtprotoLabelDefs from '../label/defs';
|
|
4
|
+
export interface QueryParams {
|
|
5
|
+
since?: number;
|
|
6
|
+
limit: number;
|
|
7
|
+
}
|
|
8
|
+
export type InputSchema = undefined;
|
|
9
|
+
export interface OutputSchema {
|
|
10
|
+
labels: ComAtprotoLabelDefs.Label[];
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export type HandlerInput = undefined;
|
|
14
|
+
export interface HandlerSuccess {
|
|
15
|
+
encoding: 'application/json';
|
|
16
|
+
body: OutputSchema;
|
|
17
|
+
headers?: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface HandlerError {
|
|
22
|
+
status: number;
|
|
23
|
+
message?: string;
|
|
24
|
+
}
|
|
25
|
+
export type HandlerOutput = HandlerError | HandlerSuccess;
|
|
26
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
27
|
+
auth: HA;
|
|
28
|
+
params: QueryParams;
|
|
29
|
+
input: HandlerInput;
|
|
30
|
+
req: express.Request;
|
|
31
|
+
res: express.Response;
|
|
32
|
+
};
|
|
33
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import stream from 'stream';
|
|
4
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
5
|
+
export interface QueryParams {
|
|
6
|
+
did: string;
|
|
7
|
+
}
|
|
8
|
+
export type InputSchema = string | Uint8Array;
|
|
9
|
+
export interface HandlerInput {
|
|
10
|
+
encoding: 'application/vnd.ipld.car';
|
|
11
|
+
body: stream.Readable;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerSuccess {
|
|
14
|
+
encoding: 'text/plain';
|
|
15
|
+
body: Uint8Array | stream.Readable;
|
|
16
|
+
headers?: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface HandlerError {
|
|
21
|
+
status: number;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
export type HandlerOutput = HandlerError | HandlerSuccess;
|
|
25
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
26
|
+
auth: HA;
|
|
27
|
+
params: QueryParams;
|
|
28
|
+
input: HandlerInput;
|
|
29
|
+
req: express.Request;
|
|
30
|
+
res: express.Response;
|
|
31
|
+
};
|
|
32
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import stream from 'stream';
|
|
4
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
5
|
+
export interface QueryParams {
|
|
6
|
+
did: string;
|
|
7
|
+
}
|
|
8
|
+
export type InputSchema = string | Uint8Array;
|
|
9
|
+
export interface HandlerInput {
|
|
10
|
+
encoding: '*/*';
|
|
11
|
+
body: stream.Readable;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerError {
|
|
14
|
+
status: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
export type HandlerOutput = HandlerError | void;
|
|
18
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
19
|
+
auth: HA;
|
|
20
|
+
params: QueryParams;
|
|
21
|
+
input: HandlerInput;
|
|
22
|
+
req: express.Request;
|
|
23
|
+
res: express.Response;
|
|
24
|
+
};
|
|
25
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export interface InputSchema {
|
|
6
|
+
phoneNumber: string;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface HandlerInput {
|
|
10
|
+
encoding: 'application/json';
|
|
11
|
+
body: InputSchema;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerError {
|
|
14
|
+
status: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
export type HandlerOutput = HandlerError | void;
|
|
18
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
19
|
+
auth: HA;
|
|
20
|
+
params: QueryParams;
|
|
21
|
+
input: HandlerInput;
|
|
22
|
+
req: express.Request;
|
|
23
|
+
res: express.Response;
|
|
24
|
+
};
|
|
25
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export interface InputSchema {
|
|
6
|
+
handle: string;
|
|
7
|
+
did: string;
|
|
8
|
+
plcOp: {};
|
|
9
|
+
[k: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface OutputSchema {
|
|
12
|
+
accessJwt: string;
|
|
13
|
+
refreshJwt: string;
|
|
14
|
+
handle: string;
|
|
15
|
+
did: string;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface HandlerInput {
|
|
19
|
+
encoding: 'application/json';
|
|
20
|
+
body: InputSchema;
|
|
21
|
+
}
|
|
22
|
+
export interface HandlerSuccess {
|
|
23
|
+
encoding: 'application/json';
|
|
24
|
+
body: OutputSchema;
|
|
25
|
+
headers?: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface HandlerError {
|
|
30
|
+
status: number;
|
|
31
|
+
message?: string;
|
|
32
|
+
error?: 'InvalidHandle' | 'InvalidPassword' | 'InvalidInviteCode' | 'HandleNotAvailable' | 'UnsupportedDomain' | 'UnresolvableDid' | 'IncompatibleDidDoc';
|
|
33
|
+
}
|
|
34
|
+
export type HandlerOutput = HandlerError | HandlerSuccess;
|
|
35
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
36
|
+
auth: HA;
|
|
37
|
+
params: QueryParams;
|
|
38
|
+
input: HandlerInput;
|
|
39
|
+
req: express.Request;
|
|
40
|
+
res: express.Response;
|
|
41
|
+
};
|
|
42
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { CID } from 'multiformats/cid';
|
|
2
|
+
import { AtUri } from '@atproto/syntax';
|
|
3
|
+
import { Database } from '../db';
|
|
4
|
+
import { AppviewAuth, ModerationViews } from './views';
|
|
5
|
+
import { Main as StrongRef } from '../lexicon/types/com/atproto/repo/strongRef';
|
|
6
|
+
import { RepoRef, RepoBlobRef } from '../lexicon/types/com/atproto/admin/defs';
|
|
7
|
+
import { ModEventType, ModerationEventRow, ModerationSubjectStatusRow, ReversibleModerationEvent } from './types';
|
|
8
|
+
import { ModerationEvent } from '../db/schema/moderation_event';
|
|
9
|
+
import AtpAgent from '@atproto/api';
|
|
10
|
+
import { Label } from '../lexicon/types/com/atproto/label/defs';
|
|
11
|
+
import { ModSubject, RecordSubject, RepoSubject } from './subject';
|
|
12
|
+
import { BackgroundQueue } from '../background';
|
|
13
|
+
import { EventPusher } from '../daemon';
|
|
14
|
+
export type ModerationServiceCreator = (db: Database) => ModerationService;
|
|
15
|
+
export declare class ModerationService {
|
|
16
|
+
db: Database;
|
|
17
|
+
backgroundQueue: BackgroundQueue;
|
|
18
|
+
eventPusher: EventPusher;
|
|
19
|
+
appviewAgent: AtpAgent;
|
|
20
|
+
private appviewAuth;
|
|
21
|
+
constructor(db: Database, backgroundQueue: BackgroundQueue, eventPusher: EventPusher, appviewAgent: AtpAgent, appviewAuth: AppviewAuth);
|
|
22
|
+
static creator(backgroundQueue: BackgroundQueue, eventPusher: EventPusher, appviewAgent: AtpAgent, appviewAuth: AppviewAuth): (db: Database) => ModerationService;
|
|
23
|
+
views: ModerationViews;
|
|
24
|
+
getEvent(id: number): Promise<ModerationEventRow | undefined>;
|
|
25
|
+
getEventOrThrow(id: number): Promise<ModerationEventRow>;
|
|
26
|
+
getEvents(opts: {
|
|
27
|
+
subject?: string;
|
|
28
|
+
createdBy?: string;
|
|
29
|
+
limit: number;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
includeAllUserRecords: boolean;
|
|
32
|
+
types: ModerationEvent['action'][];
|
|
33
|
+
sortDirection?: 'asc' | 'desc';
|
|
34
|
+
}): Promise<{
|
|
35
|
+
cursor?: string;
|
|
36
|
+
events: ModerationEventRow[];
|
|
37
|
+
}>;
|
|
38
|
+
getReport(id: number): Promise<ModerationEventRow | undefined>;
|
|
39
|
+
getCurrentStatus(subject: {
|
|
40
|
+
did: string;
|
|
41
|
+
} | {
|
|
42
|
+
uri: AtUri;
|
|
43
|
+
} | {
|
|
44
|
+
cids: CID[];
|
|
45
|
+
}): Promise<{
|
|
46
|
+
did: string;
|
|
47
|
+
id: number;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
reviewState: "com.atproto.admin.defs#reviewOpen" | "com.atproto.admin.defs#reviewEscalated" | "com.atproto.admin.defs#reviewClosed";
|
|
51
|
+
blobCids: string[] | null;
|
|
52
|
+
comment: string | null;
|
|
53
|
+
lastReportedAt: string | null;
|
|
54
|
+
lastReviewedAt: string | null;
|
|
55
|
+
muteUntil: string | null;
|
|
56
|
+
lastReviewedBy: string | null;
|
|
57
|
+
lastAppealedAt: string | null;
|
|
58
|
+
takendown: boolean;
|
|
59
|
+
appealed: boolean | null;
|
|
60
|
+
suspendUntil: string | null;
|
|
61
|
+
recordPath: string;
|
|
62
|
+
recordCid: string | null;
|
|
63
|
+
}[]>;
|
|
64
|
+
logEvent(info: {
|
|
65
|
+
event: ModEventType;
|
|
66
|
+
subject: ModSubject;
|
|
67
|
+
createdBy: string;
|
|
68
|
+
createdAt?: Date;
|
|
69
|
+
}): Promise<ModerationEventRow>;
|
|
70
|
+
getLastReversibleEventForSubject(subject: ReversalSubject): Promise<{
|
|
71
|
+
id: number;
|
|
72
|
+
createdBy: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
comment: string | null;
|
|
75
|
+
createLabelVals: string | null;
|
|
76
|
+
negateLabelVals: string | null;
|
|
77
|
+
durationInHours: number | null;
|
|
78
|
+
action: "com.atproto.admin.defs#modEventTakedown" | "com.atproto.admin.defs#modEventAcknowledge" | "com.atproto.admin.defs#modEventEscalate" | "com.atproto.admin.defs#modEventComment" | "com.atproto.admin.defs#modEventLabel" | "com.atproto.admin.defs#modEventReport" | "com.atproto.admin.defs#modEventMute" | "com.atproto.admin.defs#modEventReverseTakedown" | "com.atproto.admin.defs#modEventEmail" | "com.atproto.admin.defs#modEventResolveAppeal";
|
|
79
|
+
subjectType: "com.atproto.admin.defs#repoRef" | "com.atproto.repo.strongRef";
|
|
80
|
+
subjectDid: string;
|
|
81
|
+
subjectUri: string | null;
|
|
82
|
+
subjectCid: string | null;
|
|
83
|
+
meta: Record<string, string | boolean> | null;
|
|
84
|
+
expiresAt: string | null;
|
|
85
|
+
legacyRefId: number | null;
|
|
86
|
+
} | null | undefined>;
|
|
87
|
+
getSubjectsDueForReversal(): Promise<ReversalSubject[]>;
|
|
88
|
+
isSubjectSuspended(did: string): Promise<boolean>;
|
|
89
|
+
revertState({ createdBy, createdAt, comment, action, subject, }: ReversibleModerationEvent): Promise<ModerationEventRow>;
|
|
90
|
+
takedownRepo(subject: RepoSubject, takedownId: number, isSuspend?: boolean): Promise<void>;
|
|
91
|
+
reverseTakedownRepo(subject: RepoSubject): Promise<void>;
|
|
92
|
+
takedownRecord(subject: RecordSubject, takedownId: number): Promise<void>;
|
|
93
|
+
reverseTakedownRecord(subject: RecordSubject): Promise<void>;
|
|
94
|
+
report(info: {
|
|
95
|
+
reasonType: NonNullable<ModerationEventRow['meta']>['reportType'];
|
|
96
|
+
reason?: string;
|
|
97
|
+
subject: ModSubject;
|
|
98
|
+
reportedBy: string;
|
|
99
|
+
createdAt?: Date;
|
|
100
|
+
}): Promise<ModerationEventRow>;
|
|
101
|
+
getSubjectStatuses({ cursor, limit, takendown, appealed, reviewState, reviewedAfter, reviewedBefore, reportedAfter, reportedBefore, includeMuted, ignoreSubjects, sortDirection, lastReviewedBy, sortField, subject, }: {
|
|
102
|
+
cursor?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
takendown?: boolean;
|
|
105
|
+
appealed?: boolean | null;
|
|
106
|
+
reviewedBefore?: string;
|
|
107
|
+
reviewState?: ModerationSubjectStatusRow['reviewState'];
|
|
108
|
+
reviewedAfter?: string;
|
|
109
|
+
reportedAfter?: string;
|
|
110
|
+
reportedBefore?: string;
|
|
111
|
+
includeMuted?: boolean;
|
|
112
|
+
subject?: string;
|
|
113
|
+
ignoreSubjects?: string[];
|
|
114
|
+
sortDirection: 'asc' | 'desc';
|
|
115
|
+
lastReviewedBy?: string;
|
|
116
|
+
sortField: 'lastReviewedAt' | 'lastReportedAt';
|
|
117
|
+
}): Promise<{
|
|
118
|
+
statuses: {
|
|
119
|
+
handle: string;
|
|
120
|
+
did: string;
|
|
121
|
+
id: number;
|
|
122
|
+
createdAt: string;
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
reviewState: "com.atproto.admin.defs#reviewOpen" | "com.atproto.admin.defs#reviewEscalated" | "com.atproto.admin.defs#reviewClosed";
|
|
125
|
+
blobCids: string[] | null;
|
|
126
|
+
comment: string | null;
|
|
127
|
+
lastReportedAt: string | null;
|
|
128
|
+
lastReviewedAt: string | null;
|
|
129
|
+
muteUntil: string | null;
|
|
130
|
+
lastReviewedBy: string | null;
|
|
131
|
+
lastAppealedAt: string | null;
|
|
132
|
+
takendown: boolean;
|
|
133
|
+
appealed: boolean | null;
|
|
134
|
+
suspendUntil: string | null;
|
|
135
|
+
recordPath: string;
|
|
136
|
+
recordCid: string | null;
|
|
137
|
+
}[];
|
|
138
|
+
cursor: string | undefined;
|
|
139
|
+
}>;
|
|
140
|
+
isSubjectTakendown(subject: ModSubject): Promise<boolean>;
|
|
141
|
+
formatAndCreateLabels(src: string, uri: string, cid: string | null, labels: {
|
|
142
|
+
create?: string[];
|
|
143
|
+
negate?: string[];
|
|
144
|
+
}): Promise<Label[]>;
|
|
145
|
+
createLabels(labels: Label[]): Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
export type TakedownSubjects = {
|
|
148
|
+
did: string;
|
|
149
|
+
subjects: (RepoRef | RepoBlobRef | StrongRef)[];
|
|
150
|
+
};
|
|
151
|
+
export type ReversalSubject = {
|
|
152
|
+
subject: ModSubject;
|
|
153
|
+
reverseSuspend: boolean;
|
|
154
|
+
reverseMute: boolean;
|
|
155
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AtUri } from '@atproto/syntax';
|
|
2
|
+
import { Database } from '../db';
|
|
3
|
+
import { ModerationSubjectStatus } from '../db/schema/moderation_subject_status';
|
|
4
|
+
import { ModerationEventRow } from './types';
|
|
5
|
+
export declare const adjustModerationSubjectStatus: (db: Database, moderationEvent: ModerationEventRow, blobCids?: string[]) => Promise<import("kysely").InsertResult | null>;
|
|
6
|
+
type ModerationSubjectStatusFilter = Pick<ModerationSubjectStatus, 'did'> | Pick<ModerationSubjectStatus, 'did' | 'recordPath'> | Pick<ModerationSubjectStatus, 'did' | 'recordPath' | 'recordCid'>;
|
|
7
|
+
export declare const getModerationSubjectStatus: (db: Database, filters: ModerationSubjectStatusFilter) => Promise<{} | undefined>;
|
|
8
|
+
export declare const getStatusIdentifierFromSubject: (subject: string | AtUri) => {
|
|
9
|
+
did: string;
|
|
10
|
+
recordPath: string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AtUri } from '@atproto/syntax';
|
|
2
|
+
import { InputSchema as ReportInput } from '../lexicon/types/com/atproto/moderation/createReport';
|
|
3
|
+
import { InputSchema as ActionInput } from '../lexicon/types/com/atproto/admin/emitModerationEvent';
|
|
4
|
+
import { ModerationEventRow, ModerationSubjectStatusRow } from './types';
|
|
5
|
+
import { RepoRef } from '../lexicon/types/com/atproto/admin/defs';
|
|
6
|
+
import { Main as StrongRef } from '../lexicon/types/com/atproto/repo/strongRef';
|
|
7
|
+
type SubjectInput = ReportInput['subject'] | ActionInput['subject'];
|
|
8
|
+
export declare const subjectFromInput: (subject: SubjectInput, blobs?: string[]) => ModSubject;
|
|
9
|
+
export declare const subjectFromEventRow: (row: ModerationEventRow) => ModSubject;
|
|
10
|
+
export declare const subjectFromStatusRow: (row: ModerationSubjectStatusRow) => ModSubject;
|
|
11
|
+
type SubjectInfo = {
|
|
12
|
+
subjectType: 'com.atproto.admin.defs#repoRef' | 'com.atproto.repo.strongRef';
|
|
13
|
+
subjectDid: string;
|
|
14
|
+
subjectUri: string | null;
|
|
15
|
+
subjectCid: string | null;
|
|
16
|
+
};
|
|
17
|
+
export interface ModSubject {
|
|
18
|
+
did: string;
|
|
19
|
+
recordPath: string | undefined;
|
|
20
|
+
blobCids?: string[];
|
|
21
|
+
isRepo(): this is RepoSubject;
|
|
22
|
+
isRecord(): this is RecordSubject;
|
|
23
|
+
info(): SubjectInfo;
|
|
24
|
+
lex(): RepoRef | StrongRef;
|
|
25
|
+
}
|
|
26
|
+
export declare class RepoSubject implements ModSubject {
|
|
27
|
+
did: string;
|
|
28
|
+
blobCids: undefined;
|
|
29
|
+
recordPath: undefined;
|
|
30
|
+
constructor(did: string);
|
|
31
|
+
isRepo(): boolean;
|
|
32
|
+
isRecord(): boolean;
|
|
33
|
+
info(): {
|
|
34
|
+
subjectType: "com.atproto.admin.defs#repoRef";
|
|
35
|
+
subjectDid: string;
|
|
36
|
+
subjectUri: null;
|
|
37
|
+
subjectCid: null;
|
|
38
|
+
};
|
|
39
|
+
lex(): RepoRef;
|
|
40
|
+
}
|
|
41
|
+
export declare class RecordSubject implements ModSubject {
|
|
42
|
+
uri: string;
|
|
43
|
+
cid: string;
|
|
44
|
+
blobCids?: string[] | undefined;
|
|
45
|
+
parsedUri: AtUri;
|
|
46
|
+
did: string;
|
|
47
|
+
recordPath: string;
|
|
48
|
+
constructor(uri: string, cid: string, blobCids?: string[] | undefined);
|
|
49
|
+
isRepo(): boolean;
|
|
50
|
+
isRecord(): boolean;
|
|
51
|
+
info(): {
|
|
52
|
+
subjectType: "com.atproto.repo.strongRef";
|
|
53
|
+
subjectDid: string;
|
|
54
|
+
subjectUri: string;
|
|
55
|
+
subjectCid: string;
|
|
56
|
+
};
|
|
57
|
+
lex(): StrongRef;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Selectable } from 'kysely';
|
|
2
|
+
import { ModerationEvent } from '../db/schema/moderation_event';
|
|
3
|
+
import { ModerationSubjectStatus } from '../db/schema/moderation_subject_status';
|
|
4
|
+
import { ComAtprotoAdminDefs } from '@atproto/api';
|
|
5
|
+
import { ModSubject } from './subject';
|
|
6
|
+
export type ModerationEventRow = Selectable<ModerationEvent>;
|
|
7
|
+
export type ReversibleModerationEvent = Pick<ModerationEventRow, 'createdBy' | 'comment' | 'action'> & {
|
|
8
|
+
createdAt?: Date;
|
|
9
|
+
subject: ModSubject;
|
|
10
|
+
};
|
|
11
|
+
export type ModerationEventRowWithHandle = ModerationEventRow & {
|
|
12
|
+
subjectHandle?: string | null;
|
|
13
|
+
creatorHandle?: string | null;
|
|
14
|
+
};
|
|
15
|
+
export type ModerationSubjectStatusRow = Selectable<ModerationSubjectStatus>;
|
|
16
|
+
export type ModerationSubjectStatusRowWithHandle = ModerationSubjectStatusRow & {
|
|
17
|
+
handle: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type ModEventType = ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import AtpAgent from '@atproto/api';
|
|
2
|
+
import { BlobRef } from '@atproto/lexicon';
|
|
3
|
+
import { Database } from '../db';
|
|
4
|
+
import { ModEventView, RepoView, RepoViewDetail, RecordView, RecordViewDetail, ReportViewDetail, BlobView, SubjectStatusView, ModEventViewDetail, AccountView } from '../lexicon/types/com/atproto/admin/defs';
|
|
5
|
+
import { OutputSchema as ReportOutput } from '../lexicon/types/com/atproto/moderation/createReport';
|
|
6
|
+
import { Label } from '../lexicon/types/com/atproto/label/defs';
|
|
7
|
+
import { ModerationEventRowWithHandle, ModerationSubjectStatusRowWithHandle } from './types';
|
|
8
|
+
export type AppviewAuth = () => Promise<{
|
|
9
|
+
headers: {
|
|
10
|
+
authorization: string;
|
|
11
|
+
};
|
|
12
|
+
} | undefined>;
|
|
13
|
+
export declare class ModerationViews {
|
|
14
|
+
private db;
|
|
15
|
+
private appviewAgent;
|
|
16
|
+
private appviewAuth;
|
|
17
|
+
constructor(db: Database, appviewAgent: AtpAgent, appviewAuth: AppviewAuth);
|
|
18
|
+
getAccoutInfosByDid(dids: string[]): Promise<Map<string, AccountView>>;
|
|
19
|
+
repos(dids: string[]): Promise<Map<string, RepoView>>;
|
|
20
|
+
formatEvent(event: ModerationEventRowWithHandle): ModEventView;
|
|
21
|
+
eventDetail(result: ModerationEventRowWithHandle): Promise<ModEventViewDetail>;
|
|
22
|
+
repoDetail(did: string): Promise<RepoViewDetail | undefined>;
|
|
23
|
+
fetchRecords(subjects: RecordSubject[]): Promise<Map<string, RecordInfo>>;
|
|
24
|
+
records(subjects: RecordSubject[]): Promise<Map<string, RecordView>>;
|
|
25
|
+
recordDetail(subject: RecordSubject): Promise<RecordViewDetail | undefined>;
|
|
26
|
+
formatReport(report: ModerationEventRowWithHandle): ReportOutput;
|
|
27
|
+
subject(subject: string): Promise<SubjectView>;
|
|
28
|
+
blob(blobs: BlobRef[]): Promise<BlobView[]>;
|
|
29
|
+
labels(subject: string, includeNeg?: boolean): Promise<Label[]>;
|
|
30
|
+
getSubjectStatus(subjects: string[]): Promise<Map<string, ModerationSubjectStatusRowWithHandle>>;
|
|
31
|
+
formatSubjectStatus(status: ModerationSubjectStatusRowWithHandle): SubjectStatusView;
|
|
32
|
+
}
|
|
33
|
+
type RecordSubject = {
|
|
34
|
+
uri: string;
|
|
35
|
+
cid?: string;
|
|
36
|
+
};
|
|
37
|
+
type SubjectView = ModEventViewDetail['subject'] & ReportViewDetail['subject'];
|
|
38
|
+
type RecordInfo = {
|
|
39
|
+
uri: string;
|
|
40
|
+
cid: string;
|
|
41
|
+
value: Record<string, unknown>;
|
|
42
|
+
indexedAt: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function getSelfLabels(details: {
|
|
45
|
+
uri: string | null;
|
|
46
|
+
cid: string | null;
|
|
47
|
+
record: Record<string, unknown> | null;
|
|
48
|
+
}): Label[];
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AsyncBuffer } from '@atproto/common';
|
|
2
|
+
import { Sequencer, LabelsEvt } from './sequencer';
|
|
3
|
+
export type OutboxOpts = {
|
|
4
|
+
maxBufferSize: number;
|
|
5
|
+
};
|
|
6
|
+
export declare class Outbox {
|
|
7
|
+
sequencer: Sequencer;
|
|
8
|
+
private caughtUp;
|
|
9
|
+
lastSeen: number;
|
|
10
|
+
cutoverBuffer: LabelsEvt[];
|
|
11
|
+
outBuffer: AsyncBuffer<LabelsEvt>;
|
|
12
|
+
constructor(sequencer: Sequencer, opts?: Partial<OutboxOpts>);
|
|
13
|
+
events(backfillCursor?: number, signal?: AbortSignal): AsyncGenerator<LabelsEvt>;
|
|
14
|
+
getBackfill(backfillCursor: number): AsyncGenerator<LabelsEvt, void, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export default Outbox;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import TypedEmitter from 'typed-emitter';
|
|
3
|
+
import Database from '../db';
|
|
4
|
+
import { Labels as LabelsEvt } from '../lexicon/types/com/atproto/label/subscribeLabels';
|
|
5
|
+
import { Label as LabelTable } from '../db/schema/label';
|
|
6
|
+
import { Selectable } from 'kysely';
|
|
7
|
+
import { ModerationService } from '../mod-service';
|
|
8
|
+
export type { Labels as LabelsEvt } from '../lexicon/types/com/atproto/label/subscribeLabels';
|
|
9
|
+
type LabelRow = Selectable<LabelTable>;
|
|
10
|
+
declare const Sequencer_base: new () => SequencerEmitter;
|
|
11
|
+
export declare class Sequencer extends Sequencer_base {
|
|
12
|
+
modService: ModerationService;
|
|
13
|
+
lastSeen: number;
|
|
14
|
+
destroyed: boolean;
|
|
15
|
+
pollPromise: Promise<void>;
|
|
16
|
+
pollTimer: NodeJS.Timer | undefined;
|
|
17
|
+
triesWithNoResults: number;
|
|
18
|
+
db: Database;
|
|
19
|
+
constructor(modService: ModerationService, lastSeen?: number);
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
destroy(): Promise<void>;
|
|
22
|
+
curr(): Promise<number | null>;
|
|
23
|
+
next(cursor: number): Promise<LabelRow | null>;
|
|
24
|
+
requestLabelRange(opts: {
|
|
25
|
+
earliestId?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): Promise<LabelsEvt[]>;
|
|
28
|
+
private poll;
|
|
29
|
+
}
|
|
30
|
+
type SequencerEvents = {
|
|
31
|
+
events: (evts: LabelsEvt[]) => void;
|
|
32
|
+
close: () => void;
|
|
33
|
+
};
|
|
34
|
+
export type SequencerEmitter = TypedEmitter<SequencerEvents>;
|
|
35
|
+
export default Sequencer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import AtpAgent from '@atproto/api';
|
|
2
|
+
import { ModerationService } from './moderation';
|
|
3
|
+
import { FromDb } from './types';
|
|
4
|
+
export declare function createServices(appviewAgent: AtpAgent): Services;
|
|
5
|
+
export declare type Services = {
|
|
6
|
+
moderation: FromDb<ModerationService>;
|
|
7
|
+
};
|