This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / shared / infrastructure / http / factories / UseCaseFactory.ts
25 kB 524 lines
1import { InitiateOAuthSignInUseCase } from '../../../../modules/user/application/use-cases/InitiateOAuthSignInUseCase'; 2import { CompleteOAuthSignInUseCase } from '../../../../modules/user/application/use-cases/CompleteOAuthSignInUseCase'; 3import { RefreshAccessTokenUseCase } from '../../../../modules/user/application/use-cases/RefreshAccessTokenUseCase'; 4import { AddUrlToLibraryUseCase } from '../../../../modules/cards/application/useCases/commands/AddUrlToLibraryUseCase'; 5import { AddCardToLibraryUseCase } from '../../../../modules/cards/application/useCases/commands/AddCardToLibraryUseCase'; 6import { AddCardToCollectionUseCase } from '../../../../modules/cards/application/useCases/commands/AddCardToCollectionUseCase'; 7import { UpdateNoteCardUseCase } from '../../../../modules/cards/application/useCases/commands/UpdateNoteCardUseCase'; 8import { UpdateUrlCardAssociationsUseCase } from '../../../../modules/cards/application/useCases/commands/UpdateUrlCardAssociationsUseCase'; 9import { RemoveCardFromLibraryUseCase } from '../../../../modules/cards/application/useCases/commands/RemoveCardFromLibraryUseCase'; 10import { RemoveCardFromCollectionUseCase } from '../../../../modules/cards/application/useCases/commands/RemoveCardFromCollectionUseCase'; 11import { GetUrlMetadataUseCase } from '../../../../modules/cards/application/useCases/queries/GetUrlMetadataUseCase'; 12import { GetUrlCardViewUseCase } from '../../../../modules/cards/application/useCases/queries/GetUrlCardViewUseCase'; 13import { GetLibrariesForCardUseCase } from '../../../../modules/cards/application/useCases/queries/GetLibrariesForCardUseCase'; 14import { GetUrlCardsUseCase } from '../../../../modules/cards/application/useCases/queries/GetUrlCardsUseCase'; 15import { CreateCollectionUseCase } from '../../../../modules/cards/application/useCases/commands/CreateCollectionUseCase'; 16import { UpdateCollectionUseCase } from '../../../../modules/cards/application/useCases/commands/UpdateCollectionUseCase'; 17import { DeleteCollectionUseCase } from '../../../../modules/cards/application/useCases/commands/DeleteCollectionUseCase'; 18import { GetCollectionPageUseCase } from '../../../../modules/cards/application/useCases/queries/GetCollectionPageUseCase'; 19import { Repositories } from './RepositoryFactory'; 20import { Services, SharedServices } from './ServiceFactory'; 21import { GetProfileUseCase } from 'src/modules/cards/application/useCases/queries/GetProfileUseCase'; 22import { LoginWithAppPasswordUseCase } from 'src/modules/user/application/use-cases/LoginWithAppPasswordUseCase'; 23import { LogoutUseCase } from 'src/modules/user/application/use-cases/LogoutUseCase'; 24import { GenerateExtensionTokensUseCase } from 'src/modules/user/application/use-cases/GenerateExtensionTokensUseCase'; 25import { GetGlobalFeedUseCase } from '../../../../modules/feeds/application/useCases/queries/GetGlobalFeedUseCase'; 26import { GetGemActivityFeedUseCase } from '../../../../modules/feeds/application/useCases/queries/GetGemActivityFeedUseCase'; 27import { GetFollowingFeedUseCase } from '../../../../modules/feeds/application/useCases/queries/GetFollowingFeedUseCase'; 28import { AddActivityToFeedUseCase } from '../../../../modules/feeds/application/useCases/commands/AddActivityToFeedUseCase'; 29import { GetCollectionsUseCase } from 'src/modules/cards/application/useCases/queries/GetCollectionsUseCase'; 30import { SearchCollectionsUseCase } from 'src/modules/cards/application/useCases/queries/SearchCollectionsUseCase'; 31import { GetOpenCollectionsWithContributorUseCase } from 'src/modules/cards/application/useCases/queries/GetOpenCollectionsWithContributorUseCase'; 32import { GetCollectionPageByAtUriUseCase } from 'src/modules/cards/application/useCases/queries/GetCollectionPageByAtUriUseCase'; 33import { GetUrlStatusForMyLibraryUseCase } from '../../../../modules/cards/application/useCases/queries/GetUrlStatusForMyLibraryUseCase'; 34import { GetLibrariesForUrlUseCase } from '../../../../modules/cards/application/useCases/queries/GetLibrariesForUrlUseCase'; 35import { GetCollectionsForUrlUseCase } from '../../../../modules/cards/application/useCases/queries/GetCollectionsForUrlUseCase'; 36import { GetNoteCardsForUrlUseCase } from '../../../../modules/cards/application/useCases/queries/GetNoteCardsForUrlUseCase'; 37import { IndexUrlForSearchUseCase } from '../../../../modules/search/application/useCases/commands/IndexUrlForSearchUseCase'; 38import { GetSimilarUrlsForUrlUseCase } from '../../../../modules/search/application/useCases/queries/GetSimilarUrlsForUrlUseCase'; 39import { SemanticSearchUrlsUseCase } from '../../../../modules/search/application/useCases/queries/SemanticSearchUrlsUseCase'; 40import { SearchBskyPostsForUrlUseCase } from '../../../../modules/search/application/use-cases/SearchBskyPostsForUrlUseCase'; 41import { SearchAtProtoAccountsUseCase } from '../../../../modules/search/application/use-cases/SearchAtProtoAccountsUseCase'; 42import { SearchLeafletDocsForUrlUseCase } from '../../../../modules/search/application/use-cases/SearchLeafletDocsForUrlUseCase'; 43import { ProcessCardFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCardFirehoseEventUseCase'; 44import { ProcessCollectionFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCollectionFirehoseEventUseCase'; 45import { ProcessCollectionLinkFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCollectionLinkFirehoseEventUseCase'; 46import { ProcessMarginBookmarkFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessMarginBookmarkFirehoseEventUseCase'; 47import { ProcessMarginCollectionFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessMarginCollectionFirehoseEventUseCase'; 48import { ProcessMarginCollectionItemFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessMarginCollectionItemFirehoseEventUseCase'; 49import { ProcessCollectionLinkRemovalFirehoseEventUseCase } from '../../../../modules/atproto/application/useCases/ProcessCollectionLinkRemovalFirehoseEventUseCase'; 50import { GetMyNotificationsUseCase } from '../../../../modules/notifications/application/useCases/queries/GetMyNotificationsUseCase'; 51import { GetUnreadNotificationCountUseCase } from '../../../../modules/notifications/application/useCases/queries/GetUnreadNotificationCountUseCase'; 52import { MarkNotificationsAsReadUseCase } from '../../../../modules/notifications/application/useCases/commands/MarkNotificationsAsReadUseCase'; 53import { MarkAllNotificationsAsReadUseCase } from '../../../../modules/notifications/application/useCases/commands/MarkAllNotificationsAsReadUseCase'; 54import { CreateNotificationUseCase } from '../../../../modules/notifications/application/useCases/commands/CreateNotificationUseCase'; 55import { SyncAccountDataUseCase } from '../../../../modules/sync/application/useCases/SyncAccountDataUseCase'; 56import { FollowTargetUseCase } from '../../../../modules/user/application/useCases/commands/FollowTargetUseCase'; 57import { UnfollowTargetUseCase } from '../../../../modules/user/application/useCases/commands/UnfollowTargetUseCase'; 58 59export interface WorkerUseCases { 60 addActivityToFeedUseCase: AddActivityToFeedUseCase; 61 indexUrlForSearchUseCase: IndexUrlForSearchUseCase; 62 createNotificationUseCase: CreateNotificationUseCase; 63 syncAccountDataUseCase: SyncAccountDataUseCase; 64 // Firehose-specific use cases 65 addUrlToLibraryUseCase: AddUrlToLibraryUseCase; 66 updateUrlCardAssociationsUseCase: UpdateUrlCardAssociationsUseCase; 67 removeCardFromLibraryUseCase: RemoveCardFromLibraryUseCase; 68 createCollectionUseCase: CreateCollectionUseCase; 69 updateCollectionUseCase: UpdateCollectionUseCase; 70 deleteCollectionUseCase: DeleteCollectionUseCase; 71 processCardFirehoseEventUseCase: ProcessCardFirehoseEventUseCase; 72 processCollectionFirehoseEventUseCase: ProcessCollectionFirehoseEventUseCase; 73 processCollectionLinkFirehoseEventUseCase: ProcessCollectionLinkFirehoseEventUseCase; 74 processMarginBookmarkFirehoseEventUseCase: ProcessMarginBookmarkFirehoseEventUseCase; 75 processMarginCollectionFirehoseEventUseCase: ProcessMarginCollectionFirehoseEventUseCase; 76 processMarginCollectionItemFirehoseEventUseCase: ProcessMarginCollectionItemFirehoseEventUseCase; 77 processCollectionLinkRemovalFirehoseEventUseCase: ProcessCollectionLinkRemovalFirehoseEventUseCase; 78} 79 80export interface UseCases { 81 // User use cases 82 loginWithAppPasswordUseCase: LoginWithAppPasswordUseCase; 83 logoutUseCase: LogoutUseCase; 84 initiateOAuthSignInUseCase: InitiateOAuthSignInUseCase; 85 completeOAuthSignInUseCase: CompleteOAuthSignInUseCase; 86 getProfileUseCase: GetProfileUseCase; 87 refreshAccessTokenUseCase: RefreshAccessTokenUseCase; 88 generateExtensionTokensUseCase: GenerateExtensionTokensUseCase; 89 followTargetUseCase: FollowTargetUseCase; 90 unfollowTargetUseCase: UnfollowTargetUseCase; 91 // Card use cases 92 addUrlToLibraryUseCase: AddUrlToLibraryUseCase; 93 addCardToLibraryUseCase: AddCardToLibraryUseCase; 94 addCardToCollectionUseCase: AddCardToCollectionUseCase; 95 updateNoteCardUseCase: UpdateNoteCardUseCase; 96 updateUrlCardAssociationsUseCase: UpdateUrlCardAssociationsUseCase; 97 removeCardFromLibraryUseCase: RemoveCardFromLibraryUseCase; 98 removeCardFromCollectionUseCase: RemoveCardFromCollectionUseCase; 99 getUrlMetadataUseCase: GetUrlMetadataUseCase; 100 getUrlCardViewUseCase: GetUrlCardViewUseCase; 101 getLibrariesForCardUseCase: GetLibrariesForCardUseCase; 102 getMyUrlCardsUseCase: GetUrlCardsUseCase; 103 createCollectionUseCase: CreateCollectionUseCase; 104 updateCollectionUseCase: UpdateCollectionUseCase; 105 deleteCollectionUseCase: DeleteCollectionUseCase; 106 getCollectionPageUseCase: GetCollectionPageUseCase; 107 getCollectionPageByAtUriUseCase: GetCollectionPageByAtUriUseCase; 108 getCollectionsUseCase: GetCollectionsUseCase; 109 searchCollectionsUseCase: SearchCollectionsUseCase; 110 getOpenCollectionsWithContributorUseCase: GetOpenCollectionsWithContributorUseCase; 111 getUrlStatusForMyLibraryUseCase: GetUrlStatusForMyLibraryUseCase; 112 getLibrariesForUrlUseCase: GetLibrariesForUrlUseCase; 113 getCollectionsForUrlUseCase: GetCollectionsForUrlUseCase; 114 getNoteCardsForUrlUseCase: GetNoteCardsForUrlUseCase; 115 // Feed use cases 116 getGlobalFeedUseCase: GetGlobalFeedUseCase; 117 getGemActivityFeedUseCase: GetGemActivityFeedUseCase; 118 getFollowingFeedUseCase: GetFollowingFeedUseCase; 119 addActivityToFeedUseCase: AddActivityToFeedUseCase; 120 // Search use cases 121 getSimilarUrlsForUrlUseCase: GetSimilarUrlsForUrlUseCase; 122 semanticSearchUrlsUseCase: SemanticSearchUrlsUseCase; 123 searchBskyPostsForUrlUseCase: SearchBskyPostsForUrlUseCase; 124 searchAtProtoAccountsUseCase: SearchAtProtoAccountsUseCase; 125 searchLeafletDocsForUrlUseCase: SearchLeafletDocsForUrlUseCase; 126 // Notification use cases 127 getMyNotificationsUseCase: GetMyNotificationsUseCase; 128 getUnreadNotificationCountUseCase: GetUnreadNotificationCountUseCase; 129 markNotificationsAsReadUseCase: MarkNotificationsAsReadUseCase; 130 markAllNotificationsAsReadUseCase: MarkAllNotificationsAsReadUseCase; 131} 132 133export class UseCaseFactory { 134 static create(repositories: Repositories, services: Services): UseCases { 135 return this.createForWebApp(repositories, services); 136 } 137 138 static createForWebApp( 139 repositories: Repositories, 140 services: Services, 141 ): UseCases { 142 const getCollectionPageUseCase = new GetCollectionPageUseCase( 143 repositories.collectionRepository, 144 repositories.cardQueryRepository, 145 services.profileService, 146 ); 147 148 return { 149 // User use cases 150 loginWithAppPasswordUseCase: new LoginWithAppPasswordUseCase( 151 services.appPasswordProcessor, 152 services.tokenService, 153 repositories.userRepository, 154 services.userAuthService, 155 ), 156 logoutUseCase: new LogoutUseCase(services.tokenService), 157 initiateOAuthSignInUseCase: new InitiateOAuthSignInUseCase( 158 services.oauthProcessor, 159 ), 160 completeOAuthSignInUseCase: new CompleteOAuthSignInUseCase( 161 services.oauthProcessor, 162 services.tokenService, 163 repositories.userRepository, 164 services.userAuthService, 165 ), 166 getProfileUseCase: new GetProfileUseCase( 167 services.profileService, 168 services.identityResolutionService, 169 ), 170 refreshAccessTokenUseCase: new RefreshAccessTokenUseCase( 171 services.tokenService, 172 ), 173 generateExtensionTokensUseCase: new GenerateExtensionTokensUseCase( 174 services.tokenService, 175 ), 176 followTargetUseCase: new FollowTargetUseCase( 177 repositories.followsRepository, 178 repositories.userRepository, 179 repositories.collectionRepository, 180 services.followPublisher, 181 services.eventPublisher, 182 ), 183 unfollowTargetUseCase: new UnfollowTargetUseCase( 184 repositories.followsRepository, 185 services.followPublisher, 186 services.eventPublisher, 187 ), 188 189 // Card use cases 190 addUrlToLibraryUseCase: new AddUrlToLibraryUseCase( 191 repositories.cardRepository, 192 services.metadataService, 193 services.cardLibraryService, 194 services.cardCollectionService, 195 services.eventPublisher, 196 ), 197 addCardToLibraryUseCase: new AddCardToLibraryUseCase( 198 repositories.cardRepository, 199 services.cardLibraryService, 200 services.cardCollectionService, 201 ), 202 addCardToCollectionUseCase: new AddCardToCollectionUseCase( 203 repositories.cardRepository, 204 services.cardCollectionService, 205 services.eventPublisher, 206 ), 207 updateNoteCardUseCase: new UpdateNoteCardUseCase( 208 repositories.cardRepository, 209 services.cardPublisher, 210 ), 211 updateUrlCardAssociationsUseCase: new UpdateUrlCardAssociationsUseCase( 212 repositories.cardRepository, 213 services.cardLibraryService, 214 services.cardCollectionService, 215 services.eventPublisher, 216 ), 217 removeCardFromLibraryUseCase: new RemoveCardFromLibraryUseCase( 218 repositories.cardRepository, 219 services.cardLibraryService, 220 services.eventPublisher, 221 ), 222 removeCardFromCollectionUseCase: new RemoveCardFromCollectionUseCase( 223 repositories.cardRepository, 224 services.cardCollectionService, 225 services.eventPublisher, 226 ), 227 getUrlMetadataUseCase: new GetUrlMetadataUseCase( 228 services.metadataService, 229 repositories.cardRepository, 230 ), 231 getUrlCardViewUseCase: new GetUrlCardViewUseCase( 232 repositories.cardQueryRepository, 233 services.profileService, 234 repositories.collectionRepository, 235 ), 236 getLibrariesForCardUseCase: new GetLibrariesForCardUseCase( 237 repositories.cardQueryRepository, 238 services.profileService, 239 ), 240 getMyUrlCardsUseCase: new GetUrlCardsUseCase( 241 repositories.cardQueryRepository, 242 services.identityResolutionService, 243 services.profileService, 244 ), 245 createCollectionUseCase: new CreateCollectionUseCase( 246 repositories.collectionRepository, 247 services.collectionPublisher, 248 ), 249 updateCollectionUseCase: new UpdateCollectionUseCase( 250 repositories.collectionRepository, 251 services.collectionPublisher, 252 ), 253 deleteCollectionUseCase: new DeleteCollectionUseCase( 254 repositories.collectionRepository, 255 services.collectionPublisher, 256 ), 257 getCollectionPageUseCase, 258 getCollectionPageByAtUriUseCase: new GetCollectionPageByAtUriUseCase( 259 services.identityResolutionService, 260 repositories.atUriResolutionService, 261 getCollectionPageUseCase, 262 services.configService.getAtProtoCollections().collection, 263 services.configService.getAtProtoCollections().marginCollection, 264 ), 265 getCollectionsUseCase: new GetCollectionsUseCase( 266 repositories.collectionQueryRepository, 267 services.profileService, 268 services.identityResolutionService, 269 ), 270 searchCollectionsUseCase: new SearchCollectionsUseCase( 271 repositories.collectionQueryRepository, 272 services.profileService, 273 services.identityResolutionService, 274 ), 275 getOpenCollectionsWithContributorUseCase: 276 new GetOpenCollectionsWithContributorUseCase( 277 repositories.collectionQueryRepository, 278 services.profileService, 279 services.identityResolutionService, 280 ), 281 getUrlStatusForMyLibraryUseCase: new GetUrlStatusForMyLibraryUseCase( 282 repositories.cardRepository, 283 repositories.cardQueryRepository, 284 repositories.collectionQueryRepository, 285 repositories.collectionRepository, 286 services.profileService, 287 services.eventPublisher, 288 ), 289 getLibrariesForUrlUseCase: new GetLibrariesForUrlUseCase( 290 repositories.cardQueryRepository, 291 services.profileService, 292 ), 293 getCollectionsForUrlUseCase: new GetCollectionsForUrlUseCase( 294 repositories.collectionQueryRepository, 295 services.profileService, 296 repositories.collectionRepository, 297 ), 298 getNoteCardsForUrlUseCase: new GetNoteCardsForUrlUseCase( 299 repositories.cardQueryRepository, 300 services.profileService, 301 ), 302 303 // Feed use cases 304 getGlobalFeedUseCase: new GetGlobalFeedUseCase( 305 repositories.feedRepository, 306 services.profileService, 307 repositories.cardQueryRepository, 308 repositories.collectionRepository, 309 ), 310 getGemActivityFeedUseCase: new GetGemActivityFeedUseCase( 311 repositories.feedRepository, 312 services.profileService, 313 repositories.cardQueryRepository, 314 repositories.collectionRepository, 315 repositories.collectionQueryRepository, 316 ), 317 getFollowingFeedUseCase: new GetFollowingFeedUseCase( 318 repositories.feedRepository, 319 services.profileService, 320 repositories.cardQueryRepository, 321 repositories.collectionRepository, 322 ), 323 addActivityToFeedUseCase: new AddActivityToFeedUseCase( 324 services.feedService, 325 repositories.cardRepository, 326 repositories.followsRepository, 327 repositories.feedRepository, 328 ), 329 // Search use cases 330 getSimilarUrlsForUrlUseCase: new GetSimilarUrlsForUrlUseCase( 331 services.searchService, 332 ), 333 semanticSearchUrlsUseCase: new SemanticSearchUrlsUseCase( 334 services.searchService, 335 services.identityResolutionService, 336 ), 337 searchBskyPostsForUrlUseCase: new SearchBskyPostsForUrlUseCase( 338 services.atProtoAgentService, 339 ), 340 searchAtProtoAccountsUseCase: new SearchAtProtoAccountsUseCase( 341 services.atProtoAgentService, 342 ), 343 searchLeafletDocsForUrlUseCase: new SearchLeafletDocsForUrlUseCase( 344 services.leafletSearchService, 345 repositories.cardQueryRepository, 346 ), 347 // Notification use cases 348 getMyNotificationsUseCase: new GetMyNotificationsUseCase( 349 repositories.notificationRepository, 350 services.profileService, 351 repositories.cardQueryRepository, 352 repositories.collectionRepository, 353 ), 354 getUnreadNotificationCountUseCase: new GetUnreadNotificationCountUseCase( 355 repositories.notificationRepository, 356 ), 357 markNotificationsAsReadUseCase: new MarkNotificationsAsReadUseCase( 358 repositories.notificationRepository, 359 ), 360 markAllNotificationsAsReadUseCase: new MarkAllNotificationsAsReadUseCase( 361 repositories.notificationRepository, 362 ), 363 }; 364 } 365 366 static createForWorker( 367 repositories: Repositories, 368 services: SharedServices, 369 ): WorkerUseCases { 370 // ======================================== 371 // LEVEL 1: Leaf use cases (no use case dependencies) 372 // ======================================== 373 374 // Feed use cases 375 const addActivityToFeedUseCase = new AddActivityToFeedUseCase( 376 services.feedService, 377 repositories.cardRepository, 378 repositories.followsRepository, 379 repositories.feedRepository, 380 ); 381 382 // Search use cases 383 const indexUrlForSearchUseCase = new IndexUrlForSearchUseCase( 384 services.searchService, 385 ); 386 387 // Notification use cases 388 const createNotificationUseCase = new CreateNotificationUseCase( 389 services.notificationService, 390 ); 391 392 // Card library use cases 393 const addUrlToLibraryUseCase = new AddUrlToLibraryUseCase( 394 repositories.cardRepository, 395 services.metadataService, 396 services.cardLibraryService, 397 services.cardCollectionService, 398 services.eventPublisher, 399 ); 400 401 const updateUrlCardAssociationsUseCase = 402 new UpdateUrlCardAssociationsUseCase( 403 repositories.cardRepository, 404 services.cardLibraryService, 405 services.cardCollectionService, 406 services.eventPublisher, 407 ); 408 409 const removeCardFromLibraryUseCase = new RemoveCardFromLibraryUseCase( 410 repositories.cardRepository, 411 services.cardLibraryService, 412 services.eventPublisher, 413 ); 414 415 // Collection use cases 416 const createCollectionUseCase = new CreateCollectionUseCase( 417 repositories.collectionRepository, 418 services.collectionPublisher, 419 ); 420 421 const updateCollectionUseCase = new UpdateCollectionUseCase( 422 repositories.collectionRepository, 423 services.collectionPublisher, 424 ); 425 426 const deleteCollectionUseCase = new DeleteCollectionUseCase( 427 repositories.collectionRepository, 428 services.collectionPublisher, 429 ); 430 431 // ======================================== 432 // LEVEL 2: Process use cases (depend on Level 1) 433 // ======================================== 434 435 const processCardFirehoseEventUseCase = new ProcessCardFirehoseEventUseCase( 436 repositories.atUriResolutionService, 437 addUrlToLibraryUseCase, 438 updateUrlCardAssociationsUseCase, 439 removeCardFromLibraryUseCase, 440 repositories.cardRepository, 441 ); 442 443 const processCollectionFirehoseEventUseCase = 444 new ProcessCollectionFirehoseEventUseCase( 445 repositories.atUriResolutionService, 446 createCollectionUseCase, 447 updateCollectionUseCase, 448 deleteCollectionUseCase, 449 ); 450 451 const processCollectionLinkFirehoseEventUseCase = 452 new ProcessCollectionLinkFirehoseEventUseCase( 453 repositories.atUriResolutionService, 454 updateUrlCardAssociationsUseCase, 455 ); 456 457 const processCollectionLinkRemovalFirehoseEventUseCase = 458 new ProcessCollectionLinkRemovalFirehoseEventUseCase( 459 repositories.atUriResolutionService, 460 updateUrlCardAssociationsUseCase, 461 ); 462 463 const processMarginBookmarkFirehoseEventUseCase = 464 new ProcessMarginBookmarkFirehoseEventUseCase( 465 repositories.atUriResolutionService, 466 addUrlToLibraryUseCase, 467 removeCardFromLibraryUseCase, 468 ); 469 470 const processMarginCollectionFirehoseEventUseCase = 471 new ProcessMarginCollectionFirehoseEventUseCase( 472 repositories.atUriResolutionService, 473 createCollectionUseCase, 474 updateCollectionUseCase, 475 deleteCollectionUseCase, 476 ); 477 478 const processMarginCollectionItemFirehoseEventUseCase = 479 new ProcessMarginCollectionItemFirehoseEventUseCase( 480 repositories.atUriResolutionService, 481 updateUrlCardAssociationsUseCase, 482 ); 483 484 // ======================================== 485 // LEVEL 3: Sync use cases (depend on Level 2) 486 // ======================================== 487 488 const syncAccountDataUseCase = new SyncAccountDataUseCase( 489 repositories.syncStatusRepository, 490 services.atProtoRepoService, 491 repositories.atUriResolutionService, 492 processMarginBookmarkFirehoseEventUseCase, 493 processMarginCollectionFirehoseEventUseCase, 494 processMarginCollectionItemFirehoseEventUseCase, 495 ); 496 497 // ======================================== 498 // Return all use cases 499 // ======================================== 500 501 return { 502 // Level 1 503 addActivityToFeedUseCase, 504 indexUrlForSearchUseCase, 505 createNotificationUseCase, 506 addUrlToLibraryUseCase, 507 updateUrlCardAssociationsUseCase, 508 removeCardFromLibraryUseCase, 509 createCollectionUseCase, 510 updateCollectionUseCase, 511 deleteCollectionUseCase, 512 // Level 2 513 processCardFirehoseEventUseCase, 514 processCollectionFirehoseEventUseCase, 515 processCollectionLinkFirehoseEventUseCase, 516 processCollectionLinkRemovalFirehoseEventUseCase, 517 processMarginBookmarkFirehoseEventUseCase, 518 processMarginCollectionFirehoseEventUseCase, 519 processMarginCollectionItemFirehoseEventUseCase, 520 // Level 3 521 syncAccountDataUseCase, 522 }; 523 } 524}