@atproto/bsky 0.0.246 → 0.0.248

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 (62) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api/app/bsky/feed/searchPosts.js +1 -1
  3. package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
  4. package/dist/api/app/bsky/feed/searchPostsV2.js +2 -1
  5. package/dist/api/app/bsky/feed/searchPostsV2.js.map +1 -1
  6. package/dist/auth-verifier.d.ts +18 -13
  7. package/dist/auth-verifier.d.ts.map +1 -1
  8. package/dist/auth-verifier.js +9 -2
  9. package/dist/auth-verifier.js.map +1 -1
  10. package/dist/config.d.ts +7 -7
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +4 -1
  13. package/dist/config.js.map +1 -1
  14. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.d.ts +14 -16
  15. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.d.ts.map +1 -1
  16. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.js +6 -6
  17. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.js.map +1 -1
  18. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts +9 -1
  19. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts.map +1 -1
  20. package/dist/lexicons/chat/bsky/convo/defs.defs.js +6 -0
  21. package/dist/lexicons/chat/bsky/convo/defs.defs.js.map +1 -1
  22. package/dist/proto/bsky_pb.d.ts +17 -17
  23. package/dist/proto/bsky_pb.d.ts.map +1 -1
  24. package/dist/proto/bsky_pb.js +18 -9
  25. package/dist/proto/bsky_pb.js.map +1 -1
  26. package/package.json +8 -8
  27. package/proto/bsky.proto +13 -14
  28. package/src/api/app/bsky/feed/searchPosts.ts +1 -1
  29. package/src/api/app/bsky/feed/searchPostsV2.ts +2 -1
  30. package/src/auth-verifier.ts +28 -18
  31. package/src/config.ts +8 -5
  32. package/tests/data-plane/subscription.test.ts +2 -1
  33. package/tests/data-plane/thread-mutes.test.ts +3 -2
  34. package/tests/feed-generation.test.ts +2 -1
  35. package/tests/label-hydration.test.ts +6 -5
  36. package/tests/query-labels.test.ts +5 -4
  37. package/tests/seed/feed-hidden-replies.ts +3 -2
  38. package/tests/seed/get-suggested-starter-packs.ts +3 -2
  39. package/tests/seed/get-trends.ts +3 -2
  40. package/tests/seed/known-followers.ts +2 -1
  41. package/tests/seed/postgates.ts +3 -2
  42. package/tests/views/account-deactivation.test.ts +2 -1
  43. package/tests/views/actor-likes.test.ts +4 -3
  44. package/tests/views/author-feed.test.ts +6 -5
  45. package/tests/views/block-lists.test.ts +8 -7
  46. package/tests/views/blocks.test.ts +5 -4
  47. package/tests/views/bookmarks.test.ts +5 -4
  48. package/tests/views/feed-hidden-replies.test.ts +5 -4
  49. package/tests/views/feed-view-post.test.ts +5 -4
  50. package/tests/views/get-suggested-onboarding-users.test.ts +3 -2
  51. package/tests/views/internal-actor.test.ts +2 -1
  52. package/tests/views/known-followers.test.ts +2 -1
  53. package/tests/views/labeler-service.test.ts +4 -3
  54. package/tests/views/likes.test.ts +5 -4
  55. package/tests/views/list-feed.test.ts +7 -4
  56. package/tests/views/mute-lists.test.ts +22 -11
  57. package/tests/views/mutes.test.ts +24 -10
  58. package/tests/views/notifications.test.ts +15 -14
  59. package/tests/views/post-search.test.ts +4 -3
  60. package/tests/views/profile.test.ts +12 -8
  61. package/tests/views/quotes.test.ts +5 -4
  62. package/tests/views/thread.test.ts +4 -3
@@ -2,6 +2,7 @@ import assert from 'node:assert'
2
2
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
3
3
  import { AppBskyFeedDefs, AtUri, AtpAgent, ids } from '@atproto/api'
4
4
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
5
+ import type { DidString } from '@atproto/syntax'
5
6
 
6
7
  /**
7
8
  * The frontend computes feed slices for display using at-most one
@@ -23,10 +24,10 @@ describe('pds thread views', () => {
23
24
  let sc: SeedClient
24
25
 
25
26
  // account dids, for convenience
26
- let alice: string
27
- let bob: string
28
- let carol: string
29
- let dan: string
27
+ let alice: DidString
28
+ let bob: DidString
29
+ let carol: DidString
30
+ let dan: DidString
30
31
 
31
32
  beforeAll(async () => {
32
33
  network = await TestNetwork.create({
@@ -11,12 +11,13 @@ import {
11
11
  ids,
12
12
  } from '@atproto/api'
13
13
  import { SeedClient, TestNetwork } from '@atproto/dev-env'
14
+ import type { DidString, HandleString } from '@atproto/syntax'
14
15
 
15
16
  type User = {
16
17
  id: string
17
- did: string
18
+ did: DidString
18
19
  email: string
19
- handle: string
20
+ handle: HandleString
20
21
  password: string
21
22
  displayName: string
22
23
  description: string
@@ -1,6 +1,7 @@
1
1
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AppBskyActorDefs, AtpAgent } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork } from '@atproto/dev-env'
4
+ import type { DidString } from '@atproto/syntax'
4
5
  import { knownFollowersSeed } from '../seed/known-followers.js'
5
6
 
6
7
  describe('internal actor views', () => {
@@ -8,7 +9,7 @@ describe('internal actor views', () => {
8
9
  let pdsAgent: AtpAgent
9
10
  let seedClient: SeedClient
10
11
 
11
- let dids: Record<string, string>
12
+ let dids: Record<string, DidString>
12
13
 
13
14
  beforeAll(async () => {
14
15
  network = await TestNetwork.create({
@@ -1,6 +1,7 @@
1
1
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { AtpAgent, ids } from '@atproto/api'
3
3
  import { SeedClient, TestNetwork } from '@atproto/dev-env'
4
+ import type { DidString } from '@atproto/syntax'
4
5
  import { knownFollowersSeed } from '../seed/known-followers.js'
5
6
 
6
7
  describe('known followers (social proof)', () => {
@@ -9,7 +10,7 @@ describe('known followers (social proof)', () => {
9
10
  let pdsAgent: AtpAgent
10
11
  let seedClient: SeedClient
11
12
 
12
- let dids: Record<string, string>
13
+ let dids: Record<string, DidString>
13
14
 
14
15
  beforeAll(async () => {
15
16
  network = await TestNetwork.create({
@@ -8,6 +8,7 @@ import {
8
8
  ids,
9
9
  } from '@atproto/api'
10
10
  import { RecordRef, SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
11
+ import type { DidString } from '@atproto/syntax'
11
12
  import { forSnapshot, stripViewerFromLabeler } from '../_util.js'
12
13
 
13
14
  describe('labeler service views', () => {
@@ -17,9 +18,9 @@ describe('labeler service views', () => {
17
18
  let sc: SeedClient
18
19
 
19
20
  // account dids, for convenience
20
- let alice: string
21
- let bob: string
22
- let carol: string
21
+ let alice: DidString
22
+ let bob: DidString
23
+ let carol: DidString
23
24
 
24
25
  let aliceService: RecordRef
25
26
 
@@ -1,6 +1,7 @@
1
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
+ import type { DidString } from '@atproto/syntax'
4
5
  import {
5
6
  constantDate,
6
7
  forSnapshot,
@@ -14,10 +15,10 @@ describe('pds like views', () => {
14
15
  let sc: SeedClient
15
16
 
16
17
  // account dids, for convenience
17
- let alice: string
18
- let bob: string
19
- let carol: string
20
- let frankie: string
18
+ let alice: DidString
19
+ let bob: DidString
20
+ let carol: DidString
21
+ let frankie: DidString
21
22
 
22
23
  beforeAll(async () => {
23
24
  network = await TestNetwork.create({
@@ -1,6 +1,7 @@
1
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
+ import type { DidString } from '@atproto/syntax'
4
5
  import {
5
6
  forSnapshot,
6
7
  paginateAll,
@@ -14,9 +15,9 @@ describe('list feed views', () => {
14
15
  let sc: SeedClient
15
16
 
16
17
  // account dids, for convenience
17
- let alice: string
18
- let bob: string
19
- let carol: string
18
+ let alice: DidString
19
+ let bob: DidString
20
+ let carol: DidString
20
21
 
21
22
  let listRef: RecordRef
22
23
 
@@ -52,7 +53,9 @@ describe('list feed views', () => {
52
53
 
53
54
  // all posts are from alice or bob
54
55
  expect(
55
- res.data.feed.every((row) => [alice, bob].includes(row.post.author.did)),
56
+ res.data.feed.every((row) =>
57
+ [alice, bob].includes(row.post.author.did as DidString),
58
+ ),
56
59
  ).toBeTruthy()
57
60
  })
58
61
 
@@ -1,6 +1,7 @@
1
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
+ import type { DidString } from '@atproto/syntax'
4
5
  import { forSnapshot } from '../_util.js'
5
6
 
6
7
  describe('bsky views with mutes from mute lists', () => {
@@ -9,10 +10,10 @@ describe('bsky views with mutes from mute lists', () => {
9
10
  let pdsAgent: AtpAgent
10
11
  let sc: SeedClient
11
12
 
12
- let alice: string
13
- let bob: string
14
- let carol: string
15
- let dan: string
13
+ let alice: DidString
14
+ let bob: DidString
15
+ let carol: DidString
16
+ let dan: DidString
16
17
 
17
18
  beforeAll(async () => {
18
19
  network = await TestNetwork.create({
@@ -132,7 +133,9 @@ describe('bsky views with mutes from mute lists', () => {
132
133
  },
133
134
  )
134
135
  expect(
135
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
136
+ res.data.feed.some((post) =>
137
+ [bob, carol].includes(post.post.author.did as DidString),
138
+ ),
136
139
  ).toBe(false)
137
140
  })
138
141
 
@@ -144,7 +147,9 @@ describe('bsky views with mutes from mute lists', () => {
144
147
  },
145
148
  )
146
149
  expect(
147
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
150
+ res.data.feed.some((post) =>
151
+ [bob, carol].includes(post.post.author.did as DidString),
152
+ ),
148
153
  ).toBe(false)
149
154
  })
150
155
 
@@ -163,7 +168,9 @@ describe('bsky views with mutes from mute lists', () => {
163
168
  },
164
169
  )
165
170
  expect(
166
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
171
+ res.data.feed.some((post) =>
172
+ [bob, carol].includes(post.post.author.did as DidString),
173
+ ),
167
174
  ).toBe(false)
168
175
  })
169
176
 
@@ -216,7 +223,7 @@ describe('bsky views with mutes from mute lists', () => {
216
223
  )
217
224
  expect(
218
225
  res.data.notifications.some((notif) =>
219
- [bob, carol].includes(notif.author.did),
226
+ [bob, carol].includes(notif.author.did as DidString),
220
227
  ),
221
228
  ).toBeFalsy()
222
229
  })
@@ -238,7 +245,7 @@ describe('bsky views with mutes from mute lists', () => {
238
245
  },
239
246
  )
240
247
  for (const actor of res.data.actors) {
241
- if ([bob, carol].includes(actor.did)) {
248
+ if ([bob, carol].includes(actor.did as DidString)) {
242
249
  expect(actor.viewer?.muted).toBe(true)
243
250
  expect(actor.viewer?.mutedByList?.uri).toEqual(listUri)
244
251
  } else {
@@ -468,7 +475,9 @@ describe('bsky views with mutes from mute lists', () => {
468
475
  },
469
476
  )
470
477
  expect(
471
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
478
+ res.data.feed.some((post) =>
479
+ [bob, carol].includes(post.post.author.did as DidString),
480
+ ),
472
481
  ).toBeTruthy()
473
482
  })
474
483
 
@@ -490,7 +499,9 @@ describe('bsky views with mutes from mute lists', () => {
490
499
  },
491
500
  )
492
501
  expect(
493
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
502
+ res.data.feed.some((post) =>
503
+ [bob, carol].includes(post.post.author.did as DidString),
504
+ ),
494
505
  ).toBeTruthy()
495
506
  })
496
507
  })
@@ -6,18 +6,23 @@ import {
6
6
  basicSeed,
7
7
  usersBulkSeed,
8
8
  } from '@atproto/dev-env'
9
+ import type {
10
+ AtIdentifierString,
11
+ DidString,
12
+ HandleString,
13
+ } from '@atproto/syntax'
9
14
  import { forSnapshot, paginateAll } from '../_util.js'
10
15
 
11
16
  describe('mute views', () => {
12
17
  let network: TestNetwork
13
18
  let agent: AtpAgent
14
19
  let sc: SeedClient
15
- let alice: string
16
- let bob: string
17
- let carol: string
18
- let dan: string
20
+ let alice: DidString
21
+ let bob: DidString
22
+ let carol: DidString
23
+ let dan: DidString
19
24
 
20
- let mutes: string[]
25
+ let mutes: AtIdentifierString[]
21
26
 
22
27
  beforeAll(async () => {
23
28
  network = await TestNetwork.create({
@@ -87,7 +92,9 @@ describe('mute views', () => {
87
92
  },
88
93
  )
89
94
  expect(
90
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
95
+ res.data.feed.some((post) =>
96
+ [bob, carol].includes(post.post.author.did as DidString),
97
+ ),
91
98
  ).toBe(false)
92
99
  })
93
100
 
@@ -102,7 +109,9 @@ describe('mute views', () => {
102
109
  },
103
110
  )
104
111
  expect(
105
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
112
+ res.data.feed.some((post) =>
113
+ [bob, carol].includes(post.post.author.did as DidString),
114
+ ),
106
115
  ).toBe(false)
107
116
  })
108
117
 
@@ -121,7 +130,9 @@ describe('mute views', () => {
121
130
  },
122
131
  )
123
132
  expect(
124
- res.data.feed.some((post) => [bob, carol].includes(post.post.author.did)),
133
+ res.data.feed.some((post) =>
134
+ [bob, carol].includes(post.post.author.did as DidString),
135
+ ),
125
136
  ).toBe(false)
126
137
  })
127
138
 
@@ -167,7 +178,7 @@ describe('mute views', () => {
167
178
  )
168
179
  expect(
169
180
  res.data.notifications.some((notif) =>
170
- [bob, carol].includes(notif.author.did),
181
+ [bob, carol].includes(notif.author.did as DidString),
171
182
  ),
172
183
  ).toBeFalsy()
173
184
  })
@@ -191,7 +202,10 @@ describe('mute views', () => {
191
202
  },
192
203
  )
193
204
  for (const actor of res.data.actors) {
194
- if (mutes.includes(actor.did) || mutes.includes(actor.handle)) {
205
+ if (
206
+ mutes.includes(actor.did as DidString) ||
207
+ mutes.includes(actor.handle as HandleString)
208
+ ) {
195
209
  expect(actor.viewer?.muted).toBe(true)
196
210
  } else {
197
211
  expect(actor.viewer?.muted).toBe(false)
@@ -23,6 +23,7 @@ import {
23
23
  basicSeed,
24
24
  seedThreadV2,
25
25
  } from '@atproto/dev-env'
26
+ import type { DidString } from '@atproto/syntax'
26
27
  import { delayCursor } from '../../src/api/app/bsky/notification/listNotifications.js'
27
28
  import { Namespaces } from '../../src/stash.js'
28
29
  import { forSnapshot, paginateAll } from '../_util.js'
@@ -38,15 +39,15 @@ describe('notification views', () => {
38
39
  let sc: SeedClient
39
40
 
40
41
  // account dids, for convenience
41
- let alice: string
42
- let bob: string
43
- let carol: string
44
- let dan: string
45
- let eve: string
46
- let fred: string
47
- let greg: string
48
- let han: string
49
- let blocked: string
42
+ let alice: DidString
43
+ let bob: DidString
44
+ let carol: DidString
45
+ let dan: DidString
46
+ let eve: DidString
47
+ let fred: DidString
48
+ let greg: DidString
49
+ let han: DidString
50
+ let blocked: DidString
50
51
 
51
52
  beforeAll(async () => {
52
53
  network = await TestNetwork.create({
@@ -853,7 +854,7 @@ describe('notification views', () => {
853
854
  let delayNetwork: TestNetwork
854
855
  let delayAgent: AtpAgent
855
856
  let delaySc: SeedClient
856
- let delayAlice: string
857
+ let delayAlice: DidString
857
858
 
858
859
  beforeAll(async () => {
859
860
  delayNetwork = await TestNetwork.create({
@@ -1252,7 +1253,7 @@ describe('notification views', () => {
1252
1253
  return profiles.sort((a, b) => (a.handle > b.handle ? 1 : -1))
1253
1254
  }
1254
1255
 
1255
- const declare = async (actor: string, value: string) => {
1256
+ const declare = async (actor: DidString, value: string) => {
1256
1257
  await pdsAgent.com.atproto.repo.createRecord(
1257
1258
  {
1258
1259
  repo: actor,
@@ -1267,8 +1268,8 @@ describe('notification views', () => {
1267
1268
  }
1268
1269
 
1269
1270
  const put = async (
1270
- actor: string,
1271
- subject: string,
1271
+ actor: DidString,
1272
+ subject: DidString,
1272
1273
  val: AppBskyNotificationDefs.ActivitySubscription,
1273
1274
  ) =>
1274
1275
  agent.app.bsky.notification.putActivitySubscription(
@@ -1285,7 +1286,7 @@ describe('notification views', () => {
1285
1286
  )
1286
1287
 
1287
1288
  const list = async (
1288
- actor: string,
1289
+ actor: DidString,
1289
1290
  params?: AppBskyNotificationListActivitySubscriptions.QueryParams,
1290
1291
  ) =>
1291
1292
  agent.app.bsky.notification.listActivitySubscriptions(params ?? {}, {
@@ -1,6 +1,7 @@
1
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
+ import type { DidString } from '@atproto/syntax'
4
5
  import { DatabaseSchema } from '../../src/index.js'
5
6
 
6
7
  const TAG_HIDE = 'hide'
@@ -17,9 +18,9 @@ describe('appview search', () => {
17
18
  let nonTaggedResults: string[]
18
19
 
19
20
  // account dids, for convenience
20
- let alice: string
21
- let bob: string
22
- let carol: string
21
+ let alice: DidString
22
+ let bob: DidString
23
+ let carol: DidString
23
24
 
24
25
  beforeAll(async () => {
25
26
  network = await TestNetwork.create({
@@ -18,6 +18,7 @@ import {
18
18
  } from '@atproto/api'
19
19
  import { HOUR, MINUTE } from '@atproto/common'
20
20
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
21
+ import type { DidString } from '@atproto/syntax'
21
22
  import { forSnapshot, stripViewer } from '../_util.js'
22
23
 
23
24
  describe('pds profile views', () => {
@@ -25,15 +26,15 @@ describe('pds profile views', () => {
25
26
  let agent: AtpAgent
26
27
  let pdsAgent: AtpAgent
27
28
  let sc: SeedClient
28
- let labelerDid: string
29
+ let labelerDid: DidString
29
30
 
30
31
  // account dids, for convenience
31
- let alice: string
32
- let bob: string
33
- let dan: string
34
- let eve: string
35
- let frank: string
36
- let noprofile: string
32
+ let alice: DidString
33
+ let bob: DidString
34
+ let dan: DidString
35
+ let eve: DidString
36
+ let frank: DidString
37
+ let noprofile: DidString
37
38
 
38
39
  beforeAll(async () => {
39
40
  network = await TestNetwork.create({
@@ -756,7 +757,10 @@ describe('pds profile views', () => {
756
757
  expect(data.createdAt).toBeUndefined()
757
758
  })
758
759
 
759
- async function updateProfile(did: string, record: Record<string, unknown>) {
760
+ async function updateProfile(
761
+ did: DidString,
762
+ record: Record<string, unknown>,
763
+ ) {
760
764
  return await pdsAgent.api.com.atproto.repo.putRecord(
761
765
  {
762
766
  repo: did,
@@ -1,6 +1,7 @@
1
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
+ import type { DidString } from '@atproto/syntax'
4
5
  import { forSnapshot } from '../_util.js'
5
6
 
6
7
  describe('pds quote views', () => {
@@ -9,10 +10,10 @@ describe('pds quote views', () => {
9
10
  let sc: SeedClient
10
11
 
11
12
  // account dids, for convenience
12
- let alice: string
13
- let bob: string
14
- let carol: string
15
- let eve: string
13
+ let alice: DidString
14
+ let bob: DidString
15
+ let carol: DidString
16
+ let eve: DidString
16
17
 
17
18
  beforeAll(async () => {
18
19
  network = await TestNetwork.create({
@@ -8,6 +8,7 @@ import {
8
8
  ids,
9
9
  } from '@atproto/api'
10
10
  import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
11
+ import type { DidString } from '@atproto/syntax'
11
12
  import {
12
13
  assertIsThreadViewPost,
13
14
  forSnapshot,
@@ -21,9 +22,9 @@ describe('appview thread views', () => {
21
22
  let sc: SeedClient
22
23
 
23
24
  // account dids, for convenience
24
- let alice: string
25
- let bob: string
26
- let carol: string
25
+ let alice: DidString
26
+ let bob: DidString
27
+ let carol: DidString
27
28
 
28
29
  beforeAll(async () => {
29
30
  network = await TestNetwork.create({