refactor(store): streamline store initialization and manifest handling#76
refactor(store): streamline store initialization and manifest handling#76
Conversation
* Consolidate local and remote store initialization logic. * Introduce `getManifestPath` method to determine the appropriate manifest path based on store mode. * Update `createRemoteUCDStore` to use the correct file system bridge for HTTP.
* Changed the default base URL in `HTTPFileSystemBridge` to align with the UCD Store's proxy URL. * Removed unnecessary debug log for remote store initialization. * Updated the manifest path for remote stores to use `.ucd-store.json`.
🦋 Changeset detectedLatest commit: 3640c64 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Rate limit exceeded@luxass has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (8)
WalkthroughThis set of changes refactors the UCD Store package and its related infrastructure. It updates workflow deployment directories, improves TypeScript configuration handling, enhances store initialization and manifest logic, introduces new constants, and adjusts imports to use these constants. The HTTP file system bridge now uses a default base URL. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UCDStore
participant FSBridge
participant Constants
User->>UCDStore: new UCDStore(options)
UCDStore->>Constants: Import UNICODE_API_BASE_URL, UNICODE_PROXY_URL
UCDStore->>FSBridge: Initialize with baseUrl/proxyUrl
UCDStore->>UCDStore: initialize()
UCDStore->>UCDStore: getManifestPath()
UCDStore->>FSBridge: exists(manifestPath)
alt Store exists
UCDStore->>UCDStore: loadVersionsFromStore()
else Store does not exist (local)
UCDStore->>UCDStore: createStoreManifest()
else Store does not exist (remote)
UCDStore->>UCDStore: load versions from metadata
end
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
* Refactored `UCDStore` to utilize `UNICODE_API_BASE_URL` and `UNICODE_PROXY_URL` from constants. * Updated tests to reflect changes in default URL expectations. * Added path mapping for constants in TypeScript configuration.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the store initialization and manifest handling to streamline configuration and error management. Key changes include adding a new constants mapping in the tsconfig file, updating file system bridge URL handling and default constants usage, and refactoring store initialization logic for local and remote modes.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tooling/tsconfig/base.json | Adds a new mapping for the constants module to support updated default values. |
| packages/utils/src/fs-bridge/http.ts | Introduces a DEFAULT_BASE_URL constant and aligns URL creation with the new constant usage. |
| packages/ucd-store/test/store.test.ts | Updates tests to verify store URLs using the new UNICODE_API_BASE_URL and UNICODE_PROXY_URLs. |
| packages/ucd-store/src/store.ts | Refactors store initialization, manifest handling, and remote store FSBridge import logic. |
| packages/ucd-store/package.json | Updates playground commands with tsconfig reference for better configuration consistency. |
Comments suppressed due to low confidence (1)
packages/utils/src/fs-bridge/http.ts:4
- [nitpick] If alignment with the UCD Store's default base URL constants is intended, update this comment to clarify the plan and consider using the same constant for consistency across modules.
// MAYBE align this with the UCD Store's default base URL constants?
| ? fs({ | ||
| baseUrl: options.baseUrl || UNICODE_PROXY_URL, | ||
| }) | ||
| : fs, |
There was a problem hiding this comment.
[nitpick] Consider defining an explicit type for the FileSystemBridge factory function to improve clarity and maintainability of the conditional initialization.
| ? fs({ | |
| baseUrl: options.baseUrl || UNICODE_PROXY_URL, | |
| }) | |
| : fs, | |
| ? (fs as FileSystemBridgeFactory)({ | |
| baseUrl: options.baseUrl || UNICODE_PROXY_URL, | |
| }) | |
| : (fs as FileSystemBridge), |
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
* Changed `workingDirectory` from `.` to `./apps/api` for both preview and production workflows. * Ensures the correct directory is used for deployment.
Summary by CodeRabbit
Chores
Refactor
Style
Tests