feat(core): extend UserFrom type inference support#191
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/@types/utility.ts (1)
154-177: ⚡ Quick winUpdate JSDoc wording to reflect schema-agnostic support.
The docs for
UserFrom/SessionFromstill describe Zod-only inference, but these types now acceptSchemaTypes. Updating the descriptions/examples will keep the public type docs accurate.✏️ Suggested doc update
- * Infers the user type from a Zod identity schema, or falls back to {`@link` User}. + * Infers the user type from a supported identity schema (Zod, Valibot, ArkType, TypeBox). ... - * Infers the session type from a Zod identity schema. + * Infers the session type from a supported identity schema.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/`@types/utility.ts around lines 154 - 177, The JSDoc comments for the UserFrom and SessionFrom types incorrectly state they infer from "Zod identity schema" when they actually work with any SchemaTypes. Update the documentation text in both JSDoc blocks to remove Zod-specific references and clarify that these types accept schema-agnostic SchemaTypes. The descriptions should indicate general schema inference capability rather than being limited to Zod schemas.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/CHANGELOG.md`:
- Around line 13-14: The CHANGELOG.md file currently only documents the UserFrom
type inference changes but is missing documentation for the SessionFrom type
composition path changes that are also part of this PR. Add a second bullet
point in the Unreleased section to document the SessionFrom exported composition
path change, matching the format and detail level of the existing UserFrom entry
to ensure the release notes are complete for consumers tracking public typing
changes.
---
Nitpick comments:
In `@packages/core/src/`@types/utility.ts:
- Around line 154-177: The JSDoc comments for the UserFrom and SessionFrom types
incorrectly state they infer from "Zod identity schema" when they actually work
with any SchemaTypes. Update the documentation text in both JSDoc blocks to
remove Zod-specific references and clarify that these types accept
schema-agnostic SchemaTypes. The descriptions should indicate general schema
inference capability rather than being limited to Zod schemas.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0aee1ab9-d3c7-43b3-b1c3-7cf4e3315dd1
📒 Files selected for processing (4)
packages/core/CHANGELOG.mdpackages/core/src/@types/utility.tspackages/core/test/client/client.test-d.tspackages/core/test/identity.test.ts
Description
This pull request extends the type inference capabilities of the
UserFromutility type to support additional schema providers.Previously,
UserFromonly supported inferring user types from Zod schemas. This PR expands its coverage to also support ArkType and Valibot schemas, providing a consistent type inference experience across all supported schema libraries.Note
UserFromis an alternative toInferUser.UserFrominfers the user type directly from a schema definition.InferUserinfers the user type from an authentication instance created withcreateAuth().Usage
Both utilities infer the same user shape, but from different sources:
InferUserderives the type from a configured authentication instance.UserFromderives the type directly from a schema definition.This makes
UserFromparticularly useful when working with schemas independently of acreateAuth()instance.