-
Notifications
You must be signed in to change notification settings - Fork 247
feat(save-user-data): create a user data abstract class COMPASS-9543 #7103
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the existing UserData implementation into an abstract IUserData base class with a concrete FileUserData, and updates all storage consumers to use the new API.
- Introduces
IUserData(abstract) andFileUserDataincompass-user-data - Updates storage modules (queries, pipelines, connections, preferences, history, data modeling, atlas service) to replace
UserDatawithFileUserData - Adjusts tests and exports to align with the new types
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/my-queries-storage/src/compass-query-storage.ts | Swap to IUserData/FileUserData, adjust methods and signatures |
| packages/my-queries-storage/src/compass-pipeline-storage.ts | Replace UserData with FileUserData |
| packages/connection-storage/src/compass-main-connection-storage.ts | Replace UserData with FileUserData |
| packages/compass-user-data/src/user-data.ts | Extract IUserData, implement FileUserData, update options |
| packages/compass-user-data/src/user-data.spec.ts | Update tests to use FileUserData and its options |
| packages/compass-user-data/src/index.ts | Export IUserData and FileUserData instead of UserData |
| packages/compass-shell/src/modules/history-storage.ts | Swap UserData import for FileUserData |
| packages/compass-preferences-model/src/user-storage.ts | Replace UserData with FileUserData |
| packages/compass-preferences-model/src/preferences-persistent-storage.ts | Swap to FileUserData for preferences storage |
| packages/compass-data-modeling/src/services/data-model-storage-electron.tsx | Replace UserData with FileUserData |
| packages/compass-data-modeling/src/components/diagram-card.spec.tsx | Relax test assertion on modified date |
| packages/atlas-service/src/secret-store.ts | Replace UserData with FileUserData |
Comments suppressed due to low confidence (1)
packages/my-queries-storage/src/compass-query-storage.ts:77
- [nitpick] The comment refers to writing to "system/db", but this implementation writes to the file system. Update the comment to accurately reflect file-based storage.
// this creates a recent query that we will write to system/db
packages/compass-data-modeling/src/components/diagram-card.spec.tsx
Outdated
Show resolved
Hide resolved
Merge branch 'user-data-interface' of https://github.com/mongodb-js/compass into user-data-interface
|
|
||
| export type UserDataOptions<Input> = { | ||
| export type FileUserDataOptions<Input> = { | ||
| subdir: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming on this one is unfortunate, but I think it's also relevant for the shared userdata interface
Description
Refactoring the existing UserData class as an abstract class, and extending the abstract class as FileUserData. This is in preparation for the saving user data project for Data Explorer, where we will extend the abstract class as AtlasUserData.
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes