@atproto/pds 0.4.103 → 0.4.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/account-manager/{index.d.ts → account-manager.d.ts} +26 -35
  3. package/dist/account-manager/account-manager.d.ts.map +1 -0
  4. package/dist/account-manager/{index.js → account-manager.js} +52 -207
  5. package/dist/account-manager/account-manager.js.map +1 -0
  6. package/dist/account-manager/helpers/account.d.ts +3 -3
  7. package/dist/account-manager/helpers/device-account.d.ts +15 -15
  8. package/dist/account-manager/helpers/device-account.d.ts.map +1 -1
  9. package/dist/account-manager/helpers/device-account.js +2 -1
  10. package/dist/account-manager/helpers/device-account.js.map +1 -1
  11. package/dist/account-manager/helpers/token.d.ts +98 -98
  12. package/dist/account-manager/oauth-store.d.ts +58 -0
  13. package/dist/account-manager/oauth-store.d.ts.map +1 -0
  14. package/dist/account-manager/oauth-store.js +417 -0
  15. package/dist/account-manager/oauth-store.js.map +1 -0
  16. package/dist/actor-store/record/reader.d.ts +3 -3
  17. package/dist/actor-store/repo/reader.d.ts +2 -0
  18. package/dist/actor-store/repo/reader.d.ts.map +1 -1
  19. package/dist/actor-store/repo/reader.js +9 -0
  20. package/dist/actor-store/repo/reader.js.map +1 -1
  21. package/dist/actor-store/repo/sql-repo-reader.d.ts +1 -1
  22. package/dist/actor-store/repo/transactor.d.ts.map +1 -1
  23. package/dist/actor-store/repo/transactor.js +13 -4
  24. package/dist/actor-store/repo/transactor.js.map +1 -1
  25. package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
  26. package/dist/api/com/atproto/admin/deleteAccount.js +2 -3
  27. package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
  28. package/dist/api/com/atproto/admin/sendEmail.d.ts.map +1 -1
  29. package/dist/api/com/atproto/admin/sendEmail.js +2 -7
  30. package/dist/api/com/atproto/admin/sendEmail.js.map +1 -1
  31. package/dist/api/com/atproto/admin/updateAccountEmail.d.ts.map +1 -1
  32. package/dist/api/com/atproto/admin/updateAccountEmail.js +1 -2
  33. package/dist/api/com/atproto/admin/updateAccountEmail.js.map +1 -1
  34. package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
  35. package/dist/api/com/atproto/admin/updateAccountHandle.js +2 -6
  36. package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
  37. package/dist/api/com/atproto/admin/updateAccountPassword.d.ts.map +1 -1
  38. package/dist/api/com/atproto/admin/updateAccountPassword.js +1 -2
  39. package/dist/api/com/atproto/admin/updateAccountPassword.js.map +1 -1
  40. package/dist/api/com/atproto/identity/requestPlcOperationSignature.d.ts.map +1 -1
  41. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +2 -7
  42. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
  43. package/dist/api/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  44. package/dist/api/com/atproto/identity/resolveHandle.js +2 -36
  45. package/dist/api/com/atproto/identity/resolveHandle.js.map +1 -1
  46. package/dist/api/com/atproto/identity/signPlcOperation.d.ts.map +1 -1
  47. package/dist/api/com/atproto/identity/signPlcOperation.js +2 -7
  48. package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
  49. package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
  50. package/dist/api/com/atproto/identity/updateHandle.js +3 -14
  51. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  52. package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
  53. package/dist/api/com/atproto/repo/applyWrites.js +12 -7
  54. package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
  55. package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
  56. package/dist/api/com/atproto/repo/createRecord.js +12 -8
  57. package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
  58. package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  59. package/dist/api/com/atproto/repo/deleteRecord.js +12 -7
  60. package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
  61. package/dist/api/com/atproto/repo/listRecords.d.ts.map +1 -1
  62. package/dist/api/com/atproto/repo/listRecords.js +1 -3
  63. package/dist/api/com/atproto/repo/listRecords.js.map +1 -1
  64. package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
  65. package/dist/api/com/atproto/repo/putRecord.js +11 -8
  66. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  67. package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
  68. package/dist/api/com/atproto/server/activateAccount.js +3 -20
  69. package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
  70. package/dist/api/com/atproto/server/confirmEmail.d.ts.map +1 -1
  71. package/dist/api/com/atproto/server/confirmEmail.js +2 -7
  72. package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
  73. package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
  74. package/dist/api/com/atproto/server/createAccount.js +5 -7
  75. package/dist/api/com/atproto/server/createAccount.js.map +1 -1
  76. package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
  77. package/dist/api/com/atproto/server/createAppPassword.js +2 -7
  78. package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
  79. package/dist/api/com/atproto/server/createSession.js +2 -2
  80. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  81. package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
  82. package/dist/api/com/atproto/server/deactivateAccount.js +1 -2
  83. package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
  84. package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
  85. package/dist/api/com/atproto/server/deleteAccount.js +3 -5
  86. package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
  87. package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
  88. package/dist/api/com/atproto/server/deleteSession.js +2 -3
  89. package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
  90. package/dist/api/com/atproto/server/getAccountInviteCodes.d.ts.map +1 -1
  91. package/dist/api/com/atproto/server/getAccountInviteCodes.js +2 -7
  92. package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
  93. package/dist/api/com/atproto/server/getSession.js +2 -2
  94. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  95. package/dist/api/com/atproto/server/listAppPasswords.d.ts.map +1 -1
  96. package/dist/api/com/atproto/server/listAppPasswords.js +2 -7
  97. package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
  98. package/dist/api/com/atproto/server/refreshSession.js +2 -2
  99. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  100. package/dist/api/com/atproto/server/requestAccountDelete.d.ts.map +1 -1
  101. package/dist/api/com/atproto/server/requestAccountDelete.js +2 -7
  102. package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
  103. package/dist/api/com/atproto/server/requestEmailConfirmation.d.ts.map +1 -1
  104. package/dist/api/com/atproto/server/requestEmailConfirmation.js +2 -7
  105. package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
  106. package/dist/api/com/atproto/server/requestEmailUpdate.d.ts.map +1 -1
  107. package/dist/api/com/atproto/server/requestEmailUpdate.js +2 -7
  108. package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
  109. package/dist/api/com/atproto/server/requestPasswordReset.d.ts.map +1 -1
  110. package/dist/api/com/atproto/server/requestPasswordReset.js +1 -2
  111. package/dist/api/com/atproto/server/requestPasswordReset.js.map +1 -1
  112. package/dist/api/com/atproto/server/resetPassword.d.ts.map +1 -1
  113. package/dist/api/com/atproto/server/resetPassword.js +1 -2
  114. package/dist/api/com/atproto/server/resetPassword.js.map +1 -1
  115. package/dist/api/com/atproto/server/revokeAppPassword.d.ts.map +1 -1
  116. package/dist/api/com/atproto/server/revokeAppPassword.js +2 -7
  117. package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
  118. package/dist/api/com/atproto/server/updateEmail.d.ts.map +1 -1
  119. package/dist/api/com/atproto/server/updateEmail.js +2 -7
  120. package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
  121. package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
  122. package/dist/api/com/atproto/sync/getRecord.js +1 -4
  123. package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
  124. package/dist/api/com/atproto/sync/getRepoStatus.js +1 -1
  125. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
  126. package/dist/api/com/atproto/sync/listRepos.js +1 -1
  127. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  128. package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  129. package/dist/api/com/atproto/sync/subscribeRepos.js +2 -10
  130. package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
  131. package/dist/api/com/atproto/temp/checkSignupQueue.js +1 -1
  132. package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
  133. package/dist/api/proxy.d.ts +7 -8
  134. package/dist/api/proxy.d.ts.map +1 -1
  135. package/dist/api/proxy.js +14 -6
  136. package/dist/api/proxy.js.map +1 -1
  137. package/dist/app-view.d.ts +14 -0
  138. package/dist/app-view.d.ts.map +1 -0
  139. package/dist/app-view.js +36 -0
  140. package/dist/app-view.js.map +1 -0
  141. package/dist/auth-routes.d.ts +1 -1
  142. package/dist/auth-routes.d.ts.map +1 -1
  143. package/dist/auth-routes.js +9 -3
  144. package/dist/auth-routes.js.map +1 -1
  145. package/dist/auth-verifier.d.ts +1 -1
  146. package/dist/auth-verifier.d.ts.map +1 -1
  147. package/dist/config/config.d.ts +3 -2
  148. package/dist/config/config.d.ts.map +1 -1
  149. package/dist/config/config.js +17 -7
  150. package/dist/config/config.js.map +1 -1
  151. package/dist/config/env.d.ts +4 -0
  152. package/dist/config/env.d.ts.map +1 -1
  153. package/dist/config/env.js +5 -0
  154. package/dist/config/env.js.map +1 -1
  155. package/dist/context.d.ts +11 -4
  156. package/dist/context.d.ts.map +1 -1
  157. package/dist/context.js +33 -18
  158. package/dist/context.js.map +1 -1
  159. package/dist/handle/index.d.ts +0 -7
  160. package/dist/handle/index.d.ts.map +1 -1
  161. package/dist/handle/index.js +4 -58
  162. package/dist/handle/index.js.map +1 -1
  163. package/dist/image/image-url.d.ts +8 -0
  164. package/dist/image/image-url.d.ts.map +1 -0
  165. package/dist/image/image-url.js +26 -0
  166. package/dist/image/image-url.js.map +1 -0
  167. package/dist/index.js +1 -1
  168. package/dist/index.js.map +1 -1
  169. package/dist/lexicon/index.d.ts +6 -0
  170. package/dist/lexicon/index.d.ts.map +1 -1
  171. package/dist/lexicon/index.js +12 -0
  172. package/dist/lexicon/index.js.map +1 -1
  173. package/dist/lexicon/lexicons.d.ts +412 -158
  174. package/dist/lexicon/lexicons.d.ts.map +1 -1
  175. package/dist/lexicon/lexicons.js +222 -81
  176. package/dist/lexicon/lexicons.js.map +1 -1
  177. package/dist/lexicon/types/app/bsky/embed/video.d.ts +1 -0
  178. package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -1
  179. package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
  180. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts +7 -0
  181. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts.map +1 -1
  182. package/dist/lexicon/types/app/bsky/labeler/defs.js.map +1 -1
  183. package/dist/lexicon/types/app/bsky/labeler/service.d.ts +7 -0
  184. package/dist/lexicon/types/app/bsky/labeler/service.d.ts.map +1 -1
  185. package/dist/lexicon/types/app/bsky/labeler/service.js.map +1 -1
  186. package/dist/lexicon/types/com/atproto/identity/defs.d.ts +17 -0
  187. package/dist/lexicon/types/com/atproto/identity/defs.d.ts.map +1 -0
  188. package/dist/lexicon/types/com/atproto/identity/defs.js +16 -0
  189. package/dist/lexicon/types/com/atproto/identity/defs.js.map +1 -0
  190. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
  191. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts.map +1 -0
  192. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js +7 -0
  193. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js.map +1 -0
  194. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts +40 -0
  195. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts.map +1 -0
  196. package/dist/lexicon/types/com/atproto/identity/resolveDid.js +7 -0
  197. package/dist/lexicon/types/com/atproto/identity/resolveDid.js.map +1 -0
  198. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts +1 -0
  199. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  200. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts +36 -0
  201. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts.map +1 -0
  202. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js +7 -0
  203. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js.map +1 -0
  204. package/dist/lexicon/types/com/atproto/moderation/defs.d.ts +2 -0
  205. package/dist/lexicon/types/com/atproto/moderation/defs.d.ts.map +1 -1
  206. package/dist/lexicon/types/com/atproto/repo/listRecords.d.ts +0 -4
  207. package/dist/lexicon/types/com/atproto/repo/listRecords.d.ts.map +1 -1
  208. package/dist/lexicon/types/com/atproto/repo/listRecords.js.map +1 -1
  209. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +0 -2
  210. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
  211. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +1 -30
  212. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  213. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +0 -27
  214. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
  215. package/dist/mailer/index.d.ts +5 -5
  216. package/dist/mailer/index.d.ts.map +1 -1
  217. package/dist/mailer/index.js +6 -5
  218. package/dist/mailer/index.js.map +1 -1
  219. package/dist/read-after-write/viewer.d.ts +1 -1
  220. package/dist/read-after-write/viewer.d.ts.map +1 -1
  221. package/dist/repo/types.d.ts +6 -2
  222. package/dist/repo/types.d.ts.map +1 -1
  223. package/dist/repo/types.js.map +1 -1
  224. package/dist/scripts/rebuild-repo.d.ts.map +1 -1
  225. package/dist/scripts/rebuild-repo.js +2 -1
  226. package/dist/scripts/rebuild-repo.js.map +1 -1
  227. package/dist/sequencer/db/schema.d.ts +1 -1
  228. package/dist/sequencer/db/schema.d.ts.map +1 -1
  229. package/dist/sequencer/events.d.ts +29 -41
  230. package/dist/sequencer/events.d.ts.map +1 -1
  231. package/dist/sequencer/events.js +24 -58
  232. package/dist/sequencer/events.js.map +1 -1
  233. package/dist/sequencer/sequencer.d.ts +2 -3
  234. package/dist/sequencer/sequencer.d.ts.map +1 -1
  235. package/dist/sequencer/sequencer.js +5 -17
  236. package/dist/sequencer/sequencer.js.map +1 -1
  237. package/package.json +15 -15
  238. package/src/account-manager/{index.ts → account-manager.ts} +107 -307
  239. package/src/account-manager/helpers/device-account.ts +1 -0
  240. package/src/account-manager/oauth-store.ts +494 -0
  241. package/src/actor-store/repo/reader.ts +11 -0
  242. package/src/actor-store/repo/transactor.ts +15 -4
  243. package/src/api/com/atproto/admin/deleteAccount.ts +2 -3
  244. package/src/api/com/atproto/admin/sendEmail.ts +3 -5
  245. package/src/api/com/atproto/admin/updateAccountEmail.ts +1 -2
  246. package/src/api/com/atproto/admin/updateAccountHandle.ts +7 -8
  247. package/src/api/com/atproto/admin/updateAccountPassword.ts +1 -2
  248. package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +3 -5
  249. package/src/api/com/atproto/identity/resolveHandle.ts +2 -11
  250. package/src/api/com/atproto/identity/signPlcOperation.ts +3 -5
  251. package/src/api/com/atproto/identity/updateHandle.ts +7 -13
  252. package/src/api/com/atproto/repo/applyWrites.ts +21 -11
  253. package/src/api/com/atproto/repo/createRecord.ts +19 -14
  254. package/src/api/com/atproto/repo/deleteRecord.ts +26 -14
  255. package/src/api/com/atproto/repo/listRecords.ts +1 -11
  256. package/src/api/com/atproto/repo/putRecord.ts +24 -16
  257. package/src/api/com/atproto/server/activateAccount.ts +5 -20
  258. package/src/api/com/atproto/server/confirmEmail.ts +3 -5
  259. package/src/api/com/atproto/server/createAccount.ts +10 -11
  260. package/src/api/com/atproto/server/createAppPassword.ts +3 -6
  261. package/src/api/com/atproto/server/createSession.ts +3 -3
  262. package/src/api/com/atproto/server/deactivateAccount.ts +1 -2
  263. package/src/api/com/atproto/server/deleteAccount.ts +3 -5
  264. package/src/api/com/atproto/server/deleteSession.ts +2 -3
  265. package/src/api/com/atproto/server/getAccountInviteCodes.ts +3 -5
  266. package/src/api/com/atproto/server/getSession.ts +3 -3
  267. package/src/api/com/atproto/server/listAppPasswords.ts +3 -5
  268. package/src/api/com/atproto/server/refreshSession.ts +3 -3
  269. package/src/api/com/atproto/server/requestAccountDelete.ts +3 -5
  270. package/src/api/com/atproto/server/requestEmailConfirmation.ts +3 -5
  271. package/src/api/com/atproto/server/requestEmailUpdate.ts +3 -5
  272. package/src/api/com/atproto/server/requestPasswordReset.ts +1 -2
  273. package/src/api/com/atproto/server/resetPassword.ts +1 -2
  274. package/src/api/com/atproto/server/revokeAppPassword.ts +3 -5
  275. package/src/api/com/atproto/server/updateEmail.ts +3 -5
  276. package/src/api/com/atproto/sync/getRecord.ts +1 -4
  277. package/src/api/com/atproto/sync/getRepoStatus.ts +1 -1
  278. package/src/api/com/atproto/sync/listRepos.ts +1 -1
  279. package/src/api/com/atproto/sync/subscribeRepos.ts +2 -9
  280. package/src/api/com/atproto/temp/checkSignupQueue.ts +2 -2
  281. package/src/api/proxy.ts +19 -19
  282. package/src/app-view.ts +24 -0
  283. package/src/auth-routes.ts +9 -3
  284. package/src/auth-verifier.ts +1 -1
  285. package/src/config/config.ts +25 -13
  286. package/src/config/env.ts +12 -0
  287. package/src/context.ts +60 -24
  288. package/src/handle/index.ts +6 -52
  289. package/src/image/image-url.ts +16 -0
  290. package/src/index.ts +1 -1
  291. package/src/lexicon/index.ts +36 -0
  292. package/src/lexicon/lexicons.ts +243 -84
  293. package/src/lexicon/types/app/bsky/embed/video.ts +1 -0
  294. package/src/lexicon/types/app/bsky/labeler/defs.ts +7 -0
  295. package/src/lexicon/types/app/bsky/labeler/service.ts +7 -0
  296. package/src/lexicon/types/com/atproto/identity/defs.ts +30 -0
  297. package/src/lexicon/types/com/atproto/identity/refreshIdentity.ts +52 -0
  298. package/src/lexicon/types/com/atproto/identity/resolveDid.ts +52 -0
  299. package/src/lexicon/types/com/atproto/identity/resolveHandle.ts +1 -0
  300. package/src/lexicon/types/com/atproto/identity/resolveIdentity.ts +48 -0
  301. package/src/lexicon/types/com/atproto/moderation/defs.ts +3 -0
  302. package/src/lexicon/types/com/atproto/repo/listRecords.ts +0 -4
  303. package/src/lexicon/types/com/atproto/sync/getRecord.ts +0 -2
  304. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +0 -59
  305. package/src/mailer/index.ts +7 -5
  306. package/src/read-after-write/viewer.ts +1 -1
  307. package/src/repo/types.ts +7 -2
  308. package/src/scripts/rebuild-repo.ts +4 -1
  309. package/src/sequencer/db/schema.ts +1 -8
  310. package/src/sequencer/events.ts +29 -75
  311. package/src/sequencer/sequencer.ts +9 -23
  312. package/tests/account-deletion.test.ts +3 -5
  313. package/tests/oauth.test.ts +286 -71
  314. package/tests/sequencer.test.ts +18 -27
  315. package/tests/sync/subscribe-repos.test.ts +67 -45
  316. package/tsconfig.build.tsbuildinfo +1 -1
  317. package/dist/account-manager/index.d.ts.map +0 -1
  318. package/dist/account-manager/index.js.map +0 -1
  319. package/dist/actor-store/repo/util.d.ts +0 -5
  320. package/dist/actor-store/repo/util.d.ts.map +0 -1
  321. package/dist/actor-store/repo/util.js +0 -25
  322. package/dist/actor-store/repo/util.js.map +0 -1
  323. package/dist/oauth/provider.d.ts +0 -10
  324. package/dist/oauth/provider.d.ts.map +0 -1
  325. package/dist/oauth/provider.js +0 -38
  326. package/dist/oauth/provider.js.map +0 -1
  327. package/src/actor-store/repo/util.ts +0 -22
  328. package/src/oauth/provider.ts +0 -59
@@ -20,10 +20,6 @@ export interface QueryParams {
20
20
  /** The number of records to return. */
21
21
  limit: number
22
22
  cursor?: string
23
- /** DEPRECATED: The lowest sort-ordered rkey to start from (exclusive) */
24
- rkeyStart?: string
25
- /** DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) */
26
- rkeyEnd?: string
27
23
  /** Flag to reverse the order of the returned records. */
28
24
  reverse?: boolean
29
25
  }
@@ -19,8 +19,6 @@ export interface QueryParams {
19
19
  collection: string
20
20
  /** Record Key */
21
21
  rkey: string
22
- /** DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit */
23
- commit?: string
24
22
  }
25
23
 
26
24
  export type InputSchema = undefined
@@ -22,9 +22,6 @@ export type OutputSchema =
22
22
  | $Typed<Sync>
23
23
  | $Typed<Identity>
24
24
  | $Typed<Account>
25
- | $Typed<Handle>
26
- | $Typed<Migrate>
27
- | $Typed<Tombstone>
28
25
  | $Typed<Info>
29
26
  | { $type: string }
30
27
  export type HandlerError = ErrorFrame<'FutureCursor' | 'ConsumerTooSlow'>
@@ -150,62 +147,6 @@ export function validateAccount<V>(v: V) {
150
147
  return validate<Account & V>(v, id, hashAccount)
151
148
  }
152
149
 
153
- /** DEPRECATED -- Use #identity event instead */
154
- export interface Handle {
155
- $type?: 'com.atproto.sync.subscribeRepos#handle'
156
- seq: number
157
- did: string
158
- handle: string
159
- time: string
160
- }
161
-
162
- const hashHandle = 'handle'
163
-
164
- export function isHandle<V>(v: V) {
165
- return is$typed(v, id, hashHandle)
166
- }
167
-
168
- export function validateHandle<V>(v: V) {
169
- return validate<Handle & V>(v, id, hashHandle)
170
- }
171
-
172
- /** DEPRECATED -- Use #account event instead */
173
- export interface Migrate {
174
- $type?: 'com.atproto.sync.subscribeRepos#migrate'
175
- seq: number
176
- did: string
177
- migrateTo: string | null
178
- time: string
179
- }
180
-
181
- const hashMigrate = 'migrate'
182
-
183
- export function isMigrate<V>(v: V) {
184
- return is$typed(v, id, hashMigrate)
185
- }
186
-
187
- export function validateMigrate<V>(v: V) {
188
- return validate<Migrate & V>(v, id, hashMigrate)
189
- }
190
-
191
- /** DEPRECATED -- Use #account event instead */
192
- export interface Tombstone {
193
- $type?: 'com.atproto.sync.subscribeRepos#tombstone'
194
- seq: number
195
- did: string
196
- time: string
197
- }
198
-
199
- const hashTombstone = 'tombstone'
200
-
201
- export function isTombstone<V>(v: V) {
202
- return is$typed(v, id, hashTombstone)
203
- }
204
-
205
- export function validateTombstone<V>(v: V) {
206
- return validate<Tombstone & V>(v, id, hashTombstone)
207
- }
208
-
209
150
  export interface Info {
210
151
  $type?: 'com.atproto.sync.subscribeRepos#info'
211
152
  name: 'OutdatedCursor' | (string & {})
@@ -6,6 +6,8 @@ import { ServerConfig } from '../config'
6
6
  import { mailerLogger } from '../logger'
7
7
  import * as templates from './templates'
8
8
 
9
+ // @TODO Add support for i18n
10
+
9
11
  export class ServerMailer {
10
12
  constructor(
11
13
  public readonly transporter: Transporter<SMTPTransport.SentMessageInfo>,
@@ -23,35 +25,35 @@ export class ServerMailer {
23
25
  params: { handle: string; token: string },
24
26
  mailOpts: Mail.Options,
25
27
  ) {
26
- return this.sendTemplate('resetPassword', params, {
28
+ await this.sendTemplate('resetPassword', params, {
27
29
  subject: 'Password Reset Requested',
28
30
  ...mailOpts,
29
31
  })
30
32
  }
31
33
 
32
34
  async sendAccountDelete(params: { token: string }, mailOpts: Mail.Options) {
33
- return this.sendTemplate('deleteAccount', params, {
35
+ await this.sendTemplate('deleteAccount', params, {
34
36
  subject: 'Account Deletion Requested',
35
37
  ...mailOpts,
36
38
  })
37
39
  }
38
40
 
39
41
  async sendConfirmEmail(params: { token: string }, mailOpts: Mail.Options) {
40
- return this.sendTemplate('confirmEmail', params, {
42
+ await this.sendTemplate('confirmEmail', params, {
41
43
  subject: 'Email Confirmation',
42
44
  ...mailOpts,
43
45
  })
44
46
  }
45
47
 
46
48
  async sendUpdateEmail(params: { token: string }, mailOpts: Mail.Options) {
47
- return this.sendTemplate('updateEmail', params, {
49
+ await this.sendTemplate('updateEmail', params, {
48
50
  subject: 'Email Update Requested',
49
51
  ...mailOpts,
50
52
  })
51
53
  }
52
54
 
53
55
  async sendPlcOperation(params: { token: string }, mailOpts: Mail.Options) {
54
- return this.sendTemplate('plcOperation', params, {
56
+ await this.sendTemplate('plcOperation', params, {
55
57
  subject: 'PLC Update Operation Requested',
56
58
  ...mailOpts,
57
59
  })
@@ -1,6 +1,6 @@
1
1
  import { AtUri, INVALID_HANDLE } from '@atproto/syntax'
2
2
  import { createServiceAuthHeaders } from '@atproto/xrpc-server'
3
- import { AccountManager } from '../account-manager'
3
+ import { AccountManager } from '../account-manager/account-manager'
4
4
  import { ActorStoreReader } from '../actor-store/actor-store-reader'
5
5
  import { BskyAppView } from '../bsky-app-view'
6
6
  import { ImageUrlBuilder } from '../image/image-url-builder'
package/src/repo/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CID } from 'multiformats/cid'
2
2
  import { RepoRecord } from '@atproto/lexicon'
3
- import { CidSet, CommitData, WriteOpAction } from '@atproto/repo'
3
+ import { BlockMap, CommitData, WriteOpAction } from '@atproto/repo'
4
4
  import { AtUri } from '@atproto/syntax'
5
5
 
6
6
  export type ValidationStatus = 'valid' | 'unknown' | undefined
@@ -51,12 +51,17 @@ export type CommitOp = {
51
51
 
52
52
  export type CommitDataWithOps = CommitData & {
53
53
  ops: CommitOp[]
54
- blobs: CidSet
55
54
  prevData: CID | null
56
55
  }
57
56
 
58
57
  export type PreparedWrite = PreparedCreate | PreparedUpdate | PreparedDelete
59
58
 
59
+ export type SyncEvtData = {
60
+ cid: CID
61
+ rev: string
62
+ blocks: BlockMap
63
+ }
64
+
60
65
  export class InvalidRecordError extends Error {}
61
66
 
62
67
  export class BadCommitSwapError extends Error {
@@ -77,7 +77,10 @@ export const rebuildRepo = async (ctx: AppContext, args: string[]) => {
77
77
  }
78
78
  })
79
79
  await ctx.accountManager.updateRepoRoot(did, commit.cid, rev)
80
- await ctx.sequencer.sequenceCommit(did, commit)
80
+ const syncData = await ctx.actorStore.read(did, (store) =>
81
+ store.repo.getSyncEventData(),
82
+ )
83
+ await ctx.sequencer.sequenceSyncEvt(did, syncData)
81
84
  }
82
85
 
83
86
  const promptContinue = async (): Promise<boolean> => {
@@ -1,13 +1,6 @@
1
1
  import { Generated, GeneratedAlways, Insertable, Selectable } from 'kysely'
2
2
 
3
- export type RepoSeqEventType =
4
- | 'append'
5
- | 'rebase'
6
- | 'handle'
7
- | 'migrate'
8
- | 'identity'
9
- | 'account'
10
- | 'tombstone'
3
+ export type RepoSeqEventType = 'append' | 'sync' | 'identity' | 'account'
11
4
 
12
5
  export interface RepoSeq {
13
6
  seq: GeneratedAlways<number>
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod'
2
2
  import { cborEncode, noUndefinedVals, schema } from '@atproto/common'
3
3
  import { BlockMap, blocksToCarFile } from '@atproto/repo'
4
- import { AccountStatus } from '../account-manager'
5
- import { CommitDataWithOps } from '../repo'
4
+ import { AccountStatus } from '../account-manager/account-manager'
5
+ import { CommitDataWithOps, SyncEvtData } from '../repo'
6
6
  import { RepoSeqInsert } from './db'
7
7
 
8
8
  export const formatSeqCommit = async (
@@ -13,41 +13,18 @@ export const formatSeqCommit = async (
13
13
  blocksToSend.addMap(commitData.newBlocks)
14
14
  blocksToSend.addMap(commitData.relevantBlocks)
15
15
 
16
- let evt: CommitEvt
17
-
18
- // If event is too big (max 200 ops or 1MB of data)
19
- if (commitData.ops.length > 200 || blocksToSend.byteSize > 1000000) {
20
- const justRoot = new BlockMap()
21
- const rootBlock = blocksToSend.get(commitData.cid)
22
- if (rootBlock) {
23
- justRoot.set(commitData.cid, rootBlock)
24
- }
25
-
26
- evt = {
27
- rebase: false,
28
- tooBig: true,
29
- repo: did,
30
- commit: commitData.cid,
31
- rev: commitData.rev,
32
- since: commitData.since,
33
- blocks: await blocksToCarFile(commitData.cid, justRoot),
34
- ops: [],
35
- blobs: [],
36
- prevData: commitData.prevData ?? undefined,
37
- }
38
- } else {
39
- evt = {
40
- rebase: false,
41
- tooBig: false,
42
- repo: did,
43
- commit: commitData.cid,
44
- rev: commitData.rev,
45
- since: commitData.since,
46
- blocks: await blocksToCarFile(commitData.cid, blocksToSend),
47
- ops: commitData.ops,
48
- blobs: commitData.blobs.toList(),
49
- prevData: commitData.prevData ?? undefined,
50
- }
16
+ const evt = {
17
+ repo: did,
18
+ commit: commitData.cid,
19
+ rev: commitData.rev,
20
+ since: commitData.since,
21
+ blocks: await blocksToCarFile(commitData.cid, blocksToSend),
22
+ ops: commitData.ops,
23
+ prevData: commitData.prevData ?? undefined,
24
+ // deprecated (but still required) fields
25
+ rebase: false,
26
+ tooBig: false,
27
+ blobs: [],
51
28
  }
52
29
 
53
30
  return {
@@ -58,17 +35,19 @@ export const formatSeqCommit = async (
58
35
  }
59
36
  }
60
37
 
61
- export const formatSeqHandleUpdate = async (
38
+ export const formatSeqSyncEvt = async (
62
39
  did: string,
63
- handle: string,
40
+ data: SyncEvtData,
64
41
  ): Promise<RepoSeqInsert> => {
65
- const evt: HandleEvt = {
42
+ const blocks = await blocksToCarFile(data.cid, data.blocks)
43
+ const evt: SyncEvt = {
66
44
  did,
67
- handle,
45
+ rev: data.rev,
46
+ blocks,
68
47
  }
69
48
  return {
70
49
  did,
71
- eventType: 'handle',
50
+ eventType: 'sync',
72
51
  event: cborEncode(evt),
73
52
  sequencedAt: new Date().toISOString(),
74
53
  }
@@ -112,20 +91,6 @@ export const formatSeqAccountEvt = async (
112
91
  }
113
92
  }
114
93
 
115
- export const formatSeqTombstone = async (
116
- did: string,
117
- ): Promise<RepoSeqInsert> => {
118
- const evt: TombstoneEvt = {
119
- did,
120
- }
121
- return {
122
- did,
123
- eventType: 'tombstone',
124
- event: cborEncode(evt),
125
- sequencedAt: new Date().toISOString(),
126
- }
127
- }
128
-
129
94
  export const commitEvtOp = z.object({
130
95
  action: z.union([
131
96
  z.literal('create'),
@@ -152,11 +117,12 @@ export const commitEvt = z.object({
152
117
  })
153
118
  export type CommitEvt = z.infer<typeof commitEvt>
154
119
 
155
- export const handleEvt = z.object({
120
+ export const syncEvt = z.object({
156
121
  did: z.string(),
157
- handle: z.string(),
122
+ blocks: schema.bytes,
123
+ rev: z.string(),
158
124
  })
159
- export type HandleEvt = z.infer<typeof handleEvt>
125
+ export type SyncEvt = z.infer<typeof syncEvt>
160
126
 
161
127
  export const identityEvt = z.object({
162
128
  did: z.string(),
@@ -178,22 +144,17 @@ export const accountEvt = z.object({
178
144
  })
179
145
  export type AccountEvt = z.infer<typeof accountEvt>
180
146
 
181
- export const tombstoneEvt = z.object({
182
- did: z.string(),
183
- })
184
- export type TombstoneEvt = z.infer<typeof tombstoneEvt>
185
-
186
147
  type TypedCommitEvt = {
187
148
  type: 'commit'
188
149
  seq: number
189
150
  time: string
190
151
  evt: CommitEvt
191
152
  }
192
- type TypedHandleEvt = {
193
- type: 'handle'
153
+ type TypedSyncEvt = {
154
+ type: 'sync'
194
155
  seq: number
195
156
  time: string
196
- evt: HandleEvt
157
+ evt: SyncEvt
197
158
  }
198
159
  type TypedIdentityEvt = {
199
160
  type: 'identity'
@@ -207,15 +168,8 @@ type TypedAccountEvt = {
207
168
  time: string
208
169
  evt: AccountEvt
209
170
  }
210
- type TypedTombstoneEvt = {
211
- type: 'tombstone'
212
- seq: number
213
- time: string
214
- evt: TombstoneEvt
215
- }
216
171
  export type SeqEvt =
217
172
  | TypedCommitEvt
218
- | TypedHandleEvt
173
+ | TypedSyncEvt
219
174
  | TypedIdentityEvt
220
175
  | TypedAccountEvt
221
- | TypedTombstoneEvt
@@ -4,7 +4,7 @@ import { SECOND, cborDecode, wait } from '@atproto/common'
4
4
  import { AccountStatus } from '../account-manager/helpers/account'
5
5
  import { Crawlers } from '../crawlers'
6
6
  import { seqLogger as log } from '../logger'
7
- import { CommitDataWithOps } from '../repo'
7
+ import { CommitDataWithOps, SyncEvtData } from '../repo'
8
8
  import {
9
9
  RepoSeqEntry,
10
10
  RepoSeqInsert,
@@ -15,15 +15,13 @@ import {
15
15
  import {
16
16
  AccountEvt,
17
17
  CommitEvt,
18
- HandleEvt,
19
18
  IdentityEvt,
20
19
  SeqEvt,
21
- TombstoneEvt,
20
+ SyncEvt,
22
21
  formatSeqAccountEvt,
23
22
  formatSeqCommit,
24
- formatSeqHandleUpdate,
25
23
  formatSeqIdentityEvt,
26
- formatSeqTombstone,
24
+ formatSeqSyncEvt,
27
25
  } from './events'
28
26
 
29
27
  export * from './events'
@@ -135,19 +133,19 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
135
133
  continue
136
134
  }
137
135
  const evt = cborDecode(row.event)
138
- if (row.eventType === 'append' || row.eventType === 'rebase') {
136
+ if (row.eventType === 'append') {
139
137
  seqEvts.push({
140
138
  type: 'commit',
141
139
  seq: row.seq,
142
140
  time: row.sequencedAt,
143
141
  evt: evt as CommitEvt,
144
142
  })
145
- } else if (row.eventType === 'handle') {
143
+ } else if (row.eventType === 'sync') {
146
144
  seqEvts.push({
147
- type: 'handle',
145
+ type: 'sync',
148
146
  seq: row.seq,
149
147
  time: row.sequencedAt,
150
- evt: evt as HandleEvt,
148
+ evt: evt as SyncEvt,
151
149
  })
152
150
  } else if (row.eventType === 'identity') {
153
151
  seqEvts.push({
@@ -163,13 +161,6 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
163
161
  time: row.sequencedAt,
164
162
  evt: evt as AccountEvt,
165
163
  })
166
- } else if (row.eventType === 'tombstone') {
167
- seqEvts.push({
168
- type: 'tombstone',
169
- seq: row.seq,
170
- time: row.sequencedAt,
171
- evt: evt as TombstoneEvt,
172
- })
173
164
  }
174
165
  }
175
166
 
@@ -222,8 +213,8 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
222
213
  return await this.sequenceEvt(evt)
223
214
  }
224
215
 
225
- async sequenceHandleUpdate(did: string, handle: string): Promise<number> {
226
- const evt = await formatSeqHandleUpdate(did, handle)
216
+ async sequenceSyncEvt(did: string, data: SyncEvtData) {
217
+ const evt = await formatSeqSyncEvt(did, data)
227
218
  return await this.sequenceEvt(evt)
228
219
  }
229
220
 
@@ -240,11 +231,6 @@ export class Sequencer extends (EventEmitter as new () => SequencerEmitter) {
240
231
  return await this.sequenceEvt(evt)
241
232
  }
242
233
 
243
- async sequenceTombstone(did: string): Promise<number> {
244
- const evt = await formatSeqTombstone(did)
245
- return await this.sequenceEvt(evt)
246
- }
247
-
248
234
  async deleteAllForUser(did: string, excludingSeqs: number[] = []) {
249
235
  await this.db.executeWithRetry(
250
236
  this.db.db
@@ -151,14 +151,12 @@ describe('account deletion', () => {
151
151
  expect(
152
152
  updatedDbContents.repoSeqs
153
153
  .filter((row) => row.did === carol.did)
154
- .every(
155
- (row) => row.eventType === 'tombstone' || row.eventType === 'account',
156
- ),
154
+ .every((row) => row.eventType === 'account'),
157
155
  ).toBe(true)
158
- // check we do have a tombstone for this did
156
+ // check we do have a account (deletion) event for this did
159
157
  expect(
160
158
  updatedDbContents.repoSeqs.filter(
161
- (row) => row.did === carol.did && row.eventType === 'tombstone',
159
+ (row) => row.did === carol.did && row.eventType === 'account',
162
160
  ).length,
163
161
  ).toEqual(1)
164
162
  expect(updatedDbContents.appPasswords).toEqual(