@atproto/bsky 0.0.150 → 0.0.152

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 (105) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +4 -0
  3. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -0
  4. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js +76 -0
  5. package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -0
  6. package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts +4 -0
  7. package/dist/api/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -0
  8. package/dist/api/app/bsky/unspecced/getPostThreadV2.js +86 -0
  9. package/dist/api/app/bsky/unspecced/getPostThreadV2.js.map +1 -0
  10. package/dist/api/index.d.ts.map +1 -1
  11. package/dist/api/index.js +4 -0
  12. package/dist/api/index.js.map +1 -1
  13. package/dist/config.d.ts +2 -0
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/config.js +7 -0
  16. package/dist/config.js.map +1 -1
  17. package/dist/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.d.ts +4 -0
  18. package/dist/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.d.ts.map +1 -0
  19. package/dist/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.js +17 -0
  20. package/dist/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.js.map +1 -0
  21. package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
  22. package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
  23. package/dist/data-plane/server/db/migrations/index.js +2 -1
  24. package/dist/data-plane/server/db/migrations/index.js.map +1 -1
  25. package/dist/data-plane/server/db/tables/like.d.ts +2 -0
  26. package/dist/data-plane/server/db/tables/like.d.ts.map +1 -1
  27. package/dist/data-plane/server/db/tables/repost.d.ts +2 -0
  28. package/dist/data-plane/server/db/tables/repost.d.ts.map +1 -1
  29. package/dist/data-plane/server/indexing/plugins/like.d.ts.map +1 -1
  30. package/dist/data-plane/server/indexing/plugins/like.js +32 -9
  31. package/dist/data-plane/server/indexing/plugins/like.js.map +1 -1
  32. package/dist/data-plane/server/indexing/plugins/repost.d.ts.map +1 -1
  33. package/dist/data-plane/server/indexing/plugins/repost.js +32 -9
  34. package/dist/data-plane/server/indexing/plugins/repost.js.map +1 -1
  35. package/dist/hydration/feed.d.ts.map +1 -1
  36. package/dist/hydration/feed.js.map +1 -1
  37. package/dist/lexicon/index.d.ts +6 -2
  38. package/dist/lexicon/index.d.ts.map +1 -1
  39. package/dist/lexicon/index.js +12 -4
  40. package/dist/lexicon/index.js.map +1 -1
  41. package/dist/lexicon/lexicons.d.ts +536 -88
  42. package/dist/lexicon/lexicons.d.ts.map +1 -1
  43. package/dist/lexicon/lexicons.js +279 -44
  44. package/dist/lexicon/lexicons.js.map +1 -1
  45. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +2 -0
  46. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  47. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  48. package/dist/lexicon/types/app/bsky/feed/like.d.ts +1 -0
  49. package/dist/lexicon/types/app/bsky/feed/like.d.ts.map +1 -1
  50. package/dist/lexicon/types/app/bsky/feed/like.js.map +1 -1
  51. package/dist/lexicon/types/app/bsky/feed/repost.d.ts +1 -0
  52. package/dist/lexicon/types/app/bsky/feed/repost.d.ts.map +1 -1
  53. package/dist/lexicon/types/app/bsky/feed/repost.js.map +1 -1
  54. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -2
  55. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
  56. package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
  57. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +61 -0
  58. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -0
  59. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js +25 -0
  60. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -0
  61. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts +92 -0
  62. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -0
  63. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js +52 -0
  64. package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js.map +1 -0
  65. package/dist/views/index.d.ts +36 -1
  66. package/dist/views/index.d.ts.map +1 -1
  67. package/dist/views/index.js +468 -2
  68. package/dist/views/index.js.map +1 -1
  69. package/dist/views/threads-v2.d.ts +62 -0
  70. package/dist/views/threads-v2.d.ts.map +1 -0
  71. package/dist/views/threads-v2.js +180 -0
  72. package/dist/views/threads-v2.js.map +1 -0
  73. package/package.json +4 -4
  74. package/src/api/app/bsky/unspecced/getPostThreadHiddenV2.ts +116 -0
  75. package/src/api/app/bsky/unspecced/getPostThreadV2.ts +130 -0
  76. package/src/api/index.ts +4 -0
  77. package/src/config.ts +9 -0
  78. package/src/data-plane/server/db/migrations/20250526T023712742Z-like-repost-via.ts +17 -0
  79. package/src/data-plane/server/db/migrations/index.ts +1 -0
  80. package/src/data-plane/server/db/tables/like.ts +2 -0
  81. package/src/data-plane/server/db/tables/repost.ts +2 -0
  82. package/src/data-plane/server/indexing/plugins/like.ts +39 -9
  83. package/src/data-plane/server/indexing/plugins/repost.ts +38 -9
  84. package/src/hydration/feed.ts +1 -0
  85. package/src/lexicon/index.ts +33 -9
  86. package/src/lexicon/lexicons.ts +298 -45
  87. package/src/lexicon/types/app/bsky/feed/defs.ts +2 -0
  88. package/src/lexicon/types/app/bsky/feed/like.ts +1 -0
  89. package/src/lexicon/types/app/bsky/feed/repost.ts +1 -0
  90. package/src/lexicon/types/app/bsky/notification/listNotifications.ts +3 -1
  91. package/src/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.ts +93 -0
  92. package/src/lexicon/types/app/bsky/unspecced/getPostThreadV2.ts +160 -0
  93. package/src/views/index.ts +747 -2
  94. package/src/views/threads-v2.ts +351 -0
  95. package/tests/__snapshots__/feed-generation.test.ts.snap +2 -0
  96. package/tests/seed/thread-v2.ts +775 -0
  97. package/tests/seed/util.ts +52 -0
  98. package/tests/views/__snapshots__/author-feed.test.ts.snap +30 -24
  99. package/tests/views/__snapshots__/notifications.test.ts.snap +1164 -229
  100. package/tests/views/__snapshots__/thread-v2.test.ts.snap +1091 -0
  101. package/tests/views/__snapshots__/timeline.test.ts.snap +398 -376
  102. package/tests/views/notifications.test.ts +177 -0
  103. package/tests/views/thread-v2.test.ts +2009 -0
  104. package/tsconfig.build.tsbuildinfo +1 -1
  105. package/tsconfig.tests.tsbuildinfo +1 -1
@@ -12,6 +12,8 @@ describe('notification views', () => {
12
12
 
13
13
  // account dids, for convenience
14
14
  let alice: string
15
+ let carol: string
16
+ let dan: string
15
17
 
16
18
  beforeAll(async () => {
17
19
  network = await TestNetwork.create({
@@ -27,6 +29,8 @@ describe('notification views', () => {
27
29
  .execute()
28
30
  await network.processAll()
29
31
  alice = sc.dids.alice
32
+ carol = sc.dids.carol
33
+ dan = sc.dids.dan
30
34
  })
31
35
 
32
36
  afterAll(async () => {
@@ -156,6 +160,179 @@ describe('notification views', () => {
156
160
  expect(forSnapshot(sort(notifsDan.data.notifications))).toMatchSnapshot()
157
161
  })
158
162
 
163
+ it('generates notifications for likes', async () => {
164
+ const notifsAlice = await agent.app.bsky.notification.listNotifications(
165
+ {},
166
+ {
167
+ headers: await network.serviceHeaders(
168
+ alice,
169
+ ids.AppBskyNotificationListNotifications,
170
+ ),
171
+ },
172
+ )
173
+
174
+ const na = sort(
175
+ notifsAlice.data.notifications.filter((n) => n.reason === 'like'),
176
+ )
177
+ expect(na).toHaveLength(5)
178
+ expect(forSnapshot(na)).toMatchSnapshot()
179
+ })
180
+
181
+ it('generates notifications for reposts', async () => {
182
+ const notifsAlice = await agent.app.bsky.notification.listNotifications(
183
+ {},
184
+ {
185
+ headers: await network.serviceHeaders(
186
+ alice,
187
+ ids.AppBskyNotificationListNotifications,
188
+ ),
189
+ },
190
+ )
191
+
192
+ const na = sort(
193
+ notifsAlice.data.notifications.filter((n) => n.reason === 'repost'),
194
+ )
195
+ expect(na).toHaveLength(2)
196
+ expect(forSnapshot(na)).toMatchSnapshot()
197
+ })
198
+
199
+ it('generates notifications for likes via repost', async () => {
200
+ const op = dan
201
+ const reposter = carol
202
+ const liker = alice
203
+ await sc.like(liker, sc.posts[op][1].ref, {
204
+ via: sc.reposts[reposter][0].raw,
205
+ })
206
+ await network.processAll()
207
+
208
+ const notifsOp = await agent.app.bsky.notification.listNotifications(
209
+ {},
210
+ {
211
+ headers: await network.serviceHeaders(
212
+ op,
213
+ ids.AppBskyNotificationListNotifications,
214
+ ),
215
+ },
216
+ )
217
+
218
+ const no = sort(
219
+ notifsOp.data.notifications.filter((n) => n.reason === 'like'),
220
+ )
221
+ // Like from `alice` in this test.
222
+ expect(no).toHaveLength(1)
223
+ expect(forSnapshot(no)).toMatchSnapshot()
224
+
225
+ const notifsReposter = await agent.app.bsky.notification.listNotifications(
226
+ {},
227
+ {
228
+ headers: await network.serviceHeaders(
229
+ reposter,
230
+ ids.AppBskyNotificationListNotifications,
231
+ ),
232
+ },
233
+ )
234
+
235
+ const nr = sort(
236
+ notifsReposter.data.notifications.filter(
237
+ (n) => n.reason === 'like-via-repost',
238
+ ),
239
+ )
240
+ // Like from `alice` in this test.
241
+ expect(nr).toHaveLength(1)
242
+ expect(forSnapshot(nr)).toMatchSnapshot()
243
+ })
244
+
245
+ it('does not generate self notifications for likes via own repost', async () => {
246
+ const op = dan
247
+ const reposter = carol
248
+ await sc.like(reposter, sc.posts[op][1].ref, {
249
+ via: sc.reposts[reposter][0].raw,
250
+ })
251
+ await network.processAll()
252
+
253
+ const notifsOp = await agent.app.bsky.notification.listNotifications(
254
+ {},
255
+ {
256
+ headers: await network.serviceHeaders(
257
+ op,
258
+ ids.AppBskyNotificationListNotifications,
259
+ ),
260
+ },
261
+ )
262
+
263
+ const no = sort(
264
+ notifsOp.data.notifications.filter((n) => n.reason === 'like'),
265
+ )
266
+ // Like from `alice` in previous test + `carol` on this test.
267
+ expect(no).toHaveLength(2)
268
+ expect(forSnapshot(no)).toMatchSnapshot()
269
+
270
+ const notifsReposter = await agent.app.bsky.notification.listNotifications(
271
+ {},
272
+ {
273
+ headers: await network.serviceHeaders(
274
+ reposter,
275
+ ids.AppBskyNotificationListNotifications,
276
+ ),
277
+ },
278
+ )
279
+
280
+ const nr = sort(
281
+ notifsReposter.data.notifications.filter(
282
+ (n) => n.reason === 'like-via-repost',
283
+ ),
284
+ )
285
+ // Like from `alice` in previous test.
286
+ expect(nr).toHaveLength(1)
287
+ expect(forSnapshot(nr)).toMatchSnapshot()
288
+ })
289
+
290
+ it('generates notifications for reposts via repost', async () => {
291
+ const op = dan
292
+ const reposter = carol
293
+ const reReposter = alice
294
+ await sc.repost(reReposter, sc.posts[op][1].ref, {
295
+ via: sc.reposts[reposter][0].raw,
296
+ })
297
+ await network.processAll()
298
+
299
+ const notifsOp = await agent.app.bsky.notification.listNotifications(
300
+ {},
301
+ {
302
+ headers: await network.serviceHeaders(
303
+ op,
304
+ ids.AppBskyNotificationListNotifications,
305
+ ),
306
+ },
307
+ )
308
+
309
+ const no = sort(
310
+ notifsOp.data.notifications.filter((n) => n.reason === 'repost'),
311
+ )
312
+ // Repost from `carol` in seeds + `alice` on this test.
313
+ expect(no).toHaveLength(2)
314
+ expect(forSnapshot(no)).toMatchSnapshot()
315
+
316
+ const notifsReposter = await agent.app.bsky.notification.listNotifications(
317
+ {},
318
+ {
319
+ headers: await network.serviceHeaders(
320
+ reposter,
321
+ ids.AppBskyNotificationListNotifications,
322
+ ),
323
+ },
324
+ )
325
+
326
+ const nr = sort(
327
+ notifsReposter.data.notifications.filter(
328
+ (n) => n.reason === 'repost-via-repost',
329
+ ),
330
+ )
331
+ // Repost from `alice` in this test.
332
+ expect(nr).toHaveLength(1)
333
+ expect(forSnapshot(nr)).toMatchSnapshot()
334
+ })
335
+
159
336
  it('generates notifications for verification created and removed', async () => {
160
337
  await sc.verify(
161
338
  sc.dids.alice,