feat: add explicit RequestContext dependency pattern#10
Conversation
- Add RequestContext class that encapsulates request-scoped data - Support creation from CLS or explicit parameters - Add @ctx() decorator for injecting context in controllers - Maintain backwards compatibility with existing CLS-based code - Improve testability by allowing direct context injection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add request-context.spec.ts with 25 tests covering: - Constructor with required and optional properties - fromCls static method with all values and error cases - tryFromCls for optional context scenarios - isSuperAdmin, userId, userEmail getters - with() method for creating modified copies - toJSON() serialization - Add request-context.decorator.spec.ts with 9 tests covering: - @ctx and @ReqContext decorator definitions - ClsServiceManager integration - RequestContext creation from CLS data - Error handling for missing CLS values - Add Jest moduleNameMapper for src/* path resolution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded@aabrius has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 18 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)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Summary
Test plan
npm test -- --testPathPattern="request-context"to verify all tests pass🤖 Generated with Claude Code