@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.
- package/CHANGELOG.md +11 -0
- package/dist/api/app/bsky/actor/searchActors.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActors.js +26 -1
- package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js +26 -2
- package/dist/api/app/bsky/actor/searchActorsTypeahead.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +1 -0
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.js +56 -1
- package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.d.ts.map +1 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.js +26 -1
- package/dist/api/app/bsky/graph/searchStarterPacks.js.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.d.ts.map +1 -1
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js +27 -6
- package/dist/api/app/bsky/unspecced/getPopularFeedGenerators.js.map +1 -1
- package/dist/data-plane/server/routes/feed-gens.d.ts.map +1 -1
- package/dist/data-plane/server/routes/feed-gens.js +21 -12
- package/dist/data-plane/server/routes/feed-gens.js.map +1 -1
- package/dist/data-plane/server/routes/search.d.ts.map +1 -1
- package/dist/data-plane/server/routes/search.js +62 -12
- package/dist/data-plane/server/routes/search.js.map +1 -1
- package/dist/feature-gates/gates.d.ts +1 -0
- package/dist/feature-gates/gates.d.ts.map +1 -1
- package/dist/feature-gates/gates.js +1 -0
- package/dist/feature-gates/gates.js.map +1 -1
- package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts +4 -4
- package/dist/lexicons/chat/bsky/group/createGroup.defs.js +2 -2
- package/dist/lexicons/chat/bsky/group/createGroup.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/group/defs.defs.d.ts +8 -1
- package/dist/lexicons/chat/bsky/group/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/group/defs.defs.js +5 -1
- package/dist/lexicons/chat/bsky/group/defs.defs.js.map +1 -1
- package/dist/proto/bsky_connect.d.ts +49 -2
- package/dist/proto/bsky_connect.d.ts.map +1 -1
- package/dist/proto/bsky_connect.js +49 -2
- package/dist/proto/bsky_connect.js.map +1 -1
- package/dist/proto/bsky_pb.d.ts +482 -0
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +608 -0
- package/dist/proto/bsky_pb.js.map +1 -1
- package/package.json +6 -6
- package/proto/bsky.proto +166 -2
- package/src/api/app/bsky/actor/searchActors.ts +35 -1
- package/src/api/app/bsky/actor/searchActorsTypeahead.ts +35 -2
- package/src/api/app/bsky/feed/getFeed.ts +1 -0
- package/src/api/app/bsky/feed/searchPosts.ts +60 -1
- package/src/api/app/bsky/graph/searchStarterPacks.ts +35 -1
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +28 -6
- package/src/data-plane/server/routes/feed-gens.ts +33 -14
- package/src/data-plane/server/routes/search.ts +81 -13
- package/src/feature-gates/gates.ts +1 -0
- package/tests/data-plane/handle-invalidation.test.ts +2 -1
- package/tsconfig.build.json +2 -2
- package/tsconfig.json +2 -2
- 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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
|
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:
|
|
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
|
-
//
|
|
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(
|
package/tsconfig.build.json
CHANGED
package/tsconfig.json
CHANGED
package/tsconfig.tests.json
CHANGED