@atproto/pds 0.4.164 → 0.4.166

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 (296) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/account-manager/account-manager.js +2 -2
  3. package/dist/account-manager/account-manager.js.map +1 -1
  4. package/dist/account-manager/helpers/account-device.d.ts +4 -4
  5. package/dist/account-manager/helpers/account.d.ts +1 -1
  6. package/dist/account-manager/helpers/auth.d.ts +1 -1
  7. package/dist/account-manager/helpers/auth.d.ts.map +1 -1
  8. package/dist/account-manager/helpers/auth.js +8 -8
  9. package/dist/account-manager/helpers/auth.js.map +1 -1
  10. package/dist/account-manager/helpers/authorization-request.d.ts +1 -1
  11. package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -1
  12. package/dist/account-manager/helpers/authorization-request.js +16 -8
  13. package/dist/account-manager/helpers/authorization-request.js.map +1 -1
  14. package/dist/account-manager/helpers/token.d.ts +65 -65
  15. package/dist/actor-store/preference/reader.d.ts +2 -2
  16. package/dist/actor-store/preference/reader.d.ts.map +1 -1
  17. package/dist/actor-store/preference/reader.js +2 -2
  18. package/dist/actor-store/preference/reader.js.map +1 -1
  19. package/dist/actor-store/preference/transactor.d.ts +2 -2
  20. package/dist/actor-store/preference/transactor.d.ts.map +1 -1
  21. package/dist/actor-store/preference/transactor.js +5 -5
  22. package/dist/actor-store/preference/transactor.js.map +1 -1
  23. package/dist/actor-store/preference/util.d.ts +4 -2
  24. package/dist/actor-store/preference/util.d.ts.map +1 -1
  25. package/dist/actor-store/preference/util.js +9 -8
  26. package/dist/actor-store/preference/util.js.map +1 -1
  27. package/dist/actor-store/record/reader.d.ts +2 -2
  28. package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
  29. package/dist/api/app/bsky/actor/getPreferences.js +29 -7
  30. package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
  31. package/dist/api/app/bsky/actor/getProfile.d.ts.map +1 -1
  32. package/dist/api/app/bsky/actor/getProfile.js +9 -1
  33. package/dist/api/app/bsky/actor/getProfile.js.map +1 -1
  34. package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
  35. package/dist/api/app/bsky/actor/getProfiles.js +9 -1
  36. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  37. package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
  38. package/dist/api/app/bsky/actor/putPreferences.js +30 -8
  39. package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
  40. package/dist/api/app/bsky/feed/getActorLikes.d.ts.map +1 -1
  41. package/dist/api/app/bsky/feed/getActorLikes.js +9 -1
  42. package/dist/api/app/bsky/feed/getActorLikes.js.map +1 -1
  43. package/dist/api/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
  44. package/dist/api/app/bsky/feed/getAuthorFeed.js +9 -1
  45. package/dist/api/app/bsky/feed/getAuthorFeed.js.map +1 -1
  46. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  47. package/dist/api/app/bsky/feed/getFeed.js +8 -1
  48. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  49. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  50. package/dist/api/app/bsky/feed/getPostThread.js +8 -1
  51. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  52. package/dist/api/app/bsky/feed/getTimeline.d.ts.map +1 -1
  53. package/dist/api/app/bsky/feed/getTimeline.js +9 -1
  54. package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
  55. package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
  56. package/dist/api/app/bsky/notification/registerPush.js +16 -4
  57. package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
  58. package/dist/api/com/atproto/identity/getRecommendedDidCredentials.d.ts.map +1 -1
  59. package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js +5 -1
  60. package/dist/api/com/atproto/identity/getRecommendedDidCredentials.js.map +1 -1
  61. package/dist/api/com/atproto/identity/requestPlcOperationSignature.d.ts.map +1 -1
  62. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +9 -2
  63. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
  64. package/dist/api/com/atproto/identity/signPlcOperation.d.ts.map +1 -1
  65. package/dist/api/com/atproto/identity/signPlcOperation.js +9 -1
  66. package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
  67. package/dist/api/com/atproto/identity/submitPlcOperation.d.ts.map +1 -1
  68. package/dist/api/com/atproto/identity/submitPlcOperation.js +5 -1
  69. package/dist/api/com/atproto/identity/submitPlcOperation.js.map +1 -1
  70. package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
  71. package/dist/api/com/atproto/identity/updateHandle.js +6 -1
  72. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  73. package/dist/api/com/atproto/moderation/createReport.d.ts.map +1 -1
  74. package/dist/api/com/atproto/moderation/createReport.js +8 -3
  75. package/dist/api/com/atproto/moderation/createReport.js.map +1 -1
  76. package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
  77. package/dist/api/com/atproto/repo/applyWrites.js +25 -19
  78. package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
  79. package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
  80. package/dist/api/com/atproto/repo/createRecord.js +10 -1
  81. package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
  82. package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  83. package/dist/api/com/atproto/repo/deleteRecord.js +12 -1
  84. package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
  85. package/dist/api/com/atproto/repo/importRepo.d.ts.map +1 -1
  86. package/dist/api/com/atproto/repo/importRepo.js +7 -2
  87. package/dist/api/com/atproto/repo/importRepo.js.map +1 -1
  88. package/dist/api/com/atproto/repo/listMissingBlobs.d.ts.map +1 -1
  89. package/dist/api/com/atproto/repo/listMissingBlobs.js +6 -2
  90. package/dist/api/com/atproto/repo/listMissingBlobs.js.map +1 -1
  91. package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
  92. package/dist/api/com/atproto/repo/putRecord.js +17 -11
  93. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  94. package/dist/api/com/atproto/repo/uploadBlob.d.ts.map +1 -1
  95. package/dist/api/com/atproto/repo/uploadBlob.js +5 -1
  96. package/dist/api/com/atproto/repo/uploadBlob.js.map +1 -1
  97. package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
  98. package/dist/api/com/atproto/server/activateAccount.js +7 -1
  99. package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
  100. package/dist/api/com/atproto/server/checkAccountStatus.d.ts.map +1 -1
  101. package/dist/api/com/atproto/server/checkAccountStatus.js +5 -1
  102. package/dist/api/com/atproto/server/checkAccountStatus.js.map +1 -1
  103. package/dist/api/com/atproto/server/confirmEmail.d.ts.map +1 -1
  104. package/dist/api/com/atproto/server/confirmEmail.js +6 -1
  105. package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
  106. package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
  107. package/dist/api/com/atproto/server/createAppPassword.js +7 -1
  108. package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
  109. package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
  110. package/dist/api/com/atproto/server/deactivateAccount.js +9 -2
  111. package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
  112. package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
  113. package/dist/api/com/atproto/server/deleteSession.js +3 -1
  114. package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
  115. package/dist/api/com/atproto/server/getAccountInviteCodes.d.ts.map +1 -1
  116. package/dist/api/com/atproto/server/getAccountInviteCodes.js +8 -1
  117. package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
  118. package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
  119. package/dist/api/com/atproto/server/getServiceAuth.js +24 -13
  120. package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
  121. package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
  122. package/dist/api/com/atproto/server/getSession.js +12 -19
  123. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  124. package/dist/api/com/atproto/server/listAppPasswords.d.ts.map +1 -1
  125. package/dist/api/com/atproto/server/listAppPasswords.js +6 -1
  126. package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
  127. package/dist/api/com/atproto/server/refreshSession.js +1 -1
  128. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  129. package/dist/api/com/atproto/server/requestAccountDelete.d.ts.map +1 -1
  130. package/dist/api/com/atproto/server/requestAccountDelete.js +8 -1
  131. package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
  132. package/dist/api/com/atproto/server/requestEmailConfirmation.d.ts.map +1 -1
  133. package/dist/api/com/atproto/server/requestEmailConfirmation.js +6 -1
  134. package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
  135. package/dist/api/com/atproto/server/requestEmailUpdate.d.ts.map +1 -1
  136. package/dist/api/com/atproto/server/requestEmailUpdate.js +6 -1
  137. package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
  138. package/dist/api/com/atproto/server/revokeAppPassword.d.ts.map +1 -1
  139. package/dist/api/com/atproto/server/revokeAppPassword.js +6 -1
  140. package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
  141. package/dist/api/com/atproto/server/updateEmail.d.ts.map +1 -1
  142. package/dist/api/com/atproto/server/updateEmail.js +8 -1
  143. package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
  144. package/dist/api/com/atproto/sync/deprecated/getCheckout.d.ts.map +1 -1
  145. package/dist/api/com/atproto/sync/deprecated/getCheckout.js +7 -2
  146. package/dist/api/com/atproto/sync/deprecated/getCheckout.js.map +1 -1
  147. package/dist/api/com/atproto/sync/deprecated/getHead.d.ts.map +1 -1
  148. package/dist/api/com/atproto/sync/deprecated/getHead.js +7 -2
  149. package/dist/api/com/atproto/sync/deprecated/getHead.js.map +1 -1
  150. package/dist/api/com/atproto/sync/getBlob.d.ts.map +1 -1
  151. package/dist/api/com/atproto/sync/getBlob.js +7 -3
  152. package/dist/api/com/atproto/sync/getBlob.js.map +1 -1
  153. package/dist/api/com/atproto/sync/getBlocks.d.ts.map +1 -1
  154. package/dist/api/com/atproto/sync/getBlocks.js +7 -2
  155. package/dist/api/com/atproto/sync/getBlocks.js.map +1 -1
  156. package/dist/api/com/atproto/sync/getLatestCommit.d.ts.map +1 -1
  157. package/dist/api/com/atproto/sync/getLatestCommit.js +7 -2
  158. package/dist/api/com/atproto/sync/getLatestCommit.js.map +1 -1
  159. package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
  160. package/dist/api/com/atproto/sync/getRecord.js +7 -2
  161. package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
  162. package/dist/api/com/atproto/sync/getRepo.d.ts.map +1 -1
  163. package/dist/api/com/atproto/sync/getRepo.js +7 -3
  164. package/dist/api/com/atproto/sync/getRepo.js.map +1 -1
  165. package/dist/api/com/atproto/sync/listBlobs.d.ts.map +1 -1
  166. package/dist/api/com/atproto/sync/listBlobs.js +7 -3
  167. package/dist/api/com/atproto/sync/listBlobs.js.map +1 -1
  168. package/dist/api/com/atproto/temp/checkSignupQueue.d.ts.map +1 -1
  169. package/dist/api/com/atproto/temp/checkSignupQueue.js +7 -3
  170. package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
  171. package/dist/auth-output.d.ts +45 -0
  172. package/dist/auth-output.d.ts.map +1 -0
  173. package/dist/auth-output.js +3 -0
  174. package/dist/auth-output.js.map +1 -0
  175. package/dist/auth-scope.d.ts +16 -0
  176. package/dist/auth-scope.d.ts.map +1 -0
  177. package/dist/auth-scope.js +40 -0
  178. package/dist/auth-scope.js.map +1 -0
  179. package/dist/auth-verifier.d.ts +50 -115
  180. package/dist/auth-verifier.d.ts.map +1 -1
  181. package/dist/auth-verifier.js +275 -366
  182. package/dist/auth-verifier.js.map +1 -1
  183. package/dist/config/config.d.ts +2 -1
  184. package/dist/config/config.d.ts.map +1 -1
  185. package/dist/config/config.js +2 -1
  186. package/dist/config/config.js.map +1 -1
  187. package/dist/config/env.d.ts +1 -0
  188. package/dist/config/env.d.ts.map +1 -1
  189. package/dist/config/env.js +3 -1
  190. package/dist/config/env.js.map +1 -1
  191. package/dist/context.d.ts.map +1 -1
  192. package/dist/context.js +5 -5
  193. package/dist/context.js.map +1 -1
  194. package/dist/lexicon/index.d.ts +234 -230
  195. package/dist/lexicon/index.d.ts.map +1 -1
  196. package/dist/lexicon/index.js +682 -674
  197. package/dist/lexicon/index.js.map +1 -1
  198. package/dist/lexicon/lexicons.d.ts +17994 -17706
  199. package/dist/lexicon/lexicons.d.ts.map +1 -1
  200. package/dist/lexicon/lexicons.js +9126 -8980
  201. package/dist/lexicon/lexicons.js.map +1 -1
  202. package/dist/lexicon/types/app/bsky/graph/getLists.d.ts +2 -0
  203. package/dist/lexicon/types/app/bsky/graph/getLists.d.ts.map +1 -1
  204. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts +40 -0
  205. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts.map +1 -0
  206. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js +16 -0
  207. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js.map +1 -0
  208. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts +38 -0
  209. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts.map +1 -0
  210. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js +16 -0
  211. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js.map +1 -0
  212. package/dist/pipethrough.d.ts +5 -3
  213. package/dist/pipethrough.d.ts.map +1 -1
  214. package/dist/pipethrough.js +42 -15
  215. package/dist/pipethrough.js.map +1 -1
  216. package/dist/sequencer/events.d.ts +13 -13
  217. package/dist/util/http.d.ts +7 -0
  218. package/dist/util/http.d.ts.map +1 -0
  219. package/dist/util/http.js +31 -0
  220. package/dist/util/http.js.map +1 -0
  221. package/dist/util/types.d.ts +5 -0
  222. package/dist/util/types.d.ts.map +1 -0
  223. package/dist/util/types.js +3 -0
  224. package/dist/util/types.js.map +1 -0
  225. package/package.json +7 -6
  226. package/src/account-manager/account-manager.ts +1 -1
  227. package/src/account-manager/helpers/auth.ts +1 -1
  228. package/src/account-manager/helpers/authorization-request.ts +8 -4
  229. package/src/actor-store/preference/reader.ts +3 -4
  230. package/src/actor-store/preference/transactor.ts +6 -7
  231. package/src/actor-store/preference/util.ts +15 -5
  232. package/src/api/app/bsky/actor/getPreferences.ts +33 -8
  233. package/src/api/app/bsky/actor/getProfile.ts +9 -1
  234. package/src/api/app/bsky/actor/getProfiles.ts +9 -1
  235. package/src/api/app/bsky/actor/putPreferences.ts +35 -12
  236. package/src/api/app/bsky/feed/getActorLikes.ts +9 -1
  237. package/src/api/app/bsky/feed/getAuthorFeed.ts +9 -1
  238. package/src/api/app/bsky/feed/getFeed.ts +9 -2
  239. package/src/api/app/bsky/feed/getPostThread.ts +8 -1
  240. package/src/api/app/bsky/feed/getTimeline.ts +9 -1
  241. package/src/api/app/bsky/notification/registerPush.ts +16 -5
  242. package/src/api/com/atproto/identity/getRecommendedDidCredentials.ts +5 -1
  243. package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +9 -2
  244. package/src/api/com/atproto/identity/signPlcOperation.ts +9 -1
  245. package/src/api/com/atproto/identity/submitPlcOperation.ts +5 -1
  246. package/src/api/com/atproto/identity/updateHandle.ts +6 -1
  247. package/src/api/com/atproto/moderation/createReport.ts +8 -3
  248. package/src/api/com/atproto/repo/applyWrites.ts +28 -20
  249. package/src/api/com/atproto/repo/createRecord.ts +12 -1
  250. package/src/api/com/atproto/repo/deleteRecord.ts +14 -1
  251. package/src/api/com/atproto/repo/importRepo.ts +9 -2
  252. package/src/api/com/atproto/repo/listMissingBlobs.ts +7 -2
  253. package/src/api/com/atproto/repo/putRecord.ts +18 -10
  254. package/src/api/com/atproto/repo/uploadBlob.ts +6 -2
  255. package/src/api/com/atproto/server/activateAccount.ts +10 -2
  256. package/src/api/com/atproto/server/checkAccountStatus.ts +5 -1
  257. package/src/api/com/atproto/server/confirmEmail.ts +6 -1
  258. package/src/api/com/atproto/server/createAppPassword.ts +9 -1
  259. package/src/api/com/atproto/server/deactivateAccount.ts +11 -2
  260. package/src/api/com/atproto/server/deleteSession.ts +3 -1
  261. package/src/api/com/atproto/server/getAccountInviteCodes.ts +11 -2
  262. package/src/api/com/atproto/server/getServiceAuth.ts +37 -18
  263. package/src/api/com/atproto/server/getSession.ts +20 -27
  264. package/src/api/com/atproto/server/listAppPasswords.ts +8 -1
  265. package/src/api/com/atproto/server/refreshSession.ts +1 -1
  266. package/src/api/com/atproto/server/requestAccountDelete.ts +11 -2
  267. package/src/api/com/atproto/server/requestEmailConfirmation.ts +6 -1
  268. package/src/api/com/atproto/server/requestEmailUpdate.ts +6 -1
  269. package/src/api/com/atproto/server/revokeAppPassword.ts +8 -1
  270. package/src/api/com/atproto/server/updateEmail.ts +11 -2
  271. package/src/api/com/atproto/sync/deprecated/getCheckout.ts +7 -6
  272. package/src/api/com/atproto/sync/deprecated/getHead.ts +7 -6
  273. package/src/api/com/atproto/sync/getBlob.ts +7 -7
  274. package/src/api/com/atproto/sync/getBlocks.ts +7 -6
  275. package/src/api/com/atproto/sync/getLatestCommit.ts +7 -6
  276. package/src/api/com/atproto/sync/getRecord.ts +7 -6
  277. package/src/api/com/atproto/sync/getRepo.ts +7 -7
  278. package/src/api/com/atproto/sync/listBlobs.ts +7 -7
  279. package/src/api/com/atproto/temp/checkSignupQueue.ts +8 -2
  280. package/src/auth-output.ts +51 -0
  281. package/src/auth-scope.ts +40 -0
  282. package/src/auth-verifier.ts +404 -520
  283. package/src/config/config.ts +7 -7
  284. package/src/config/env.ts +5 -1
  285. package/src/context.ts +6 -5
  286. package/src/lexicon/index.ts +1247 -1221
  287. package/src/lexicon/lexicons.ts +9494 -9341
  288. package/src/lexicon/types/app/bsky/graph/getLists.ts +2 -0
  289. package/src/lexicon/types/app/bsky/graph/getListsWithMembership.ts +63 -0
  290. package/src/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.ts +65 -0
  291. package/src/pipethrough.ts +61 -18
  292. package/src/util/http.ts +31 -0
  293. package/src/util/types.ts +7 -0
  294. package/tests/oauth.test.ts +11 -37
  295. package/tests/preferences.test.ts +7 -3
  296. package/tsconfig.build.tsbuildinfo +1 -1
@@ -20,6 +20,8 @@ export type QueryParams = {
20
20
  actor: string
21
21
  limit: number
22
22
  cursor?: string
23
+ /** Optional filter by list purpose. If not specified, all supported types are returned. */
24
+ purposes?: 'modlist' | 'curatelist' | (string & {})[]
23
25
  }
24
26
  export type InputSchema = undefined
25
27
 
@@ -0,0 +1,63 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+ import type * as AppBskyGraphDefs from './defs.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.graph.getListsWithMembership'
17
+
18
+ export type QueryParams = {
19
+ /** The account (actor) to check for membership. */
20
+ actor: string
21
+ limit: number
22
+ cursor?: string
23
+ /** Optional filter by list purpose. If not specified, all supported types are returned. */
24
+ purposes?: 'modlist' | 'curatelist' | (string & {})[]
25
+ }
26
+ export type InputSchema = undefined
27
+
28
+ export interface OutputSchema {
29
+ cursor?: string
30
+ listsWithMembership: ListWithMembership[]
31
+ }
32
+
33
+ export type HandlerInput = void
34
+
35
+ export interface HandlerSuccess {
36
+ encoding: 'application/json'
37
+ body: OutputSchema
38
+ headers?: { [key: string]: string }
39
+ }
40
+
41
+ export interface HandlerError {
42
+ status: number
43
+ message?: string
44
+ }
45
+
46
+ export type HandlerOutput = HandlerError | HandlerSuccess
47
+
48
+ /** A list and an optional list item indicating membership of a target user to that list. */
49
+ export interface ListWithMembership {
50
+ $type?: 'app.bsky.graph.getListsWithMembership#listWithMembership'
51
+ list: AppBskyGraphDefs.ListView
52
+ listItem?: AppBskyGraphDefs.ListItemView
53
+ }
54
+
55
+ const hashListWithMembership = 'listWithMembership'
56
+
57
+ export function isListWithMembership<V>(v: V) {
58
+ return is$typed(v, id, hashListWithMembership)
59
+ }
60
+
61
+ export function validateListWithMembership<V>(v: V) {
62
+ return validate<ListWithMembership & V>(v, id, hashListWithMembership)
63
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+ import type * as AppBskyGraphDefs from './defs.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.graph.getStarterPacksWithMembership'
17
+
18
+ export type QueryParams = {
19
+ /** The account (actor) to check for membership. */
20
+ actor: string
21
+ limit: number
22
+ cursor?: string
23
+ }
24
+ export type InputSchema = undefined
25
+
26
+ export interface OutputSchema {
27
+ cursor?: string
28
+ starterPacksWithMembership: StarterPackWithMembership[]
29
+ }
30
+
31
+ export type HandlerInput = void
32
+
33
+ export interface HandlerSuccess {
34
+ encoding: 'application/json'
35
+ body: OutputSchema
36
+ headers?: { [key: string]: string }
37
+ }
38
+
39
+ export interface HandlerError {
40
+ status: number
41
+ message?: string
42
+ }
43
+
44
+ export type HandlerOutput = HandlerError | HandlerSuccess
45
+
46
+ /** A starter pack and an optional list item indicating membership of a target user to that starter pack. */
47
+ export interface StarterPackWithMembership {
48
+ $type?: 'app.bsky.graph.getStarterPacksWithMembership#starterPackWithMembership'
49
+ starterPack: AppBskyGraphDefs.StarterPackView
50
+ listItem?: AppBskyGraphDefs.ListItemView
51
+ }
52
+
53
+ const hashStarterPackWithMembership = 'starterPackWithMembership'
54
+
55
+ export function isStarterPackWithMembership<V>(v: V) {
56
+ return is$typed(v, id, hashStarterPackWithMembership)
57
+ }
58
+
59
+ export function validateStarterPackWithMembership<V>(v: V) {
60
+ return validate<StarterPackWithMembership & V>(
61
+ v,
62
+ id,
63
+ hashStarterPackWithMembership,
64
+ )
65
+ }
@@ -1,6 +1,6 @@
1
1
  import { IncomingHttpHeaders, ServerResponse } from 'node:http'
2
2
  import { PassThrough, Readable } from 'node:stream'
3
- import express from 'express'
3
+ import { Request } from 'express'
4
4
  import { Dispatcher } from 'undici'
5
5
  import {
6
6
  decodeStream,
@@ -8,6 +8,7 @@ import {
8
8
  omit,
9
9
  streamToNodeBuffer,
10
10
  } from '@atproto/common'
11
+ import { RpcScopeMatch } from '@atproto/oauth-scopes'
11
12
  import { ResponseType, XRPCError as XRPCClientError } from '@atproto/xrpc'
12
13
  import {
13
14
  CatchallHandler,
@@ -16,15 +17,20 @@ import {
16
17
  InternalServerError,
17
18
  InvalidRequestError,
18
19
  XRPCError as XRPCServerError,
20
+ excludeErrorResult,
19
21
  parseReqNsid,
20
22
  } from '@atproto/xrpc-server'
21
23
  import { buildProxiedContentEncoding } from '@atproto-labs/xrpc-utils'
24
+ import { isAccessPrivileged } from './auth-scope'
22
25
  import { AppContext } from './context'
23
26
  import { ids } from './lexicon/lexicons'
24
27
  import { httpLogger } from './logger'
25
28
 
26
29
  export const proxyHandler = (ctx: AppContext): CatchallHandler => {
27
- const accessStandard = ctx.authVerifier.accessStandard()
30
+ const performAuth = ctx.authVerifier.authorization<RpcScopeMatch>({
31
+ authorize: (permissions, { params }) => permissions.assertRpc(params),
32
+ })
33
+
28
34
  return async (req, res, next) => {
29
35
  // /!\ Hot path
30
36
  try {
@@ -50,13 +56,20 @@ export const proxyHandler = (ctx: AppContext): CatchallHandler => {
50
56
  throw new InvalidRequestError('Bad token method', 'InvalidToken')
51
57
  }
52
58
 
53
- const auth = await accessStandard({ req, res })
54
- if (!auth.credentials.isPrivileged && PRIVILEGED_METHODS.has(lxm)) {
59
+ const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)
60
+
61
+ const authResult = await performAuth({ req, res, params: { lxm, aud } })
62
+
63
+ const { credentials } = excludeErrorResult(authResult)
64
+
65
+ if (
66
+ credentials.type === 'access' &&
67
+ !isAccessPrivileged(credentials.scope) &&
68
+ PRIVILEGED_METHODS.has(lxm)
69
+ ) {
55
70
  throw new InvalidRequestError('Bad token method', 'InvalidToken')
56
71
  }
57
72
 
58
- const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)
59
-
60
73
  const headers: IncomingHttpHeaders = {
61
74
  'accept-encoding': req.headers['accept-encoding'] || 'identity',
62
75
  'accept-language': req.headers['accept-language'],
@@ -67,9 +80,7 @@ export const proxyHandler = (ctx: AppContext): CatchallHandler => {
67
80
  'content-encoding': body && req.headers['content-encoding'],
68
81
  'content-length': body && req.headers['content-length'],
69
82
 
70
- authorization: auth.credentials.did
71
- ? `Bearer ${await ctx.serviceAuthJwt(auth.credentials.did, aud, lxm)}`
72
- : undefined,
83
+ authorization: `Bearer ${await ctx.serviceAuthJwt(credentials.did, aud, lxm)}`,
73
84
  }
74
85
 
75
86
  const dispatchOptions: Dispatcher.RequestOptions = {
@@ -122,7 +133,7 @@ export type PipethroughOptions = {
122
133
 
123
134
  export async function pipethrough(
124
135
  ctx: AppContext,
125
- req: express.Request,
136
+ req: Request,
126
137
  options?: PipethroughOptions,
127
138
  ): Promise<
128
139
  HandlerPipeThroughStream & {
@@ -189,9 +200,25 @@ export async function pipethrough(
189
200
  // Request setup/formatting
190
201
  // -------------------
191
202
 
203
+ export function computeProxyTo(
204
+ ctx: AppContext,
205
+ req: Request,
206
+ lxm: string,
207
+ ): string {
208
+ const proxyToHeader = req.header('atproto-proxy')
209
+ if (proxyToHeader) return proxyToHeader
210
+
211
+ const service = defaultService(ctx, lxm)
212
+ if (service.serviceInfo) {
213
+ return `${service.serviceInfo.did}#${service.serviceId}`
214
+ }
215
+
216
+ throw new InvalidRequestError(`No service configured for ${lxm}`)
217
+ }
218
+
192
219
  export async function parseProxyInfo(
193
220
  ctx: AppContext,
194
- req: express.Request,
221
+ req: Request,
195
222
  lxm: string,
196
223
  ): Promise<{ url: string; did: string }> {
197
224
  // /!\ Hot path
@@ -199,8 +226,8 @@ export async function parseProxyInfo(
199
226
  const proxyToHeader = req.header('atproto-proxy')
200
227
  if (proxyToHeader) return parseProxyHeader(ctx, proxyToHeader)
201
228
 
202
- const defaultProxy = defaultService(ctx, lxm)
203
- if (defaultProxy) return defaultProxy
229
+ const { serviceInfo } = defaultService(ctx, lxm)
230
+ if (serviceInfo) return serviceInfo
204
231
 
205
232
  throw new InvalidRequestError(`No service configured for ${lxm}`)
206
233
  }
@@ -472,7 +499,7 @@ function* responseHeaders(
472
499
  // Utils
473
500
  // -------------------
474
501
 
475
- export const PRIVILEGED_METHODS = new Set<string>([
502
+ export const CHAT_BSKY_METHODS = new Set<string>([
476
503
  ids.ChatBskyActorDeleteAccount,
477
504
  ids.ChatBskyActorExportAccountData,
478
505
  ids.ChatBskyConvoDeleteMessageForSelf,
@@ -487,6 +514,10 @@ export const PRIVILEGED_METHODS = new Set<string>([
487
514
  ids.ChatBskyConvoSendMessageBatch,
488
515
  ids.ChatBskyConvoUnmuteConvo,
489
516
  ids.ChatBskyConvoUpdateRead,
517
+ ])
518
+
519
+ export const PRIVILEGED_METHODS = new Set<string>([
520
+ ...CHAT_BSKY_METHODS,
490
521
  ids.ComAtprotoServerCreateAccount,
491
522
  ])
492
523
 
@@ -515,7 +546,10 @@ export const PROTECTED_METHODS = new Set<string>([
515
546
  const defaultService = (
516
547
  ctx: AppContext,
517
548
  nsid: string,
518
- ): { url: string; did: string } | null => {
549
+ ): {
550
+ serviceId: string
551
+ serviceInfo: { url: string; did: string } | null
552
+ } => {
519
553
  switch (nsid) {
520
554
  case ids.ToolsOzoneTeamAddMember:
521
555
  case ids.ToolsOzoneTeamDeleteMember:
@@ -541,11 +575,20 @@ const defaultService = (
541
575
  case ids.ToolsOzoneSafelinkRemoveRule:
542
576
  case ids.ToolsOzoneSafelinkQueryEvents:
543
577
  case ids.ToolsOzoneSafelinkQueryRules:
544
- return ctx.cfg.modService
578
+ return {
579
+ serviceId: 'atproto_labeler',
580
+ serviceInfo: ctx.cfg.modService,
581
+ }
545
582
  case ids.ComAtprotoModerationCreateReport:
546
- return ctx.cfg.reportService
583
+ return {
584
+ serviceId: 'atproto_labeler',
585
+ serviceInfo: ctx.cfg.reportService,
586
+ }
547
587
  default:
548
- return ctx.cfg.bskyAppView
588
+ return {
589
+ serviceId: 'bsky_appview',
590
+ serviceInfo: ctx.cfg.bskyAppView,
591
+ }
549
592
  }
550
593
  }
551
594
 
@@ -0,0 +1,31 @@
1
+ import { ServerResponse } from 'node:http'
2
+
3
+ /**
4
+ * Set or appends a value to the `Vary` header in the response, only if the
5
+ * value is not already present.
6
+ */
7
+ export function appendVary(res: ServerResponse, value: string) {
8
+ if (!varyContains(res, value.toLowerCase())) {
9
+ res.appendHeader('Vary', value)
10
+ }
11
+ }
12
+
13
+ function varyContains(res: ServerResponse, searchValue: string) {
14
+ const headerValue = res.getHeader('Vary')
15
+ switch (typeof headerValue) {
16
+ case 'string':
17
+ return varyStringContains(headerValue, searchValue)
18
+ case 'object':
19
+ // headerValue is a string[] here
20
+ return headerValue.some((h) => varyStringContains(h, searchValue))
21
+ default:
22
+ return false
23
+ }
24
+ }
25
+
26
+ function varyStringContains(headerValue: string, searchValue: string): boolean {
27
+ return headerValue
28
+ .split(',')
29
+ .map((v) => v.trim().toLowerCase())
30
+ .some((v) => v === searchValue || v === `*`)
31
+ }
@@ -0,0 +1,7 @@
1
+ export type Simplify<T> = {
2
+ [K in keyof T]: T[K]
3
+ } & NonNullable<unknown>
4
+
5
+ export type WithRequired<T, K extends keyof T> = Simplify<
6
+ Omit<T, K> & Required<Pick<T, K>>
7
+ >
@@ -180,7 +180,11 @@ describe('oauth', () => {
180
180
  })
181
181
 
182
182
  it('allows resetting the password', async () => {
183
- const sendTemplateMock = await withMokedMailer(network)
183
+ const sendTemplateMock = jest
184
+ .spyOn(network.pds.ctx.mailer, 'sendResetPassword')
185
+ .mockImplementation(async () => {
186
+ // noop
187
+ })
184
188
 
185
189
  const page = await PageHelper.from(browser)
186
190
 
@@ -194,7 +198,7 @@ describe('oauth', () => {
194
198
  await input.press('Enter')
195
199
  })
196
200
 
197
- await page.checkTitle('Se connecter')
201
+ await page.checkTitle('Connexion')
198
202
 
199
203
  await page.clickOnButton('Oublié ?')
200
204
 
@@ -210,17 +214,13 @@ describe('oauth', () => {
210
214
 
211
215
  expect(sendTemplateMock).toHaveBeenCalledTimes(1)
212
216
 
213
- const [templateName, params] = sendTemplateMock.mock.calls[0]
214
-
215
- expect(templateName).toBe('resetPassword')
217
+ const [params] = sendTemplateMock.mock.lastCall
216
218
  expect(params).toEqual({
217
219
  handle: 'alice.test',
218
220
  token: expect.any(String),
219
221
  })
220
222
 
221
- const { token } = params as { token: string }
222
-
223
- await page.typeInInput('code', token)
223
+ await page.typeInInput('code', params.token)
224
224
 
225
225
  await page.typeInInput('password', 'alice-new-pass')
226
226
 
@@ -233,8 +233,7 @@ describe('oauth', () => {
233
233
  // TODO: Find out why we can't use "using" here
234
234
  await page[Symbol.asyncDispose]()
235
235
 
236
- // TODO: Find out why we can't use "using" here
237
- sendTemplateMock[Symbol.dispose]()
236
+ sendTemplateMock.mockRestore()
238
237
  })
239
238
 
240
239
  it('Allows to sign-in trough OAuth', async () => {
@@ -250,12 +249,12 @@ describe('oauth', () => {
250
249
  await input.press('Enter')
251
250
  })
252
251
 
253
- await page.checkTitle('Se connecter')
252
+ await page.checkTitle('Connexion')
254
253
 
255
254
  await page.typeIn('input[type="password"]', 'alice-new-pass')
256
255
 
257
256
  // Make sure the warning is visible
258
- await page.ensureTextVisibility('Avertissement')
257
+ await page.ensureTextVisibility('Avertissement', 'h3')
259
258
 
260
259
  await page.clickOn(
261
260
  'label::-p-text(Se souvenir de ce compte sur cet appareil)',
@@ -317,31 +316,6 @@ describe('oauth', () => {
317
316
  })
318
317
  })
319
318
 
320
- async function withMokedMailer(network: TestNetworkNoAppView) {
321
- // @ts-expect-error
322
- const sendTemplateOrig = network.pds.ctx.mailer.sendTemplate
323
- const sendTemplateMock = jest.fn(
324
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
325
- async (templateName: unknown, params: unknown, mailOpts: unknown) => {
326
- //
327
- },
328
- ) as jest.Mock<
329
- Promise<void>,
330
- [templateName: unknown, params: unknown, mailOpts: unknown]
331
- > &
332
- Disposable
333
-
334
- sendTemplateMock[Symbol.dispose] = () => {
335
- // @ts-expect-error
336
- network.pds.ctx.mailer.sendTemplate = sendTemplateOrig
337
- }
338
-
339
- // @ts-expect-error
340
- network.pds.ctx.mailer.sendTemplate = sendTemplateMock
341
-
342
- return sendTemplateMock
343
- }
344
-
345
319
  function clientHandler(
346
320
  req: IncomingMessage,
347
321
  res: ServerResponse,
@@ -1,6 +1,5 @@
1
1
  import { AtpAgent } from '@atproto/api'
2
2
  import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
3
- import { AuthScope } from '../dist/auth-verifier'
4
3
  import usersSeed from './seeds/users'
5
4
 
6
5
  describe('user preferences', () => {
@@ -58,7 +57,9 @@ describe('user preferences', () => {
58
57
  store.pref.putPreferences(
59
58
  [{ $type: 'com.atproto.server.defs#unknown' }],
60
59
  'com.atproto',
61
- AuthScope.Access,
60
+ {
61
+ hasAccessFull: true,
62
+ },
62
63
  ),
63
64
  )
64
65
  const { data } = await agent.api.app.bsky.actor.getPreferences(
@@ -109,7 +110,10 @@ describe('user preferences', () => {
109
110
  // Ensure other prefs were not clobbered
110
111
  const otherPrefs = await network.pds.ctx.actorStore.read(
111
112
  sc.dids.alice,
112
- (store) => store.pref.getPreferences('com.atproto', AuthScope.Access),
113
+ (store) =>
114
+ store.pref.getPreferences('com.atproto', {
115
+ hasAccessFull: true,
116
+ }),
113
117
  )
114
118
  expect(otherPrefs).toEqual([{ $type: 'com.atproto.server.defs#unknown' }])
115
119
  })