@atproto/pds 0.4.28 → 0.4.30
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +16 -0
- package/dist/account-manager/helpers/account.d.ts +20 -1
- package/dist/account-manager/helpers/account.d.ts.map +1 -1
- package/dist/account-manager/helpers/account.js +32 -7
- package/dist/account-manager/helpers/account.js.map +1 -1
- package/dist/account-manager/index.d.ts +7 -2
- package/dist/account-manager/index.d.ts.map +1 -1
- package/dist/account-manager/index.js +24 -8
- package/dist/account-manager/index.js.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfile.js +1 -1
- package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js +1 -1
- package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.js +1 -1
- package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js +1 -1
- package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +1 -1
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/registerPush.js +4 -1
- package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
- package/dist/api/chat/index.js +14 -14
- package/dist/api/chat/index.js.map +1 -1
- package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/deleteAccount.js +4 -2
- package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
- package/dist/api/com/atproto/admin/getAccountInfo.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/getAccountInfo.js +1 -0
- package/dist/api/com/atproto/admin/getAccountInfo.js.map +1 -1
- package/dist/api/com/atproto/admin/getSubjectStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/getSubjectStatus.js +4 -3
- package/dist/api/com/atproto/admin/getSubjectStatus.js.map +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.js +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
- package/dist/api/com/atproto/admin/updateSubjectStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/updateSubjectStatus.js +2 -0
- package/dist/api/com/atproto/admin/updateSubjectStatus.js.map +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js +1 -1
- package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js.map +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +1 -1
- package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js +1 -1
- package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js +1 -1
- package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +2 -2
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.js +4 -1
- package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.js +4 -1
- package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.js +4 -1
- package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/describeRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/describeRepo.js +2 -4
- package/dist/api/com/atproto/repo/describeRepo.js.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/importRepo.js +3 -1
- package/dist/api/com/atproto/repo/importRepo.js.map +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.js +1 -1
- package/dist/api/com/atproto/repo/listMissingBlobs.js.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.js +4 -1
- package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/uploadBlob.js +3 -1
- package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.js +3 -2
- package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js +1 -1
- package/dist/api/com/atproto/server/checkAccountStatus.js.map +1 -1
- package/dist/api/com/atproto/server/confirmEmail.js +1 -1
- package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
- package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAccount.js +4 -2
- package/dist/api/com/atproto/server/createAccount.js.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAppPassword.js +3 -1
- package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/createSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createSession.js +2 -0
- package/dist/api/com/atproto/server/createSession.js.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deactivateAccount.js +3 -1
- package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deleteAccount.js +4 -3
- package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js +1 -1
- package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
- package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getSession.js +7 -2
- package/dist/api/com/atproto/server/getSession.js.map +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.js +1 -1
- package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.js +2 -0
- package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js +1 -1
- package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js +1 -1
- package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js +1 -1
- package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js +1 -1
- package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
- package/dist/api/com/atproto/server/updateEmail.js +1 -1
- package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
- package/dist/api/com/atproto/server/util.d.ts +1 -0
- package/dist/api/com/atproto/server/util.d.ts.map +1 -1
- package/dist/api/com/atproto/server/util.js +9 -6
- package/dist/api/com/atproto/server/util.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js +2 -8
- package/dist/api/com/atproto/sync/deprecated/getCheckout.js.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/deprecated/getHead.js +2 -7
- package/dist/api/com/atproto/sync/deprecated/getHead.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlob.js +3 -6
- package/dist/api/com/atproto/sync/getBlob.js.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getBlocks.js +2 -7
- package/dist/api/com/atproto/sync/getBlocks.js.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getLatestCommit.js +2 -7
- package/dist/api/com/atproto/sync/getLatestCommit.js.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.js +2 -7
- package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRepo.js +2 -7
- package/dist/api/com/atproto/sync/getRepo.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepoStatus.d.ts +4 -0
- package/dist/api/com/atproto/sync/getRepoStatus.d.ts.map +1 -0
- package/dist/api/com/atproto/sync/getRepoStatus.js +28 -0
- package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -0
- package/dist/api/com/atproto/sync/index.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/index.js +2 -0
- package/dist/api/com/atproto/sync/index.js.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/listBlobs.js +2 -8
- package/dist/api/com/atproto/sync/listBlobs.js.map +1 -1
- package/dist/api/com/atproto/sync/listRepos.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/listRepos.js +13 -8
- package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
- package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/subscribeRepos.js +8 -0
- package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
- package/dist/api/com/atproto/sync/util.d.ts +4 -0
- package/dist/api/com/atproto/sync/util.d.ts.map +1 -0
- package/dist/api/com/atproto/sync/util.js +25 -0
- package/dist/api/com/atproto/sync/util.js.map +1 -0
- package/dist/api/com/atproto/temp/checkSignupQueue.d.ts.map +1 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.js +4 -1
- package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
- package/dist/auth-verifier.d.ts +13 -7
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +29 -46
- package/dist/auth-verifier.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +2 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +145 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +225 -4
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/chat/bsky/convo/defs.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/admin/defs.js.map +1 -1
- package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/createSession.d.ts +3 -0
- package/dist/lexicon/types/com/atproto/server/createSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/getSession.d.ts +3 -0
- package/dist/lexicon/types/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +3 -0
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getLatestCommit.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/getRepoStatus.d.ts +42 -0
- package/dist/lexicon/types/com/atproto/sync/getRepoStatus.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/getRepoStatus.js +3 -0
- package/dist/lexicon/types/com/atproto/sync/getRepoStatus.js.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/listBlobs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/sync/listBlobs.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +3 -0
- package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/listRepos.js.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +19 -4
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +11 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +2 -0
- package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +17 -14
- package/dist/pipethrough.js.map +1 -1
- package/dist/scripts/index.d.ts +4 -0
- package/dist/scripts/index.d.ts.map +1 -0
- package/dist/scripts/index.js +8 -0
- package/dist/scripts/index.js.map +1 -0
- package/dist/scripts/rebuild-repo.d.ts +3 -0
- package/dist/scripts/rebuild-repo.d.ts.map +1 -0
- package/dist/scripts/rebuild-repo.js +121 -0
- package/dist/scripts/rebuild-repo.js.map +1 -0
- package/dist/sequencer/db/schema.d.ts +1 -1
- package/dist/sequencer/db/schema.d.ts.map +1 -1
- package/dist/sequencer/events.d.ts +27 -2
- package/dist/sequencer/events.d.ts.map +1 -1
- package/dist/sequencer/events.js +35 -2
- package/dist/sequencer/events.js.map +1 -1
- package/dist/sequencer/sequencer.d.ts +8 -6
- package/dist/sequencer/sequencer.d.ts.map +1 -1
- package/dist/sequencer/sequencer.js +22 -9
- package/dist/sequencer/sequencer.js.map +1 -1
- package/package.json +4 -4
- package/src/account-manager/helpers/account.ts +38 -6
- package/src/account-manager/index.ts +21 -8
- package/src/api/app/bsky/actor/getPreferences.ts +1 -1
- package/src/api/app/bsky/actor/getProfile.ts +1 -1
- package/src/api/app/bsky/actor/getProfiles.ts +1 -1
- package/src/api/app/bsky/actor/putPreferences.ts +1 -1
- package/src/api/app/bsky/feed/getActorLikes.ts +1 -1
- package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -1
- package/src/api/app/bsky/feed/getFeed.ts +1 -1
- package/src/api/app/bsky/feed/getPostThread.ts +1 -1
- package/src/api/app/bsky/feed/getTimeline.ts +1 -1
- package/src/api/app/bsky/notification/registerPush.ts +4 -1
- package/src/api/chat/index.ts +14 -14
- package/src/api/com/atproto/admin/deleteAccount.ts +7 -2
- package/src/api/com/atproto/admin/getAccountInfo.ts +1 -0
- package/src/api/com/atproto/admin/getSubjectStatus.ts +4 -3
- package/src/api/com/atproto/admin/updateAccountHandle.ts +1 -1
- package/src/api/com/atproto/admin/updateSubjectStatus.ts +2 -0
- package/src/api/com/atproto/identity/getRecommendedDidCredentials.ts +1 -1
- package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +1 -1
- package/src/api/com/atproto/identity/signPlcOperation.ts +1 -1
- package/src/api/com/atproto/identity/submitPlcOperation.ts +2 -1
- package/src/api/com/atproto/identity/updateHandle.ts +2 -2
- package/src/api/com/atproto/repo/applyWrites.ts +4 -1
- package/src/api/com/atproto/repo/createRecord.ts +4 -1
- package/src/api/com/atproto/repo/deleteRecord.ts +4 -1
- package/src/api/com/atproto/repo/describeRepo.ts +2 -4
- package/src/api/com/atproto/repo/importRepo.ts +3 -1
- package/src/api/com/atproto/repo/listMissingBlobs.ts +1 -1
- package/src/api/com/atproto/repo/putRecord.ts +4 -1
- package/src/api/com/atproto/repo/uploadBlob.ts +3 -1
- package/src/api/com/atproto/server/activateAccount.ts +3 -2
- package/src/api/com/atproto/server/checkAccountStatus.ts +1 -1
- package/src/api/com/atproto/server/confirmEmail.ts +1 -1
- package/src/api/com/atproto/server/createAccount.ts +6 -3
- package/src/api/com/atproto/server/createAppPassword.ts +3 -1
- package/src/api/com/atproto/server/createSession.ts +2 -0
- package/src/api/com/atproto/server/deactivateAccount.ts +3 -1
- package/src/api/com/atproto/server/deleteAccount.ts +7 -3
- package/src/api/com/atproto/server/getAccountInviteCodes.ts +1 -1
- package/src/api/com/atproto/server/getServiceAuth.ts +1 -1
- package/src/api/com/atproto/server/getSession.ts +7 -2
- package/src/api/com/atproto/server/listAppPasswords.ts +1 -1
- package/src/api/com/atproto/server/refreshSession.ts +2 -0
- package/src/api/com/atproto/server/requestAccountDelete.ts +1 -1
- package/src/api/com/atproto/server/requestEmailConfirmation.ts +1 -1
- package/src/api/com/atproto/server/requestEmailUpdate.ts +1 -1
- package/src/api/com/atproto/server/revokeAppPassword.ts +1 -1
- package/src/api/com/atproto/server/updateEmail.ts +1 -1
- package/src/api/com/atproto/server/util.ts +12 -5
- package/src/api/com/atproto/sync/deprecated/getCheckout.ts +6 -8
- package/src/api/com/atproto/sync/deprecated/getHead.ts +7 -10
- package/src/api/com/atproto/sync/getBlob.ts +8 -6
- package/src/api/com/atproto/sync/getBlocks.ts +6 -7
- package/src/api/com/atproto/sync/getLatestCommit.ts +7 -10
- package/src/api/com/atproto/sync/getRecord.ts +7 -7
- package/src/api/com/atproto/sync/getRepo.ts +6 -7
- package/src/api/com/atproto/sync/getRepoStatus.ts +31 -0
- package/src/api/com/atproto/sync/index.ts +2 -0
- package/src/api/com/atproto/sync/listBlobs.ts +6 -8
- package/src/api/com/atproto/sync/listRepos.ts +13 -8
- package/src/api/com/atproto/sync/subscribeRepos.ts +7 -0
- package/src/api/com/atproto/sync/util.ts +36 -0
- package/src/api/com/atproto/temp/checkSignupQueue.ts +4 -1
- package/src/auth-verifier.ts +62 -47
- package/src/index.ts +1 -0
- package/src/lexicon/index.ts +12 -0
- package/src/lexicon/lexicons.ts +236 -7
- package/src/lexicon/types/chat/bsky/convo/defs.ts +1 -1
- package/src/lexicon/types/com/atproto/admin/defs.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +1 -0
- package/src/lexicon/types/com/atproto/server/createSession.ts +3 -0
- package/src/lexicon/types/com/atproto/server/getSession.ts +3 -0
- package/src/lexicon/types/com/atproto/server/refreshSession.ts +3 -0
- package/src/lexicon/types/com/atproto/sync/getBlob.ts +6 -0
- package/src/lexicon/types/com/atproto/sync/getBlocks.ts +6 -0
- package/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +1 -1
- package/src/lexicon/types/com/atproto/sync/getRecord.ts +6 -0
- package/src/lexicon/types/com/atproto/sync/getRepo.ts +1 -0
- package/src/lexicon/types/com/atproto/sync/getRepoStatus.ts +52 -0
- package/src/lexicon/types/com/atproto/sync/listBlobs.ts +1 -0
- package/src/lexicon/types/com/atproto/sync/listRepos.ts +3 -0
- package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +30 -3
- package/src/lexicon/types/tools/ozone/moderation/defs.ts +2 -0
- package/src/pipethrough.ts +5 -4
- package/src/scripts/index.ts +5 -0
- package/src/scripts/rebuild-repo.ts +143 -0
- package/src/sequencer/db/schema.ts +1 -0
- package/src/sequencer/events.ts +47 -0
- package/src/sequencer/sequencer.ts +35 -14
- package/tests/account-deactivation.test.ts +67 -12
- package/tests/account-deletion.test.ts +10 -2
- package/tests/auth.test.ts +3 -0
- package/tests/moderation.test.ts +2 -2
- package/tests/proxied/notif.test.ts +1 -0
- package/tests/sequencer.test.ts +2 -2
- package/tests/sync/list.test.ts +1 -0
- package/tests/sync/subscribe-repos.test.ts +224 -40
- package/tests/sync/sync.test.ts +48 -4
@@ -11,7 +11,8 @@ import {
|
|
11
11
|
import { Server } from '../../../../lexicon'
|
12
12
|
import { InputSchema as CreateAccountInput } from '../../../../lexicon/types/com/atproto/server/createAccount'
|
13
13
|
import AppContext from '../../../../context'
|
14
|
-
import {
|
14
|
+
import { safeResolveDidDoc } from './util'
|
15
|
+
import { AccountStatus } from '../../../../account-manager'
|
15
16
|
|
16
17
|
export default function (server: Server, ctx: AppContext) {
|
17
18
|
server.com.atproto.server.createAccount({
|
@@ -56,6 +57,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
56
57
|
}
|
57
58
|
}
|
58
59
|
|
60
|
+
didDoc = await safeResolveDidDoc(ctx, did, true)
|
61
|
+
|
59
62
|
creds = await ctx.accountManager.createAccount({
|
60
63
|
did,
|
61
64
|
handle,
|
@@ -68,11 +71,11 @@ export default function (server: Server, ctx: AppContext) {
|
|
68
71
|
})
|
69
72
|
|
70
73
|
if (!deactivated) {
|
74
|
+
await ctx.sequencer.sequenceIdentityEvt(did, handle)
|
75
|
+
await ctx.sequencer.sequenceAccountEvt(did, AccountStatus.Active)
|
71
76
|
await ctx.sequencer.sequenceCommit(did, commit, [])
|
72
|
-
await ctx.sequencer.sequenceIdentityEvt(did)
|
73
77
|
}
|
74
78
|
await ctx.accountManager.updateRepoRoot(did, commit.cid, commit.rev)
|
75
|
-
didDoc = await didDocForSession(ctx, did, true)
|
76
79
|
await ctx.actorStore.clearReservedKeypair(signingKey.did(), did)
|
77
80
|
} catch (err) {
|
78
81
|
// this will only be reached if the actor store _did not_ exist before
|
@@ -4,7 +4,9 @@ import { authPassthru, resultPassthru } from '../../../proxy'
|
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.server.createAppPassword({
|
7
|
-
auth: ctx.authVerifier.accessFull
|
7
|
+
auth: ctx.authVerifier.accessFull({
|
8
|
+
checkTakedown: true,
|
9
|
+
}),
|
8
10
|
handler: async ({ auth, input, req }) => {
|
9
11
|
if (ctx.entrywayAgent) {
|
10
12
|
return resultPassthru(
|
@@ -3,13 +3,15 @@ import AppContext from '../../../../context'
|
|
3
3
|
|
4
4
|
export default function (server: Server, ctx: AppContext) {
|
5
5
|
server.com.atproto.server.deactivateAccount({
|
6
|
-
auth: ctx.authVerifier.accessFull,
|
6
|
+
auth: ctx.authVerifier.accessFull(),
|
7
7
|
handler: async ({ auth, input }) => {
|
8
8
|
const requester = auth.credentials.did
|
9
9
|
await ctx.accountManager.deactivateAccount(
|
10
10
|
requester,
|
11
11
|
input.body.deleteAfter ?? null,
|
12
12
|
)
|
13
|
+
const status = await ctx.accountManager.getAccountStatus(requester)
|
14
|
+
await ctx.sequencer.sequenceAccountEvt(requester, status)
|
13
15
|
},
|
14
16
|
})
|
15
17
|
}
|
@@ -3,6 +3,7 @@ import { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'
|
|
3
3
|
import { Server } from '../../../../lexicon'
|
4
4
|
import AppContext from '../../../../context'
|
5
5
|
import { authPassthru } from '../../../proxy'
|
6
|
+
import { AccountStatus } from '../../../../account-manager'
|
6
7
|
|
7
8
|
export default function (server: Server, ctx: AppContext) {
|
8
9
|
server.com.atproto.server.deleteAccount({
|
@@ -44,9 +45,12 @@ export default function (server: Server, ctx: AppContext) {
|
|
44
45
|
)
|
45
46
|
await ctx.actorStore.destroy(did)
|
46
47
|
await ctx.accountManager.deleteAccount(did)
|
47
|
-
await ctx.sequencer.
|
48
|
-
|
49
|
-
|
48
|
+
const accountSeq = await ctx.sequencer.sequenceAccountEvt(
|
49
|
+
did,
|
50
|
+
AccountStatus.Deleted,
|
51
|
+
)
|
52
|
+
const tombstoneSeq = await ctx.sequencer.sequenceTombstone(did)
|
53
|
+
await ctx.sequencer.deleteAllForUser(did, [accountSeq, tombstoneSeq])
|
50
54
|
},
|
51
55
|
})
|
52
56
|
}
|
@@ -7,7 +7,7 @@ import { authPassthru, resultPassthru } from '../../../proxy'
|
|
7
7
|
|
8
8
|
export default function (server: Server, ctx: AppContext) {
|
9
9
|
server.com.atproto.server.getAccountInviteCodes({
|
10
|
-
auth: ctx.authVerifier.accessFull,
|
10
|
+
auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
|
11
11
|
handler: async ({ params, auth, req }) => {
|
12
12
|
if (ctx.entrywayAgent) {
|
13
13
|
return resultPassthru(
|
@@ -4,7 +4,7 @@ import { Server } from '../../../../lexicon'
|
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.server.getServiceAuth({
|
7
|
-
auth: ctx.authVerifier.
|
7
|
+
auth: ctx.authVerifier.accessPrivileged(),
|
8
8
|
handler: async ({ params, auth }) => {
|
9
9
|
const did = auth.credentials.did
|
10
10
|
const keypair = await ctx.actorStore.keypair(did)
|
@@ -4,10 +4,13 @@ import AppContext from '../../../../context'
|
|
4
4
|
import { Server } from '../../../../lexicon'
|
5
5
|
import { authPassthru, resultPassthru } from '../../../proxy'
|
6
6
|
import { didDocForSession } from './util'
|
7
|
+
import { AuthScope } from '../../../../auth-verifier'
|
7
8
|
|
8
9
|
export default function (server: Server, ctx: AppContext) {
|
9
10
|
server.com.atproto.server.getSession({
|
10
|
-
auth: ctx.authVerifier.
|
11
|
+
auth: ctx.authVerifier.accessStandard({
|
12
|
+
additional: [AuthScope.SignupQueued],
|
13
|
+
}),
|
11
14
|
handler: async ({ auth, req }) => {
|
12
15
|
if (ctx.entrywayAgent) {
|
13
16
|
return resultPassthru(
|
@@ -20,7 +23,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
20
23
|
|
21
24
|
const did = auth.credentials.did
|
22
25
|
const [user, didDoc] = await Promise.all([
|
23
|
-
ctx.accountManager.getAccount(did),
|
26
|
+
ctx.accountManager.getAccount(did, { includeDeactivated: true }),
|
24
27
|
didDocForSession(ctx, did),
|
25
28
|
])
|
26
29
|
if (!user) {
|
@@ -36,6 +39,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
36
39
|
email: user.email ?? undefined,
|
37
40
|
didDoc,
|
38
41
|
emailConfirmed: !!user.emailConfirmedAt,
|
42
|
+
active: user.active,
|
43
|
+
status: user.status,
|
39
44
|
},
|
40
45
|
}
|
41
46
|
},
|
@@ -4,7 +4,7 @@ import { authPassthru, resultPassthru } from '../../../proxy'
|
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.server.listAppPasswords({
|
7
|
-
auth: ctx.authVerifier.
|
7
|
+
auth: ctx.authVerifier.accessStandard(),
|
8
8
|
handler: async ({ auth, req }) => {
|
9
9
|
if (ctx.entrywayAgent) {
|
10
10
|
return resultPassthru(
|
@@ -18,7 +18,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
18
18
|
calcKey: ({ auth }) => auth.credentials.did,
|
19
19
|
},
|
20
20
|
],
|
21
|
-
auth: ctx.authVerifier.
|
21
|
+
auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
|
22
22
|
handler: async ({ auth, req }) => {
|
23
23
|
const did = auth.credentials.did
|
24
24
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -18,7 +18,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
18
18
|
calcKey: ({ auth }) => auth.credentials.did,
|
19
19
|
},
|
20
20
|
],
|
21
|
-
auth: ctx.authVerifier.
|
21
|
+
auth: ctx.authVerifier.accessStandard({ checkTakedown: true }),
|
22
22
|
handler: async ({ auth, req }) => {
|
23
23
|
const did = auth.credentials.did
|
24
24
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -18,7 +18,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
18
18
|
calcKey: ({ auth }) => auth.credentials.did,
|
19
19
|
},
|
20
20
|
],
|
21
|
-
auth: ctx.authVerifier.
|
21
|
+
auth: ctx.authVerifier.accessStandard({ checkTakedown: true }),
|
22
22
|
handler: async ({ auth, req }) => {
|
23
23
|
const did = auth.credentials.did
|
24
24
|
const account = await ctx.accountManager.getAccount(did, {
|
@@ -4,7 +4,7 @@ import { authPassthru } from '../../../proxy'
|
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.server.revokeAppPassword({
|
7
|
-
auth: ctx.authVerifier.
|
7
|
+
auth: ctx.authVerifier.accessStandard(),
|
8
8
|
handler: async ({ auth, input, req }) => {
|
9
9
|
if (ctx.entrywayAgent) {
|
10
10
|
await ctx.entrywayAgent.com.atproto.server.revokeAppPassword(
|
@@ -7,7 +7,7 @@ import { UserAlreadyExistsError } from '../../../../account-manager/helpers/acco
|
|
7
7
|
|
8
8
|
export default function (server: Server, ctx: AppContext) {
|
9
9
|
server.com.atproto.server.updateEmail({
|
10
|
-
auth: ctx.authVerifier.accessFull,
|
10
|
+
auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
|
11
11
|
handler: async ({ auth, input, req }) => {
|
12
12
|
const did = auth.credentials.did
|
13
13
|
const { token, email } = input.body
|
@@ -2,7 +2,7 @@ import * as crypto from '@atproto/crypto'
|
|
2
2
|
import { DidDocument } from '@atproto/identity'
|
3
3
|
import { ServerConfig } from '../../../../config'
|
4
4
|
import AppContext from '../../../../context'
|
5
|
-
import {
|
5
|
+
import { httpLogger } from '../../../../logger'
|
6
6
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
7
7
|
import { getPdsEndpoint, getSigningDidKey } from '@atproto/common'
|
8
8
|
|
@@ -28,21 +28,28 @@ export const getRandomToken = () => {
|
|
28
28
|
return token.slice(0, 5) + '-' + token.slice(5, 10)
|
29
29
|
}
|
30
30
|
|
31
|
-
|
32
|
-
export const didDocForSession = async (
|
31
|
+
export const safeResolveDidDoc = async (
|
33
32
|
ctx: AppContext,
|
34
33
|
did: string,
|
35
34
|
forceRefresh?: boolean,
|
36
35
|
): Promise<DidDocument | undefined> => {
|
37
|
-
if (!ctx.cfg.identity.enableDidDocWithSession) return
|
38
36
|
try {
|
39
37
|
const didDoc = await ctx.idResolver.did.resolve(did, forceRefresh)
|
40
38
|
return didDoc ?? undefined
|
41
39
|
} catch (err) {
|
42
|
-
|
40
|
+
httpLogger.warn({ err, did }, 'failed to resolve did doc')
|
43
41
|
}
|
44
42
|
}
|
45
43
|
|
44
|
+
export const didDocForSession = async (
|
45
|
+
ctx: AppContext,
|
46
|
+
did: string,
|
47
|
+
forceRefresh?: boolean,
|
48
|
+
): Promise<DidDocument | undefined> => {
|
49
|
+
if (!ctx.cfg.identity.enableDidDocWithSession) return
|
50
|
+
return safeResolveDidDoc(ctx, did, forceRefresh)
|
51
|
+
}
|
52
|
+
|
46
53
|
export const isValidDidDocForService = async (
|
47
54
|
ctx: AppContext,
|
48
55
|
did: string,
|
@@ -1,20 +1,18 @@
|
|
1
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
1
|
import { Server } from '../../../../../lexicon'
|
3
2
|
import AppContext from '../../../../../context'
|
4
3
|
import { getCarStream } from '../getRepo'
|
4
|
+
import { assertRepoAvailability } from '../util'
|
5
5
|
|
6
6
|
export default function (server: Server, ctx: AppContext) {
|
7
7
|
server.com.atproto.sync.getCheckout({
|
8
8
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
9
9
|
handler: async ({ params, auth }) => {
|
10
10
|
const { did } = params
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
17
|
-
}
|
11
|
+
await assertRepoAvailability(
|
12
|
+
ctx,
|
13
|
+
did,
|
14
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
+
)
|
18
16
|
|
19
17
|
const carStream = await getCarStream(ctx, did)
|
20
18
|
|
@@ -1,22 +1,19 @@
|
|
1
1
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
2
|
import { Server } from '../../../../../lexicon'
|
3
3
|
import AppContext from '../../../../../context'
|
4
|
+
import { assertRepoAvailability } from '../util'
|
4
5
|
|
5
6
|
export default function (server: Server, ctx: AppContext) {
|
6
7
|
server.com.atproto.sync.getHead({
|
7
8
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
8
9
|
handler: async ({ params, auth }) => {
|
9
10
|
const { did } = params
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
'HeadNotFound',
|
17
|
-
)
|
18
|
-
}
|
19
|
-
}
|
11
|
+
await assertRepoAvailability(
|
12
|
+
ctx,
|
13
|
+
did,
|
14
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
+
)
|
16
|
+
|
20
17
|
const root = await ctx.actorStore.read(did, (store) =>
|
21
18
|
store.repo.storage.getRoot(),
|
22
19
|
)
|
@@ -3,17 +3,19 @@ import { Server } from '../../../../lexicon'
|
|
3
3
|
import AppContext from '../../../../context'
|
4
4
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
5
5
|
import { BlobNotFoundError } from '@atproto/repo'
|
6
|
+
import { assertRepoAvailability } from './util'
|
6
7
|
|
7
8
|
export default function (server: Server, ctx: AppContext) {
|
8
9
|
server.com.atproto.sync.getBlob({
|
9
10
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
10
11
|
handler: async ({ params, res, auth }) => {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
const { did } = params
|
13
|
+
await assertRepoAvailability(
|
14
|
+
ctx,
|
15
|
+
did,
|
16
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
17
|
+
)
|
18
|
+
|
17
19
|
const cid = CID.parse(params.cid)
|
18
20
|
const found = await ctx.actorStore.read(params.did, async (store) => {
|
19
21
|
try {
|
@@ -4,19 +4,18 @@ import { byteIterableToStream } from '@atproto/common'
|
|
4
4
|
import { blocksToCarStream } from '@atproto/repo'
|
5
5
|
import { Server } from '../../../../lexicon'
|
6
6
|
import AppContext from '../../../../context'
|
7
|
+
import { assertRepoAvailability } from './util'
|
7
8
|
|
8
9
|
export default function (server: Server, ctx: AppContext) {
|
9
10
|
server.com.atproto.sync.getBlocks({
|
10
11
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
11
12
|
handler: async ({ params, auth }) => {
|
12
13
|
const { did } = params
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
}
|
14
|
+
await assertRepoAvailability(
|
15
|
+
ctx,
|
16
|
+
did,
|
17
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
18
|
+
)
|
20
19
|
|
21
20
|
const cids = params.cids.map((c) => CID.parse(c))
|
22
21
|
const got = await ctx.actorStore.read(did, (store) =>
|
@@ -1,22 +1,19 @@
|
|
1
1
|
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
2
|
import { Server } from '../../../../lexicon'
|
3
3
|
import AppContext from '../../../../context'
|
4
|
+
import { assertRepoAvailability } from './util'
|
4
5
|
|
5
6
|
export default function (server: Server, ctx: AppContext) {
|
6
7
|
server.com.atproto.sync.getLatestCommit({
|
7
8
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
8
9
|
handler: async ({ params, auth }) => {
|
9
10
|
const { did } = params
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
'RepoNotFound',
|
17
|
-
)
|
18
|
-
}
|
19
|
-
}
|
11
|
+
await assertRepoAvailability(
|
12
|
+
ctx,
|
13
|
+
did,
|
14
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
15
|
+
)
|
16
|
+
|
20
17
|
const root = await ctx.actorStore.read(did, (store) =>
|
21
18
|
store.repo.storage.getRootDetailed(),
|
22
19
|
)
|
@@ -6,19 +6,19 @@ import { Server } from '../../../../lexicon'
|
|
6
6
|
import AppContext from '../../../../context'
|
7
7
|
import { byteIterableToStream } from '@atproto/common'
|
8
8
|
import { SqlRepoReader } from '../../../../actor-store/repo/sql-repo-reader'
|
9
|
+
import { assertRepoAvailability } from './util'
|
9
10
|
|
10
11
|
export default function (server: Server, ctx: AppContext) {
|
11
12
|
server.com.atproto.sync.getRecord({
|
12
13
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
13
14
|
handler: async ({ params, auth }) => {
|
14
15
|
const { did, collection, rkey } = params
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
16
|
+
await assertRepoAvailability(
|
17
|
+
ctx,
|
18
|
+
did,
|
19
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
20
|
+
)
|
21
|
+
|
22
22
|
// must open up the db outside of store interface so that we can close the file handle after finished streaming
|
23
23
|
const actorDb = await ctx.actorStore.openDb(did)
|
24
24
|
|
@@ -6,19 +6,18 @@ import {
|
|
6
6
|
RepoRootNotFoundError,
|
7
7
|
SqlRepoReader,
|
8
8
|
} from '../../../../actor-store/repo/sql-repo-reader'
|
9
|
+
import { assertRepoAvailability } from './util'
|
9
10
|
|
10
11
|
export default function (server: Server, ctx: AppContext) {
|
11
12
|
server.com.atproto.sync.getRepo({
|
12
13
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
13
14
|
handler: async ({ params, auth }) => {
|
14
15
|
const { did, since } = params
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
}
|
16
|
+
await assertRepoAvailability(
|
17
|
+
ctx,
|
18
|
+
did,
|
19
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
20
|
+
)
|
22
21
|
|
23
22
|
const carStream = await getCarStream(ctx, did, since)
|
24
23
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { Server } from '../../../../lexicon'
|
2
|
+
import AppContext from '../../../../context'
|
3
|
+
import { assertRepoAvailability } from './util'
|
4
|
+
|
5
|
+
export default function (server: Server, ctx: AppContext) {
|
6
|
+
server.com.atproto.sync.getRepoStatus({
|
7
|
+
handler: async ({ params }) => {
|
8
|
+
const { did } = params
|
9
|
+
const account = await assertRepoAvailability(ctx, did, true)
|
10
|
+
const { active, status } = account
|
11
|
+
|
12
|
+
let rev: string | undefined = undefined
|
13
|
+
if (active) {
|
14
|
+
const root = await ctx.actorStore.read(did, (store) =>
|
15
|
+
store.repo.storage.getRootDetailed(),
|
16
|
+
)
|
17
|
+
rev = root.rev
|
18
|
+
}
|
19
|
+
|
20
|
+
return {
|
21
|
+
encoding: 'application/json',
|
22
|
+
body: {
|
23
|
+
did,
|
24
|
+
active,
|
25
|
+
status,
|
26
|
+
rev,
|
27
|
+
},
|
28
|
+
}
|
29
|
+
},
|
30
|
+
})
|
31
|
+
}
|
@@ -3,6 +3,7 @@ import AppContext from '../../../../context'
|
|
3
3
|
import getBlob from './getBlob'
|
4
4
|
import getBlocks from './getBlocks'
|
5
5
|
import getLatestCommit from './getLatestCommit'
|
6
|
+
import getRepoStatus from './getRepoStatus'
|
6
7
|
import getRecord from './getRecord'
|
7
8
|
import getRepo from './getRepo'
|
8
9
|
import subscribeRepos from './subscribeRepos'
|
@@ -15,6 +16,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
15
16
|
getBlob(server, ctx)
|
16
17
|
getBlocks(server, ctx)
|
17
18
|
getLatestCommit(server, ctx)
|
19
|
+
getRepoStatus(server, ctx)
|
18
20
|
getRecord(server, ctx)
|
19
21
|
getRepo(server, ctx)
|
20
22
|
subscribeRepos(server, ctx)
|
@@ -1,19 +1,17 @@
|
|
1
|
-
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
1
|
import { Server } from '../../../../lexicon'
|
3
2
|
import AppContext from '../../../../context'
|
3
|
+
import { assertRepoAvailability } from './util'
|
4
4
|
|
5
5
|
export default function (server: Server, ctx: AppContext) {
|
6
6
|
server.com.atproto.sync.listBlobs({
|
7
7
|
auth: ctx.authVerifier.optionalAccessOrAdminToken,
|
8
8
|
handler: async ({ params, auth }) => {
|
9
9
|
const { did, since, limit, cursor } = params
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
}
|
10
|
+
await assertRepoAvailability(
|
11
|
+
ctx,
|
12
|
+
did,
|
13
|
+
ctx.authVerifier.isUserOrAdmin(auth, did),
|
14
|
+
)
|
17
15
|
|
18
16
|
const blobCids = await ctx.actorStore.read(did, (store) =>
|
19
17
|
store.repo.blob.listBlobs({ since, limit, cursor }),
|
@@ -2,7 +2,7 @@ import { InvalidRequestError } from '@atproto/xrpc-server'
|
|
2
2
|
import { Server } from '../../../../lexicon'
|
3
3
|
import AppContext from '../../../../context'
|
4
4
|
import { Cursor, GenericKeyset, paginate } from '../../../../db/pagination'
|
5
|
-
import {
|
5
|
+
import { formatAccountStatus } from '../../../../account-manager/helpers/account'
|
6
6
|
|
7
7
|
export default function (server: Server, ctx: AppContext) {
|
8
8
|
server.com.atproto.sync.listRepos(async ({ params }) => {
|
@@ -12,13 +12,13 @@ export default function (server: Server, ctx: AppContext) {
|
|
12
12
|
let builder = db.db
|
13
13
|
.selectFrom('actor')
|
14
14
|
.innerJoin('repo_root', 'repo_root.did', 'actor.did')
|
15
|
-
.where(notSoftDeletedClause(ref('actor')))
|
16
|
-
.where('actor.deactivatedAt', 'is', null)
|
17
15
|
.select([
|
18
16
|
'actor.did as did',
|
19
17
|
'repo_root.cid as head',
|
20
18
|
'repo_root.rev as rev',
|
21
19
|
'actor.createdAt as createdAt',
|
20
|
+
'actor.deactivatedAt as deactivatedAt',
|
21
|
+
'actor.takedownRef as takedownRef',
|
22
22
|
])
|
23
23
|
const keyset = new TimeDidKeyset(ref('actor.createdAt'), ref('actor.did'))
|
24
24
|
builder = paginate(builder, {
|
@@ -29,11 +29,16 @@ export default function (server: Server, ctx: AppContext) {
|
|
29
29
|
tryIndex: true,
|
30
30
|
})
|
31
31
|
const res = await builder.execute()
|
32
|
-
const repos = res.map((row) =>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
const repos = res.map((row) => {
|
33
|
+
const { active, status } = formatAccountStatus(row)
|
34
|
+
return {
|
35
|
+
did: row.did,
|
36
|
+
head: row.head,
|
37
|
+
rev: row.rev ?? '',
|
38
|
+
active,
|
39
|
+
status,
|
40
|
+
}
|
41
|
+
})
|
37
42
|
return {
|
38
43
|
encoding: 'application/json',
|
39
44
|
body: {
|
@@ -59,6 +59,13 @@ export default function (server: Server, ctx: AppContext) {
|
|
59
59
|
time: evt.time,
|
60
60
|
...evt.evt,
|
61
61
|
}
|
62
|
+
} else if (evt.type === 'account') {
|
63
|
+
yield {
|
64
|
+
$type: '#account',
|
65
|
+
seq: evt.seq,
|
66
|
+
time: evt.time,
|
67
|
+
...evt.evt,
|
68
|
+
}
|
62
69
|
} else if (evt.type === 'tombstone') {
|
63
70
|
yield {
|
64
71
|
$type: '#tombstone',
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { InvalidRequestError } from '@atproto/xrpc-server'
|
2
|
+
import { ActorAccount } from '../../../../account-manager/helpers/account'
|
3
|
+
import AppContext from '../../../../context'
|
4
|
+
|
5
|
+
export const assertRepoAvailability = async (
|
6
|
+
ctx: AppContext,
|
7
|
+
did: string,
|
8
|
+
isAdminOrSelf: boolean,
|
9
|
+
): Promise<ActorAccount> => {
|
10
|
+
const account = await ctx.accountManager.getAccount(did, {
|
11
|
+
includeDeactivated: true,
|
12
|
+
includeTakenDown: true,
|
13
|
+
})
|
14
|
+
if (!account) {
|
15
|
+
throw new InvalidRequestError(
|
16
|
+
`Could not find repo for DID: ${did}`,
|
17
|
+
'RepoNotFound',
|
18
|
+
)
|
19
|
+
}
|
20
|
+
if (isAdminOrSelf) {
|
21
|
+
return account
|
22
|
+
}
|
23
|
+
if (account.takedownRef) {
|
24
|
+
throw new InvalidRequestError(
|
25
|
+
`Repo has been takendown: ${did}`,
|
26
|
+
'RepoTakendown',
|
27
|
+
)
|
28
|
+
}
|
29
|
+
if (account.deactivatedAt) {
|
30
|
+
throw new InvalidRequestError(
|
31
|
+
`Repo has been deactivated: ${did}`,
|
32
|
+
'RepoDeactivated',
|
33
|
+
)
|
34
|
+
}
|
35
|
+
return account
|
36
|
+
}
|