-
Notifications
You must be signed in to change notification settings - Fork 2
graphql/environment: send Current-Profile on subscription/websocket connections #273
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
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the """ WalkthroughA new patch version (1.3.2) of the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AuthModule
participant WebSocketServer
Client->>AuthModule: Retrieve auth token
Client->>AuthModule: Retrieve current profile key
AuthModule-->>Client: Return token and profile key
Client->>AuthModule: Parse profile key to get profile ID
AuthModule-->>Client: Return MinimalProfile (with id)
Client->>WebSocketServer: Connect with Authorization and Current-Profile headers
WebSocketServer-->>Client: Establish subscription connection
Poem
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 (
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
packages/graphql/package.json (1)
26-29: Add missing authentication package to peerDependencies.The code imports from
@baseapp-frontend/authenticationbut this dependency is not declared in the package.json. This is likely causing the TypeScript compilation error.Add the authentication package to peerDependencies:
"peerDependencies": { + "@baseapp-frontend/authentication": "workspace:*", "@baseapp-frontend/utils": "workspace:*", "react": "catalog:react19" },
🧹 Nitpick comments (1)
packages/graphql/config/environment.ts (1)
104-110: Well-implemented profile parameter addition with good error handling.The implementation correctly adds the Current-Profile parameter to websocket connections while maintaining backward compatibility. The code safely handles missing profile data and parsing errors.
Consider adding a type guard for extra safety:
const CurrentProfile = parseString<MinimalProfile>(CurrentProfileStr) +const profileId = CurrentProfile?.id && typeof CurrentProfile.id === 'string' ? CurrentProfile.id : undefined if (!Authorization) return {} return { Authorization, - 'Current-Profile': CurrentProfile ? CurrentProfile.id : undefined, + 'Current-Profile': profileId, }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/graphql/CHANGELOG.md(1 hunks)packages/graphql/config/environment.ts(2 hunks)packages/graphql/package.json(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/graphql/config/environment.ts (4)
packages/utils/functions/token/getToken/index.ts (1)
getToken(9-17)packages/authentication/modules/profile/useCurrentProfile/constants.ts (1)
CURRENT_PROFILE_KEY_NAME(1-1)packages/utils/functions/string/parseString/index.ts (1)
parseString(1-10)packages/authentication/types/profile.ts (1)
MinimalProfile(1-6)
🪛 GitHub Actions: Main Workflow
packages/graphql/config/environment.ts
[error] 1-1: TypeScript error TS2307: Cannot find module '@baseapp-frontend/authentication' or its corresponding type declarations.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/graphql/config/environment.ts (1)
102-111: Excellent implementation that follows established patterns.The websocket connection parameter enhancement is well-designed:
- Uses the same token retrieval pattern as Authorization
- Safely handles missing or invalid profile data
- Maintains backward compatibility
- Follows the existing codebase patterns
packages/graphql/package.json (1)
4-4: Appropriate patch version bump for the new feature.The version increment from 1.3.1 to 1.3.2 correctly follows semantic versioning for a backward-compatible feature addition.
packages/graphql/CHANGELOG.md (1)
3-7: Well-documented changelog entry.The changelog entry accurately describes the feature addition and follows the established format.
vitorguima
left a comment
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.
Fix lint before merging @nossila
|



Make it send Current-Profile param on subscription/websocket connection
Summary by CodeRabbit
New Features
Chores