@atproto/bsky 0.0.74 → 0.0.76

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 (64) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/app/bsky/actor/getProfiles.d.ts.map +1 -1
  3. package/dist/api/app/bsky/actor/getProfiles.js +9 -1
  4. package/dist/api/app/bsky/actor/getProfiles.js.map +1 -1
  5. package/dist/api/app/bsky/actor/searchActorsTypeahead.js +10 -2
  6. package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
  7. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  8. package/dist/api/app/bsky/feed/getFeed.js +8 -1
  9. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  10. package/dist/api/app/bsky/feed/getPosts.d.ts.map +1 -1
  11. package/dist/api/app/bsky/feed/getPosts.js +8 -1
  12. package/dist/api/app/bsky/feed/getPosts.js.map +1 -1
  13. package/dist/api/app/bsky/graph/getList.d.ts.map +1 -1
  14. package/dist/api/app/bsky/graph/getList.js +32 -2
  15. package/dist/api/app/bsky/graph/getList.js.map +1 -1
  16. package/dist/auth-verifier.d.ts +8 -3
  17. package/dist/auth-verifier.d.ts.map +1 -1
  18. package/dist/auth-verifier.js +43 -29
  19. package/dist/auth-verifier.js.map +1 -1
  20. package/dist/hydration/hydrator.d.ts +1 -0
  21. package/dist/hydration/hydrator.d.ts.map +1 -1
  22. package/dist/hydration/hydrator.js +15 -6
  23. package/dist/hydration/hydrator.js.map +1 -1
  24. package/package.json +5 -5
  25. package/src/api/app/bsky/actor/getProfiles.ts +10 -1
  26. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +9 -4
  27. package/src/api/app/bsky/feed/getFeed.ts +12 -1
  28. package/src/api/app/bsky/feed/getPosts.ts +9 -1
  29. package/src/api/app/bsky/graph/getList.ts +47 -4
  30. package/src/auth-verifier.ts +78 -51
  31. package/src/hydration/hydrator.ts +18 -2
  32. package/tests/admin/admin-auth.test.ts +15 -8
  33. package/tests/auth.test.ts +2 -1
  34. package/tests/data-plane/handle-invalidation.test.ts +31 -5
  35. package/tests/data-plane/indexing.test.ts +138 -23
  36. package/tests/data-plane/thread-mutes.test.ts +41 -9
  37. package/tests/feed-generation.test.ts +150 -32
  38. package/tests/server.test.ts +1 -1
  39. package/tests/views/__snapshots__/lists.test.ts.snap +145 -26
  40. package/tests/views/__snapshots__/starter-packs.test.ts.snap +245 -4
  41. package/tests/views/account-deactivation.test.ts +8 -2
  42. package/tests/views/actor-likes.test.ts +27 -6
  43. package/tests/views/actor-search.test.ts +5 -1
  44. package/tests/views/author-feed.test.ts +73 -12
  45. package/tests/views/block-lists.test.ts +201 -40
  46. package/tests/views/blocks.test.ts +245 -46
  47. package/tests/views/follows.test.ts +133 -22
  48. package/tests/views/known-followers.test.ts +43 -7
  49. package/tests/views/labeler-service.test.ts +36 -6
  50. package/tests/views/likes.test.ts +8 -5
  51. package/tests/views/list-feed.test.ts +25 -4
  52. package/tests/views/lists.test.ts +73 -31
  53. package/tests/views/mute-lists.test.ts +101 -29
  54. package/tests/views/mutes.test.ts +77 -17
  55. package/tests/views/notifications.test.ts +141 -25
  56. package/tests/views/posts.test.ts +13 -2
  57. package/tests/views/profile.test.ts +37 -11
  58. package/tests/views/reposts.test.ts +31 -5
  59. package/tests/views/starter-packs.test.ts +83 -3
  60. package/tests/views/suggested-follows.test.ts +31 -5
  61. package/tests/views/suggestions.test.ts +37 -6
  62. package/tests/views/thread.test.ts +121 -20
  63. package/tests/views/threadgating.test.ts +128 -22
  64. package/tests/views/timeline.test.ts +67 -14
@@ -2,6 +2,7 @@ import { AtpAgent } from '@atproto/api'
2
2
  import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
3
3
  import { forSnapshot, paginateAll } from '../_util'
4
4
  import { Notification } from '../../src/lexicon/types/app/bsky/notification/listNotifications'
5
+ import { ids } from '../../src/lexicon/lexicons'
5
6
 
6
7
  describe('notification views', () => {
7
8
  let network: TestNetwork
@@ -48,14 +49,24 @@ describe('notification views', () => {
48
49
  const notifCountAlice =
49
50
  await agent.api.app.bsky.notification.getUnreadCount(
50
51
  {},
51
- { headers: await network.serviceHeaders(alice) },
52
+ {
53
+ headers: await network.serviceHeaders(
54
+ alice,
55
+ ids.AppBskyNotificationGetUnreadCount,
56
+ ),
57
+ },
52
58
  )
53
59
 
54
60
  expect(notifCountAlice.data.count).toBe(12)
55
61
 
56
62
  const notifCountBob = await agent.api.app.bsky.notification.getUnreadCount(
57
63
  {},
58
- { headers: await network.serviceHeaders(sc.dids.bob) },
64
+ {
65
+ headers: await network.serviceHeaders(
66
+ sc.dids.bob,
67
+ ids.AppBskyNotificationGetUnreadCount,
68
+ ),
69
+ },
59
70
  )
60
71
 
61
72
  expect(notifCountBob.data.count).toBeGreaterThanOrEqual(3)
@@ -75,14 +86,24 @@ describe('notification views', () => {
75
86
  const notifCountAlice =
76
87
  await agent.api.app.bsky.notification.getUnreadCount(
77
88
  {},
78
- { headers: await network.serviceHeaders(alice) },
89
+ {
90
+ headers: await network.serviceHeaders(
91
+ alice,
92
+ ids.AppBskyNotificationGetUnreadCount,
93
+ ),
94
+ },
79
95
  )
80
96
 
81
97
  expect(notifCountAlice.data.count).toBe(13)
82
98
 
83
99
  const notifCountBob = await agent.api.app.bsky.notification.getUnreadCount(
84
100
  {},
85
- { headers: await network.serviceHeaders(sc.dids.bob) },
101
+ {
102
+ headers: await network.serviceHeaders(
103
+ sc.dids.bob,
104
+ ids.AppBskyNotificationGetUnreadCount,
105
+ ),
106
+ },
86
107
  )
87
108
 
88
109
  expect(notifCountBob.data.count).toBeGreaterThanOrEqual(4)
@@ -97,7 +118,12 @@ describe('notification views', () => {
97
118
 
98
119
  const notifsAlice = await agent.api.app.bsky.notification.listNotifications(
99
120
  {},
100
- { headers: await network.serviceHeaders(sc.dids.alice) },
121
+ {
122
+ headers: await network.serviceHeaders(
123
+ sc.dids.alice,
124
+ ids.AppBskyNotificationListNotifications,
125
+ ),
126
+ },
101
127
  )
102
128
  const hasNotif = notifsAlice.data.notifications.some(
103
129
  (notif) => notif.uri === second.ref.uriStr,
@@ -114,7 +140,12 @@ describe('notification views', () => {
114
140
  // Dan was quoted by alice
115
141
  const notifsDan = await agent.api.app.bsky.notification.listNotifications(
116
142
  {},
117
- { headers: await network.serviceHeaders(sc.dids.dan) },
143
+ {
144
+ headers: await network.serviceHeaders(
145
+ sc.dids.dan,
146
+ ids.AppBskyNotificationListNotifications,
147
+ ),
148
+ },
118
149
  )
119
150
  expect(forSnapshot(sort(notifsDan.data.notifications))).toMatchSnapshot()
120
151
  })
@@ -122,7 +153,12 @@ describe('notification views', () => {
122
153
  it('fetches notifications without a last-seen', async () => {
123
154
  const notifRes = await agent.api.app.bsky.notification.listNotifications(
124
155
  {},
125
- { headers: await network.serviceHeaders(alice) },
156
+ {
157
+ headers: await network.serviceHeaders(
158
+ alice,
159
+ ids.AppBskyNotificationListNotifications,
160
+ ),
161
+ },
126
162
  )
127
163
 
128
164
  const notifs = notifRes.data.notifications
@@ -140,7 +176,12 @@ describe('notification views', () => {
140
176
  const paginator = async (cursor?: string) => {
141
177
  const res = await agent.api.app.bsky.notification.listNotifications(
142
178
  { cursor, limit: 6 },
143
- { headers: await network.serviceHeaders(alice) },
179
+ {
180
+ headers: await network.serviceHeaders(
181
+ alice,
182
+ ids.AppBskyNotificationListNotifications,
183
+ ),
184
+ },
144
185
  )
145
186
  return res.data
146
187
  }
@@ -152,7 +193,12 @@ describe('notification views', () => {
152
193
 
153
194
  const full = await agent.api.app.bsky.notification.listNotifications(
154
195
  {},
155
- { headers: await network.serviceHeaders(alice) },
196
+ {
197
+ headers: await network.serviceHeaders(
198
+ alice,
199
+ ids.AppBskyNotificationListNotifications,
200
+ ),
201
+ },
156
202
  )
157
203
 
158
204
  expect(full.data.notifications.length).toEqual(13)
@@ -162,26 +208,44 @@ describe('notification views', () => {
162
208
  it('fetches notification count with a last-seen', async () => {
163
209
  const full = await agent.api.app.bsky.notification.listNotifications(
164
210
  {},
165
- { headers: await network.serviceHeaders(alice) },
211
+ {
212
+ headers: await network.serviceHeaders(
213
+ alice,
214
+ ids.AppBskyNotificationListNotifications,
215
+ ),
216
+ },
166
217
  )
167
218
  const seenAt = full.data.notifications[3].indexedAt
168
219
  await agent.api.app.bsky.notification.updateSeen(
169
220
  { seenAt },
170
221
  {
171
- headers: await network.serviceHeaders(alice),
222
+ headers: await network.serviceHeaders(
223
+ alice,
224
+ ids.AppBskyNotificationUpdateSeen,
225
+ ),
172
226
  encoding: 'application/json',
173
227
  },
174
228
  )
175
229
  const full2 = await agent.api.app.bsky.notification.listNotifications(
176
230
  {},
177
- { headers: await network.serviceHeaders(alice) },
231
+ {
232
+ headers: await network.serviceHeaders(
233
+ alice,
234
+ ids.AppBskyNotificationListNotifications,
235
+ ),
236
+ },
178
237
  )
179
238
  expect(full2.data.notifications.length).toBe(full.data.notifications.length)
180
239
  expect(full2.data.seenAt).toEqual(seenAt)
181
240
 
182
241
  const notifCount = await agent.api.app.bsky.notification.getUnreadCount(
183
242
  {},
184
- { headers: await network.serviceHeaders(alice) },
243
+ {
244
+ headers: await network.serviceHeaders(
245
+ alice,
246
+ ids.AppBskyNotificationGetUnreadCount,
247
+ ),
248
+ },
185
249
  )
186
250
 
187
251
  expect(notifCount.data.count).toBe(
@@ -193,7 +257,10 @@ describe('notification views', () => {
193
257
  await agent.api.app.bsky.notification.updateSeen(
194
258
  { seenAt: new Date(0).toISOString() },
195
259
  {
196
- headers: await network.serviceHeaders(alice),
260
+ headers: await network.serviceHeaders(
261
+ alice,
262
+ ids.AppBskyNotificationUpdateSeen,
263
+ ),
197
264
  encoding: 'application/json',
198
265
  },
199
266
  )
@@ -202,19 +269,32 @@ describe('notification views', () => {
202
269
  it('fetches notifications with a last-seen', async () => {
203
270
  const full = await agent.api.app.bsky.notification.listNotifications(
204
271
  {},
205
- { headers: await network.serviceHeaders(alice) },
272
+ {
273
+ headers: await network.serviceHeaders(
274
+ alice,
275
+ ids.AppBskyNotificationListNotifications,
276
+ ),
277
+ },
206
278
  )
207
279
  const seenAt = full.data.notifications[3].indexedAt
208
280
  await agent.api.app.bsky.notification.updateSeen(
209
281
  { seenAt },
210
282
  {
211
- headers: await network.serviceHeaders(alice),
283
+ headers: await network.serviceHeaders(
284
+ alice,
285
+ ids.AppBskyNotificationUpdateSeen,
286
+ ),
212
287
  encoding: 'application/json',
213
288
  },
214
289
  )
215
290
  const notifRes = await agent.api.app.bsky.notification.listNotifications(
216
291
  {},
217
- { headers: await network.serviceHeaders(alice) },
292
+ {
293
+ headers: await network.serviceHeaders(
294
+ alice,
295
+ ids.AppBskyNotificationListNotifications,
296
+ ),
297
+ },
218
298
  )
219
299
 
220
300
  const notifs = notifRes.data.notifications
@@ -226,7 +306,10 @@ describe('notification views', () => {
226
306
  await agent.api.app.bsky.notification.updateSeen(
227
307
  { seenAt: new Date(0).toISOString() },
228
308
  {
229
- headers: await network.serviceHeaders(alice),
309
+ headers: await network.serviceHeaders(
310
+ alice,
311
+ ids.AppBskyNotificationUpdateSeen,
312
+ ),
230
313
  encoding: 'application/json',
231
314
  },
232
315
  )
@@ -245,11 +328,21 @@ describe('notification views', () => {
245
328
 
246
329
  const notifRes = await agent.api.app.bsky.notification.listNotifications(
247
330
  {},
248
- { headers: await network.serviceHeaders(alice) },
331
+ {
332
+ headers: await network.serviceHeaders(
333
+ alice,
334
+ ids.AppBskyNotificationListNotifications,
335
+ ),
336
+ },
249
337
  )
250
338
  const notifCount = await agent.api.app.bsky.notification.getUnreadCount(
251
339
  {},
252
- { headers: await network.serviceHeaders(alice) },
340
+ {
341
+ headers: await network.serviceHeaders(
342
+ alice,
343
+ ids.AppBskyNotificationGetUnreadCount,
344
+ ),
345
+ },
253
346
  )
254
347
 
255
348
  const notifs = sort(notifRes.data.notifications)
@@ -270,7 +363,12 @@ describe('notification views', () => {
270
363
  it('fetches notifications with explicit priority', async () => {
271
364
  const priority = await agent.api.app.bsky.notification.listNotifications(
272
365
  { priority: true },
273
- { headers: await network.serviceHeaders(sc.dids.carol) },
366
+ {
367
+ headers: await network.serviceHeaders(
368
+ sc.dids.carol,
369
+ ids.AppBskyNotificationListNotifications,
370
+ ),
371
+ },
274
372
  )
275
373
  // only notifs from follow (alice)
276
374
  expect(
@@ -281,7 +379,12 @@ describe('notification views', () => {
281
379
  expect(forSnapshot(priority.data)).toMatchSnapshot()
282
380
  const noPriority = await agent.api.app.bsky.notification.listNotifications(
283
381
  { priority: false },
284
- { headers: await network.serviceHeaders(sc.dids.carol) },
382
+ {
383
+ headers: await network.serviceHeaders(
384
+ sc.dids.carol,
385
+ ids.AppBskyNotificationListNotifications,
386
+ ),
387
+ },
285
388
  )
286
389
  expect(forSnapshot(noPriority.data)).toMatchSnapshot()
287
390
  })
@@ -291,13 +394,21 @@ describe('notification views', () => {
291
394
  { priority: true },
292
395
  {
293
396
  encoding: 'application/json',
294
- headers: await network.serviceHeaders(sc.dids.carol),
397
+ headers: await network.serviceHeaders(
398
+ sc.dids.carol,
399
+ ids.AppBskyNotificationPutPreferences,
400
+ ),
295
401
  },
296
402
  )
297
403
  await network.processAll()
298
404
  const notifs = await agent.api.app.bsky.notification.listNotifications(
299
405
  {},
300
- { headers: await network.serviceHeaders(sc.dids.carol) },
406
+ {
407
+ headers: await network.serviceHeaders(
408
+ sc.dids.carol,
409
+ ids.AppBskyNotificationListNotifications,
410
+ ),
411
+ },
301
412
  )
302
413
  // only notifs from follow (alice)
303
414
  expect(
@@ -312,7 +423,12 @@ describe('notification views', () => {
312
423
  const { data: notifs } =
313
424
  await agent.api.app.bsky.notification.listNotifications(
314
425
  { cursor: '90210::bafycid' },
315
- { headers: await network.serviceHeaders(alice) },
426
+ {
427
+ headers: await network.serviceHeaders(
428
+ alice,
429
+ ids.AppBskyNotificationListNotifications,
430
+ ),
431
+ },
316
432
  )
317
433
  expect(notifs).toMatchObject({ notifications: [] })
318
434
  })
@@ -1,6 +1,7 @@
1
1
  import { AppBskyFeedPost, AtpAgent } from '@atproto/api'
2
2
  import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
3
3
  import { forSnapshot, stripViewerFromPost } from '../_util'
4
+ import { ids } from '../../src/lexicon/lexicons'
4
5
 
5
6
  describe('pds posts views', () => {
6
7
  let network: TestNetwork
@@ -34,7 +35,12 @@ describe('pds posts views', () => {
34
35
  ]
35
36
  const posts = await agent.api.app.bsky.feed.getPosts(
36
37
  { uris },
37
- { headers: await network.serviceHeaders(sc.dids.alice) },
38
+ {
39
+ headers: await network.serviceHeaders(
40
+ sc.dids.alice,
41
+ ids.AppBskyFeedGetPosts,
42
+ ),
43
+ },
38
44
  )
39
45
 
40
46
  expect(posts.data.posts.length).toBe(uris.length)
@@ -53,7 +59,12 @@ describe('pds posts views', () => {
53
59
 
54
60
  const authed = await agent.api.app.bsky.feed.getPosts(
55
61
  { uris },
56
- { headers: await network.serviceHeaders(sc.dids.alice) },
62
+ {
63
+ headers: await network.serviceHeaders(
64
+ sc.dids.alice,
65
+ ids.AppBskyFeedGetPosts,
66
+ ),
67
+ },
57
68
  )
58
69
  const unauthed = await agent.api.app.bsky.feed.getPosts({
59
70
  uris,
@@ -38,7 +38,12 @@ describe('pds profile views', () => {
38
38
  it('fetches own profile', async () => {
39
39
  const aliceForAlice = await agent.api.app.bsky.actor.getProfile(
40
40
  { actor: alice },
41
- { headers: await network.serviceHeaders(alice) },
41
+ {
42
+ headers: await network.serviceHeaders(
43
+ alice,
44
+ ids.AppBskyActorGetProfile,
45
+ ),
46
+ },
42
47
  )
43
48
 
44
49
  expect(forSnapshot(aliceForAlice.data)).toMatchSnapshot()
@@ -47,7 +52,9 @@ describe('pds profile views', () => {
47
52
  it('reflects self-labels', async () => {
48
53
  const aliceForBob = await agent.api.app.bsky.actor.getProfile(
49
54
  { actor: alice },
50
- { headers: await network.serviceHeaders(bob) },
55
+ {
56
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
57
+ },
51
58
  )
52
59
 
53
60
  const labels = aliceForBob.data.labels
@@ -61,7 +68,9 @@ describe('pds profile views', () => {
61
68
  it("fetches other's profile, with a follow", async () => {
62
69
  const aliceForBob = await agent.api.app.bsky.actor.getProfile(
63
70
  { actor: alice },
64
- { headers: await network.serviceHeaders(bob) },
71
+ {
72
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
73
+ },
65
74
  )
66
75
 
67
76
  expect(forSnapshot(aliceForBob.data)).toMatchSnapshot()
@@ -70,7 +79,9 @@ describe('pds profile views', () => {
70
79
  it("fetches other's profile, without a follow", async () => {
71
80
  const danForBob = await agent.api.app.bsky.actor.getProfile(
72
81
  { actor: dan },
73
- { headers: await network.serviceHeaders(bob) },
82
+ {
83
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
84
+ },
74
85
  )
75
86
 
76
87
  expect(forSnapshot(danForBob.data)).toMatchSnapshot()
@@ -90,7 +101,9 @@ describe('pds profile views', () => {
90
101
  'missing.test',
91
102
  ],
92
103
  },
93
- { headers: await network.serviceHeaders(bob) },
104
+ {
105
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfiles),
106
+ },
94
107
  )
95
108
 
96
109
  expect(profiles.map((p) => p.handle)).toEqual([
@@ -135,7 +148,12 @@ describe('pds profile views', () => {
135
148
 
136
149
  const aliceForAlice = await agent.api.app.bsky.actor.getProfile(
137
150
  { actor: alice },
138
- { headers: await network.serviceHeaders(alice) },
151
+ {
152
+ headers: await network.serviceHeaders(
153
+ alice,
154
+ ids.AppBskyActorGetProfile,
155
+ ),
156
+ },
139
157
  )
140
158
 
141
159
  expect(forSnapshot(aliceForAlice.data)).toMatchSnapshot()
@@ -145,13 +163,15 @@ describe('pds profile views', () => {
145
163
  const byDid = await agent.api.app.bsky.actor.getProfile(
146
164
  { actor: alice },
147
165
  {
148
- headers: await network.serviceHeaders(bob),
166
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
149
167
  },
150
168
  )
151
169
 
152
170
  const byHandle = await agent.api.app.bsky.actor.getProfile(
153
171
  { actor: sc.accounts[alice].handle },
154
- { headers: await network.serviceHeaders(bob) },
172
+ {
173
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
174
+ },
155
175
  )
156
176
 
157
177
  expect(byHandle.data).toEqual(byDid.data)
@@ -160,7 +180,9 @@ describe('pds profile views', () => {
160
180
  it('fetches profile unauthed', async () => {
161
181
  const { data: authed } = await agent.api.app.bsky.actor.getProfile(
162
182
  { actor: alice },
163
- { headers: await network.serviceHeaders(bob) },
183
+ {
184
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
185
+ },
164
186
  )
165
187
  const { data: unauthed } = await agent.api.app.bsky.actor.getProfile({
166
188
  actor: alice,
@@ -173,7 +195,9 @@ describe('pds profile views', () => {
173
195
  {
174
196
  actors: [alice, 'bob.test', 'missing.test'],
175
197
  },
176
- { headers: await network.serviceHeaders(bob) },
198
+ {
199
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfiles),
200
+ },
177
201
  )
178
202
  const { data: unauthed } = await agent.api.app.bsky.actor.getProfiles({
179
203
  actors: [alice, 'bob.test', 'missing.test'],
@@ -188,7 +212,9 @@ describe('pds profile views', () => {
188
212
  })
189
213
  const promise = agent.api.app.bsky.actor.getProfile(
190
214
  { actor: alice },
191
- { headers: await network.serviceHeaders(bob) },
215
+ {
216
+ headers: await network.serviceHeaders(bob, ids.AppBskyActorGetProfile),
217
+ },
192
218
  )
193
219
 
194
220
  await expect(promise).rejects.toThrow('Account has been suspended')
@@ -1,6 +1,7 @@
1
1
  import { AtpAgent } from '@atproto/api'
2
2
  import { TestNetwork, SeedClient, repostsSeed } from '@atproto/dev-env'
3
3
  import { forSnapshot, paginateAll, stripViewer } from '../_util'
4
+ import { ids } from '../../src/lexicon/lexicons'
4
5
 
5
6
  describe('pds repost views', () => {
6
7
  let network: TestNetwork
@@ -30,7 +31,12 @@ describe('pds repost views', () => {
30
31
  it('fetches reposted-by for a post', async () => {
31
32
  const view = await agent.api.app.bsky.feed.getRepostedBy(
32
33
  { uri: sc.posts[alice][2].ref.uriStr },
33
- { headers: await network.serviceHeaders(alice) },
34
+ {
35
+ headers: await network.serviceHeaders(
36
+ alice,
37
+ ids.AppBskyFeedGetRepostedBy,
38
+ ),
39
+ },
34
40
  )
35
41
  expect(view.data.uri).toEqual(sc.posts[sc.dids.alice][2].ref.uriStr)
36
42
  expect(forSnapshot(view.data.repostedBy)).toMatchSnapshot()
@@ -39,7 +45,12 @@ describe('pds repost views', () => {
39
45
  it('fetches reposted-by for a reply', async () => {
40
46
  const view = await agent.api.app.bsky.feed.getRepostedBy(
41
47
  { uri: sc.replies[bob][0].ref.uriStr },
42
- { headers: await network.serviceHeaders(alice) },
48
+ {
49
+ headers: await network.serviceHeaders(
50
+ alice,
51
+ ids.AppBskyFeedGetRepostedBy,
52
+ ),
53
+ },
43
54
  )
44
55
  expect(view.data.uri).toEqual(sc.replies[sc.dids.bob][0].ref.uriStr)
45
56
  expect(forSnapshot(view.data.repostedBy)).toMatchSnapshot()
@@ -54,7 +65,12 @@ describe('pds repost views', () => {
54
65
  cursor,
55
66
  limit: 2,
56
67
  },
57
- { headers: await network.serviceHeaders(alice) },
68
+ {
69
+ headers: await network.serviceHeaders(
70
+ alice,
71
+ ids.AppBskyFeedGetRepostedBy,
72
+ ),
73
+ },
58
74
  )
59
75
  return res.data
60
76
  }
@@ -66,7 +82,12 @@ describe('pds repost views', () => {
66
82
 
67
83
  const full = await agent.api.app.bsky.feed.getRepostedBy(
68
84
  { uri: sc.posts[alice][2].ref.uriStr },
69
- { headers: await network.serviceHeaders(alice) },
85
+ {
86
+ headers: await network.serviceHeaders(
87
+ alice,
88
+ ids.AppBskyFeedGetRepostedBy,
89
+ ),
90
+ },
70
91
  )
71
92
 
72
93
  expect(full.data.repostedBy.length).toEqual(4)
@@ -76,7 +97,12 @@ describe('pds repost views', () => {
76
97
  it('fetches reposted-by unauthed', async () => {
77
98
  const { data: authed } = await agent.api.app.bsky.feed.getRepostedBy(
78
99
  { uri: sc.posts[alice][2].ref.uriStr },
79
- { headers: await network.serviceHeaders(alice) },
100
+ {
101
+ headers: await network.serviceHeaders(
102
+ alice,
103
+ ids.AppBskyFeedGetRepostedBy,
104
+ ),
105
+ },
80
106
  )
81
107
  const { data: unauthed } = await agent.api.app.bsky.feed.getRepostedBy({
82
108
  uri: sc.posts[alice][2].ref.uriStr,
@@ -1,8 +1,9 @@
1
1
  import { AtpAgent } from '@atproto/api'
2
- import { TestNetwork, SeedClient, basicSeed, RecordRef } from '@atproto/dev-env'
2
+ import { TestNetwork, SeedClient, RecordRef, basicSeed } from '@atproto/dev-env'
3
3
  import { isRecord as isProfile } from '../../src/lexicon/types/app/bsky/actor/profile'
4
4
  import { forSnapshot } from '../_util'
5
5
  import assert from 'assert'
6
+ import { ids } from '../../src/lexicon/lexicons'
6
7
 
7
8
  describe('starter packs', () => {
8
9
  let network: TestNetwork
@@ -10,6 +11,7 @@ describe('starter packs', () => {
10
11
  let sc: SeedClient
11
12
  let sp1: RecordRef
12
13
  let sp2: RecordRef
14
+ let sp3: RecordRef
13
15
 
14
16
  beforeAll(async () => {
15
17
  network = await TestNetwork.create({
@@ -47,6 +49,25 @@ describe('starter packs', () => {
47
49
  })
48
50
  await sc.createProfile(did, `Newskie ${n}`, 'New here', [], sp1)
49
51
  }
52
+
53
+ await sc.createAccount('frankie', {
54
+ handle: 'frankie.test',
55
+ email: 'frankie@frankie.com',
56
+ password: 'password',
57
+ })
58
+ await sc.createAccount('greta', {
59
+ handle: 'greta.test',
60
+ email: 'greta@greta.com',
61
+ password: 'password',
62
+ })
63
+ sp3 = await sc.createStarterPack(
64
+ sc.dids.alice,
65
+ "alice's about to get blocked starter pack",
66
+ [sc.dids.alice, sc.dids.frankie, sc.dids.greta],
67
+ [],
68
+ )
69
+ await sc.block(sc.dids.frankie, sc.dids.alice)
70
+
50
71
  await network.processAll()
51
72
  })
52
73
 
@@ -58,7 +79,7 @@ describe('starter packs', () => {
58
79
  const { data } = await agent.api.app.bsky.graph.getActorStarterPacks({
59
80
  actor: sc.dids.alice,
60
81
  })
61
- expect(data.starterPacks).toHaveLength(2)
82
+ expect(data.starterPacks).toHaveLength(3)
62
83
  expect(forSnapshot(data.starterPacks)).toMatchSnapshot()
63
84
  })
64
85
 
@@ -106,7 +127,12 @@ describe('starter packs', () => {
106
127
  data: { notifications },
107
128
  } = await agent.api.app.bsky.notification.listNotifications(
108
129
  { limit: 3 }, // three most recent
109
- { headers: await network.serviceHeaders(sc.dids.alice) },
130
+ {
131
+ headers: await network.serviceHeaders(
132
+ sc.dids.alice,
133
+ ids.AppBskyNotificationListNotifications,
134
+ ),
135
+ },
110
136
  )
111
137
  expect(notifications).toHaveLength(3)
112
138
  notifications.forEach((notif) => {
@@ -118,4 +144,58 @@ describe('starter packs', () => {
118
144
  })
119
145
  expect(forSnapshot(notifications)).toMatchSnapshot()
120
146
  })
147
+
148
+ it('does not include users with creator block relationship in list sample for non-creator, in-list viewers', async () => {
149
+ const view = await agent.api.app.bsky.graph.getStarterPack(
150
+ {
151
+ starterPack: sp3.uriStr,
152
+ },
153
+ {
154
+ headers: await network.serviceHeaders(
155
+ sc.dids.frankie,
156
+ ids.AppBskyGraphGetStarterPack,
157
+ ),
158
+ },
159
+ )
160
+ expect(view.data.starterPack.listItemsSample?.length).toBe(2)
161
+ expect(forSnapshot(view.data.starterPack.listItemsSample)).toMatchSnapshot()
162
+ })
163
+
164
+ it('does not include users with creator block relationship in list sample for non-creator, not-in-list viewers', async () => {
165
+ const view = await agent.api.app.bsky.graph.getStarterPack(
166
+ {
167
+ starterPack: sp3.uriStr,
168
+ },
169
+ {
170
+ headers: await network.serviceHeaders(
171
+ sc.dids.bob,
172
+ ids.AppBskyGraphGetStarterPack,
173
+ ),
174
+ },
175
+ )
176
+ expect(view.data.starterPack.listItemsSample?.length).toBe(2)
177
+ expect(forSnapshot(view.data.starterPack.listItemsSample)).toMatchSnapshot()
178
+ })
179
+
180
+ it('does not include users with creator block relationship in list sample for signed-out viewers', async () => {
181
+ const view = await agent.api.app.bsky.graph.getStarterPack({
182
+ starterPack: sp3.uriStr,
183
+ })
184
+ expect(view.data.starterPack.listItemsSample?.length).toBe(2)
185
+ expect(forSnapshot(view.data.starterPack.listItemsSample)).toMatchSnapshot()
186
+ })
187
+
188
+ it('does include users with creator block relationship in list sample for creator', async () => {
189
+ const view = await agent.api.app.bsky.graph.getStarterPack(
190
+ { starterPack: sp3.uriStr },
191
+ {
192
+ headers: await network.serviceHeaders(
193
+ sc.dids.alice,
194
+ ids.AppBskyGraphGetStarterPack,
195
+ ),
196
+ },
197
+ )
198
+ expect(view.data.starterPack.listItemsSample?.length).toBe(3)
199
+ expect(forSnapshot(view.data.starterPack.listItemsSample)).toMatchSnapshot()
200
+ })
121
201
  })