@atproto/bsky 0.0.238 → 0.0.239

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 (59) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/api/app/bsky/actor/searchActors.d.ts.map +1 -1
  3. package/dist/api/app/bsky/actor/searchActors.js +26 -1
  4. package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
  5. package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts.map +1 -1
  6. package/dist/api/app/bsky/actor/searchActorsTypeahead.js +26 -2
  7. package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
  8. package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
  9. package/dist/api/app/bsky/feed/getFeed.js +1 -0
  10. package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
  11. package/dist/api/app/bsky/feed/searchPosts.d.ts.map +1 -1
  12. package/dist/api/app/bsky/feed/searchPosts.js +56 -1
  13. package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
  14. package/dist/api/app/bsky/graph/searchStarterPacks.d.ts.map +1 -1
  15. package/dist/api/app/bsky/graph/searchStarterPacks.js +26 -1
  16. package/dist/api/app/bsky/graph/searchStarterPacks.js.map +1 -1
  17. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts.map +1 -1
  18. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js +27 -6
  19. package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js.map +1 -1
  20. package/dist/data-plane/server/routes/feed-gens.d.ts.map +1 -1
  21. package/dist/data-plane/server/routes/feed-gens.js +21 -12
  22. package/dist/data-plane/server/routes/feed-gens.js.map +1 -1
  23. package/dist/data-plane/server/routes/search.d.ts.map +1 -1
  24. package/dist/data-plane/server/routes/search.js +62 -12
  25. package/dist/data-plane/server/routes/search.js.map +1 -1
  26. package/dist/feature-gates/gates.d.ts +1 -0
  27. package/dist/feature-gates/gates.d.ts.map +1 -1
  28. package/dist/feature-gates/gates.js +1 -0
  29. package/dist/feature-gates/gates.js.map +1 -1
  30. package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts +4 -4
  31. package/dist/lexicons/chat/bsky/group/createGroup.defs.js +2 -2
  32. package/dist/lexicons/chat/bsky/group/createGroup.defs.js.map +1 -1
  33. package/dist/lexicons/chat/bsky/group/defs.defs.d.ts +8 -1
  34. package/dist/lexicons/chat/bsky/group/defs.defs.d.ts.map +1 -1
  35. package/dist/lexicons/chat/bsky/group/defs.defs.js +5 -1
  36. package/dist/lexicons/chat/bsky/group/defs.defs.js.map +1 -1
  37. package/dist/proto/bsky_connect.d.ts +49 -2
  38. package/dist/proto/bsky_connect.d.ts.map +1 -1
  39. package/dist/proto/bsky_connect.js +49 -2
  40. package/dist/proto/bsky_connect.js.map +1 -1
  41. package/dist/proto/bsky_pb.d.ts +482 -0
  42. package/dist/proto/bsky_pb.d.ts.map +1 -1
  43. package/dist/proto/bsky_pb.js +608 -0
  44. package/dist/proto/bsky_pb.js.map +1 -1
  45. package/package.json +6 -6
  46. package/proto/bsky.proto +166 -2
  47. package/src/api/app/bsky/actor/searchActors.ts +35 -1
  48. package/src/api/app/bsky/actor/searchActorsTypeahead.ts +35 -2
  49. package/src/api/app/bsky/feed/getFeed.ts +1 -0
  50. package/src/api/app/bsky/feed/searchPosts.ts +60 -1
  51. package/src/api/app/bsky/graph/searchStarterPacks.ts +35 -1
  52. package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +28 -6
  53. package/src/data-plane/server/routes/feed-gens.ts +33 -14
  54. package/src/data-plane/server/routes/search.ts +81 -13
  55. package/src/feature-gates/gates.ts +1 -0
  56. package/tests/data-plane/handle-invalidation.test.ts +2 -1
  57. package/tsconfig.build.json +2 -2
  58. package/tsconfig.json +2 -2
  59. package/tsconfig.tests.json +2 -2
@@ -8,9 +8,12 @@ import {
8
8
  } from '../db/pagination.js'
9
9
  import { parsePostSearchQuery } from '../util.js'
10
10
 
11
- export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
12
- // @TODO actor search endpoints still fall back to search service
13
- async searchActors(req) {
11
+ export default (db: Database): Partial<ServiceImpl<typeof Service>> => {
12
+ const searchActorsImpl = async (req: {
13
+ term: string
14
+ limit: number
15
+ cursor?: string
16
+ }) => {
14
17
  const { term, limit, cursor } = req
15
18
  const { ref } = db.db.dynamic
16
19
  let builder = db.db
@@ -35,10 +38,13 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
35
38
  dids: res.map((row) => row.did),
36
39
  cursor: keyset.packFromResult(res),
37
40
  }
38
- },
41
+ }
39
42
 
40
- // @TODO post search endpoint still falls back to search service
41
- async searchPosts(req) {
43
+ const searchPostsImpl = async (req: {
44
+ term: string
45
+ limit: number
46
+ cursor?: string
47
+ }) => {
42
48
  const { term, limit, cursor } = req
43
49
  const { q, author } = parsePostSearchQuery(term)
44
50
 
@@ -75,9 +81,13 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
75
81
  uris: res.map((row) => row.uri),
76
82
  cursor: keyset.packFromResult(res),
77
83
  }
78
- },
84
+ }
79
85
 
80
- async searchStarterPacks(req) {
86
+ const searchStarterPacksImpl = async (req: {
87
+ term: string
88
+ limit: number
89
+ cursor?: string
90
+ }) => {
81
91
  const { term, limit, cursor } = req
82
92
  const { ref } = db.db.dynamic
83
93
  let builder = db.db
@@ -99,14 +109,72 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
99
109
 
100
110
  const res = await builder.execute()
101
111
 
102
- const cur = keyset.packFromResult(res)
103
-
104
112
  return {
105
113
  uris: res.map((row) => row.uri),
106
- cursor: cur,
114
+ cursor: keyset.packFromResult(res),
107
115
  }
108
- },
109
- })
116
+ }
117
+
118
+ return {
119
+ // @TODO actor search endpoints still fall back to search service
120
+ searchActors: searchActorsImpl,
121
+
122
+ // @TODO post search endpoint still falls back to search service
123
+ searchPosts: searchPostsImpl,
124
+
125
+ searchStarterPacks: searchStarterPacksImpl,
126
+
127
+ // V2 endpoints reuse the V1 SQL for dev env and reshape the response.
128
+ async searchActorsV2(req) {
129
+ const { dids, cursor } = await searchActorsImpl({
130
+ term: req.params?.query ?? '',
131
+ limit: req.params?.limit ?? 25,
132
+ cursor: req.params?.cursor,
133
+ })
134
+ return {
135
+ actors: dids.map((did) => ({ did, score: 0 })),
136
+ pageInfo: { cursor: cursor ?? '', hitsTotal: 0n },
137
+ }
138
+ },
139
+
140
+ async searchActorsTypeahead(req) {
141
+ const { dids } = await searchActorsImpl({
142
+ term: req.query,
143
+ limit: req.limit || 10,
144
+ })
145
+ return {
146
+ actors: dids.map((did) => ({ did, score: 0 })),
147
+ }
148
+ },
149
+
150
+ async searchPostsV2(req) {
151
+ const author = req.filters?.authors?.[0]
152
+ const baseQuery = req.params?.query ?? ''
153
+ const term = author ? `${baseQuery} from:${author}` : baseQuery
154
+ const { uris, cursor } = await searchPostsImpl({
155
+ term,
156
+ limit: req.params?.limit ?? 25,
157
+ cursor: req.params?.cursor,
158
+ })
159
+ return {
160
+ posts: uris.map((uri) => ({ uri, score: 0 })),
161
+ pageInfo: { cursor: cursor ?? '', hitsTotal: 0n },
162
+ }
163
+ },
164
+
165
+ async searchStarterPacksV2(req) {
166
+ const { uris, cursor } = await searchStarterPacksImpl({
167
+ term: req.params?.query ?? '',
168
+ limit: req.params?.limit ?? 25,
169
+ cursor: req.params?.cursor,
170
+ })
171
+ return {
172
+ starterPacks: uris.map((uri) => ({ uri, score: 0 })),
173
+ pageInfo: { cursor: cursor ?? '', hitsTotal: 0n },
174
+ }
175
+ },
176
+ }
177
+ }
110
178
 
111
179
  // Remove leading @ in case a handle is input that way
112
180
  const cleanQuery = (query: string) => query.trim().replace(/^@/g, '')
@@ -11,6 +11,7 @@ export enum Gate {
11
11
  SuggestedUsersForExploreEnable = 'suggested_users:for_explore:enable',
12
12
  SuggestedUsersForDiscoverEnable = 'suggested_users:for_discover:enable',
13
13
  SuggestedUsersForSeeMoreEnable = 'suggested_users:for_see_more:enable',
14
+ SearchV2Enable = 'search:v2:enable',
14
15
 
15
16
  // temp
16
17
  AATest = 'aa-test-appview',
@@ -116,7 +116,8 @@ describe('handle invalidation', () => {
116
116
 
117
117
  it('deals with handle contention', async () => {
118
118
  await backdateIndexedAt(bob)
119
- // update alices handle so that the pds will let bob take her old handle
119
+ // make alice lose her handle so that the pds will let bob take her old handle
120
+ mockHandles['not-alice.test'] = null
120
121
  await network.pds.ctx.accountManager.updateHandle(alice, 'not-alice.test')
121
122
 
122
123
  await pdsAgent.api.com.atproto.identity.updateHandle(
@@ -3,8 +3,8 @@
3
3
  "compilerOptions": {
4
4
  "rootDir": "./src",
5
5
  "outDir": "./dist",
6
- "noUnusedLocals": false
6
+ "noUnusedLocals": false,
7
7
  },
8
8
  "include": ["./src"],
9
- "exclude": ["./src/**/*.test.ts"]
9
+ "exclude": ["./src/**/*.test.ts"],
10
10
  }
package/tsconfig.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "include": [],
3
3
  "references": [
4
4
  { "path": "./tsconfig.build.json" },
5
- { "path": "./tsconfig.tests.json" }
6
- ]
5
+ { "path": "./tsconfig.tests.json" },
6
+ ],
7
7
  }
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig/vitest.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": ".",
5
- "noUnusedLocals": false
5
+ "noUnusedLocals": false,
6
6
  },
7
- "include": ["./tests", "./src/**/*.test.ts"]
7
+ "include": ["./tests", "./src/**/*.test.ts"],
8
8
  }