@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
@@ -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 { didDocForSession } from './util'
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(
@@ -86,6 +86,8 @@ export default function (server: Server, ctx: AppContext) {
86
86
  emailConfirmed: !!user.emailConfirmedAt,
87
87
  accessJwt,
88
88
  refreshJwt,
89
+ active: user.active,
90
+ status: user.status,
89
91
  },
90
92
  }
91
93
  },
@@ -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.sequenceIdentityEvt(did)
48
- await ctx.sequencer.sequenceTombstone(did)
49
- await ctx.sequencer.deleteAllForUser(did)
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.accessAppPassPrivileged,
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.accessDeactived,
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.access,
7
+ auth: ctx.authVerifier.accessStandard(),
8
8
  handler: async ({ auth, req }) => {
9
9
  if (ctx.entrywayAgent) {
10
10
  return resultPassthru(
@@ -52,6 +52,8 @@ export default function (server: Server, ctx: AppContext) {
52
52
  handle: user.handle ?? INVALID_HANDLE,
53
53
  accessJwt: rotated.accessJwt,
54
54
  refreshJwt: rotated.refreshJwt,
55
+ active: user.active,
56
+ status: user.status,
55
57
  },
56
58
  }
57
59
  },
@@ -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.accessCheckTakedown,
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.accessCheckTakedown,
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.accessCheckTakedown,
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.access,
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 { dbLogger } from '../../../../logger'
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
- // @TODO once supporting multiple pdses, validate pds in did doc based on allow-list.
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
- dbLogger.warn({ err, did }, 'failed to resolve did doc')
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
- // takedown check for anyone other than an admin or the user
12
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
13
- const available = await ctx.accountManager.isRepoAvailable(did)
14
- if (!available) {
15
- throw new InvalidRequestError(`Could not find repo for DID: ${did}`)
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
- // takedown check for anyone other than an admin or the user
11
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
12
- const available = await ctx.accountManager.isRepoAvailable(did)
13
- if (!available) {
14
- throw new InvalidRequestError(
15
- `Could not find root for DID: ${did}`,
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
- if (!ctx.authVerifier.isUserOrAdmin(auth, params.did)) {
12
- const available = await ctx.accountManager.isRepoAvailable(params.did)
13
- if (!available) {
14
- throw new InvalidRequestError('Blob not found')
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
- // takedown check for anyone other than an admin or the user
14
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
15
- const available = await ctx.accountManager.isRepoAvailable(did)
16
- if (!available) {
17
- throw new InvalidRequestError(`Could not find repo for DID: ${did}`)
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
- // takedown check for anyone other than an admin or the user
11
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
12
- const available = await ctx.accountManager.isRepoAvailable(did)
13
- if (!available) {
14
- throw new InvalidRequestError(
15
- `Could not find root for DID: ${did}`,
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
- // takedown check for anyone other than an admin or the user
16
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
17
- const available = await ctx.accountManager.isRepoAvailable(did)
18
- if (!available) {
19
- throw new InvalidRequestError(`Could not find repo for DID: ${did}`)
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
- // takedown check for anyone other than an admin or the user
16
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
17
- const available = await ctx.accountManager.isRepoAvailable(did)
18
- if (!available) {
19
- throw new InvalidRequestError(`Could not find repo for DID: ${did}`)
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
- // takedown check for anyone other than an admin or the user
11
- if (!ctx.authVerifier.isUserOrAdmin(auth, did)) {
12
- const available = await ctx.accountManager.isRepoAvailable(did)
13
- if (!available) {
14
- throw new InvalidRequestError(`Could not find root for DID: ${did}`)
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 { notSoftDeletedClause } from '../../../../db/util'
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
- did: row.did,
34
- head: row.head,
35
- rev: row.rev ?? '',
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
+ }