-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(cli): generated TS typing for auth()
access is too strong
#1589
Conversation
WalkthroughWalkthroughThe changes in the Changes
Sequence Diagram(s)sequenceDiagram
participant Model
participant AuthModel
participant generateAuthType
Model ->> generateAuthType: Call with Model and AuthModel
generateAuthType ->> AuthModel: Process required relation fields
generateAuthType ->> generateAuthType: Ensure auth model ID fields are required
generateAuthType ->> Model: Return updated Model with required fields
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add CodeRabbit Configration 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/schema/src/plugins/enhancer/enhance/auth-type-generator.ts (6 hunks)
- tests/integration/tests/enhancements/with-policy/auth.test.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- tests/integration/tests/enhancements/with-policy/auth.test.ts
Additional comments not posted (5)
packages/schema/src/plugins/enhancer/enhance/auth-type-generator.ts (5)
Line range hint
1-22
:
LGTM! Initialization and imports are correct.The imports and initial setup for the
generateAuthType
function, including the newrequiredRelations
parameter, are correctly implemented.
26-30
: LGTM!ensureType
function is correctly implemented.The
ensureType
function ensures that each model has an entry in thetypes
map, consistent with the newrequiredRelations
structure.
37-41
: LGTM!addAddField
function is correctly implemented.The
addAddField
function correctly handles adding required relation fields to thetypes
map, ensuring no duplicates are added.
91-101
: LGTM! Correct handling of ID fields and required relations.The code correctly ensures that the auth model's ID fields are always required and merges required relation fields into the type definition.
104-105
: LGTM! Addition ofRecord<string, unknown>
is correct.The addition of
Record<string, unknown>
to the type definition ensures flexibility by allowing additional fields.
No description provided.