@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.
Files changed (347) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/account-manager/helpers/account.d.ts +20 -1
  3. package/dist/account-manager/helpers/account.d.ts.map +1 -1
  4. package/dist/account-manager/helpers/account.js +32 -7
  5. package/dist/account-manager/helpers/account.js.map +1 -1
  6. package/dist/account-manager/index.d.ts +7 -2
  7. package/dist/account-manager/index.d.ts.map +1 -1
  8. package/dist/account-manager/index.js +24 -8
  9. package/dist/account-manager/index.js.map +1 -1
  10. package/dist/api/app/bsky/actor/getPreferences.js +1 -1
  11. package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
  12. package/dist/api/app/bsky/actor/getProfile.js +1 -1
  13. package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
  14. package/dist/api/app/bsky/actor/getProfiles.js +1 -1
  15. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  16. package/dist/api/app/bsky/actor/putPreferences.js +1 -1
  17. package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
  18. package/dist/api/app/bsky/feed/getActorLikes.js +1 -1
  19. package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
  20. package/dist/api/app/bsky/feed/getAuthorFeed.js +1 -1
  21. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  22. package/dist/api/app/bsky/feed/getFeed.js +1 -1
  23. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  24. package/dist/api/app/bsky/feed/getPostThread.js +1 -1
  25. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  26. package/dist/api/app/bsky/feed/getTimeline.js +1 -1
  27. package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
  28. package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
  29. package/dist/api/app/bsky/notification/registerPush.js +4 -1
  30. package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
  31. package/dist/api/chat/index.js +14 -14
  32. package/dist/api/chat/index.js.map +1 -1
  33. package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
  34. package/dist/api/com/atproto/admin/deleteAccount.js +4 -2
  35. package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
  36. package/dist/api/com/atproto/admin/getAccountInfo.d.ts.map +1 -1
  37. package/dist/api/com/atproto/admin/getAccountInfo.js +1 -0
  38. package/dist/api/com/atproto/admin/getAccountInfo.js.map +1 -1
  39. package/dist/api/com/atproto/admin/getSubjectStatus.d.ts.map +1 -1
  40. package/dist/api/com/atproto/admin/getSubjectStatus.js +4 -3
  41. package/dist/api/com/atproto/admin/getSubjectStatus.js.map +1 -1
  42. package/dist/api/com/atproto/admin/updateAccountHandle.js +1 -1
  43. package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
  44. package/dist/api/com/atproto/admin/updateSubjectStatus.d.ts.map +1 -1
  45. package/dist/api/com/atproto/admin/updateSubjectStatus.js +2 -0
  46. package/dist/api/com/atproto/admin/updateSubjectStatus.js.map +1 -1
  47. package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js +1 -1
  48. package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js.map +1 -1
  49. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +1 -1
  50. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
  51. package/dist/api/com/atproto/identity/signPlcOperation.js +1 -1
  52. package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
  53. package/dist/api/com/atproto/identity/submitPlcOperation.d.ts.map +1 -1
  54. package/dist/api/com/atproto/identity/submitPlcOperation.js +1 -1
  55. package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
  56. package/dist/api/com/atproto/identity/updateHandle.js +2 -2
  57. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  58. package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
  59. package/dist/api/com/atproto/repo/applyWrites.js +4 -1
  60. package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
  61. package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
  62. package/dist/api/com/atproto/repo/createRecord.js +4 -1
  63. package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
  64. package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  65. package/dist/api/com/atproto/repo/deleteRecord.js +4 -1
  66. package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
  67. package/dist/api/com/atproto/repo/describeRepo.d.ts.map +1 -1
  68. package/dist/api/com/atproto/repo/describeRepo.js +2 -4
  69. package/dist/api/com/atproto/repo/describeRepo.js.map +1 -1
  70. package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
  71. package/dist/api/com/atproto/repo/importRepo.js +3 -1
  72. package/dist/api/com/atproto/repo/importRepo.js.map +1 -1
  73. package/dist/api/com/atproto/repo/listMissingBlobs.js +1 -1
  74. package/dist/api/com/atproto/repo/listMissingBlobs.js.map +1 -1
  75. package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
  76. package/dist/api/com/atproto/repo/putRecord.js +4 -1
  77. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  78. package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
  79. package/dist/api/com/atproto/repo/uploadBlob.js +3 -1
  80. package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
  81. package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
  82. package/dist/api/com/atproto/server/activateAccount.js +3 -2
  83. package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
  84. package/dist/api/com/atproto/server/checkAccountStatus.js +1 -1
  85. package/dist/api/com/atproto/server/checkAccountStatus.js.map +1 -1
  86. package/dist/api/com/atproto/server/confirmEmail.js +1 -1
  87. package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
  88. package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
  89. package/dist/api/com/atproto/server/createAccount.js +4 -2
  90. package/dist/api/com/atproto/server/createAccount.js.map +1 -1
  91. package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
  92. package/dist/api/com/atproto/server/createAppPassword.js +3 -1
  93. package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
  94. package/dist/api/com/atproto/server/createSession.d.ts.map +1 -1
  95. package/dist/api/com/atproto/server/createSession.js +2 -0
  96. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  97. package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
  98. package/dist/api/com/atproto/server/deactivateAccount.js +3 -1
  99. package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
  100. package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
  101. package/dist/api/com/atproto/server/deleteAccount.js +4 -3
  102. package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
  103. package/dist/api/com/atproto/server/getAccountInviteCodes.js +1 -1
  104. package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
  105. package/dist/api/com/atproto/server/getServiceAuth.js +1 -1
  106. package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
  107. package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
  108. package/dist/api/com/atproto/server/getSession.js +7 -2
  109. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  110. package/dist/api/com/atproto/server/listAppPasswords.js +1 -1
  111. package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
  112. package/dist/api/com/atproto/server/refreshSession.d.ts.map +1 -1
  113. package/dist/api/com/atproto/server/refreshSession.js +2 -0
  114. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  115. package/dist/api/com/atproto/server/requestAccountDelete.js +1 -1
  116. package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
  117. package/dist/api/com/atproto/server/requestEmailConfirmation.js +1 -1
  118. package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
  119. package/dist/api/com/atproto/server/requestEmailUpdate.js +1 -1
  120. package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
  121. package/dist/api/com/atproto/server/revokeAppPassword.js +1 -1
  122. package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
  123. package/dist/api/com/atproto/server/updateEmail.js +1 -1
  124. package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
  125. package/dist/api/com/atproto/server/util.d.ts +1 -0
  126. package/dist/api/com/atproto/server/util.d.ts.map +1 -1
  127. package/dist/api/com/atproto/server/util.js +9 -6
  128. package/dist/api/com/atproto/server/util.js.map +1 -1
  129. package/dist/api/com/atproto/sync/deprecated/getCheckout.d.ts.map +1 -1
  130. package/dist/api/com/atproto/sync/deprecated/getCheckout.js +2 -8
  131. package/dist/api/com/atproto/sync/deprecated/getCheckout.js.map +1 -1
  132. package/dist/api/com/atproto/sync/deprecated/getHead.d.ts.map +1 -1
  133. package/dist/api/com/atproto/sync/deprecated/getHead.js +2 -7
  134. package/dist/api/com/atproto/sync/deprecated/getHead.js.map +1 -1
  135. package/dist/api/com/atproto/sync/getBlob.d.ts.map +1 -1
  136. package/dist/api/com/atproto/sync/getBlob.js +3 -6
  137. package/dist/api/com/atproto/sync/getBlob.js.map +1 -1
  138. package/dist/api/com/atproto/sync/getBlocks.d.ts.map +1 -1
  139. package/dist/api/com/atproto/sync/getBlocks.js +2 -7
  140. package/dist/api/com/atproto/sync/getBlocks.js.map +1 -1
  141. package/dist/api/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
  142. package/dist/api/com/atproto/sync/getLatestCommit.js +2 -7
  143. package/dist/api/com/atproto/sync/getLatestCommit.js.map +1 -1
  144. package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
  145. package/dist/api/com/atproto/sync/getRecord.js +2 -7
  146. package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
  147. package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
  148. package/dist/api/com/atproto/sync/getRepo.js +2 -7
  149. package/dist/api/com/atproto/sync/getRepo.js.map +1 -1
  150. package/dist/api/com/atproto/sync/getRepoStatus.d.ts +4 -0
  151. package/dist/api/com/atproto/sync/getRepoStatus.d.ts.map +1 -0
  152. package/dist/api/com/atproto/sync/getRepoStatus.js +28 -0
  153. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -0
  154. package/dist/api/com/atproto/sync/index.d.ts.map +1 -1
  155. package/dist/api/com/atproto/sync/index.js +2 -0
  156. package/dist/api/com/atproto/sync/index.js.map +1 -1
  157. package/dist/api/com/atproto/sync/listBlobs.d.ts.map +1 -1
  158. package/dist/api/com/atproto/sync/listBlobs.js +2 -8
  159. package/dist/api/com/atproto/sync/listBlobs.js.map +1 -1
  160. package/dist/api/com/atproto/sync/listRepos.d.ts.map +1 -1
  161. package/dist/api/com/atproto/sync/listRepos.js +13 -8
  162. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  163. package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  164. package/dist/api/com/atproto/sync/subscribeRepos.js +8 -0
  165. package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
  166. package/dist/api/com/atproto/sync/util.d.ts +4 -0
  167. package/dist/api/com/atproto/sync/util.d.ts.map +1 -0
  168. package/dist/api/com/atproto/sync/util.js +25 -0
  169. package/dist/api/com/atproto/sync/util.js.map +1 -0
  170. package/dist/api/com/atproto/temp/checkSignupQueue.d.ts.map +1 -1
  171. package/dist/api/com/atproto/temp/checkSignupQueue.js +4 -1
  172. package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
  173. package/dist/auth-verifier.d.ts +13 -7
  174. package/dist/auth-verifier.d.ts.map +1 -1
  175. package/dist/auth-verifier.js +29 -46
  176. package/dist/auth-verifier.js.map +1 -1
  177. package/dist/index.d.ts +1 -0
  178. package/dist/index.d.ts.map +1 -1
  179. package/dist/index.js +3 -1
  180. package/dist/index.js.map +1 -1
  181. package/dist/lexicon/index.d.ts +2 -0
  182. package/dist/lexicon/index.d.ts.map +1 -1
  183. package/dist/lexicon/index.js +4 -0
  184. package/dist/lexicon/index.js.map +1 -1
  185. package/dist/lexicon/lexicons.d.ts +145 -0
  186. package/dist/lexicon/lexicons.d.ts.map +1 -1
  187. package/dist/lexicon/lexicons.js +225 -4
  188. package/dist/lexicon/lexicons.js.map +1 -1
  189. package/dist/lexicon/types/chat/bsky/convo/defs.d.ts +1 -1
  190. package/dist/lexicon/types/com/atproto/admin/defs.d.ts +1 -0
  191. package/dist/lexicon/types/com/atproto/admin/defs.d.ts.map +1 -1
  192. package/dist/lexicon/types/com/atproto/admin/defs.js.map +1 -1
  193. package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +1 -0
  194. package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts.map +1 -1
  195. package/dist/lexicon/types/com/atproto/server/createSession.d.ts +3 -0
  196. package/dist/lexicon/types/com/atproto/server/createSession.d.ts.map +1 -1
  197. package/dist/lexicon/types/com/atproto/server/getSession.d.ts +3 -0
  198. package/dist/lexicon/types/com/atproto/server/getSession.d.ts.map +1 -1
  199. package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +3 -0
  200. package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts.map +1 -1
  201. package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts +1 -0
  202. package/dist/lexicon/types/com/atproto/sync/getBlob.d.ts.map +1 -1
  203. package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts +1 -0
  204. package/dist/lexicon/types/com/atproto/sync/getBlocks.d.ts.map +1 -1
  205. package/dist/lexicon/types/com/atproto/sync/getLatestCommit.d.ts +1 -1
  206. package/dist/lexicon/types/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
  207. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +1 -0
  208. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
  209. package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts +1 -0
  210. package/dist/lexicon/types/com/atproto/sync/getRepo.d.ts.map +1 -1
  211. package/dist/lexicon/types/com/atproto/sync/getRepoStatus.d.ts +42 -0
  212. package/dist/lexicon/types/com/atproto/sync/getRepoStatus.d.ts.map +1 -0
  213. package/dist/lexicon/types/com/atproto/sync/getRepoStatus.js +3 -0
  214. package/dist/lexicon/types/com/atproto/sync/getRepoStatus.js.map +1 -0
  215. package/dist/lexicon/types/com/atproto/sync/listBlobs.d.ts +1 -0
  216. package/dist/lexicon/types/com/atproto/sync/listBlobs.d.ts.map +1 -1
  217. package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +3 -0
  218. package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts.map +1 -1
  219. package/dist/lexicon/types/com/atproto/sync/listRepos.js.map +1 -1
  220. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +19 -4
  221. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  222. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +11 -1
  223. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
  224. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts +2 -0
  225. package/dist/lexicon/types/tools/ozone/moderation/defs.d.ts.map +1 -1
  226. package/dist/lexicon/types/tools/ozone/moderation/defs.js.map +1 -1
  227. package/dist/pipethrough.d.ts.map +1 -1
  228. package/dist/pipethrough.js +17 -14
  229. package/dist/pipethrough.js.map +1 -1
  230. package/dist/scripts/index.d.ts +4 -0
  231. package/dist/scripts/index.d.ts.map +1 -0
  232. package/dist/scripts/index.js +8 -0
  233. package/dist/scripts/index.js.map +1 -0
  234. package/dist/scripts/rebuild-repo.d.ts +3 -0
  235. package/dist/scripts/rebuild-repo.d.ts.map +1 -0
  236. package/dist/scripts/rebuild-repo.js +121 -0
  237. package/dist/scripts/rebuild-repo.js.map +1 -0
  238. package/dist/sequencer/db/schema.d.ts +1 -1
  239. package/dist/sequencer/db/schema.d.ts.map +1 -1
  240. package/dist/sequencer/events.d.ts +27 -2
  241. package/dist/sequencer/events.d.ts.map +1 -1
  242. package/dist/sequencer/events.js +35 -2
  243. package/dist/sequencer/events.js.map +1 -1
  244. package/dist/sequencer/sequencer.d.ts +8 -6
  245. package/dist/sequencer/sequencer.d.ts.map +1 -1
  246. package/dist/sequencer/sequencer.js +22 -9
  247. package/dist/sequencer/sequencer.js.map +1 -1
  248. package/package.json +4 -4
  249. package/src/account-manager/helpers/account.ts +38 -6
  250. package/src/account-manager/index.ts +21 -8
  251. package/src/api/app/bsky/actor/getPreferences.ts +1 -1
  252. package/src/api/app/bsky/actor/getProfile.ts +1 -1
  253. package/src/api/app/bsky/actor/getProfiles.ts +1 -1
  254. package/src/api/app/bsky/actor/putPreferences.ts +1 -1
  255. package/src/api/app/bsky/feed/getActorLikes.ts +1 -1
  256. package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -1
  257. package/src/api/app/bsky/feed/getFeed.ts +1 -1
  258. package/src/api/app/bsky/feed/getPostThread.ts +1 -1
  259. package/src/api/app/bsky/feed/getTimeline.ts +1 -1
  260. package/src/api/app/bsky/notification/registerPush.ts +4 -1
  261. package/src/api/chat/index.ts +14 -14
  262. package/src/api/com/atproto/admin/deleteAccount.ts +7 -2
  263. package/src/api/com/atproto/admin/getAccountInfo.ts +1 -0
  264. package/src/api/com/atproto/admin/getSubjectStatus.ts +4 -3
  265. package/src/api/com/atproto/admin/updateAccountHandle.ts +1 -1
  266. package/src/api/com/atproto/admin/updateSubjectStatus.ts +2 -0
  267. package/src/api/com/atproto/identity/getRecommendedDidCredentials.ts +1 -1
  268. package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +1 -1
  269. package/src/api/com/atproto/identity/signPlcOperation.ts +1 -1
  270. package/src/api/com/atproto/identity/submitPlcOperation.ts +2 -1
  271. package/src/api/com/atproto/identity/updateHandle.ts +2 -2
  272. package/src/api/com/atproto/repo/applyWrites.ts +4 -1
  273. package/src/api/com/atproto/repo/createRecord.ts +4 -1
  274. package/src/api/com/atproto/repo/deleteRecord.ts +4 -1
  275. package/src/api/com/atproto/repo/describeRepo.ts +2 -4
  276. package/src/api/com/atproto/repo/importRepo.ts +3 -1
  277. package/src/api/com/atproto/repo/listMissingBlobs.ts +1 -1
  278. package/src/api/com/atproto/repo/putRecord.ts +4 -1
  279. package/src/api/com/atproto/repo/uploadBlob.ts +3 -1
  280. package/src/api/com/atproto/server/activateAccount.ts +3 -2
  281. package/src/api/com/atproto/server/checkAccountStatus.ts +1 -1
  282. package/src/api/com/atproto/server/confirmEmail.ts +1 -1
  283. package/src/api/com/atproto/server/createAccount.ts +6 -3
  284. package/src/api/com/atproto/server/createAppPassword.ts +3 -1
  285. package/src/api/com/atproto/server/createSession.ts +2 -0
  286. package/src/api/com/atproto/server/deactivateAccount.ts +3 -1
  287. package/src/api/com/atproto/server/deleteAccount.ts +7 -3
  288. package/src/api/com/atproto/server/getAccountInviteCodes.ts +1 -1
  289. package/src/api/com/atproto/server/getServiceAuth.ts +1 -1
  290. package/src/api/com/atproto/server/getSession.ts +7 -2
  291. package/src/api/com/atproto/server/listAppPasswords.ts +1 -1
  292. package/src/api/com/atproto/server/refreshSession.ts +2 -0
  293. package/src/api/com/atproto/server/requestAccountDelete.ts +1 -1
  294. package/src/api/com/atproto/server/requestEmailConfirmation.ts +1 -1
  295. package/src/api/com/atproto/server/requestEmailUpdate.ts +1 -1
  296. package/src/api/com/atproto/server/revokeAppPassword.ts +1 -1
  297. package/src/api/com/atproto/server/updateEmail.ts +1 -1
  298. package/src/api/com/atproto/server/util.ts +12 -5
  299. package/src/api/com/atproto/sync/deprecated/getCheckout.ts +6 -8
  300. package/src/api/com/atproto/sync/deprecated/getHead.ts +7 -10
  301. package/src/api/com/atproto/sync/getBlob.ts +8 -6
  302. package/src/api/com/atproto/sync/getBlocks.ts +6 -7
  303. package/src/api/com/atproto/sync/getLatestCommit.ts +7 -10
  304. package/src/api/com/atproto/sync/getRecord.ts +7 -7
  305. package/src/api/com/atproto/sync/getRepo.ts +6 -7
  306. package/src/api/com/atproto/sync/getRepoStatus.ts +31 -0
  307. package/src/api/com/atproto/sync/index.ts +2 -0
  308. package/src/api/com/atproto/sync/listBlobs.ts +6 -8
  309. package/src/api/com/atproto/sync/listRepos.ts +13 -8
  310. package/src/api/com/atproto/sync/subscribeRepos.ts +7 -0
  311. package/src/api/com/atproto/sync/util.ts +36 -0
  312. package/src/api/com/atproto/temp/checkSignupQueue.ts +4 -1
  313. package/src/auth-verifier.ts +62 -47
  314. package/src/index.ts +1 -0
  315. package/src/lexicon/index.ts +12 -0
  316. package/src/lexicon/lexicons.ts +236 -7
  317. package/src/lexicon/types/chat/bsky/convo/defs.ts +1 -1
  318. package/src/lexicon/types/com/atproto/admin/defs.ts +1 -0
  319. package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +1 -0
  320. package/src/lexicon/types/com/atproto/server/createSession.ts +3 -0
  321. package/src/lexicon/types/com/atproto/server/getSession.ts +3 -0
  322. package/src/lexicon/types/com/atproto/server/refreshSession.ts +3 -0
  323. package/src/lexicon/types/com/atproto/sync/getBlob.ts +6 -0
  324. package/src/lexicon/types/com/atproto/sync/getBlocks.ts +6 -0
  325. package/src/lexicon/types/com/atproto/sync/getLatestCommit.ts +1 -1
  326. package/src/lexicon/types/com/atproto/sync/getRecord.ts +6 -0
  327. package/src/lexicon/types/com/atproto/sync/getRepo.ts +1 -0
  328. package/src/lexicon/types/com/atproto/sync/getRepoStatus.ts +52 -0
  329. package/src/lexicon/types/com/atproto/sync/listBlobs.ts +1 -0
  330. package/src/lexicon/types/com/atproto/sync/listRepos.ts +3 -0
  331. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +30 -3
  332. package/src/lexicon/types/tools/ozone/moderation/defs.ts +2 -0
  333. package/src/pipethrough.ts +5 -4
  334. package/src/scripts/index.ts +5 -0
  335. package/src/scripts/rebuild-repo.ts +143 -0
  336. package/src/sequencer/db/schema.ts +1 -0
  337. package/src/sequencer/events.ts +47 -0
  338. package/src/sequencer/sequencer.ts +35 -14
  339. package/tests/account-deactivation.test.ts +67 -12
  340. package/tests/account-deletion.test.ts +10 -2
  341. package/tests/auth.test.ts +3 -0
  342. package/tests/moderation.test.ts +2 -2
  343. package/tests/proxied/notif.test.ts +1 -0
  344. package/tests/sequencer.test.ts +2 -2
  345. package/tests/sync/list.test.ts +1 -0
  346. package/tests/sync/subscribe-repos.test.ts +224 -40
  347. package/tests/sync/sync.test.ts +48 -4
@@ -1,5 +1,10 @@
1
1
  import AtpAgent from '@atproto/api'
2
- import { SeedClient, TestNetworkNoAppView, basicSeed } from '@atproto/dev-env'
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: blobCid,
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
- expect(listedRepos.data.repos.find((r) => r.did === alice)).toBeUndefined()
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 all seqs for this did are gone, except for the tombstone
146
+ // check we didn't touch other user seqs
147
147
  expect(
148
- updatedDbContents.repoSeqs.filter((row) => row.eventType !== 'tombstone'),
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(
@@ -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)
@@ -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('Blob not found')
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('Blob not found')
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),
@@ -37,6 +37,7 @@ describe('notif service proxy', () => {
37
37
  }
38
38
  return x
39
39
  })
40
+ await network.pds.ctx.idResolver.did.resolve(notifDid, true)
40
41
  })
41
42
 
42
43
  afterAll(async () => {
@@ -25,8 +25,8 @@ describe('sequencer', () => {
25
25
  await userSeed(sc)
26
26
  alice = sc.dids.alice
27
27
  bob = sc.dids.bob
28
- // 10 events in userSeed
29
- totalEvts = 10
28
+ // 14 events in userSeed
29
+ totalEvts = 14
30
30
  })
31
31
 
32
32
  afterAll(async () => {
@@ -29,6 +29,7 @@ describe('sync listing', () => {
29
29
  sc.dids.carol,
30
30
  sc.dids.dan,
31
31
  ])
32
+ expect(res.data.repos.every((r) => r.active === true)).toBe(true)
32
33
  })
33
34
 
34
35
  it('paginates listed hosted repos', async () => {
@@ -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 getTombstoneEvts = (frames: Frame[]): TombstoneEvt[] => {
97
- const evts: TombstoneEvt[] = []
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 === '#tombstone') {
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 verifyHandleEvent = (evt: unknown, did: string, handle: string) => {
107
- expect(evt?.['did']).toBe(did)
108
- expect(evt?.['handle']).toBe(handle)
109
- expect(typeof evt?.['time']).toBe('string')
110
- expect(typeof evt?.['seq']).toBe('number')
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
- await verifyRepo(alice, getCommitEvents(alice, frames))
134
- await verifyRepo(bob, getCommitEvents(bob, frames))
135
- await verifyRepo(carol, getCommitEvents(carol, frames))
136
- await verifyRepo(dan, getCommitEvents(dan, frames))
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
- for (const did of [baddie1, baddie2]) {
343
- await ctx.sequencer.sequenceTombstone(did)
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(-2))
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 () => {
@@ -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(/Could not find repo for DID/)
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: { authorization: `Bearer ${sc.accounts[did].accessJwt}` } },
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(/Could not find root for DID/)
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(/Could not find repo for DID/)
289
+ await expect(tryGetRecord).rejects.toThrow(/Repo has been takendown/)
246
290
  })
247
291
  })
248
292
  })