@atproto/pds 0.4.19 → 0.4.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (302) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/app/bsky/actor/index.d.ts.map +1 -1
  3. package/dist/api/app/bsky/actor/index.js +0 -6
  4. package/dist/api/app/bsky/actor/index.js.map +1 -1
  5. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  6. package/dist/api/app/bsky/feed/getFeed.js +1 -3
  7. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  8. package/dist/api/app/bsky/feed/index.d.ts.map +1 -1
  9. package/dist/api/app/bsky/feed/index.js +0 -20
  10. package/dist/api/app/bsky/feed/index.js.map +1 -1
  11. package/dist/api/app/bsky/index.d.ts.map +1 -1
  12. package/dist/api/app/bsky/index.js +0 -6
  13. package/dist/api/app/bsky/index.js.map +1 -1
  14. package/dist/api/app/bsky/notification/index.d.ts.map +1 -1
  15. package/dist/api/app/bsky/notification/index.js +0 -6
  16. package/dist/api/app/bsky/notification/index.js.map +1 -1
  17. package/dist/api/com/atproto/index.d.ts.map +1 -1
  18. package/dist/api/com/atproto/index.js +0 -2
  19. package/dist/api/com/atproto/index.js.map +1 -1
  20. package/dist/api/com/atproto/repo/getRecord.js +1 -1
  21. package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
  22. package/dist/api/index.d.ts.map +1 -1
  23. package/dist/api/index.js +0 -2
  24. package/dist/api/index.js.map +1 -1
  25. package/dist/context.d.ts +3 -0
  26. package/dist/context.d.ts.map +1 -1
  27. package/dist/context.js +30 -0
  28. package/dist/context.js.map +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +26 -45
  31. package/dist/index.js.map +1 -1
  32. package/dist/pipethrough.d.ts +12 -22
  33. package/dist/pipethrough.d.ts.map +1 -1
  34. package/dist/pipethrough.js +159 -81
  35. package/dist/pipethrough.js.map +1 -1
  36. package/package.json +8 -8
  37. package/src/api/app/bsky/actor/index.ts +0 -6
  38. package/src/api/app/bsky/feed/getFeed.ts +1 -3
  39. package/src/api/app/bsky/feed/index.ts +0 -20
  40. package/src/api/app/bsky/index.ts +0 -6
  41. package/src/api/app/bsky/notification/index.ts +0 -7
  42. package/src/api/com/atproto/index.ts +0 -2
  43. package/src/api/com/atproto/repo/getRecord.ts +1 -1
  44. package/src/api/index.ts +0 -2
  45. package/src/context.ts +34 -1
  46. package/src/index.ts +27 -51
  47. package/src/pipethrough.ts +184 -114
  48. package/dist/api/app/bsky/actor/getSuggestions.d.ts +0 -4
  49. package/dist/api/app/bsky/actor/getSuggestions.d.ts.map +0 -1
  50. package/dist/api/app/bsky/actor/getSuggestions.js +0 -19
  51. package/dist/api/app/bsky/actor/getSuggestions.js.map +0 -1
  52. package/dist/api/app/bsky/actor/searchActors.d.ts +0 -4
  53. package/dist/api/app/bsky/actor/searchActors.d.ts.map +0 -1
  54. package/dist/api/app/bsky/actor/searchActors.js +0 -17
  55. package/dist/api/app/bsky/actor/searchActors.js.map +0 -1
  56. package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts +0 -4
  57. package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts.map +0 -1
  58. package/dist/api/app/bsky/actor/searchActorsTypeahead.js +0 -17
  59. package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +0 -1
  60. package/dist/api/app/bsky/feed/getActorFeeds.d.ts +0 -4
  61. package/dist/api/app/bsky/feed/getActorFeeds.d.ts.map +0 -1
  62. package/dist/api/app/bsky/feed/getActorFeeds.js +0 -17
  63. package/dist/api/app/bsky/feed/getActorFeeds.js.map +0 -1
  64. package/dist/api/app/bsky/feed/getFeedGenerator.d.ts +0 -4
  65. package/dist/api/app/bsky/feed/getFeedGenerator.d.ts.map +0 -1
  66. package/dist/api/app/bsky/feed/getFeedGenerator.js +0 -17
  67. package/dist/api/app/bsky/feed/getFeedGenerator.js.map +0 -1
  68. package/dist/api/app/bsky/feed/getFeedGenerators.d.ts +0 -4
  69. package/dist/api/app/bsky/feed/getFeedGenerators.d.ts.map +0 -1
  70. package/dist/api/app/bsky/feed/getFeedGenerators.js +0 -17
  71. package/dist/api/app/bsky/feed/getFeedGenerators.js.map +0 -1
  72. package/dist/api/app/bsky/feed/getLikes.d.ts +0 -4
  73. package/dist/api/app/bsky/feed/getLikes.d.ts.map +0 -1
  74. package/dist/api/app/bsky/feed/getLikes.js +0 -17
  75. package/dist/api/app/bsky/feed/getLikes.js.map +0 -1
  76. package/dist/api/app/bsky/feed/getListFeed.d.ts +0 -4
  77. package/dist/api/app/bsky/feed/getListFeed.d.ts.map +0 -1
  78. package/dist/api/app/bsky/feed/getListFeed.js +0 -17
  79. package/dist/api/app/bsky/feed/getListFeed.js.map +0 -1
  80. package/dist/api/app/bsky/feed/getPosts.d.ts +0 -4
  81. package/dist/api/app/bsky/feed/getPosts.d.ts.map +0 -1
  82. package/dist/api/app/bsky/feed/getPosts.js +0 -17
  83. package/dist/api/app/bsky/feed/getPosts.js.map +0 -1
  84. package/dist/api/app/bsky/feed/getRepostedBy.d.ts +0 -4
  85. package/dist/api/app/bsky/feed/getRepostedBy.d.ts.map +0 -1
  86. package/dist/api/app/bsky/feed/getRepostedBy.js +0 -17
  87. package/dist/api/app/bsky/feed/getRepostedBy.js.map +0 -1
  88. package/dist/api/app/bsky/feed/getSuggestedFeeds.d.ts +0 -4
  89. package/dist/api/app/bsky/feed/getSuggestedFeeds.d.ts.map +0 -1
  90. package/dist/api/app/bsky/feed/getSuggestedFeeds.js +0 -17
  91. package/dist/api/app/bsky/feed/getSuggestedFeeds.js.map +0 -1
  92. package/dist/api/app/bsky/feed/searchPosts.d.ts +0 -4
  93. package/dist/api/app/bsky/feed/searchPosts.d.ts.map +0 -1
  94. package/dist/api/app/bsky/feed/searchPosts.js +0 -17
  95. package/dist/api/app/bsky/feed/searchPosts.js.map +0 -1
  96. package/dist/api/app/bsky/feed/sendInteractions.d.ts +0 -4
  97. package/dist/api/app/bsky/feed/sendInteractions.d.ts.map +0 -1
  98. package/dist/api/app/bsky/feed/sendInteractions.js +0 -14
  99. package/dist/api/app/bsky/feed/sendInteractions.js.map +0 -1
  100. package/dist/api/app/bsky/graph/getBlocks.d.ts +0 -4
  101. package/dist/api/app/bsky/graph/getBlocks.d.ts.map +0 -1
  102. package/dist/api/app/bsky/graph/getBlocks.js +0 -17
  103. package/dist/api/app/bsky/graph/getBlocks.js.map +0 -1
  104. package/dist/api/app/bsky/graph/getFollowers.d.ts +0 -4
  105. package/dist/api/app/bsky/graph/getFollowers.d.ts.map +0 -1
  106. package/dist/api/app/bsky/graph/getFollowers.js +0 -17
  107. package/dist/api/app/bsky/graph/getFollowers.js.map +0 -1
  108. package/dist/api/app/bsky/graph/getFollows.d.ts +0 -4
  109. package/dist/api/app/bsky/graph/getFollows.d.ts.map +0 -1
  110. package/dist/api/app/bsky/graph/getFollows.js +0 -17
  111. package/dist/api/app/bsky/graph/getFollows.js.map +0 -1
  112. package/dist/api/app/bsky/graph/getList.d.ts +0 -4
  113. package/dist/api/app/bsky/graph/getList.d.ts.map +0 -1
  114. package/dist/api/app/bsky/graph/getList.js +0 -17
  115. package/dist/api/app/bsky/graph/getList.js.map +0 -1
  116. package/dist/api/app/bsky/graph/getListBlocks.d.ts +0 -4
  117. package/dist/api/app/bsky/graph/getListBlocks.d.ts.map +0 -1
  118. package/dist/api/app/bsky/graph/getListBlocks.js +0 -17
  119. package/dist/api/app/bsky/graph/getListBlocks.js.map +0 -1
  120. package/dist/api/app/bsky/graph/getListMutes.d.ts +0 -4
  121. package/dist/api/app/bsky/graph/getListMutes.d.ts.map +0 -1
  122. package/dist/api/app/bsky/graph/getListMutes.js +0 -17
  123. package/dist/api/app/bsky/graph/getListMutes.js.map +0 -1
  124. package/dist/api/app/bsky/graph/getLists.d.ts +0 -4
  125. package/dist/api/app/bsky/graph/getLists.d.ts.map +0 -1
  126. package/dist/api/app/bsky/graph/getLists.js +0 -17
  127. package/dist/api/app/bsky/graph/getLists.js.map +0 -1
  128. package/dist/api/app/bsky/graph/getMutes.d.ts +0 -4
  129. package/dist/api/app/bsky/graph/getMutes.d.ts.map +0 -1
  130. package/dist/api/app/bsky/graph/getMutes.js +0 -17
  131. package/dist/api/app/bsky/graph/getMutes.js.map +0 -1
  132. package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.d.ts +0 -4
  133. package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +0 -1
  134. package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js +0 -17
  135. package/dist/api/app/bsky/graph/getSuggestedFollowsByActor.js.map +0 -1
  136. package/dist/api/app/bsky/graph/index.d.ts +0 -4
  137. package/dist/api/app/bsky/graph/index.d.ts.map +0 -1
  138. package/dist/api/app/bsky/graph/index.js +0 -35
  139. package/dist/api/app/bsky/graph/index.js.map +0 -1
  140. package/dist/api/app/bsky/graph/muteActor.d.ts +0 -4
  141. package/dist/api/app/bsky/graph/muteActor.d.ts.map +0 -1
  142. package/dist/api/app/bsky/graph/muteActor.js +0 -14
  143. package/dist/api/app/bsky/graph/muteActor.js.map +0 -1
  144. package/dist/api/app/bsky/graph/muteActorList.d.ts +0 -4
  145. package/dist/api/app/bsky/graph/muteActorList.d.ts.map +0 -1
  146. package/dist/api/app/bsky/graph/muteActorList.js +0 -14
  147. package/dist/api/app/bsky/graph/muteActorList.js.map +0 -1
  148. package/dist/api/app/bsky/graph/unmuteActor.d.ts +0 -4
  149. package/dist/api/app/bsky/graph/unmuteActor.d.ts.map +0 -1
  150. package/dist/api/app/bsky/graph/unmuteActor.js +0 -14
  151. package/dist/api/app/bsky/graph/unmuteActor.js.map +0 -1
  152. package/dist/api/app/bsky/graph/unmuteActorList.d.ts +0 -4
  153. package/dist/api/app/bsky/graph/unmuteActorList.d.ts.map +0 -1
  154. package/dist/api/app/bsky/graph/unmuteActorList.js +0 -14
  155. package/dist/api/app/bsky/graph/unmuteActorList.js.map +0 -1
  156. package/dist/api/app/bsky/labeler/getServices.d.ts +0 -4
  157. package/dist/api/app/bsky/labeler/getServices.d.ts.map +0 -1
  158. package/dist/api/app/bsky/labeler/getServices.js +0 -14
  159. package/dist/api/app/bsky/labeler/getServices.js.map +0 -1
  160. package/dist/api/app/bsky/labeler/index.d.ts +0 -4
  161. package/dist/api/app/bsky/labeler/index.d.ts.map +0 -1
  162. package/dist/api/app/bsky/labeler/index.js +0 -11
  163. package/dist/api/app/bsky/labeler/index.js.map +0 -1
  164. package/dist/api/app/bsky/notification/getUnreadCount.d.ts +0 -4
  165. package/dist/api/app/bsky/notification/getUnreadCount.d.ts.map +0 -1
  166. package/dist/api/app/bsky/notification/getUnreadCount.js +0 -17
  167. package/dist/api/app/bsky/notification/getUnreadCount.js.map +0 -1
  168. package/dist/api/app/bsky/notification/listNotifications.d.ts +0 -4
  169. package/dist/api/app/bsky/notification/listNotifications.d.ts.map +0 -1
  170. package/dist/api/app/bsky/notification/listNotifications.js +0 -17
  171. package/dist/api/app/bsky/notification/listNotifications.js.map +0 -1
  172. package/dist/api/app/bsky/notification/updateSeen.d.ts +0 -4
  173. package/dist/api/app/bsky/notification/updateSeen.d.ts.map +0 -1
  174. package/dist/api/app/bsky/notification/updateSeen.js +0 -14
  175. package/dist/api/app/bsky/notification/updateSeen.js.map +0 -1
  176. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts +0 -4
  177. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts.map +0 -1
  178. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js +0 -18
  179. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js.map +0 -1
  180. package/dist/api/app/bsky/unspecced/getTaggedSuggestions.d.ts +0 -4
  181. package/dist/api/app/bsky/unspecced/getTaggedSuggestions.d.ts.map +0 -1
  182. package/dist/api/app/bsky/unspecced/getTaggedSuggestions.js +0 -18
  183. package/dist/api/app/bsky/unspecced/getTaggedSuggestions.js.map +0 -1
  184. package/dist/api/app/bsky/unspecced/index.d.ts +0 -4
  185. package/dist/api/app/bsky/unspecced/index.d.ts.map +0 -1
  186. package/dist/api/app/bsky/unspecced/index.js +0 -14
  187. package/dist/api/app/bsky/unspecced/index.js.map +0 -1
  188. package/dist/api/com/atproto/moderation/createReport.d.ts +0 -4
  189. package/dist/api/com/atproto/moderation/createReport.d.ts.map +0 -1
  190. package/dist/api/com/atproto/moderation/createReport.js +0 -14
  191. package/dist/api/com/atproto/moderation/createReport.js.map +0 -1
  192. package/dist/api/com/atproto/moderation/index.d.ts +0 -4
  193. package/dist/api/com/atproto/moderation/index.d.ts.map +0 -1
  194. package/dist/api/com/atproto/moderation/index.js +0 -11
  195. package/dist/api/com/atproto/moderation/index.js.map +0 -1
  196. package/dist/api/tools/ozone/communication/createTemplate.d.ts +0 -4
  197. package/dist/api/tools/ozone/communication/createTemplate.d.ts.map +0 -1
  198. package/dist/api/tools/ozone/communication/createTemplate.js +0 -14
  199. package/dist/api/tools/ozone/communication/createTemplate.js.map +0 -1
  200. package/dist/api/tools/ozone/communication/deleteTemplate.d.ts +0 -4
  201. package/dist/api/tools/ozone/communication/deleteTemplate.d.ts.map +0 -1
  202. package/dist/api/tools/ozone/communication/deleteTemplate.js +0 -14
  203. package/dist/api/tools/ozone/communication/deleteTemplate.js.map +0 -1
  204. package/dist/api/tools/ozone/communication/index.d.ts +0 -4
  205. package/dist/api/tools/ozone/communication/index.d.ts.map +0 -1
  206. package/dist/api/tools/ozone/communication/index.js +0 -17
  207. package/dist/api/tools/ozone/communication/index.js.map +0 -1
  208. package/dist/api/tools/ozone/communication/listTemplates.d.ts +0 -4
  209. package/dist/api/tools/ozone/communication/listTemplates.d.ts.map +0 -1
  210. package/dist/api/tools/ozone/communication/listTemplates.js +0 -14
  211. package/dist/api/tools/ozone/communication/listTemplates.js.map +0 -1
  212. package/dist/api/tools/ozone/communication/updateTemplate.d.ts +0 -4
  213. package/dist/api/tools/ozone/communication/updateTemplate.d.ts.map +0 -1
  214. package/dist/api/tools/ozone/communication/updateTemplate.js +0 -14
  215. package/dist/api/tools/ozone/communication/updateTemplate.js.map +0 -1
  216. package/dist/api/tools/ozone/index.d.ts +0 -4
  217. package/dist/api/tools/ozone/index.d.ts.map +0 -1
  218. package/dist/api/tools/ozone/index.js +0 -13
  219. package/dist/api/tools/ozone/index.js.map +0 -1
  220. package/dist/api/tools/ozone/moderation/emitEvent.d.ts +0 -4
  221. package/dist/api/tools/ozone/moderation/emitEvent.d.ts.map +0 -1
  222. package/dist/api/tools/ozone/moderation/emitEvent.js +0 -14
  223. package/dist/api/tools/ozone/moderation/emitEvent.js.map +0 -1
  224. package/dist/api/tools/ozone/moderation/getEvent.d.ts +0 -4
  225. package/dist/api/tools/ozone/moderation/getEvent.d.ts.map +0 -1
  226. package/dist/api/tools/ozone/moderation/getEvent.js +0 -14
  227. package/dist/api/tools/ozone/moderation/getEvent.js.map +0 -1
  228. package/dist/api/tools/ozone/moderation/getRecord.d.ts +0 -4
  229. package/dist/api/tools/ozone/moderation/getRecord.d.ts.map +0 -1
  230. package/dist/api/tools/ozone/moderation/getRecord.js +0 -14
  231. package/dist/api/tools/ozone/moderation/getRecord.js.map +0 -1
  232. package/dist/api/tools/ozone/moderation/getRepo.d.ts +0 -4
  233. package/dist/api/tools/ozone/moderation/getRepo.d.ts.map +0 -1
  234. package/dist/api/tools/ozone/moderation/getRepo.js +0 -14
  235. package/dist/api/tools/ozone/moderation/getRepo.js.map +0 -1
  236. package/dist/api/tools/ozone/moderation/index.d.ts +0 -4
  237. package/dist/api/tools/ozone/moderation/index.d.ts.map +0 -1
  238. package/dist/api/tools/ozone/moderation/index.js +0 -23
  239. package/dist/api/tools/ozone/moderation/index.js.map +0 -1
  240. package/dist/api/tools/ozone/moderation/queryEvents.d.ts +0 -4
  241. package/dist/api/tools/ozone/moderation/queryEvents.d.ts.map +0 -1
  242. package/dist/api/tools/ozone/moderation/queryEvents.js +0 -14
  243. package/dist/api/tools/ozone/moderation/queryEvents.js.map +0 -1
  244. package/dist/api/tools/ozone/moderation/queryStatuses.d.ts +0 -4
  245. package/dist/api/tools/ozone/moderation/queryStatuses.d.ts.map +0 -1
  246. package/dist/api/tools/ozone/moderation/queryStatuses.js +0 -14
  247. package/dist/api/tools/ozone/moderation/queryStatuses.js.map +0 -1
  248. package/dist/api/tools/ozone/moderation/searchRepos.d.ts +0 -4
  249. package/dist/api/tools/ozone/moderation/searchRepos.d.ts.map +0 -1
  250. package/dist/api/tools/ozone/moderation/searchRepos.js +0 -14
  251. package/dist/api/tools/ozone/moderation/searchRepos.js.map +0 -1
  252. package/src/api/app/bsky/actor/getSuggestions.ts +0 -17
  253. package/src/api/app/bsky/actor/searchActors.ts +0 -15
  254. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +0 -15
  255. package/src/api/app/bsky/feed/getActorFeeds.ts +0 -15
  256. package/src/api/app/bsky/feed/getFeedGenerator.ts +0 -15
  257. package/src/api/app/bsky/feed/getFeedGenerators.ts +0 -15
  258. package/src/api/app/bsky/feed/getLikes.ts +0 -15
  259. package/src/api/app/bsky/feed/getListFeed.ts +0 -15
  260. package/src/api/app/bsky/feed/getPosts.ts +0 -15
  261. package/src/api/app/bsky/feed/getRepostedBy.ts +0 -15
  262. package/src/api/app/bsky/feed/getSuggestedFeeds.ts +0 -15
  263. package/src/api/app/bsky/feed/searchPosts.ts +0 -15
  264. package/src/api/app/bsky/feed/sendInteractions.ts +0 -13
  265. package/src/api/app/bsky/graph/getBlocks.ts +0 -15
  266. package/src/api/app/bsky/graph/getFollowers.ts +0 -15
  267. package/src/api/app/bsky/graph/getFollows.ts +0 -15
  268. package/src/api/app/bsky/graph/getList.ts +0 -15
  269. package/src/api/app/bsky/graph/getListBlocks.ts +0 -15
  270. package/src/api/app/bsky/graph/getListMutes.ts +0 -15
  271. package/src/api/app/bsky/graph/getLists.ts +0 -15
  272. package/src/api/app/bsky/graph/getMutes.ts +0 -15
  273. package/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +0 -15
  274. package/src/api/app/bsky/graph/index.ts +0 -31
  275. package/src/api/app/bsky/graph/muteActor.ts +0 -13
  276. package/src/api/app/bsky/graph/muteActorList.ts +0 -13
  277. package/src/api/app/bsky/graph/unmuteActor.ts +0 -13
  278. package/src/api/app/bsky/graph/unmuteActorList.ts +0 -13
  279. package/src/api/app/bsky/labeler/getServices.ts +0 -13
  280. package/src/api/app/bsky/labeler/index.ts +0 -7
  281. package/src/api/app/bsky/notification/getUnreadCount.ts +0 -15
  282. package/src/api/app/bsky/notification/listNotifications.ts +0 -15
  283. package/src/api/app/bsky/notification/updateSeen.ts +0 -13
  284. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +0 -16
  285. package/src/api/app/bsky/unspecced/getTaggedSuggestions.ts +0 -16
  286. package/src/api/app/bsky/unspecced/index.ts +0 -10
  287. package/src/api/com/atproto/moderation/createReport.ts +0 -13
  288. package/src/api/com/atproto/moderation/index.ts +0 -7
  289. package/src/api/tools/ozone/communication/createTemplate.ts +0 -13
  290. package/src/api/tools/ozone/communication/deleteTemplate.ts +0 -13
  291. package/src/api/tools/ozone/communication/index.ts +0 -13
  292. package/src/api/tools/ozone/communication/listTemplates.ts +0 -13
  293. package/src/api/tools/ozone/communication/updateTemplate.ts +0 -13
  294. package/src/api/tools/ozone/index.ts +0 -9
  295. package/src/api/tools/ozone/moderation/emitEvent.ts +0 -13
  296. package/src/api/tools/ozone/moderation/getEvent.ts +0 -13
  297. package/src/api/tools/ozone/moderation/getRecord.ts +0 -13
  298. package/src/api/tools/ozone/moderation/getRepo.ts +0 -13
  299. package/src/api/tools/ozone/moderation/index.ts +0 -19
  300. package/src/api/tools/ozone/moderation/queryEvents.ts +0 -13
  301. package/src/api/tools/ozone/moderation/queryStatuses.ts +0 -13
  302. package/src/api/tools/ozone/moderation/searchRepos.ts +0 -13
@@ -26,82 +26,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.parseRes = exports.doProxy = exports.createUrlAndHeaders = exports.parseProxyHeader = exports.pipethroughProcedure = exports.pipethrough = void 0;
29
+ exports.parseRes = exports.parseProxyRes = exports.pipeProxyRes = exports.makeRequest = exports.parseProxyHeader = exports.formatHeaders = exports.formatUrlAndAud = exports.pipethrough = exports.proxyHandler = void 0;
30
30
  const ui8 = __importStar(require("uint8arrays"));
31
31
  const node_net_1 = __importDefault(require("node:net"));
32
+ const node_stream_1 = __importDefault(require("node:stream"));
32
33
  const lexicon_1 = require("@atproto/lexicon");
33
34
  const xrpc_server_1 = require("@atproto/xrpc-server");
34
35
  const xrpc_1 = require("@atproto/xrpc");
35
36
  const lexicons_1 = require("./lexicon/lexicons");
36
37
  const logger_1 = require("./logger");
37
38
  const common_1 = require("@atproto/common");
38
- const defaultService = (ctx, path) => {
39
- const nsid = path.replace('/xrpc/', '');
40
- switch (nsid) {
41
- case lexicons_1.ids.ToolsOzoneCommunicationCreateTemplate:
42
- case lexicons_1.ids.ToolsOzoneCommunicationDeleteTemplate:
43
- case lexicons_1.ids.ToolsOzoneCommunicationUpdateTemplate:
44
- case lexicons_1.ids.ToolsOzoneCommunicationListTemplates:
45
- case lexicons_1.ids.ToolsOzoneModerationEmitEvent:
46
- case lexicons_1.ids.ToolsOzoneModerationGetEvent:
47
- case lexicons_1.ids.ToolsOzoneModerationGetRecord:
48
- case lexicons_1.ids.ToolsOzoneModerationGetRepo:
49
- case lexicons_1.ids.ToolsOzoneModerationQueryEvents:
50
- case lexicons_1.ids.ToolsOzoneModerationQueryStatuses:
51
- case lexicons_1.ids.ToolsOzoneModerationSearchRepos:
52
- return ctx.cfg.modService;
53
- case lexicons_1.ids.ComAtprotoModerationCreateReport:
54
- return ctx.cfg.reportService;
55
- default:
56
- return ctx.cfg.bskyAppView;
39
+ const proxyHandler = (ctx) => async (req, res, next) => {
40
+ try {
41
+ const { url, aud } = await (0, exports.formatUrlAndAud)(ctx, req);
42
+ const auth = await ctx.authVerifier.access({ req });
43
+ const headers = await (0, exports.formatHeaders)(ctx, req, aud, auth.credentials.did);
44
+ const body = node_stream_1.default.Readable.toWeb(req);
45
+ const reqInit = formatReqInit(req, headers, body);
46
+ const proxyRes = await (0, exports.makeRequest)(url, reqInit);
47
+ await (0, exports.pipeProxyRes)(proxyRes, res);
57
48
  }
49
+ catch (err) {
50
+ return next(err);
51
+ }
52
+ return next();
58
53
  };
59
- const pipethrough = async (ctx, req, requester, audOverride, options) => {
60
- const { url, headers } = await (0, exports.createUrlAndHeaders)(ctx, req, requester, audOverride, options);
61
- const reqInit = {
62
- headers,
63
- };
64
- return (0, exports.doProxy)(url, reqInit);
54
+ exports.proxyHandler = proxyHandler;
55
+ const pipethrough = async (ctx, req, requester, audOverride) => {
56
+ const { url, aud } = await (0, exports.formatUrlAndAud)(ctx, req, audOverride);
57
+ const headers = await (0, exports.formatHeaders)(ctx, req, aud, requester);
58
+ const reqInit = formatReqInit(req, headers);
59
+ const res = await (0, exports.makeRequest)(url, reqInit);
60
+ return (0, exports.parseProxyRes)(res);
65
61
  };
66
62
  exports.pipethrough = pipethrough;
67
- const pipethroughProcedure = async (ctx, req, body, requester, audOverride) => {
68
- const { url, headers } = await (0, exports.createUrlAndHeaders)(ctx, req, requester, audOverride);
69
- const reqInit = {
70
- method: 'post',
71
- headers,
72
- body: new TextEncoder().encode((0, lexicon_1.stringifyLex)(body)),
73
- duplex: 'half',
74
- };
75
- return (0, exports.doProxy)(url, reqInit);
76
- };
77
- exports.pipethroughProcedure = pipethroughProcedure;
78
- const parseProxyHeader = async (ctx, req) => {
79
- const proxyTo = req.header('atproto-proxy');
80
- if (!proxyTo)
81
- return;
82
- const [did, serviceId] = proxyTo.split('#');
83
- if (!serviceId) {
84
- throw new xrpc_server_1.InvalidRequestError('no service id specified');
85
- }
86
- const didDoc = await ctx.idResolver.did.resolve(did);
87
- if (!didDoc) {
88
- throw new xrpc_server_1.InvalidRequestError('could not resolve proxy did');
89
- }
90
- const serviceUrl = (0, common_1.getServiceEndpoint)(didDoc, { id: `#${serviceId}` });
91
- if (!serviceUrl) {
92
- throw new xrpc_server_1.InvalidRequestError('could not resolve proxy did service url');
93
- }
94
- return { did, serviceUrl };
95
- };
96
- exports.parseProxyHeader = parseProxyHeader;
63
+ // Request setup/formatting
64
+ // -------------------
97
65
  const REQ_HEADERS_TO_FORWARD = [
98
66
  'accept-language',
99
67
  'content-type',
100
68
  'atproto-accept-labelers',
69
+ 'x-bsky-topics',
101
70
  ];
102
- const createUrlAndHeaders = async (ctx, req, requester, audOverride, options) => {
71
+ const formatUrlAndAud = async (ctx, req, audOverride) => {
103
72
  const proxyTo = await (0, exports.parseProxyHeader)(ctx, req);
104
- const defaultProxy = defaultService(ctx, req.path);
73
+ const defaultProxy = defaultService(ctx, req);
105
74
  const serviceUrl = proxyTo?.serviceUrl ?? defaultProxy?.url;
106
75
  const aud = audOverride ?? proxyTo?.did ?? defaultProxy?.did;
107
76
  if (!serviceUrl || !aud) {
@@ -111,52 +80,168 @@ const createUrlAndHeaders = async (ctx, req, requester, audOverride, options) =>
111
80
  if (!ctx.cfg.service.devMode && !isSafeUrl(url)) {
112
81
  throw new xrpc_server_1.InvalidRequestError(`Invalid service url: ${url.toString()}`);
113
82
  }
83
+ return { url, aud };
84
+ };
85
+ exports.formatUrlAndAud = formatUrlAndAud;
86
+ const formatHeaders = async (ctx, req, aud, requester) => {
114
87
  const headers = requester
115
88
  ? (await ctx.serviceAuthHeaders(requester, aud)).headers
116
89
  : {};
117
- const allowedHeaders = REQ_HEADERS_TO_FORWARD.concat(options?.reqHeadersToForward ?? []);
118
90
  // forward select headers to upstream services
119
- for (const header of allowedHeaders) {
91
+ for (const header of REQ_HEADERS_TO_FORWARD) {
120
92
  const val = req.headers[header];
121
93
  if (val) {
122
94
  headers[header] = val;
123
95
  }
124
96
  }
125
- return { url, headers };
97
+ return headers;
98
+ };
99
+ exports.formatHeaders = formatHeaders;
100
+ const formatReqInit = (req, headers, body) => {
101
+ if (req.method === 'GET') {
102
+ return {
103
+ method: 'get',
104
+ headers,
105
+ };
106
+ }
107
+ else if (req.method === 'HEAD') {
108
+ return {
109
+ method: 'head',
110
+ headers,
111
+ };
112
+ }
113
+ else if (req.method === 'POST') {
114
+ return {
115
+ method: 'post',
116
+ headers,
117
+ body,
118
+ duplex: 'half',
119
+ };
120
+ }
121
+ else {
122
+ throw new xrpc_server_1.InvalidRequestError('Method not found');
123
+ }
124
+ };
125
+ const parseProxyHeader = async (ctx, req) => {
126
+ const proxyTo = req.header('atproto-proxy');
127
+ if (!proxyTo)
128
+ return;
129
+ const [did, serviceId] = proxyTo.split('#');
130
+ if (!serviceId) {
131
+ throw new xrpc_server_1.InvalidRequestError('no service id specified');
132
+ }
133
+ const didDoc = await ctx.idResolver.did.resolve(did);
134
+ if (!didDoc) {
135
+ throw new xrpc_server_1.InvalidRequestError('could not resolve proxy did');
136
+ }
137
+ const serviceUrl = (0, common_1.getServiceEndpoint)(didDoc, { id: `#${serviceId}` });
138
+ if (!serviceUrl) {
139
+ throw new xrpc_server_1.InvalidRequestError('could not resolve proxy did service url');
140
+ }
141
+ return { did, serviceUrl };
126
142
  };
127
- exports.createUrlAndHeaders = createUrlAndHeaders;
128
- const doProxy = async (url, reqInit) => {
143
+ exports.parseProxyHeader = parseProxyHeader;
144
+ // Sending request
145
+ // -------------------
146
+ const makeRequest = async (url, reqInit) => {
129
147
  let res;
130
- let buffer;
131
148
  try {
132
149
  res = await fetch(url, reqInit);
133
- buffer = await res.arrayBuffer();
134
150
  }
135
151
  catch (err) {
136
152
  logger_1.httpLogger.warn({ err }, 'pipethrough network error');
137
153
  throw new xrpc_1.XRPCError(xrpc_1.ResponseType.UpstreamFailure);
138
154
  }
139
155
  if (res.status !== xrpc_1.ResponseType.Success) {
140
- const ui8Buffer = new Uint8Array(buffer);
156
+ const arrBuffer = await readArrayBufferRes(res);
157
+ const ui8Buffer = new Uint8Array(arrBuffer);
141
158
  const errInfo = safeParseJson(ui8.toString(ui8Buffer, 'utf8'));
142
159
  throw new xrpc_1.XRPCError(res.status, safeString(errInfo?.['error']), safeString(errInfo?.['message']), simpleHeaders(res.headers));
143
160
  }
144
- const encoding = res.headers.get('content-type') ?? 'application/json';
145
- const resHeaders = makeResHeaders(res);
146
- return { encoding, buffer, headers: resHeaders };
161
+ return res;
147
162
  };
148
- exports.doProxy = doProxy;
163
+ exports.makeRequest = makeRequest;
164
+ // Response parsing/forwarding
165
+ // -------------------
149
166
  const RES_HEADERS_TO_FORWARD = [
150
- 'atproto-repo-rev',
167
+ 'content-type',
151
168
  'content-language',
169
+ 'atproto-repo-rev',
152
170
  'atproto-content-labelers',
153
171
  ];
154
- const makeResHeaders = (res) => {
155
- const headers = RES_HEADERS_TO_FORWARD.reduce((acc, cur) => {
172
+ const pipeProxyRes = async (upstreamRes, ownRes) => {
173
+ for (const headerName of RES_HEADERS_TO_FORWARD) {
174
+ const headerVal = upstreamRes.headers.get(headerName);
175
+ if (headerVal) {
176
+ ownRes.setHeader(headerName, headerVal);
177
+ }
178
+ }
179
+ if (upstreamRes.body) {
180
+ const contentLength = upstreamRes.headers.get('content-length');
181
+ const contentEncoding = upstreamRes.headers.get('content-encoding');
182
+ if (contentLength && (!contentEncoding || contentEncoding === 'identity')) {
183
+ ownRes.setHeader('content-length', contentLength);
184
+ }
185
+ else {
186
+ ownRes.setHeader('transfer-encoding', 'chunked');
187
+ }
188
+ ownRes.status(200);
189
+ const resStream = node_stream_1.default.Readable.fromWeb(upstreamRes.body);
190
+ await node_stream_1.default.promises.pipeline(resStream, ownRes);
191
+ }
192
+ else {
193
+ ownRes.status(200).end();
194
+ }
195
+ };
196
+ exports.pipeProxyRes = pipeProxyRes;
197
+ const parseProxyRes = async (res) => {
198
+ const buffer = await readArrayBufferRes(res);
199
+ const encoding = res.headers.get('content-type') ?? 'application/json';
200
+ const resHeaders = RES_HEADERS_TO_FORWARD.reduce((acc, cur) => {
156
201
  acc[cur] = res.headers.get(cur) ?? undefined;
157
202
  return acc;
158
203
  }, {});
159
- return (0, common_1.noUndefinedVals)(headers);
204
+ return { encoding, buffer, headers: (0, common_1.noUndefinedVals)(resHeaders) };
205
+ };
206
+ exports.parseProxyRes = parseProxyRes;
207
+ // Utils
208
+ // -------------------
209
+ const defaultService = (ctx, req) => {
210
+ const nsid = req.originalUrl.split('?')[0].replace('/xrpc/', '');
211
+ switch (nsid) {
212
+ case lexicons_1.ids.ToolsOzoneCommunicationCreateTemplate:
213
+ case lexicons_1.ids.ToolsOzoneCommunicationDeleteTemplate:
214
+ case lexicons_1.ids.ToolsOzoneCommunicationUpdateTemplate:
215
+ case lexicons_1.ids.ToolsOzoneCommunicationListTemplates:
216
+ case lexicons_1.ids.ToolsOzoneModerationEmitEvent:
217
+ case lexicons_1.ids.ToolsOzoneModerationGetEvent:
218
+ case lexicons_1.ids.ToolsOzoneModerationGetRecord:
219
+ case lexicons_1.ids.ToolsOzoneModerationGetRepo:
220
+ case lexicons_1.ids.ToolsOzoneModerationQueryEvents:
221
+ case lexicons_1.ids.ToolsOzoneModerationQueryStatuses:
222
+ case lexicons_1.ids.ToolsOzoneModerationSearchRepos:
223
+ return ctx.cfg.modService;
224
+ case lexicons_1.ids.ComAtprotoModerationCreateReport:
225
+ return ctx.cfg.reportService;
226
+ default:
227
+ return ctx.cfg.bskyAppView;
228
+ }
229
+ };
230
+ const parseRes = (nsid, res) => {
231
+ const buffer = new Uint8Array(res.buffer);
232
+ const json = safeParseJson(ui8.toString(buffer, 'utf8'));
233
+ const lex = json && (0, lexicon_1.jsonToLex)(json);
234
+ return lexicons_1.lexicons.assertValidXrpcOutput(nsid, lex);
235
+ };
236
+ exports.parseRes = parseRes;
237
+ const readArrayBufferRes = async (res) => {
238
+ try {
239
+ return await res.arrayBuffer();
240
+ }
241
+ catch (err) {
242
+ logger_1.httpLogger.warn({ err }, 'pipethrough network error');
243
+ throw new xrpc_1.XRPCError(xrpc_1.ResponseType.UpstreamFailure);
244
+ }
160
245
  };
161
246
  const isSafeUrl = (url) => {
162
247
  if (url.protocol !== 'https:')
@@ -167,13 +252,6 @@ const isSafeUrl = (url) => {
167
252
  return false;
168
253
  return true;
169
254
  };
170
- const parseRes = (nsid, res) => {
171
- const buffer = new Uint8Array(res.buffer);
172
- const json = safeParseJson(ui8.toString(buffer, 'utf8'));
173
- const lex = json && (0, lexicon_1.jsonToLex)(json);
174
- return lexicons_1.lexicons.assertValidXrpcOutput(nsid, lex);
175
- };
176
- exports.parseRes = parseRes;
177
255
  const safeString = (str) => {
178
256
  return typeof str === 'string' ? str : undefined;
179
257
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAClC,wDAA0B;AAC1B,8CAAoE;AACpE,sDAA8E;AAC9E,wCAAuD;AACvD,iDAAkD;AAClD,qCAAqC;AACrC,4CAAqE;AAWrE,MAAM,cAAc,GAAG,CACrB,GAAe,EACf,IAAY,EACyB,EAAE;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IACvC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,cAAG,CAAC,qCAAqC,CAAC;QAC/C,KAAK,cAAG,CAAC,qCAAqC,CAAC;QAC/C,KAAK,cAAG,CAAC,qCAAqC,CAAC;QAC/C,KAAK,cAAG,CAAC,oCAAoC,CAAC;QAC9C,KAAK,cAAG,CAAC,6BAA6B,CAAC;QACvC,KAAK,cAAG,CAAC,4BAA4B,CAAC;QACtC,KAAK,cAAG,CAAC,6BAA6B,CAAC;QACvC,KAAK,cAAG,CAAC,2BAA2B,CAAC;QACrC,KAAK,cAAG,CAAC,+BAA+B,CAAC;QACzC,KAAK,cAAG,CAAC,iCAAiC,CAAC;QAC3C,KAAK,cAAG,CAAC,+BAA+B;YACtC,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,CAAA;QAC3B,KAAK,cAAG,CAAC,gCAAgC;YACvC,OAAO,GAAG,CAAC,GAAG,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AAC,GAAW,EAAsB,EAAE;IACrD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAClD,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE;IAC9C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,OAAgB,EAA0B,EAAE;IACjE,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IACnB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.19",
3
+ "version": "0.4.21",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -43,16 +43,16 @@
43
43
  "typed-emitter": "^2.1.0",
44
44
  "uint8arrays": "3.0.0",
45
45
  "zod": "^3.21.4",
46
- "@atproto/api": "^0.12.8",
46
+ "@atproto/api": "^0.12.9",
47
47
  "@atproto/aws": "^0.2.0",
48
- "@atproto/common": "^0.4.0",
49
- "@atproto/crypto": "^0.4.0",
50
48
  "@atproto/identity": "^0.4.0",
51
49
  "@atproto/lexicon": "^0.4.0",
52
50
  "@atproto/repo": "^0.4.0",
53
51
  "@atproto/syntax": "^0.3.0",
54
52
  "@atproto/xrpc": "^0.5.0",
55
- "@atproto/xrpc-server": "^0.5.1"
53
+ "@atproto/xrpc-server": "^0.5.1",
54
+ "@atproto/common": "^0.4.0",
55
+ "@atproto/crypto": "^0.4.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -70,9 +70,9 @@
70
70
  "jest": "^28.1.2",
71
71
  "ts-node": "^10.8.2",
72
72
  "ws": "^8.12.0",
73
- "@atproto/api": "^0.12.8",
74
- "@atproto/bsky": "^0.0.50",
75
- "@atproto/lex-cli": "^0.4.0"
73
+ "@atproto/api": "^0.12.9",
74
+ "@atproto/lex-cli": "^0.4.0",
75
+ "@atproto/bsky": "^0.0.51"
76
76
  },
77
77
  "scripts": {
78
78
  "codegen": "lex gen-server ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/tools/ozone/*/*",
@@ -4,17 +4,11 @@ import AppContext from '../../../../context'
4
4
  import getPreferences from './getPreferences'
5
5
  import getProfile from './getProfile'
6
6
  import getProfiles from './getProfiles'
7
- import getSuggestions from './getSuggestions'
8
7
  import putPreferences from './putPreferences'
9
- import searchActors from './searchActors'
10
- import searchActorsTypeahead from './searchActorsTypeahead'
11
8
 
12
9
  export default function (server: Server, ctx: AppContext) {
13
10
  getPreferences(server, ctx)
14
11
  getProfile(server, ctx)
15
12
  getProfiles(server, ctx)
16
- getSuggestions(server, ctx)
17
13
  putPreferences(server, ctx)
18
- searchActors(server, ctx)
19
- searchActorsTypeahead(server, ctx)
20
14
  }
@@ -16,9 +16,7 @@ export default function (server: Server, ctx: AppContext) {
16
16
  { feed: params.feed },
17
17
  await ctx.appviewAuthHeaders(requester),
18
18
  )
19
- return pipethrough(ctx, req, requester, feed.view.did, {
20
- reqHeadersToForward: ['x-bsky-topics'],
21
- })
19
+ return pipethrough(ctx, req, requester, feed.view.did)
22
20
  },
23
21
  })
24
22
  }
@@ -1,35 +1,15 @@
1
1
  import { Server } from '../../../../lexicon'
2
2
  import AppContext from '../../../../context'
3
- import getActorFeeds from './getActorFeeds'
4
3
  import getActorLikes from './getActorLikes'
5
4
  import getAuthorFeed from './getAuthorFeed'
6
5
  import getFeed from './getFeed'
7
- import getFeedGenerator from './getFeedGenerator'
8
- import getFeedGenerators from './getFeedGenerators'
9
- import getLikes from './getLikes'
10
- import getListFeed from './getListFeed'
11
- import getPosts from './getPosts'
12
6
  import getPostThread from './getPostThread'
13
- import getRepostedBy from './getRepostedBy'
14
- import getSuggestedFeeds from './getSuggestedFeeds'
15
7
  import getTimeline from './getTimeline'
16
- import searchPosts from './searchPosts'
17
- import sendInteractions from './sendInteractions'
18
8
 
19
9
  export default function (server: Server, ctx: AppContext) {
20
- getActorFeeds(server, ctx)
21
10
  getActorLikes(server, ctx)
22
11
  getAuthorFeed(server, ctx)
23
12
  getFeed(server, ctx)
24
- getFeedGenerator(server, ctx)
25
- getFeedGenerators(server, ctx)
26
- getLikes(server, ctx)
27
- getListFeed(server, ctx)
28
- getPosts(server, ctx)
29
13
  getPostThread(server, ctx)
30
- getRepostedBy(server, ctx)
31
- getSuggestedFeeds(server, ctx)
32
14
  getTimeline(server, ctx)
33
- searchPosts(server, ctx)
34
- sendInteractions(server, ctx)
35
15
  }
@@ -2,16 +2,10 @@ import { Server } from '../../../lexicon'
2
2
  import AppContext from '../../../context'
3
3
  import actor from './actor'
4
4
  import feed from './feed'
5
- import graph from './graph'
6
- import labeler from './labeler'
7
5
  import notification from './notification'
8
- import unspecced from './unspecced'
9
6
 
10
7
  export default function (server: Server, ctx: AppContext) {
11
8
  actor(server, ctx)
12
9
  feed(server, ctx)
13
- graph(server, ctx)
14
- labeler(server, ctx)
15
10
  notification(server, ctx)
16
- unspecced(server, ctx)
17
11
  }
@@ -1,14 +1,7 @@
1
1
  import { Server } from '../../../../lexicon'
2
2
  import AppContext from '../../../../context'
3
-
4
- import getUnreadCount from './getUnreadCount'
5
- import listNotifications from './listNotifications'
6
3
  import registerPush from './registerPush'
7
- import updateSeen from './updateSeen'
8
4
 
9
5
  export default function (server: Server, ctx: AppContext) {
10
- getUnreadCount(server, ctx)
11
- listNotifications(server, ctx)
12
6
  registerPush(server, ctx)
13
- updateSeen(server, ctx)
14
7
  }
@@ -2,7 +2,6 @@ import AppContext from '../../../context'
2
2
  import { Server } from '../../../lexicon'
3
3
  import admin from './admin'
4
4
  import identity from './identity'
5
- import moderation from './moderation'
6
5
  import repo from './repo'
7
6
  import serverMethods from './server'
8
7
  import sync from './sync'
@@ -11,7 +10,6 @@ import temp from './temp'
11
10
  export default function (server: Server, ctx: AppContext) {
12
11
  admin(server, ctx)
13
12
  identity(server, ctx)
14
- moderation(server, ctx)
15
13
  repo(server, ctx)
16
14
  serverMethods(server, ctx)
17
15
  sync(server, ctx)
@@ -32,6 +32,6 @@ export default function (server: Server, ctx: AppContext) {
32
32
  throw new InvalidRequestError(`Could not locate record`)
33
33
  }
34
34
 
35
- return await pipethrough(ctx, req)
35
+ return await pipethrough(ctx, req, null)
36
36
  })
37
37
  }
package/src/api/index.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { Server } from '../lexicon'
2
2
  import comAtproto from './com/atproto'
3
3
  import appBsky from './app/bsky'
4
- import toolsOzone from './tools/ozone'
5
4
  import AppContext from '../context'
6
5
 
7
6
  export default function (server: Server, ctx: AppContext) {
8
7
  comAtproto(server, ctx)
9
8
  appBsky(server, ctx)
10
- toolsOzone(server, ctx)
11
9
  return server
12
10
  }
package/src/context.ts CHANGED
@@ -6,7 +6,12 @@ import * as crypto from '@atproto/crypto'
6
6
  import { IdResolver } from '@atproto/identity'
7
7
  import { AtpAgent } from '@atproto/api'
8
8
  import { KmsKeypair, S3BlobStore } from '@atproto/aws'
9
- import { createServiceAuthHeaders } from '@atproto/xrpc-server'
9
+ import {
10
+ RateLimiter,
11
+ RateLimiterCreator,
12
+ RateLimiterOpts,
13
+ createServiceAuthHeaders,
14
+ } from '@atproto/xrpc-server'
10
15
  import { ServerConfig, ServerSecrets } from './config'
11
16
  import {
12
17
  AuthVerifier,
@@ -39,6 +44,7 @@ export type AppContextOptions = {
39
44
  sequencer: Sequencer
40
45
  backgroundQueue: BackgroundQueue
41
46
  redisScratch?: Redis
47
+ ratelimitCreator?: RateLimiterCreator
42
48
  crawlers: Crawlers
43
49
  appViewAgent?: AtpAgent
44
50
  moderationAgent?: AtpAgent
@@ -62,6 +68,7 @@ export class AppContext {
62
68
  public sequencer: Sequencer
63
69
  public backgroundQueue: BackgroundQueue
64
70
  public redisScratch?: Redis
71
+ public ratelimitCreator?: RateLimiterCreator
65
72
  public crawlers: Crawlers
66
73
  public appViewAgent: AtpAgent | undefined
67
74
  public moderationAgent: AtpAgent | undefined
@@ -84,6 +91,7 @@ export class AppContext {
84
91
  this.sequencer = opts.sequencer
85
92
  this.backgroundQueue = opts.backgroundQueue
86
93
  this.redisScratch = opts.redisScratch
94
+ this.ratelimitCreator = opts.ratelimitCreator
87
95
  this.crawlers = opts.crawlers
88
96
  this.appViewAgent = opts.appViewAgent
89
97
  this.moderationAgent = opts.moderationAgent
@@ -160,6 +168,30 @@ export class AppContext {
160
168
  ? getRedisClient(cfg.redis.address, cfg.redis.password)
161
169
  : undefined
162
170
 
171
+ let ratelimitCreator: RateLimiterCreator | undefined = undefined
172
+ if (cfg.rateLimits.enabled) {
173
+ const bypassSecret = cfg.rateLimits.bypassKey
174
+ const bypassIps = cfg.rateLimits.bypassIps
175
+ if (cfg.rateLimits.mode === 'redis') {
176
+ if (!redisScratch) {
177
+ throw new Error('Redis not set up for ratelimiting mode: `redis`')
178
+ }
179
+ ratelimitCreator = (opts: RateLimiterOpts) =>
180
+ RateLimiter.redis(redisScratch, {
181
+ bypassSecret,
182
+ bypassIps,
183
+ ...opts,
184
+ })
185
+ } else {
186
+ ratelimitCreator = (opts: RateLimiterOpts) =>
187
+ RateLimiter.memory({
188
+ bypassSecret,
189
+ bypassIps,
190
+ ...opts,
191
+ })
192
+ }
193
+ }
194
+
163
195
  const appViewAgent = cfg.bskyAppView
164
196
  ? new AtpAgent({ service: cfg.bskyAppView.url })
165
197
  : undefined
@@ -231,6 +263,7 @@ export class AppContext {
231
263
  sequencer,
232
264
  backgroundQueue,
233
265
  redisScratch,
266
+ ratelimitCreator,
234
267
  crawlers,
235
268
  appViewAgent,
236
269
  moderationAgent,