@atproto/bsky 0.0.243 → 0.0.244

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 (272) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api/app/bsky/actor/searchActorsTypeahead.js +5 -3
  3. package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
  4. package/dist/api/app/bsky/notification/putPreferencesV2.js +4 -1
  5. package/dist/api/app/bsky/notification/putPreferencesV2.js.map +1 -1
  6. package/dist/api/app/bsky/notification/util.d.ts +1 -0
  7. package/dist/api/app/bsky/notification/util.d.ts.map +1 -1
  8. package/dist/api/app/bsky/notification/util.js +7 -7
  9. package/dist/api/app/bsky/notification/util.js.map +1 -1
  10. package/dist/api/blob-dispatcher.d.ts.map +1 -1
  11. package/dist/api/blob-dispatcher.js +9 -8
  12. package/dist/api/blob-dispatcher.js.map +1 -1
  13. package/dist/api/blob-resolver.d.ts +1 -1
  14. package/dist/api/blob-resolver.d.ts.map +1 -1
  15. package/dist/api/blob-resolver.js +0 -1
  16. package/dist/api/blob-resolver.js.map +1 -1
  17. package/dist/data-plane/bsync/index.d.ts +2 -0
  18. package/dist/data-plane/bsync/index.d.ts.map +1 -1
  19. package/dist/data-plane/bsync/index.js +7 -10
  20. package/dist/data-plane/bsync/index.js.map +1 -1
  21. package/dist/data-plane/server/background.d.ts +12 -8
  22. package/dist/data-plane/server/background.d.ts.map +1 -1
  23. package/dist/data-plane/server/background.js +32 -14
  24. package/dist/data-plane/server/background.js.map +1 -1
  25. package/dist/data-plane/server/index.d.ts +2 -0
  26. package/dist/data-plane/server/index.d.ts.map +1 -1
  27. package/dist/data-plane/server/index.js +7 -10
  28. package/dist/data-plane/server/index.js.map +1 -1
  29. package/dist/data-plane/server/indexing/index.d.ts +2 -2
  30. package/dist/data-plane/server/indexing/index.d.ts.map +1 -1
  31. package/dist/data-plane/server/indexing/index.js.map +1 -1
  32. package/dist/data-plane/server/indexing/plugins/block.d.ts +1 -1
  33. package/dist/data-plane/server/indexing/plugins/block.d.ts.map +1 -1
  34. package/dist/data-plane/server/indexing/plugins/block.js.map +1 -1
  35. package/dist/data-plane/server/indexing/plugins/chat-declaration.d.ts +1 -1
  36. package/dist/data-plane/server/indexing/plugins/chat-declaration.d.ts.map +1 -1
  37. package/dist/data-plane/server/indexing/plugins/chat-declaration.js.map +1 -1
  38. package/dist/data-plane/server/indexing/plugins/feed-generator.d.ts +1 -1
  39. package/dist/data-plane/server/indexing/plugins/feed-generator.d.ts.map +1 -1
  40. package/dist/data-plane/server/indexing/plugins/feed-generator.js.map +1 -1
  41. package/dist/data-plane/server/indexing/plugins/follow.d.ts +1 -1
  42. package/dist/data-plane/server/indexing/plugins/follow.d.ts.map +1 -1
  43. package/dist/data-plane/server/indexing/plugins/follow.js.map +1 -1
  44. package/dist/data-plane/server/indexing/plugins/germ-declaration.d.ts +1 -1
  45. package/dist/data-plane/server/indexing/plugins/germ-declaration.d.ts.map +1 -1
  46. package/dist/data-plane/server/indexing/plugins/germ-declaration.js.map +1 -1
  47. package/dist/data-plane/server/indexing/plugins/labeler.d.ts +1 -1
  48. package/dist/data-plane/server/indexing/plugins/labeler.d.ts.map +1 -1
  49. package/dist/data-plane/server/indexing/plugins/labeler.js.map +1 -1
  50. package/dist/data-plane/server/indexing/plugins/like.d.ts +1 -1
  51. package/dist/data-plane/server/indexing/plugins/like.d.ts.map +1 -1
  52. package/dist/data-plane/server/indexing/plugins/like.js.map +1 -1
  53. package/dist/data-plane/server/indexing/plugins/list-block.d.ts +1 -1
  54. package/dist/data-plane/server/indexing/plugins/list-block.d.ts.map +1 -1
  55. package/dist/data-plane/server/indexing/plugins/list-block.js.map +1 -1
  56. package/dist/data-plane/server/indexing/plugins/list-item.d.ts +1 -1
  57. package/dist/data-plane/server/indexing/plugins/list-item.d.ts.map +1 -1
  58. package/dist/data-plane/server/indexing/plugins/list-item.js.map +1 -1
  59. package/dist/data-plane/server/indexing/plugins/list.d.ts +1 -1
  60. package/dist/data-plane/server/indexing/plugins/list.d.ts.map +1 -1
  61. package/dist/data-plane/server/indexing/plugins/list.js.map +1 -1
  62. package/dist/data-plane/server/indexing/plugins/notif-declaration.d.ts +1 -1
  63. package/dist/data-plane/server/indexing/plugins/notif-declaration.d.ts.map +1 -1
  64. package/dist/data-plane/server/indexing/plugins/notif-declaration.js.map +1 -1
  65. package/dist/data-plane/server/indexing/plugins/post-gate.d.ts +1 -1
  66. package/dist/data-plane/server/indexing/plugins/post-gate.d.ts.map +1 -1
  67. package/dist/data-plane/server/indexing/plugins/post-gate.js.map +1 -1
  68. package/dist/data-plane/server/indexing/plugins/post.d.ts +1 -1
  69. package/dist/data-plane/server/indexing/plugins/post.d.ts.map +1 -1
  70. package/dist/data-plane/server/indexing/plugins/post.js.map +1 -1
  71. package/dist/data-plane/server/indexing/plugins/profile.d.ts +1 -1
  72. package/dist/data-plane/server/indexing/plugins/profile.d.ts.map +1 -1
  73. package/dist/data-plane/server/indexing/plugins/profile.js.map +1 -1
  74. package/dist/data-plane/server/indexing/plugins/repost.d.ts +1 -1
  75. package/dist/data-plane/server/indexing/plugins/repost.d.ts.map +1 -1
  76. package/dist/data-plane/server/indexing/plugins/repost.js.map +1 -1
  77. package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts +1 -1
  78. package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts.map +1 -1
  79. package/dist/data-plane/server/indexing/plugins/starter-pack.js.map +1 -1
  80. package/dist/data-plane/server/indexing/plugins/status.d.ts +1 -1
  81. package/dist/data-plane/server/indexing/plugins/status.d.ts.map +1 -1
  82. package/dist/data-plane/server/indexing/plugins/status.js.map +1 -1
  83. package/dist/data-plane/server/indexing/plugins/thread-gate.d.ts +1 -1
  84. package/dist/data-plane/server/indexing/plugins/thread-gate.d.ts.map +1 -1
  85. package/dist/data-plane/server/indexing/plugins/thread-gate.js.map +1 -1
  86. package/dist/data-plane/server/indexing/plugins/verification.d.ts +1 -1
  87. package/dist/data-plane/server/indexing/plugins/verification.d.ts.map +1 -1
  88. package/dist/data-plane/server/indexing/plugins/verification.js.map +1 -1
  89. package/dist/data-plane/server/indexing/processor.d.ts +1 -1
  90. package/dist/data-plane/server/indexing/processor.d.ts.map +1 -1
  91. package/dist/data-plane/server/indexing/processor.js.map +1 -1
  92. package/dist/data-plane/server/routes/notifs.d.ts.map +1 -1
  93. package/dist/data-plane/server/routes/notifs.js +1 -8
  94. package/dist/data-plane/server/routes/notifs.js.map +1 -1
  95. package/dist/data-plane/server/routes/search.js +2 -2
  96. package/dist/data-plane/server/routes/search.js.map +1 -1
  97. package/dist/data-plane/server/subscription.d.ts +13 -12
  98. package/dist/data-plane/server/subscription.d.ts.map +1 -1
  99. package/dist/data-plane/server/subscription.js +59 -26
  100. package/dist/data-plane/server/subscription.js.map +1 -1
  101. package/dist/feature-gates/index.d.ts +2 -1
  102. package/dist/feature-gates/index.d.ts.map +1 -1
  103. package/dist/feature-gates/index.js +9 -6
  104. package/dist/feature-gates/index.js.map +1 -1
  105. package/dist/feature-gates/metrics.d.ts +3 -3
  106. package/dist/feature-gates/metrics.d.ts.map +1 -1
  107. package/dist/feature-gates/metrics.js +8 -8
  108. package/dist/feature-gates/metrics.js.map +1 -1
  109. package/dist/index.d.ts +1 -0
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +16 -7
  112. package/dist/index.js.map +1 -1
  113. package/dist/lexicons/app/bsky/notification/defs.defs.d.ts +5 -0
  114. package/dist/lexicons/app/bsky/notification/defs.defs.d.ts.map +1 -1
  115. package/dist/lexicons/app/bsky/notification/defs.defs.js +1 -0
  116. package/dist/lexicons/app/bsky/notification/defs.defs.js.map +1 -1
  117. package/dist/lexicons/chat/bsky/notification/defs.d.ts +2 -0
  118. package/dist/lexicons/chat/bsky/notification/defs.d.ts.map +1 -0
  119. package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts +20 -0
  120. package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts.map +1 -0
  121. package/dist/lexicons/chat/bsky/notification/defs.defs.js +19 -0
  122. package/dist/lexicons/chat/bsky/notification/defs.defs.js.map +1 -0
  123. package/dist/lexicons/chat/bsky/notification/defs.js +5 -0
  124. package/dist/lexicons/chat/bsky/notification/defs.js.map +1 -0
  125. package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts +3 -0
  126. package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts.map +1 -0
  127. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts +18 -0
  128. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts.map +1 -0
  129. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js +16 -0
  130. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js.map +1 -0
  131. package/dist/lexicons/chat/bsky/notification/getPreferences.js +6 -0
  132. package/dist/lexicons/chat/bsky/notification/getPreferences.js.map +1 -0
  133. package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts +3 -0
  134. package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts.map +1 -0
  135. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts +27 -0
  136. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts.map +1 -0
  137. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js +22 -0
  138. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js.map +1 -0
  139. package/dist/lexicons/chat/bsky/notification/putPreferences.js +6 -0
  140. package/dist/lexicons/chat/bsky/notification/putPreferences.js.map +1 -0
  141. package/dist/lexicons/chat/bsky/notification.d.ts +4 -0
  142. package/dist/lexicons/chat/bsky/notification.d.ts.map +1 -0
  143. package/dist/lexicons/chat/bsky/notification.js +7 -0
  144. package/dist/lexicons/chat/bsky/notification.js.map +1 -0
  145. package/dist/lexicons/chat/bsky.d.ts +1 -0
  146. package/dist/lexicons/chat/bsky.d.ts.map +1 -1
  147. package/dist/lexicons/chat/bsky.js +1 -0
  148. package/dist/lexicons/chat/bsky.js.map +1 -1
  149. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +4 -0
  150. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
  151. package/dist/lexicons/tools/ozone/report/defs.defs.js +2 -0
  152. package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
  153. package/dist/lexicons/tools/ozone/report/queryActivities.d.ts +3 -0
  154. package/dist/lexicons/tools/ozone/report/queryActivities.d.ts.map +1 -0
  155. package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts +42 -0
  156. package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts.map +1 -0
  157. package/dist/lexicons/tools/ozone/report/queryActivities.defs.js +31 -0
  158. package/dist/lexicons/tools/ozone/report/queryActivities.defs.js.map +1 -0
  159. package/dist/lexicons/tools/ozone/report/queryActivities.js +6 -0
  160. package/dist/lexicons/tools/ozone/report/queryActivities.js.map +1 -0
  161. package/dist/lexicons/tools/ozone/report.d.ts +1 -0
  162. package/dist/lexicons/tools/ozone/report.d.ts.map +1 -1
  163. package/dist/lexicons/tools/ozone/report.js +1 -0
  164. package/dist/lexicons/tools/ozone/report.js.map +1 -1
  165. package/dist/proto/bsky_pb.d.ts +47 -53
  166. package/dist/proto/bsky_pb.d.ts.map +1 -1
  167. package/dist/proto/bsky_pb.js +62 -71
  168. package/dist/proto/bsky_pb.js.map +1 -1
  169. package/package.json +10 -10
  170. package/proto/bsky.proto +19 -17
  171. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +5 -3
  172. package/src/api/app/bsky/notification/putPreferencesV2.ts +4 -1
  173. package/src/api/app/bsky/notification/util.ts +7 -11
  174. package/src/api/blob-dispatcher.ts +12 -8
  175. package/src/api/blob-resolver.ts +0 -1
  176. package/src/data-plane/bsync/index.ts +12 -10
  177. package/src/data-plane/server/background.ts +49 -18
  178. package/src/data-plane/server/index.ts +12 -10
  179. package/src/data-plane/server/indexing/index.ts +1 -1
  180. package/src/data-plane/server/indexing/plugins/block.ts +4 -1
  181. package/src/data-plane/server/indexing/plugins/chat-declaration.ts +4 -1
  182. package/src/data-plane/server/indexing/plugins/feed-generator.ts +4 -1
  183. package/src/data-plane/server/indexing/plugins/follow.ts +4 -1
  184. package/src/data-plane/server/indexing/plugins/germ-declaration.ts +4 -1
  185. package/src/data-plane/server/indexing/plugins/labeler.ts +4 -1
  186. package/src/data-plane/server/indexing/plugins/like.ts +4 -1
  187. package/src/data-plane/server/indexing/plugins/list-block.ts +4 -1
  188. package/src/data-plane/server/indexing/plugins/list-item.ts +4 -1
  189. package/src/data-plane/server/indexing/plugins/list.ts +4 -1
  190. package/src/data-plane/server/indexing/plugins/notif-declaration.ts +4 -1
  191. package/src/data-plane/server/indexing/plugins/post-gate.ts +4 -1
  192. package/src/data-plane/server/indexing/plugins/post.ts +4 -1
  193. package/src/data-plane/server/indexing/plugins/profile.ts +4 -1
  194. package/src/data-plane/server/indexing/plugins/repost.ts +4 -1
  195. package/src/data-plane/server/indexing/plugins/starter-pack.ts +4 -1
  196. package/src/data-plane/server/indexing/plugins/status.ts +4 -1
  197. package/src/data-plane/server/indexing/plugins/thread-gate.ts +4 -1
  198. package/src/data-plane/server/indexing/plugins/verification.ts +4 -1
  199. package/src/data-plane/server/indexing/processor.ts +1 -1
  200. package/src/data-plane/server/routes/notifs.ts +0 -14
  201. package/src/data-plane/server/routes/search.ts +2 -2
  202. package/src/data-plane/server/subscription.ts +74 -31
  203. package/src/feature-gates/index.ts +10 -6
  204. package/src/feature-gates/metrics.test.ts +12 -12
  205. package/src/feature-gates/metrics.ts +8 -8
  206. package/src/index.ts +16 -9
  207. package/tests/_util.ts +8 -25
  208. package/tests/admin/admin-auth.test.ts +2 -2
  209. package/tests/admin/moderation.test.ts +1 -1
  210. package/tests/auth.test.ts +4 -6
  211. package/tests/blob-resolver.test.ts +4 -5
  212. package/tests/data-plane/db.test.ts +1 -1
  213. package/tests/data-plane/duplicate-records.test.ts +1 -1
  214. package/tests/data-plane/handle-invalidation.test.ts +2 -2
  215. package/tests/data-plane/indexing.test.ts +24 -21
  216. package/tests/data-plane/subscription.test.ts +1 -1
  217. package/tests/data-plane/thread-mutes.test.ts +2 -2
  218. package/tests/entryway-auth.test.ts +4 -5
  219. package/tests/feed-generation.test.ts +5 -5
  220. package/tests/image/server.test.ts +1 -1
  221. package/tests/label-hydration.test.ts +3 -5
  222. package/tests/postgates.test.ts +3 -6
  223. package/tests/query-labels.test.ts +3 -5
  224. package/tests/redis-cache.test.ts +1 -3
  225. package/tests/server.test.ts +11 -16
  226. package/tests/sitemap.test.ts +3 -4
  227. package/tests/stash.test.ts +12 -8
  228. package/tests/utils.test.ts +3 -13
  229. package/tests/views/account-deactivation.test.ts +3 -5
  230. package/tests/views/actor-likes.test.ts +3 -5
  231. package/tests/views/actor-search.test.ts +6 -7
  232. package/tests/views/age-assurance-v2.test.ts +9 -6
  233. package/tests/views/age-assurance.test.ts +30 -36
  234. package/tests/views/author-feed.test.ts +4 -6
  235. package/tests/views/block-lists.test.ts +3 -5
  236. package/tests/views/blocks.test.ts +3 -5
  237. package/tests/views/bookmarks.test.ts +4 -4
  238. package/tests/views/drafts.test.ts +7 -14
  239. package/tests/views/feed-hidden-replies.test.ts +3 -6
  240. package/tests/views/feed-view-post.test.ts +3 -6
  241. package/tests/views/follows.test.ts +4 -6
  242. package/tests/views/get-config.test.ts +4 -7
  243. package/tests/views/get-suggested-onboarding-users.test.ts +11 -9
  244. package/tests/views/get-suggested-starter-packs.test.ts +11 -9
  245. package/tests/views/get-trends.test.ts +15 -9
  246. package/tests/views/internal-actor.test.ts +3 -6
  247. package/tests/views/known-followers.test.ts +3 -6
  248. package/tests/views/labeler-service.test.ts +3 -5
  249. package/tests/views/labels-needs-review.test.ts +3 -6
  250. package/tests/views/labels-takedown.test.ts +3 -4
  251. package/tests/views/likes.test.ts +4 -6
  252. package/tests/views/list-feed.test.ts +3 -5
  253. package/tests/views/lists.test.ts +3 -5
  254. package/tests/views/mute-lists.test.ts +3 -5
  255. package/tests/views/mutes.test.ts +4 -5
  256. package/tests/views/notifications.test.ts +12 -11
  257. package/tests/views/post-search.test.ts +3 -24
  258. package/tests/views/posts-debug.test.ts +11 -6
  259. package/tests/views/posts.test.ts +3 -4
  260. package/tests/views/profile-debug.test.ts +11 -5
  261. package/tests/views/profile.test.ts +11 -5
  262. package/tests/views/quotes.test.ts +4 -6
  263. package/tests/views/reposts.test.ts +4 -6
  264. package/tests/views/starter-packs.test.ts +3 -6
  265. package/tests/views/suggestions.test.ts +9 -13
  266. package/tests/views/thread-v2.test.ts +3 -5
  267. package/tests/views/thread.test.ts +3 -7
  268. package/tests/views/threadgating.test.ts +3 -5
  269. package/tests/views/timeline.test.ts +4 -5
  270. package/tests/views/verification.test.ts +4 -6
  271. package/tsconfig.build.tsbuildinfo +1 -1
  272. package/vitest.config.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyFeedGetLikes, AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork, likesSeed } from '@atproto/dev-env'
4
4
  import {
@@ -31,18 +31,16 @@ describe('pds like views', () => {
31
31
  email: 'frankie@frankie.com',
32
32
  password: 'password',
33
33
  })
34
- await network.processAll()
35
34
 
36
35
  alice = sc.dids.alice
37
36
  bob = sc.dids.bob
38
37
  carol = sc.dids.carol
39
38
  frankie = sc.dids.frankie
40
- }, 20_000) // @NOTE seeding can take a while
41
-
42
- afterAll(async () => {
43
- await network.close()
44
39
  })
45
40
 
41
+ beforeEach(async () => network.processAll())
42
+ afterAll(async () => network?.close())
43
+
46
44
  const getCursors = (items: { createdAt?: string }[]) =>
47
45
  items.map((item) => item.createdAt ?? constantDate)
48
46
 
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyFeedGetListFeed, AtpAgent, ids } from '@atproto/api'
3
3
  import { RecordRef, SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
4
  import {
@@ -33,12 +33,10 @@ describe('list feed views', () => {
33
33
  listRef = await sc.createList(alice, 'test list', 'curate')
34
34
  await sc.addToList(alice, alice, listRef)
35
35
  await sc.addToList(alice, bob, listRef)
36
- await network.processAll()
37
36
  })
38
37
 
39
- afterAll(async () => {
40
- await network.close()
41
- })
38
+ beforeEach(async () => network.processAll())
39
+ afterAll(async () => network?.close())
42
40
 
43
41
  it('fetches list feed', async () => {
44
42
  const res = await agent.api.app.bsky.feed.getListFeed(
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import {
3
3
  AppBskyGraphGetLists,
4
4
  AppBskyGraphGetListsWithMembership,
@@ -86,7 +86,6 @@ describe('bsky actor likes feed views', () => {
86
86
  await sc.block(sc.dids.frankie, sc.dids.greta)
87
87
  await sc.block(sc.dids.frankie, sc.dids.eve)
88
88
 
89
- await network.processAll()
90
89
  blockList = newBlockList.uriStr
91
90
  curateList = newCurList.uriStr
92
91
  referenceList = newRefList.uriStr
@@ -102,9 +101,8 @@ describe('bsky actor likes feed views', () => {
102
101
  greta = sc.dids.greta
103
102
  })
104
103
 
105
- afterAll(async () => {
106
- await network.close()
107
- })
104
+ beforeEach(async () => network.processAll())
105
+ afterAll(async () => network?.close())
108
106
 
109
107
  it('does not include reference lists in getActorLists', async () => {
110
108
  const view = await agent.app.bsky.graph.getLists({
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AtUri, AtpAgent, ids } from '@atproto/api'
3
3
  import { RecordRef, SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
4
  import { forSnapshot } from '../_util.js'
@@ -29,12 +29,10 @@ describe('bsky views with mutes from mute lists', () => {
29
29
  // add follows to ensure mutes work even w follows
30
30
  await sc.follow(carol, dan)
31
31
  await sc.follow(dan, carol)
32
- await network.processAll()
33
32
  })
34
33
 
35
- afterAll(async () => {
36
- await network.close()
37
- })
34
+ beforeEach(async () => network.processAll())
35
+ afterAll(async () => network?.close())
38
36
 
39
37
  let listUri: string
40
38
  let listCid: string
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyGraphGetMutes, AtpAgent, ids } from '@atproto/api'
3
3
  import {
4
4
  SeedClient,
@@ -54,12 +54,11 @@ describe('mute views', () => {
54
54
  },
55
55
  )
56
56
  }
57
- }, 20_000) // @NOTE seeding can take a while
58
-
59
- afterAll(async () => {
60
- await network.close()
61
57
  })
62
58
 
59
+ beforeEach(async () => network.processAll())
60
+ afterAll(async () => network?.close())
61
+
63
62
  it('flags mutes in threads', async () => {
64
63
  const res = await agent.api.app.bsky.feed.getPostThread(
65
64
  { depth: 1, uri: sc.posts[alice][1].ref.uriStr },
@@ -91,8 +91,6 @@ describe('notification views', () => {
91
91
  password: 'blocked-pass',
92
92
  })
93
93
 
94
- await network.processAll()
95
-
96
94
  alice = sc.dids.alice
97
95
  bob = sc.dids.bob
98
96
  carol = sc.dids.carol
@@ -104,9 +102,8 @@ describe('notification views', () => {
104
102
  blocked = sc.dids.blocked
105
103
  })
106
104
 
107
- afterAll(async () => {
108
- await network.close()
109
- })
105
+ beforeEach(async () => network.processAll())
106
+ afterAll(async () => network?.close())
110
107
 
111
108
  const sortNotifs = (
112
109
  notifs: AppBskyNotificationListNotifications.Notification[],
@@ -728,12 +725,12 @@ describe('notification views', () => {
728
725
  await network.processAll()
729
726
  })
730
727
 
731
- // @NOTE there is some flakyness between these tests. We sometimes get
732
- // "priority": true when the snapshot expects false.
733
-
734
728
  it('filters notifications by reason', async () => {
735
729
  const res = await agent.app.bsky.notification.listNotifications(
736
730
  {
731
+ // Pin priority so the snapshot doesn't race with the viewer's stored
732
+ // priority preference, which neighbouring tests mutate.
733
+ priority: false,
737
734
  reasons: ['mention'],
738
735
  },
739
736
  {
@@ -750,6 +747,9 @@ describe('notification views', () => {
750
747
  it('filters notifications by multiple reasons', async () => {
751
748
  const res = await agent.app.bsky.notification.listNotifications(
752
749
  {
750
+ // Pin priority so the snapshot doesn't race with the viewer's stored
751
+ // priority preference, which neighbouring tests mutate.
752
+ priority: false,
753
753
  reasons: ['mention', 'reply'],
754
754
  },
755
755
  {
@@ -1203,7 +1203,8 @@ describe('notification views', () => {
1203
1203
  },
1204
1204
  }
1205
1205
  const expected0: AppBskyNotificationDefs.Preferences = {
1206
- chat: input0.chat,
1206
+ // chat is deprecated: input is ignored and the default is always returned.
1207
+ chat: cp,
1207
1208
  follow: fp,
1208
1209
  like: fp,
1209
1210
  likeViaRepost: fp,
@@ -1227,8 +1228,8 @@ describe('notification views', () => {
1227
1228
  },
1228
1229
  }
1229
1230
  const expected1: AppBskyNotificationDefs.Preferences = {
1230
- // Kept from the previous call.
1231
- chat: input0.chat,
1231
+ // chat is deprecated: input is ignored and the default is always returned.
1232
+ chat: cp,
1232
1233
  follow: fp,
1233
1234
  like: fp,
1234
1235
  likeViaRepost: fp,
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyFeedSearchPosts, AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
4
  import { DatabaseSchema } from '../../src/index.js'
@@ -51,13 +51,8 @@ describe('appview search', () => {
51
51
  nonTaggedResults = [post2.ref.uriStr, post0.ref.uriStr]
52
52
  })
53
53
 
54
- afterAll(async () => {
55
- await deleteTags(network.bsky.db.db, {
56
- uri: post1.ref.uriStr,
57
- })
58
-
59
- await network.close()
60
- })
54
+ beforeEach(async () => network.processAll())
55
+ afterAll(async () => network?.close())
61
56
 
62
57
  describe(`post search with 'top' sort`, () => {
63
58
  type TestCase = {
@@ -202,19 +197,3 @@ const createTag = async (
202
197
  .returningAll()
203
198
  .execute()
204
199
  }
205
-
206
- const deleteTags = async (
207
- db: DatabaseSchema,
208
- opts: {
209
- uri: string
210
- },
211
- ) => {
212
- await db
213
- .updateTable('record')
214
- .set({
215
- tags: JSON.stringify([]),
216
- })
217
- .where('uri', '=', opts.uri)
218
- .returningAll()
219
- .execute()
220
- }
@@ -1,4 +1,12 @@
1
- import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'
1
+ import {
2
+ afterAll,
3
+ afterEach,
4
+ beforeAll,
5
+ beforeEach,
6
+ describe,
7
+ expect,
8
+ it,
9
+ } from 'vitest'
2
10
  import { AtpAgent, ids } from '@atproto/api'
3
11
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
12
 
@@ -14,16 +22,13 @@ describe('post views w/ debug field', () => {
14
22
  agent = network.bsky.getAgent()
15
23
  sc = network.getSeedClient()
16
24
  await basicSeed(sc)
17
- await network.processAll()
18
25
  })
19
26
 
27
+ beforeEach(async () => network.processAll())
20
28
  afterEach(() => {
21
29
  network.bsky.ctx.cfg.debugFieldAllowedDids.clear()
22
30
  })
23
-
24
- afterAll(async () => {
25
- await network.close()
26
- })
31
+ afterAll(async () => network?.close())
27
32
 
28
33
  it(`does not include debug field for unauthed requests`, async () => {
29
34
  network.bsky.ctx.cfg.debugFieldAllowedDids.add(sc.dids.bob)
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import {
3
3
  AppBskyEmbedGallery,
4
4
  AppBskyEmbedRecord,
@@ -52,9 +52,8 @@ describe('pds posts views', () => {
52
52
  })
53
53
  })
54
54
 
55
- afterAll(async () => {
56
- await network.close()
57
- })
55
+ beforeEach(async () => network.processAll())
56
+ afterAll(async () => network?.close())
58
57
 
59
58
  it('fetches posts', async () => {
60
59
  const uris = [
@@ -1,4 +1,12 @@
1
- import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'
1
+ import {
2
+ afterAll,
3
+ afterEach,
4
+ beforeAll,
5
+ beforeEach,
6
+ describe,
7
+ expect,
8
+ it,
9
+ } from 'vitest'
2
10
  import { AtpAgent, ids } from '@atproto/api'
3
11
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
12
 
@@ -16,13 +24,11 @@ describe('profile views w/ debug field', () => {
16
24
  await basicSeed(sc)
17
25
  })
18
26
 
27
+ beforeEach(async () => network.processAll())
19
28
  afterEach(() => {
20
29
  network.bsky.ctx.cfg.debugFieldAllowedDids.clear()
21
30
  })
22
-
23
- afterAll(async () => {
24
- await network.close()
25
- })
31
+ afterAll(async () => network?.close())
26
32
 
27
33
  it(`does not include debug field for unauthed requests`, async () => {
28
34
  network.bsky.ctx.cfg.debugFieldAllowedDids.add(sc.dids.bob)
@@ -1,7 +1,15 @@
1
1
  import assert from 'node:assert'
2
2
  import fs from 'node:fs/promises'
3
3
  import { Timestamp } from '@bufbuild/protobuf'
4
- import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
4
+ import {
5
+ afterAll,
6
+ beforeAll,
7
+ beforeEach,
8
+ describe,
9
+ expect,
10
+ it,
11
+ vi,
12
+ } from 'vitest'
5
13
  import {
6
14
  AppBskyEmbedExternal,
7
15
  AtpAgent,
@@ -77,7 +85,6 @@ describe('pds profile views', () => {
77
85
  password: 'noprofile-pass',
78
86
  })
79
87
 
80
- await network.processAll()
81
88
  alice = sc.dids.alice
82
89
  bob = sc.dids.bob
83
90
  dan = sc.dids.dan
@@ -86,9 +93,8 @@ describe('pds profile views', () => {
86
93
  noprofile = sc.dids.noprofile
87
94
  })
88
95
 
89
- afterAll(async () => {
90
- await network.close()
91
- })
96
+ beforeEach(async () => network.processAll())
97
+ afterAll(async () => network?.close())
92
98
 
93
99
  // @TODO(bsky) blocked by actor takedown via labels.
94
100
 
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork, quotesSeed } from '@atproto/dev-env'
4
4
  import { forSnapshot } from '../_util.js'
@@ -21,17 +21,15 @@ describe('pds quote views', () => {
21
21
  agent = network.bsky.getAgent()
22
22
  sc = network.getSeedClient()
23
23
  await quotesSeed(sc)
24
- await network.processAll()
25
24
  alice = sc.dids.alice
26
25
  bob = sc.dids.bob
27
26
  carol = sc.dids.carol
28
27
  eve = sc.dids.eve
29
- }, 20_000) // @NOTE seeding can take a while
30
-
31
- afterAll(async () => {
32
- await network.close()
33
28
  })
34
29
 
30
+ beforeEach(async () => network.processAll())
31
+ afterAll(async () => network?.close())
32
+
35
33
  it('fetches post quotes', async () => {
36
34
  const alicePostQuotes = await agent.api.app.bsky.feed.getQuotes(
37
35
  { uri: sc.posts[alice][0].ref.uriStr, limit: 30 },
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyFeedGetRepostedBy, AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork, repostsSeed } from '@atproto/dev-env'
4
4
  import { forSnapshot, paginateAll, stripViewer } from '../_util.js'
@@ -19,15 +19,13 @@ describe('pds repost views', () => {
19
19
  agent = network.bsky.getAgent()
20
20
  sc = network.getSeedClient()
21
21
  await repostsSeed(sc)
22
- await network.processAll()
23
22
  alice = sc.dids.alice
24
23
  bob = sc.dids.bob
25
- }, 20_000) // @NOTE seeding can take a while
26
-
27
- afterAll(async () => {
28
- await network.close()
29
24
  })
30
25
 
26
+ beforeEach(async () => network.processAll())
27
+ afterAll(async () => network?.close())
28
+
31
29
  it('fetches reposted-by for a post', async () => {
32
30
  const view = await agent.api.app.bsky.feed.getRepostedBy(
33
31
  { uri: sc.posts[alice][2].ref.uriStr },
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import {
4
4
  AppBskyActorProfile,
5
5
  AppBskyGraphGetStarterPacksWithMembership,
@@ -80,13 +80,10 @@ describe('starter packs', () => {
80
80
  [sc.dids.alice, sc.dids.frankie],
81
81
  [],
82
82
  )
83
-
84
- await network.processAll()
85
83
  })
86
84
 
87
- afterAll(async () => {
88
- await network.close()
89
- })
85
+ beforeEach(async () => network.processAll())
86
+ afterAll(async () => network?.close())
90
87
 
91
88
  it('gets actor starter packs.', async () => {
92
89
  const { data } = await agent.api.app.bsky.graph.getActorStarterPacks({
@@ -1,4 +1,4 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
4
4
  import { stripViewer } from '../_util.js'
@@ -15,24 +15,20 @@ describe('pds user search views', () => {
15
15
  agent = network.bsky.getAgent()
16
16
  sc = network.getSeedClient()
17
17
  await basicSeed(sc)
18
- await network.processAll()
19
-
20
- const suggestions = [
21
- { did: sc.dids.alice, order: 1 },
22
- { did: sc.dids.bob, order: 2 },
23
- { did: sc.dids.carol, order: 3 },
24
- { did: sc.dids.dan, order: 4 },
25
- ]
26
18
 
27
19
  await network.bsky.db.db
28
20
  .insertInto('suggested_follow')
29
- .values(suggestions)
21
+ .values([
22
+ { did: sc.dids.alice, order: 1 },
23
+ { did: sc.dids.bob, order: 2 },
24
+ { did: sc.dids.carol, order: 3 },
25
+ { did: sc.dids.dan, order: 4 },
26
+ ])
30
27
  .execute()
31
28
  })
32
29
 
33
- afterAll(async () => {
34
- await network.close()
35
- })
30
+ beforeEach(async () => network.processAll())
31
+ afterAll(async () => network?.close())
36
32
 
37
33
  it('actor suggestion gives users', async () => {
38
34
  const result = await agent.api.app.bsky.actor.getSuggestions(
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import {
4
4
  AppBskyUnspeccedDefs,
5
5
  AppBskyUnspeccedGetPostThreadOtherV2,
@@ -54,12 +54,10 @@ describe('appview thread views v2', () => {
54
54
  agent = network.bsky.getAgent()
55
55
  sc = network.getSeedClient()
56
56
  labelerDid = network.bsky.ctx.cfg.modServiceDid
57
- await network.processAll()
58
57
  })
59
58
 
60
- afterAll(async () => {
61
- await network.close()
62
- })
59
+ beforeEach(async () => network.processAll())
60
+ afterAll(async () => network?.close())
63
61
 
64
62
  describe('not found anchor', () => {
65
63
  it('returns not found error', async () => {
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import {
4
4
  AppBskyFeedDefs,
5
5
  AppBskyFeedGetPostThread,
@@ -40,17 +40,13 @@ describe('appview thread views', () => {
40
40
  await sc.like(alice, sc.replies[alice][0].ref)
41
41
  await sc.like(alice, sc.replies[bob][0].ref)
42
42
  await sc.like(alice, sc.replies[carol][0].ref)
43
- })
44
43
 
45
- beforeAll(async () => {
46
44
  // Add a repost of a reply so that we can confirm myState in the thread
47
45
  await sc.repost(bob, sc.replies[alice][0].ref)
48
- await network.processAll()
49
46
  })
50
47
 
51
- afterAll(async () => {
52
- await network.close()
53
- })
48
+ beforeEach(async () => network.processAll())
49
+ afterAll(async () => network?.close())
54
50
 
55
51
  it('fetches deep post thread', async () => {
56
52
  const thread = await agent.api.app.bsky.feed.getPostThread(
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import { AppBskyFeedDefs, AtpAgent, ids } from '@atproto/api'
4
4
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
5
5
  import { forSnapshot } from '../_util.js'
@@ -23,12 +23,10 @@ describe('views with thread gating', () => {
23
23
  email: 'eve@eve.com',
24
24
  password: 'hunter2',
25
25
  })
26
- await network.processAll()
27
26
  })
28
27
 
29
- afterAll(async () => {
30
- await network.close()
31
- })
28
+ beforeEach(async () => network.processAll())
29
+ afterAll(async () => network?.close())
32
30
 
33
31
  // check that replyDisabled state is applied correctly in a simple method like getPosts
34
32
  const checkReplyDisabled = async (
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import {
4
4
  AppBskyFeedDefs,
5
5
  AppBskyFeedGetTimeline,
@@ -35,7 +35,7 @@ describe('timeline views', () => {
35
35
  agent = network.bsky.getAgent()
36
36
  sc = network.getSeedClient()
37
37
  await basicSeed(sc)
38
- await network.processAll()
38
+
39
39
  alice = sc.dids.alice
40
40
  bob = sc.dids.bob
41
41
  carol = sc.dids.carol
@@ -54,9 +54,8 @@ describe('timeline views', () => {
54
54
  })
55
55
  })
56
56
 
57
- afterAll(async () => {
58
- await network.close()
59
- })
57
+ beforeEach(async () => network.processAll())
58
+ afterAll(async () => network?.close())
60
59
 
61
60
  // @TODO(bsky) blocks posts, reposts, replies by actor takedown via labels
62
61
  // @TODO(bsky) blocks posts, reposts, replies by record takedown via labels
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert'
2
- import { afterAll, beforeAll, describe, expect, it } from 'vitest'
2
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import { AppBskyActorDefs, AtpAgent, ids } from '@atproto/api'
4
4
  import { SeedClient, TestNetwork, verificationsSeed } from '@atproto/dev-env'
5
5
 
@@ -41,7 +41,6 @@ describe('verification views', () => {
41
41
  sc = network.getSeedClient()
42
42
 
43
43
  await verificationsSeed(sc)
44
- await network.processAll()
45
44
 
46
45
  labelerDid = network.bsky.ctx.cfg.modServiceDid
47
46
  alice = sc.dids.alice
@@ -63,12 +62,11 @@ describe('verification views', () => {
63
62
  .set({ trustedVerifier: true })
64
63
  .where('did', 'in', [verifier1, verifier2, verifier3])
65
64
  .execute()
66
- }, 20_000) // @NOTE seeding can take a while
67
-
68
- afterAll(async () => {
69
- await network.close()
70
65
  })
71
66
 
67
+ beforeEach(async () => network.processAll())
68
+ afterAll(async () => network?.close())
69
+
72
70
  describe('profile views', () => {
73
71
  const testCases: ProfileViewTestCase[] = [
74
72
  {