Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDS: ActorStore Refactor #3492

Merged
merged 3 commits into from
Feb 5, 2025
Merged

Conversation

matthieusieben
Copy link
Contributor

@matthieusieben matthieusieben commented Feb 4, 2025

These changes essentially allow to access the ActorStore from the AccountManager class. This enables accessing the user's profile record from the OAuth Provider. These changes are needed to avoid code duplication (for getting the user profile, and building the profile url) when building the account data needed by the OAuth UI.

Note

This PR is a prerequisite for #2945

This PR simplifies the code of the pds package by:

  • Removing the DetailedAccountStore class (merging its logic inside AccountManager)
  • Reworking the ActorStore to avoid circular dependency between AccountManager and LocalViewerCreator, caused by previous point.
  • Factorizing image URL building into a new ImageUrlBuilder class (to avoid code duplication in AccountManager & LocalViewer)
  • Adding an BskyAppView class that exposes an agent: AtpAgent and image url builder function (used by the ImageUrlBuilder).
  • Marking the db property of ActorStoreReader as protected, preventing its (unsafe) use from outside the class. This change also caused several small utilities to be moved in the actor-store "reader classes" (actor-store/*/reader.ts).

@matthieusieben matthieusieben force-pushed the msi/refactor-actor-store-reader branch 5 times, most recently from 5dc7b4d to cb70e9e Compare February 4, 2025 11:49
@matthieusieben matthieusieben force-pushed the msi/refactor-actor-store-reader branch from cb70e9e to 01c11c6 Compare February 4, 2025 14:34
packages/pds/src/account-manager/index.ts Outdated Show resolved Hide resolved
packages/pds/src/actor-store/index.ts Outdated Show resolved Hide resolved
packages/pds/src/db/db.ts Show resolved Hide resolved
- Removing `DetailedAccountStore` class (moving its logic inside `AccountManager`)
- Factorizes image URL building into its own class (for easy re-use from `AccountManager`)
- Adds an `AppView` class that exposes an `agent: AtpAgent` and url builder function (used by the `ImageUrlBuilder`).
- Reworks the `ActorStore` to avoid circular dependency between `AccountManager` and `LocalViewerCreator` (needed because of first item)
@matthieusieben matthieusieben force-pushed the msi/refactor-actor-store-reader branch from 01c11c6 to 0dbb458 Compare February 5, 2025 07:47
@matthieusieben matthieusieben force-pushed the msi/refactor-actor-store-reader branch from db1e3ca to 4924bc6 Compare February 5, 2025 08:55
@matthieusieben matthieusieben merged commit 53a577f into main Feb 5, 2025
10 checks passed
@matthieusieben matthieusieben deleted the msi/refactor-actor-store-reader branch February 5, 2025 12:37
@github-actions github-actions bot mentioned this pull request Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants