alpha
Login
or
Join now
nandi.uk
/
semble
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
rename xrpc mention to page parts
author
Wesley Finck
date
3 months ago
(Apr 17, 2026, 7:11 PM -0700)
commit
fa697c7a
fa697c7a5c78c5c05a2fcaebb166dd81606212e1
parent
24f5dd69
24f5dd69a36099e3c680aa2f3cd6faedd417f38c
+38
-47
5 changed files
Expand all
Collapse all
Unified
Split
src
modules
search
application
useCases
queries
PagePartsSearchUseCase.ts
infrastructure
http
controllers
PagePartsSearchController.ts
shared
infrastructure
http
app.ts
factories
ControllerFactory.ts
UseCaseFactory.ts
+25
-34
src/modules/search/application/useCases/queries/PagePartsSearchUseCase.ts
View file
Reviewed
···
19
19
import { CollectionId } from 'src/modules/cards/domain/value-objects/CollectionId';
20
20
21
21
// XRPC parts.page.mention.search types based on lexicon
22
22
-
export interface XrpcMentionLabel {
22
22
+
export interface PagePartsLabel {
23
23
text: string;
24
24
}
25
25
26
26
-
export interface XrpcEmbedInfo {
26
26
+
export interface PagePartsEmbedInfo {
27
27
src: string;
28
28
width?: number;
29
29
height?: number;
···
33
33
};
34
34
}
35
35
36
36
-
export interface XrpcSubscopeInfo {
36
36
+
export interface PagePartsSubscopeInfo {
37
37
scope: string;
38
38
label: string;
39
39
}
40
40
41
41
-
export interface XrpcMentionSearchResult {
41
41
+
export interface PagePartsSearchResult {
42
42
uri: string;
43
43
name: string;
44
44
description?: string;
45
45
-
labels?: XrpcMentionLabel[];
45
45
+
labels?: PagePartsLabel[];
46
46
href?: string;
47
47
icon?: string;
48
48
-
embed?: XrpcEmbedInfo;
49
49
-
subscope?: XrpcSubscopeInfo;
48
48
+
embed?: PagePartsEmbedInfo;
49
49
+
subscope?: PagePartsSubscopeInfo;
50
50
}
51
51
52
52
-
export interface XrpcMentionSearchResponse {
53
53
-
results: XrpcMentionSearchResult[];
52
52
+
export interface PagePartsSearchResponse {
53
53
+
results: PagePartsSearchResult[];
54
54
}
55
55
56
56
-
export interface XrpcMentionSearchQuery {
56
56
+
export interface PagePartsSearchQuery {
57
57
service: string;
58
58
search: string;
59
59
scope?: string;
···
71
71
/**
72
72
* Encapsulates the logic for determining search parameters based on service type and scope
73
73
*/
74
74
-
class MentionSearchContext {
74
74
+
class PagePartsSearchContext {
75
75
private parsedScope?: DIDOrATUri;
76
76
private scopeIdentifier?: string;
77
77
···
196
196
}
197
197
}
198
198
199
199
-
export class XrpcMentionSearchUseCase
199
199
+
export class PagePartsSearchUseCase
200
200
implements
201
201
UseCase<
202
202
-
XrpcMentionSearchQuery,
202
202
+
PagePartsSearchQuery,
203
203
Result<
204
204
-
XrpcMentionSearchResponse,
204
204
+
PagePartsSearchResponse,
205
205
ValidationError | AppError.UnexpectedError
206
206
>
207
207
>
···
213
213
) {}
214
214
215
215
async execute(
216
216
-
query: XrpcMentionSearchQuery,
216
216
+
query: PagePartsSearchQuery,
217
217
): Promise<
218
218
-
Result<
219
219
-
XrpcMentionSearchResponse,
220
220
-
ValidationError | AppError.UnexpectedError
221
221
-
>
218
218
+
Result<PagePartsSearchResponse, ValidationError | AppError.UnexpectedError>
222
219
> {
223
220
try {
224
221
// Create and initialize search context
225
225
-
const context = new MentionSearchContext(
222
222
+
const context = new PagePartsSearchContext(
226
223
query.service,
227
224
query.scope,
228
225
query.search,
···
255
252
}
256
253
257
254
private async handleCollectionSearch(
258
258
-
query: XrpcMentionSearchQuery,
259
259
-
context: MentionSearchContext,
255
255
+
query: PagePartsSearchQuery,
256
256
+
context: PagePartsSearchContext,
260
257
): Promise<
261
261
-
Result<
262
262
-
XrpcMentionSearchResponse,
263
263
-
ValidationError | AppError.UnexpectedError
264
264
-
>
258
258
+
Result<PagePartsSearchResponse, ValidationError | AppError.UnexpectedError>
265
259
> {
266
260
const result = await this.searchCollectionsUseCase.execute({
267
261
searchText: query.search || '',
···
277
271
return err(AppError.UnexpectedError.create(result.error));
278
272
}
279
273
280
280
-
const mappedResults: XrpcMentionSearchResult[] = [];
274
274
+
const mappedResults: PagePartsSearchResult[] = [];
281
275
282
276
for (const collection of result.value.collections) {
283
277
if (!collection.uri) {
···
322
316
}
323
317
324
318
private async handleCardSearch(
325
325
-
query: XrpcMentionSearchQuery,
326
326
-
context: MentionSearchContext,
319
319
+
query: PagePartsSearchQuery,
320
320
+
context: PagePartsSearchContext,
327
321
): Promise<
328
328
-
Result<
329
329
-
XrpcMentionSearchResponse,
330
330
-
ValidationError | AppError.UnexpectedError
331
331
-
>
322
322
+
Result<PagePartsSearchResponse, ValidationError | AppError.UnexpectedError>
332
323
> {
333
324
const filtersResult = await context.getCardSearchFilters(
334
325
this.atUriResolutionService,
···
354
345
return err(AppError.UnexpectedError.create(result.error));
355
346
}
356
347
357
357
-
const mappedResults: XrpcMentionSearchResult[] = result.value.urls.map(
348
348
+
const mappedResults: PagePartsSearchResult[] = result.value.urls.map(
358
349
(urlView) => ({
359
350
uri: urlView.url,
360
351
name: urlView.metadata.title || urlView.url,
+4
-4
src/modules/search/infrastructure/http/controllers/PagePartsSearchController.ts
View file
Reviewed
···
1
1
import { Controller } from '../../../../../shared/infrastructure/http/Controller';
2
2
import { Response } from 'express';
3
3
-
import { XrpcMentionSearchUseCase } from '../../../application/useCases/queries/PagePartsSearchUseCase';
3
3
+
import { PagePartsSearchUseCase } from '../../../application/useCases/queries/PagePartsSearchUseCase';
4
4
import { AuthenticatedRequest } from '../../../../../shared/infrastructure/http/middleware/AuthMiddleware';
5
5
import { parseReqNsid, verifyJwt } from '@atproto/xrpc-server';
6
6
import { IIdentityResolutionService } from '../../../../../modules/atproto/domain/services/IIdentityResolutionService';
7
7
8
8
-
export class XrpcMentionSearchController extends Controller {
8
8
+
export class PagePartsSearchController extends Controller {
9
9
constructor(
10
10
-
private xrpcMentionSearchUseCase: XrpcMentionSearchUseCase,
10
10
+
private pagePartsSearchUseCase: PagePartsSearchUseCase,
11
11
private appUrl: string,
12
12
private serviceDid: string,
13
13
private identityResolutionService: IIdentityResolutionService,
···
64
64
// Validate JWT and extract DID (optional)
65
65
const callingUserId = await this.validateAuth(req);
66
66
67
67
-
const result = await this.xrpcMentionSearchUseCase.execute({
67
67
+
const result = await this.pagePartsSearchUseCase.execute({
68
68
service: serviceUri,
69
69
search: search || '',
70
70
scope,
+1
-1
src/shared/infrastructure/http/app.ts
View file
Reviewed
···
216
216
// XRPC mention search endpoint
217
217
app.get('/xrpc/parts.page.mention.search', (req, res) => {
218
218
console.log('Received XRPC mention search request with query:', req.query);
219
219
-
return controllers.xrpcMentionSearchController.execute(req, res);
219
219
+
return controllers.pagePartsSearchController.execute(req, res);
220
220
});
221
221
222
222
// Register routes
+4
-4
src/shared/infrastructure/http/factories/ControllerFactory.ts
View file
Reviewed
···
26
26
import { SearchBskyPostsForUrlController } from '../../../../modules/search/infrastructure/http/controllers/SearchBskyPostsForUrlController';
27
27
import { SearchAtProtoAccountsController } from '../../../../modules/search/infrastructure/http/controllers/SearchAtProtoAccountsController';
28
28
import { SearchLeafletDocsForUrlController } from '../../../../modules/search/infrastructure/http/controllers/SearchLeafletDocsForUrlController';
29
29
-
import { XrpcMentionSearchController } from '../../../../modules/search/infrastructure/http/controllers/PagePartsSearchController';
29
29
+
import { PagePartsSearchController } from '../../../../modules/search/infrastructure/http/controllers/PagePartsSearchController';
30
30
import { UseCases } from './UseCaseFactory';
31
31
import { GetMyProfileController } from 'src/modules/cards/infrastructure/http/controllers/GetMyProfileController';
32
32
import { GetUserProfileController } from 'src/modules/cards/infrastructure/http/controllers/GetUserProfileController';
···
140
140
searchBskyPostsForUrlController: SearchBskyPostsForUrlController;
141
141
searchAtProtoAccountsController: SearchAtProtoAccountsController;
142
142
searchLeafletDocsForUrlController: SearchLeafletDocsForUrlController;
143
143
-
xrpcMentionSearchController: XrpcMentionSearchController;
143
143
+
pagePartsSearchController: PagePartsSearchController;
144
144
// Notification controllers
145
145
getMyNotificationsController: GetMyNotificationsController;
146
146
getUnreadNotificationCountController: GetUnreadNotificationCountController;
···
368
368
searchLeafletDocsForUrlController: new SearchLeafletDocsForUrlController(
369
369
useCases.searchLeafletDocsForUrlUseCase,
370
370
),
371
371
-
xrpcMentionSearchController: new XrpcMentionSearchController(
372
372
-
useCases.xrpcMentionSearchUseCase,
371
371
+
pagePartsSearchController: new PagePartsSearchController(
372
372
+
useCases.pagePartsSearchUseCase,
373
373
appUrl,
374
374
serviceDid,
375
375
services.identityResolutionService,
+4
-4
src/shared/infrastructure/http/factories/UseCaseFactory.ts
View file
Reviewed
···
42
42
import { SearchBskyPostsForUrlUseCase } from '../../../../modules/search/application/use-cases/SearchBskyPostsForUrlUseCase';
43
43
import { SearchAtProtoAccountsUseCase } from '../../../../modules/search/application/use-cases/SearchAtProtoAccountsUseCase';
44
44
import { SearchLeafletDocsForUrlUseCase } from '../../../../modules/search/application/use-cases/SearchLeafletDocsForUrlUseCase';
45
45
-
import { XrpcMentionSearchUseCase } from '../../../../modules/search/application/useCases/queries/PagePartsSearchUseCase';
45
45
+
import { PagePartsSearchUseCase } from '../../../../modules/search/application/useCases/queries/PagePartsSearchUseCase';
46
46
import { ProcessCardFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCardFirehoseEventUseCase';
47
47
import { ProcessCollectionFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCollectionFirehoseEventUseCase';
48
48
import { ProcessCollectionLinkFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCollectionLinkFirehoseEventUseCase';
···
169
169
searchBskyPostsForUrlUseCase: SearchBskyPostsForUrlUseCase;
170
170
searchAtProtoAccountsUseCase: SearchAtProtoAccountsUseCase;
171
171
searchLeafletDocsForUrlUseCase: SearchLeafletDocsForUrlUseCase;
172
172
-
xrpcMentionSearchUseCase: XrpcMentionSearchUseCase;
172
172
+
pagePartsSearchUseCase: PagePartsSearchUseCase;
173
173
// Notification use cases
174
174
getMyNotificationsUseCase: GetMyNotificationsUseCase;
175
175
getUnreadNotificationCountUseCase: GetUnreadNotificationCountUseCase;
···
204
204
repositories.followsRepository,
205
205
);
206
206
207
207
-
const xrpcMentionSearchUseCase = new XrpcMentionSearchUseCase(
207
207
+
const pagePartsSearchUseCase = new PagePartsSearchUseCase(
208
208
searchUrlsUseCase,
209
209
searchCollectionsUseCase,
210
210
repositories.atUriResolutionService,
···
510
510
services.leafletSearchService,
511
511
repositories.cardQueryRepository,
512
512
),
513
513
-
xrpcMentionSearchUseCase,
513
513
+
pagePartsSearchUseCase,
514
514
// Notification use cases
515
515
getMyNotificationsUseCase: new GetMyNotificationsUseCase(
516
516
repositories.notificationRepository,