Extract some tinybird response types to make them reusable on other widgets#168
Extract some tinybird response types to make them reusable on other widgets#168
Conversation
WalkthroughThis pull request updates the type definitions used in the Tinybird data sources. The changes remove redundant type aliases and replace them with direct references and new type imports from a newly introduced file. Both the active contributors and contributors leaderboard sources have been modified to use these new type definitions, streamlining data handling and ensuring consistent typing across the codebase. Changes
Possibly related PRs
Suggested reviewers
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📥 CommitsReviewing files that changed from the base of the PR and between cef583af68046c91cbd4e44e4e308cb61be6825e and fb954c556b6adad02b7c2f1f60a947e2c39addc2. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/server/data/tinybird/responses.types.ts (1)
13-19: Add missing semicolon for consistencyThere's a missing semicolon at the end of line 19, while the rest of the file uses semicolons consistently.
contributionCount: number, contributionPercentage: number - }[]; + }[];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between bbd7fc3 and cef583af68046c91cbd4e44e4e308cb61be6825e.
📒 Files selected for processing (3)
frontend/server/data/tinybird/active-contributors-data-source.ts(3 hunks)frontend/server/data/tinybird/contributors-leaderboard-source.ts(3 hunks)frontend/server/data/tinybird/responses.types.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
frontend/server/data/tinybird/active-contributors-data-source.ts (1)
Learnt from: borfast
PR: LF-Engineering/insights#76
File: frontend/server/data/tinybird/active-contributors-data-source.test.ts:10-10
Timestamp: 2025-04-10T15:19:07.017Z
Learning: The tests in the frontend/server/data/tinybird directory became broken due to changes introduced in another branch and will need to be revisited later as part of the data sources refactoring.
🔇 Additional comments (7)
frontend/server/data/tinybird/responses.types.ts (1)
1-2: Well-organized type definitions for Tinybird API responsesThe creation of this file aligns well with the PR objective to extract response types and make them reusable across widgets.
frontend/server/data/tinybird/active-contributors-data-source.ts (3)
14-14: Good refactoring to import shared typesImporting the Tinybird response types from a dedicated file improves code organization and reusability across widgets.
30-30: Simplified type structureDirectly using
ActiveContributorsDataPoint[]instead of a type alias improves code clarity and reduces unnecessary abstraction.
66-66: Consistent type usageProperly updated the type annotation for
processedDatato match the type structure changes throughout the file.frontend/server/data/tinybird/contributors-leaderboard-source.ts (3)
3-3: Good refactoring to import shared typesImporting the Tinybird response type from a dedicated file improves code organization and reusability.
18-18: Simplified type structureDirectly using
ContributorsLeaderboardDataPoint[]instead of a type alias improves code clarity and reduces unnecessary abstraction.
32-32: Consistent type usageProperly updated the type annotation for
processedDatato match the type structure changes throughout the file.
fb954c5 to
bbd7fc3
Compare
|
This was closed inadvertently. There #169 to replace it. |
The Code Review Engagement widget needs data from both the contributors leaderboard, and the active contributors TinyBird endpoints, but the return types were in the respective data sources.
This PR moves those data sources to a separate module, so we can access them from the Code Review Engagement later.
Summary by CodeRabbit