@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
@@ -1,5 +1,10 @@
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
ImageRef,
|
4
|
+
SeedClient,
|
5
|
+
TestNetworkNoAppView,
|
6
|
+
basicSeed,
|
7
|
+
} from '@atproto/dev-env'
|
3
8
|
|
4
9
|
describe('account deactivation', () => {
|
5
10
|
let network: TestNetworkNoAppView
|
@@ -8,6 +13,7 @@ describe('account deactivation', () => {
|
|
8
13
|
let agent: AtpAgent
|
9
14
|
|
10
15
|
let alice: string
|
16
|
+
let aliceAvatar: ImageRef
|
11
17
|
|
12
18
|
beforeAll(async () => {
|
13
19
|
network = await TestNetworkNoAppView.create({
|
@@ -19,6 +25,16 @@ describe('account deactivation', () => {
|
|
19
25
|
|
20
26
|
await basicSeed(sc)
|
21
27
|
alice = sc.dids.alice
|
28
|
+
|
29
|
+
aliceAvatar = await sc.uploadFile(
|
30
|
+
alice,
|
31
|
+
'../dev-env/src/seed/img/key-portrait-small.jpg',
|
32
|
+
'image/jpeg',
|
33
|
+
)
|
34
|
+
await sc.updateProfile(alice, {
|
35
|
+
avatar: aliceAvatar.image,
|
36
|
+
})
|
37
|
+
|
22
38
|
await network.processAll()
|
23
39
|
})
|
24
40
|
|
@@ -33,16 +49,33 @@ describe('account deactivation', () => {
|
|
33
49
|
)
|
34
50
|
})
|
35
51
|
|
52
|
+
it('returns deactivated status', async () => {
|
53
|
+
const res = await agent.com.atproto.sync.getRepoStatus({ did: alice })
|
54
|
+
expect(res.data).toEqual({
|
55
|
+
did: alice,
|
56
|
+
active: false,
|
57
|
+
status: 'deactivated',
|
58
|
+
})
|
59
|
+
|
60
|
+
const adminRes = await agent.com.atproto.admin.getAccountInfo(
|
61
|
+
{
|
62
|
+
did: alice,
|
63
|
+
},
|
64
|
+
{ headers: network.pds.adminAuthHeaders() },
|
65
|
+
)
|
66
|
+
expect(typeof adminRes.data.deactivatedAt).toBeDefined()
|
67
|
+
})
|
68
|
+
|
36
69
|
it('no longer serves repo data', async () => {
|
37
70
|
await expect(
|
38
71
|
agent.com.atproto.sync.getRepo({ did: alice }),
|
39
|
-
).rejects.toThrow()
|
72
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
40
73
|
await expect(
|
41
74
|
agent.com.atproto.sync.getLatestCommit({ did: alice }),
|
42
|
-
).rejects.toThrow()
|
75
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
43
76
|
await expect(
|
44
77
|
agent.com.atproto.sync.listBlobs({ did: alice }),
|
45
|
-
).rejects.toThrow()
|
78
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
46
79
|
const recordUri = sc.posts[alice][0].ref.uri
|
47
80
|
await expect(
|
48
81
|
agent.com.atproto.sync.getRecord({
|
@@ -50,7 +83,7 @@ describe('account deactivation', () => {
|
|
50
83
|
collection: recordUri.collection,
|
51
84
|
rkey: recordUri.rkey,
|
52
85
|
}),
|
53
|
-
).rejects.toThrow()
|
86
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
54
87
|
await expect(
|
55
88
|
agent.com.atproto.repo.getRecord({
|
56
89
|
repo: alice,
|
@@ -62,17 +95,18 @@ describe('account deactivation', () => {
|
|
62
95
|
agent.com.atproto.repo.describeRepo({
|
63
96
|
repo: alice,
|
64
97
|
}),
|
65
|
-
).rejects.toThrow()
|
98
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
66
99
|
|
67
|
-
const blobCid = sc.profiles[alice].avatar.cid
|
68
100
|
await expect(
|
69
101
|
agent.com.atproto.sync.getBlob({
|
70
102
|
did: alice,
|
71
|
-
cid:
|
103
|
+
cid: aliceAvatar.image.ref.toString(),
|
72
104
|
}),
|
73
|
-
).rejects.toThrow()
|
105
|
+
).rejects.toThrow(/Repo has been deactivated/)
|
74
106
|
const listedRepos = await agent.com.atproto.sync.listRepos()
|
75
|
-
|
107
|
+
const listedAlice = listedRepos.data.repos.find((r) => r.did === alice)
|
108
|
+
expect(listedAlice?.active).toBe(false)
|
109
|
+
expect(listedAlice?.status).toBe('deactivated')
|
76
110
|
})
|
77
111
|
|
78
112
|
it('no longer resolves handle', async () => {
|
@@ -83,11 +117,19 @@ describe('account deactivation', () => {
|
|
83
117
|
).rejects.toThrow()
|
84
118
|
})
|
85
119
|
|
86
|
-
it('still allows login', async () => {
|
87
|
-
await agent.com.atproto.server.createSession({
|
120
|
+
it('still allows login and returns status', async () => {
|
121
|
+
const res = await agent.com.atproto.server.createSession({
|
88
122
|
identifier: alice,
|
89
123
|
password: sc.accounts[alice].password,
|
90
124
|
})
|
125
|
+
expect(res.data.status).toEqual('deactivated')
|
126
|
+
})
|
127
|
+
|
128
|
+
it('returns status on getSession', async () => {
|
129
|
+
const res = await agent.com.atproto.server.getSession(undefined, {
|
130
|
+
headers: sc.getHeaders(alice),
|
131
|
+
})
|
132
|
+
expect(res.data.status).toEqual('deactivated')
|
91
133
|
})
|
92
134
|
|
93
135
|
it('does not allow writes', async () => {
|
@@ -143,6 +185,19 @@ describe('account deactivation', () => {
|
|
143
185
|
await agent.com.atproto.server.activateAccount(undefined, {
|
144
186
|
headers: sc.getHeaders(alice),
|
145
187
|
})
|
188
|
+
|
146
189
|
await agent.com.atproto.sync.getRepo({ did: alice })
|
190
|
+
|
191
|
+
const statusRes = await agent.com.atproto.sync.getRepoStatus({ did: alice })
|
192
|
+
expect(statusRes.data.active).toBe(true)
|
193
|
+
expect(statusRes.data.status).toBeUndefined()
|
194
|
+
|
195
|
+
const adminRes = await agent.com.atproto.admin.getAccountInfo(
|
196
|
+
{
|
197
|
+
did: alice,
|
198
|
+
},
|
199
|
+
{ headers: network.pds.adminAuthHeaders() },
|
200
|
+
)
|
201
|
+
expect(adminRes.data.deactivatedAt).toBeUndefined()
|
147
202
|
})
|
148
203
|
})
|
@@ -143,10 +143,18 @@ describe('account deletion', () => {
|
|
143
143
|
expect(updatedDbContents.userAccounts).toEqual(
|
144
144
|
initialDbContents.userAccounts.filter((row) => row.did !== carol.did),
|
145
145
|
)
|
146
|
-
// check
|
146
|
+
// check we didn't touch other user seqs
|
147
147
|
expect(
|
148
|
-
updatedDbContents.repoSeqs.filter((row) => row.
|
148
|
+
updatedDbContents.repoSeqs.filter((row) => row.did !== carol.did),
|
149
149
|
).toEqual(initialDbContents.repoSeqs.filter((row) => row.did !== carol.did))
|
150
|
+
// check all seqs for this did are gone, except for the tombstone & account events
|
151
|
+
expect(
|
152
|
+
updatedDbContents.repoSeqs
|
153
|
+
.filter((row) => row.did === carol.did)
|
154
|
+
.every(
|
155
|
+
(row) => row.eventType === 'tombstone' || row.eventType === 'account',
|
156
|
+
),
|
157
|
+
).toBe(true)
|
150
158
|
// check we do have a tombstone for this did
|
151
159
|
expect(
|
152
160
|
updatedDbContents.repoSeqs.filter(
|
package/tests/auth.test.ts
CHANGED
@@ -62,6 +62,7 @@ describe('auth', () => {
|
|
62
62
|
handle: account.handle,
|
63
63
|
email,
|
64
64
|
emailConfirmed: false,
|
65
|
+
active: true,
|
65
66
|
})
|
66
67
|
// Valid refresh token
|
67
68
|
const nextSession = await refreshSession(account.refreshJwt)
|
@@ -91,6 +92,7 @@ describe('auth', () => {
|
|
91
92
|
handle: session.handle,
|
92
93
|
email,
|
93
94
|
emailConfirmed: false,
|
95
|
+
active: true,
|
94
96
|
})
|
95
97
|
// Valid refresh token
|
96
98
|
const nextSession = await refreshSession(session.refreshJwt)
|
@@ -135,6 +137,7 @@ describe('auth', () => {
|
|
135
137
|
handle: session.handle,
|
136
138
|
email,
|
137
139
|
emailConfirmed: false,
|
140
|
+
active: true,
|
138
141
|
})
|
139
142
|
// Valid refresh token
|
140
143
|
const nextSession = await refreshSession(session.refreshJwt)
|
package/tests/moderation.test.ts
CHANGED
@@ -238,12 +238,12 @@ describe('moderation', () => {
|
|
238
238
|
}
|
239
239
|
// public, disallow
|
240
240
|
const attempt1 = agent.api.com.atproto.sync.getBlob(blobParams)
|
241
|
-
await expect(attempt1).rejects.toThrow(
|
241
|
+
await expect(attempt1).rejects.toThrow(/Repo has been takendown/)
|
242
242
|
// logged-in, disallow
|
243
243
|
const attempt2 = agent.api.com.atproto.sync.getBlob(blobParams, {
|
244
244
|
headers: sc.getHeaders(sc.dids.bob),
|
245
245
|
})
|
246
|
-
await expect(attempt2).rejects.toThrow(
|
246
|
+
await expect(attempt2).rejects.toThrow(/Repo has been takendown/)
|
247
247
|
// logged-in as account, allow
|
248
248
|
const res1 = await agent.api.com.atproto.sync.getBlob(blobParams, {
|
249
249
|
headers: sc.getHeaders(sc.dids.carol),
|
package/tests/sequencer.test.ts
CHANGED
package/tests/sync/list.test.ts
CHANGED
@@ -16,10 +16,13 @@ import {
|
|
16
16
|
Commit as CommitEvt,
|
17
17
|
Handle as HandleEvt,
|
18
18
|
Tombstone as TombstoneEvt,
|
19
|
+
Account as AccountEvt,
|
20
|
+
Identity as IdentityEvt,
|
19
21
|
} from '../../src/lexicon/types/com/atproto/sync/subscribeRepos'
|
20
22
|
import { AppContext } from '../../src'
|
21
23
|
import basicSeed from '../seeds/basic'
|
22
24
|
import { CID } from 'multiformats/cid'
|
25
|
+
import { AccountStatus } from '../../src/account-manager'
|
23
26
|
|
24
27
|
describe('repo subscribe repos', () => {
|
25
28
|
let serverHost: string
|
@@ -64,16 +67,6 @@ describe('repo subscribe repos', () => {
|
|
64
67
|
return repo.verifyRepo(car.blocks, car.root, did, signingKey.did())
|
65
68
|
}
|
66
69
|
|
67
|
-
const getHandleEvts = (frames: Frame[]): HandleEvt[] => {
|
68
|
-
const evts: HandleEvt[] = []
|
69
|
-
for (const frame of frames) {
|
70
|
-
if (frame instanceof MessageFrame && frame.header.t === '#handle') {
|
71
|
-
evts.push(frame.body)
|
72
|
-
}
|
73
|
-
}
|
74
|
-
return evts
|
75
|
-
}
|
76
|
-
|
77
70
|
const getAllEvents = (userDid: string, frames: Frame[]) => {
|
78
71
|
const types: unknown[] = []
|
79
72
|
for (const frame of frames) {
|
@@ -93,21 +86,65 @@ describe('repo subscribe repos', () => {
|
|
93
86
|
return types
|
94
87
|
}
|
95
88
|
|
96
|
-
const
|
97
|
-
const evts:
|
89
|
+
const getEventType = <T>(frames: Frame[], type: string): T[] => {
|
90
|
+
const evts: T[] = []
|
98
91
|
for (const frame of frames) {
|
99
|
-
if (frame instanceof MessageFrame && frame.header.t ===
|
92
|
+
if (frame instanceof MessageFrame && frame.header.t === type) {
|
100
93
|
evts.push(frame.body)
|
101
94
|
}
|
102
95
|
}
|
103
96
|
return evts
|
104
97
|
}
|
105
98
|
|
106
|
-
const
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
99
|
+
const getAccountEvts = (frames: Frame[]): AccountEvt[] => {
|
100
|
+
return getEventType(frames, '#account')
|
101
|
+
}
|
102
|
+
|
103
|
+
const getIdentityEvts = (frames: Frame[]): IdentityEvt[] => {
|
104
|
+
return getEventType(frames, '#identity')
|
105
|
+
}
|
106
|
+
|
107
|
+
const getHandleEvts = (frames: Frame[]): HandleEvt[] => {
|
108
|
+
return getEventType(frames, '#handle')
|
109
|
+
}
|
110
|
+
|
111
|
+
const getTombstoneEvts = (frames: Frame[]): TombstoneEvt[] => {
|
112
|
+
return getEventType(frames, '#tombstone')
|
113
|
+
}
|
114
|
+
|
115
|
+
const getCommitEvents = (frames: Frame[]): CommitEvt[] => {
|
116
|
+
return getEventType(frames, '#commit')
|
117
|
+
}
|
118
|
+
|
119
|
+
const verifyIdentityEvent = (
|
120
|
+
evt: IdentityEvt,
|
121
|
+
did: string,
|
122
|
+
handle?: string,
|
123
|
+
) => {
|
124
|
+
expect(typeof evt.seq).toBe('number')
|
125
|
+
expect(evt.did).toBe(did)
|
126
|
+
expect(typeof evt.time).toBe('string')
|
127
|
+
expect(evt.handle).toEqual(handle)
|
128
|
+
}
|
129
|
+
|
130
|
+
const verifyHandleEvent = (evt: HandleEvt, did: string, handle: string) => {
|
131
|
+
expect(typeof evt.seq).toBe('number')
|
132
|
+
expect(evt.did).toBe(did)
|
133
|
+
expect(evt.handle).toBe(handle)
|
134
|
+
expect(typeof evt.time).toBe('string')
|
135
|
+
}
|
136
|
+
|
137
|
+
const verifyAccountEvent = (
|
138
|
+
evt: AccountEvt,
|
139
|
+
did: string,
|
140
|
+
active: boolean,
|
141
|
+
status?: AccountStatus,
|
142
|
+
) => {
|
143
|
+
expect(typeof evt.seq).toBe('number')
|
144
|
+
expect(evt.did).toBe(did)
|
145
|
+
expect(typeof evt.time).toBe('string')
|
146
|
+
expect(evt.active).toBe(active)
|
147
|
+
expect(evt.status).toBe(status)
|
111
148
|
}
|
112
149
|
|
113
150
|
const verifyTombstoneEvent = (evt: unknown, did: string) => {
|
@@ -116,24 +153,14 @@ describe('repo subscribe repos', () => {
|
|
116
153
|
expect(typeof evt?.['seq']).toBe('number')
|
117
154
|
}
|
118
155
|
|
119
|
-
const getCommitEvents = (userDid: string, frames: Frame[]) => {
|
120
|
-
const evts: CommitEvt[] = []
|
121
|
-
for (const frame of frames) {
|
122
|
-
if (frame instanceof MessageFrame && frame.header.t === '#commit') {
|
123
|
-
const body = frame.body as CommitEvt
|
124
|
-
if (body.repo === userDid) {
|
125
|
-
evts.push(frame.body)
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
return evts
|
130
|
-
}
|
131
|
-
|
132
156
|
const verifyCommitEvents = async (frames: Frame[]) => {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
await verifyRepo(
|
157
|
+
const forUser = (user: string) => (commit: CommitEvt) =>
|
158
|
+
commit.repo === user
|
159
|
+
const commits = getCommitEvents(frames)
|
160
|
+
await verifyRepo(alice, commits.filter(forUser(alice)))
|
161
|
+
await verifyRepo(bob, commits.filter(forUser(bob)))
|
162
|
+
await verifyRepo(carol, commits.filter(forUser(carol)))
|
163
|
+
await verifyRepo(dan, commits.filter(forUser(dan)))
|
137
164
|
}
|
138
165
|
|
139
166
|
const verifyRepo = async (did: string, evts: CommitEvt[]) => {
|
@@ -217,6 +244,19 @@ describe('repo subscribe repos', () => {
|
|
217
244
|
ws.terminate()
|
218
245
|
|
219
246
|
await verifyCommitEvents(evts)
|
247
|
+
|
248
|
+
const accountEvts = getAccountEvts(evts)
|
249
|
+
expect(accountEvts.length).toBe(4)
|
250
|
+
verifyAccountEvent(accountEvts[0], alice, true)
|
251
|
+
verifyAccountEvent(accountEvts[1], bob, true)
|
252
|
+
verifyAccountEvent(accountEvts[2], carol, true)
|
253
|
+
verifyAccountEvent(accountEvts[3], dan, true)
|
254
|
+
const identityEvts = getIdentityEvts(evts)
|
255
|
+
expect(identityEvts.length).toBe(4)
|
256
|
+
verifyIdentityEvent(identityEvts[0], alice, 'alice.test')
|
257
|
+
verifyIdentityEvent(identityEvts[1], bob, 'bob.test')
|
258
|
+
verifyIdentityEvent(identityEvts[2], carol, 'carol.test')
|
259
|
+
verifyIdentityEvent(identityEvts[3], dan, 'dan.test')
|
220
260
|
})
|
221
261
|
|
222
262
|
it('syncs new events', async () => {
|
@@ -303,9 +343,18 @@ describe('repo subscribe repos', () => {
|
|
303
343
|
ws.terminate()
|
304
344
|
|
305
345
|
await verifyCommitEvents(evts)
|
346
|
+
|
306
347
|
const handleEvts = getHandleEvts(evts.slice(-6))
|
348
|
+
expect(handleEvts.length).toBe(3)
|
307
349
|
verifyHandleEvent(handleEvts[0], alice, 'alice2.test')
|
308
350
|
verifyHandleEvent(handleEvts[1], bob, 'bob2.test')
|
351
|
+
verifyHandleEvent(handleEvts[2], bob, 'bob2.test')
|
352
|
+
|
353
|
+
const identityEvts = getIdentityEvts(evts.slice(-6))
|
354
|
+
expect(identityEvts.length).toBe(3)
|
355
|
+
verifyIdentityEvent(identityEvts[0], alice, 'alice2.test')
|
356
|
+
verifyIdentityEvent(identityEvts[1], bob, 'bob2.test')
|
357
|
+
verifyIdentityEvent(identityEvts[2], bob, 'bob2.test')
|
309
358
|
})
|
310
359
|
|
311
360
|
it('resends handle events on idempotent updates', async () => {
|
@@ -323,6 +372,121 @@ describe('repo subscribe repos', () => {
|
|
323
372
|
verifyHandleEvent(handleEvts[0], bob, 'bob2.test')
|
324
373
|
})
|
325
374
|
|
375
|
+
it('syncs account events', async () => {
|
376
|
+
// deactivate then reactivate alice
|
377
|
+
await agent.api.com.atproto.server.deactivateAccount(
|
378
|
+
{},
|
379
|
+
{
|
380
|
+
encoding: 'application/json',
|
381
|
+
headers: sc.getHeaders(alice),
|
382
|
+
},
|
383
|
+
)
|
384
|
+
await agent.api.com.atproto.server.activateAccount(undefined, {
|
385
|
+
headers: sc.getHeaders(alice),
|
386
|
+
})
|
387
|
+
|
388
|
+
// takedown then restore bob
|
389
|
+
await agent.api.com.atproto.admin.updateSubjectStatus(
|
390
|
+
{
|
391
|
+
subject: {
|
392
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
393
|
+
did: bob,
|
394
|
+
},
|
395
|
+
takedown: { applied: true },
|
396
|
+
},
|
397
|
+
{
|
398
|
+
encoding: 'application/json',
|
399
|
+
headers: network.pds.adminAuthHeaders(),
|
400
|
+
},
|
401
|
+
)
|
402
|
+
await agent.api.com.atproto.admin.updateSubjectStatus(
|
403
|
+
{
|
404
|
+
subject: {
|
405
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
406
|
+
did: bob,
|
407
|
+
},
|
408
|
+
takedown: { applied: false },
|
409
|
+
},
|
410
|
+
{
|
411
|
+
encoding: 'application/json',
|
412
|
+
headers: network.pds.adminAuthHeaders(),
|
413
|
+
},
|
414
|
+
)
|
415
|
+
|
416
|
+
const ws = new WebSocket(
|
417
|
+
`ws://${serverHost}/xrpc/com.atproto.sync.subscribeRepos?cursor=${-1}`,
|
418
|
+
)
|
419
|
+
|
420
|
+
const gen = byFrame(ws)
|
421
|
+
const evts = await readTillCaughtUp(gen)
|
422
|
+
ws.terminate()
|
423
|
+
|
424
|
+
// @NOTE requires a larger slice because of over-emission on activateAccount - see note on route
|
425
|
+
const accountEvts = getAccountEvts(evts.slice(-6))
|
426
|
+
expect(accountEvts.length).toBe(4)
|
427
|
+
verifyAccountEvent(accountEvts[0], alice, false, AccountStatus.Deactivated)
|
428
|
+
verifyAccountEvent(accountEvts[1], alice, true)
|
429
|
+
verifyAccountEvent(accountEvts[2], bob, false, AccountStatus.Takendown)
|
430
|
+
verifyAccountEvent(accountEvts[3], bob, true)
|
431
|
+
})
|
432
|
+
|
433
|
+
it('syncs interleaved account events', async () => {
|
434
|
+
// deactivate -> takedown -> restore -> activate
|
435
|
+
// deactivate then reactivate alice
|
436
|
+
await agent.api.com.atproto.server.deactivateAccount(
|
437
|
+
{},
|
438
|
+
{
|
439
|
+
encoding: 'application/json',
|
440
|
+
headers: sc.getHeaders(alice),
|
441
|
+
},
|
442
|
+
)
|
443
|
+
await agent.api.com.atproto.admin.updateSubjectStatus(
|
444
|
+
{
|
445
|
+
subject: {
|
446
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
447
|
+
did: alice,
|
448
|
+
},
|
449
|
+
takedown: { applied: true },
|
450
|
+
},
|
451
|
+
{
|
452
|
+
encoding: 'application/json',
|
453
|
+
headers: network.pds.adminAuthHeaders(),
|
454
|
+
},
|
455
|
+
)
|
456
|
+
await agent.api.com.atproto.admin.updateSubjectStatus(
|
457
|
+
{
|
458
|
+
subject: {
|
459
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
460
|
+
did: alice,
|
461
|
+
},
|
462
|
+
takedown: { applied: false },
|
463
|
+
},
|
464
|
+
{
|
465
|
+
encoding: 'application/json',
|
466
|
+
headers: network.pds.adminAuthHeaders(),
|
467
|
+
},
|
468
|
+
)
|
469
|
+
await agent.api.com.atproto.server.activateAccount(undefined, {
|
470
|
+
headers: sc.getHeaders(alice),
|
471
|
+
})
|
472
|
+
|
473
|
+
const ws = new WebSocket(
|
474
|
+
`ws://${serverHost}/xrpc/com.atproto.sync.subscribeRepos?cursor=${-1}`,
|
475
|
+
)
|
476
|
+
|
477
|
+
const gen = byFrame(ws)
|
478
|
+
const evts = await readTillCaughtUp(gen)
|
479
|
+
ws.terminate()
|
480
|
+
|
481
|
+
// @NOTE requires a larger slice because of over-emission on activateAccount - see note on route
|
482
|
+
const accountEvts = getAccountEvts(evts.slice(-6))
|
483
|
+
expect(accountEvts.length).toBe(4)
|
484
|
+
verifyAccountEvent(accountEvts[0], alice, false, AccountStatus.Deactivated)
|
485
|
+
verifyAccountEvent(accountEvts[1], alice, false, AccountStatus.Takendown)
|
486
|
+
verifyAccountEvent(accountEvts[2], alice, false, AccountStatus.Deactivated)
|
487
|
+
verifyAccountEvent(accountEvts[3], alice, true)
|
488
|
+
})
|
489
|
+
|
326
490
|
it('syncs tombstones', async () => {
|
327
491
|
const baddie1 = (
|
328
492
|
await sc.createAccount('baddie1.test', {
|
@@ -338,10 +502,24 @@ describe('repo subscribe repos', () => {
|
|
338
502
|
password: 'baddie2-pass',
|
339
503
|
})
|
340
504
|
).did
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
505
|
+
const deleteToken = await ctx.accountManager.createEmailToken(
|
506
|
+
baddie1,
|
507
|
+
'delete_account',
|
508
|
+
)
|
509
|
+
await agent.api.com.atproto.server.deleteAccount({
|
510
|
+
did: baddie1,
|
511
|
+
password: 'baddie1-pass',
|
512
|
+
token: deleteToken,
|
513
|
+
})
|
514
|
+
await agent.api.com.atproto.admin.deleteAccount(
|
515
|
+
{
|
516
|
+
did: baddie2,
|
517
|
+
},
|
518
|
+
{
|
519
|
+
encoding: 'application/json',
|
520
|
+
headers: network.pds.adminAuthHeaders(),
|
521
|
+
},
|
522
|
+
)
|
345
523
|
|
346
524
|
const ws = new WebSocket(
|
347
525
|
`ws://${serverHost}/xrpc/com.atproto.sync.subscribeRepos?cursor=${-1}`,
|
@@ -351,9 +529,15 @@ describe('repo subscribe repos', () => {
|
|
351
529
|
const evts = await readTillCaughtUp(gen)
|
352
530
|
ws.terminate()
|
353
531
|
|
354
|
-
const tombstoneEvts = getTombstoneEvts(evts.slice(-
|
532
|
+
const tombstoneEvts = getTombstoneEvts(evts.slice(-4))
|
533
|
+
expect(tombstoneEvts.length).toBe(2)
|
355
534
|
verifyTombstoneEvent(tombstoneEvts[0], baddie1)
|
356
535
|
verifyTombstoneEvent(tombstoneEvts[1], baddie2)
|
536
|
+
|
537
|
+
const accountEvts = getAccountEvts(evts.slice(-4))
|
538
|
+
expect(accountEvts.length).toBe(2)
|
539
|
+
verifyAccountEvent(accountEvts[0], baddie1, false, AccountStatus.Deleted)
|
540
|
+
verifyAccountEvent(accountEvts[1], baddie2, false, AccountStatus.Deleted)
|
357
541
|
})
|
358
542
|
|
359
543
|
it('account deletions invalidate all seq ops', async () => {
|
package/tests/sync/sync.test.ts
CHANGED
@@ -18,6 +18,7 @@ describe('repo sync', () => {
|
|
18
18
|
const uris: AtUri[] = []
|
19
19
|
const storage = new MemoryBlockstore()
|
20
20
|
let currRoot: CID | undefined
|
21
|
+
let currRev: string | undefined
|
21
22
|
|
22
23
|
beforeAll(async () => {
|
23
24
|
network = await TestNetworkNoAppView.create({
|
@@ -64,6 +65,7 @@ describe('repo sync', () => {
|
|
64
65
|
expect(contents).toEqual(repoData)
|
65
66
|
|
66
67
|
currRoot = car.root
|
68
|
+
currRev = loaded.commit.rev
|
67
69
|
})
|
68
70
|
|
69
71
|
it('syncs creates and deletes', async () => {
|
@@ -101,6 +103,16 @@ describe('repo sync', () => {
|
|
101
103
|
expect(contents).toEqual(repoData)
|
102
104
|
|
103
105
|
currRoot = car.root
|
106
|
+
currRev = loaded.commit.rev
|
107
|
+
})
|
108
|
+
|
109
|
+
it('syncs repo status', async () => {
|
110
|
+
const status = await agent.api.com.atproto.sync.getRepoStatus({ did })
|
111
|
+
expect(status.data).toEqual({
|
112
|
+
did,
|
113
|
+
active: true,
|
114
|
+
rev: currRev,
|
115
|
+
})
|
104
116
|
})
|
105
117
|
|
106
118
|
it('syncs latest repo commit', async () => {
|
@@ -211,15 +223,47 @@ describe('repo sync', () => {
|
|
211
223
|
)
|
212
224
|
})
|
213
225
|
|
226
|
+
afterAll(async () => {
|
227
|
+
await agent.api.com.atproto.admin.updateSubjectStatus(
|
228
|
+
{
|
229
|
+
subject: {
|
230
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
231
|
+
did,
|
232
|
+
},
|
233
|
+
takedown: { applied: false },
|
234
|
+
},
|
235
|
+
{
|
236
|
+
encoding: 'application/json',
|
237
|
+
headers: network.pds.adminAuthHeaders(),
|
238
|
+
},
|
239
|
+
)
|
240
|
+
})
|
241
|
+
|
242
|
+
it('returns takendown status', async () => {
|
243
|
+
const res = await agent.api.com.atproto.sync.getRepoStatus({ did })
|
244
|
+
expect(res.data).toEqual({
|
245
|
+
did,
|
246
|
+
active: false,
|
247
|
+
status: 'takendown',
|
248
|
+
})
|
249
|
+
})
|
250
|
+
|
251
|
+
it('lists as takendown in listRepos', async () => {
|
252
|
+
const res = await agent.api.com.atproto.sync.listRepos()
|
253
|
+
const found = res.data.repos.find((r) => r.did === did)
|
254
|
+
expect(found?.active).toBe(false)
|
255
|
+
expect(found?.status).toBe('takendown')
|
256
|
+
})
|
257
|
+
|
214
258
|
it('does not sync repo unauthed', async () => {
|
215
259
|
const tryGetRepo = agent.api.com.atproto.sync.getRepo({ did })
|
216
|
-
await expect(tryGetRepo).rejects.toThrow(/
|
260
|
+
await expect(tryGetRepo).rejects.toThrow(/Repo has been takendown/)
|
217
261
|
})
|
218
262
|
|
219
263
|
it('syncs repo to owner or admin', async () => {
|
220
264
|
const tryGetRepoOwner = agent.api.com.atproto.sync.getRepo(
|
221
265
|
{ did },
|
222
|
-
{ headers:
|
266
|
+
{ headers: sc.getHeaders(did) },
|
223
267
|
)
|
224
268
|
await expect(tryGetRepoOwner).resolves.toBeDefined()
|
225
269
|
const tryGetRepoAdmin = agent.api.com.atproto.sync.getRepo(
|
@@ -231,7 +275,7 @@ describe('repo sync', () => {
|
|
231
275
|
|
232
276
|
it('does not sync latest commit unauthed', async () => {
|
233
277
|
const tryGetLatest = agent.api.com.atproto.sync.getLatestCommit({ did })
|
234
|
-
await expect(tryGetLatest).rejects.toThrow(/
|
278
|
+
await expect(tryGetLatest).rejects.toThrow(/Repo has been takendown/)
|
235
279
|
})
|
236
280
|
|
237
281
|
it('does not sync a record proof unauthed', async () => {
|
@@ -242,7 +286,7 @@ describe('repo sync', () => {
|
|
242
286
|
collection,
|
243
287
|
rkey,
|
244
288
|
})
|
245
|
-
await expect(tryGetRecord).rejects.toThrow(/
|
289
|
+
await expect(tryGetRecord).rejects.toThrow(/Repo has been takendown/)
|
246
290
|
})
|
247
291
|
})
|
248
292
|
})
|