refactor!: drop the I prefix from TypeScript interfaces - #1636
refactor!: drop the I prefix from TypeScript interfaces#1636subhankarmaiti wants to merge 2 commits into
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (44)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts (1)
5-25: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winComplete the
NativeBridgemock.
NativeBridgedefines 42 required methods, but this mock defines only 16. Addjest.fn()stubs for the 26 missing methods:resumeSession,customTokenExchange, all MFA, passkey, passwordless, and My Account methods.🤖 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 `@src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts` around lines 5 - 25, Complete the mockBridge NativeBridge object by adding jest.fn() stubs for all remaining required interface methods, including resumeSession, customTokenExchange, and every MFA, passkey, passwordless, and My Account method, while preserving the existing adapter-specific mocks.
🧹 Nitpick comments (1)
src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts (1)
2-2: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winComplete the bridge mock and use a type-only import.
jest.Mocked<NativeBridge>requires 26 missing methods. Add stubs or narrow the injected bridge contract.NativeBridgeis type-only, andverbatimModuleSyntaxis enabled. Useimport type.🤖 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 `@src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts` at line 2, Update the bridge mock setup in NativeCredentialsManager tests to satisfy the jest.Mocked<NativeBridge> contract by adding stubs for all required methods or narrowing the injected bridge type to the methods used. Change the NativeBridge import to a type-only import to comply with verbatimModuleSyntax.
🤖 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.
Outside diff comments:
In `@src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts`:
- Around line 5-25: Complete the mockBridge NativeBridge object by adding
jest.fn() stubs for all remaining required interface methods, including
resumeSession, customTokenExchange, and every MFA, passkey, passwordless, and My
Account method, while preserving the existing adapter-specific mocks.
---
Nitpick comments:
In `@src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts`:
- Line 2: Update the bridge mock setup in NativeCredentialsManager tests to
satisfy the jest.Mocked<NativeBridge> contract by adding stubs for all required
methods or narrowing the injected bridge type to the methods used. Change the
NativeBridge import to a type-only import to comply with verbatimModuleSyntax.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 56b8cb09-b25a-4129-b9dc-a4454192ee06
📒 Files selected for processing (44)
CLAUDE.mdMIGRATION_GUIDE.mdreferences/code-style.mdsrc/Auth0.tssrc/core/interfaces/Auth0Client.tssrc/core/interfaces/AuthenticationProvider.tssrc/core/interfaces/CredentialsManager.tssrc/core/interfaces/MfaClient.tssrc/core/interfaces/MyAccountClient.tssrc/core/interfaces/PasswordlessClient.tssrc/core/interfaces/WebAuthProvider.tssrc/core/interfaces/index.tssrc/core/models/ApiCredentials.tssrc/core/models/Credentials.tssrc/core/services/AuthenticationOrchestrator.tssrc/factory/Auth0ClientFactory.tssrc/factory/Auth0ClientFactory.web.tssrc/hooks/Auth0Context.tssrc/hooks/Auth0Provider.tsxsrc/index.tssrc/platforms/native/adapters/NativeAuth0Client.tssrc/platforms/native/adapters/NativeCredentialsManager.tssrc/platforms/native/adapters/NativeMfaClient.tssrc/platforms/native/adapters/NativeMyAccountClient.tssrc/platforms/native/adapters/NativePasswordlessClient.tssrc/platforms/native/adapters/NativeWebAuthProvider.tssrc/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.tssrc/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.tssrc/platforms/native/adapters/__tests__/NativeMfaClient.spec.tssrc/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.tssrc/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.tssrc/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.tssrc/platforms/native/bridge/NativeBridge.tssrc/platforms/native/bridge/NativeBridgeManager.tssrc/platforms/native/bridge/index.tssrc/platforms/web/adapters/WebAuth0Client.tssrc/platforms/web/adapters/WebAuthenticationProvider.tssrc/platforms/web/adapters/WebCredentialsManager.tssrc/platforms/web/adapters/WebMfaClient.tssrc/platforms/web/adapters/WebMyAccountClient.tssrc/platforms/web/adapters/WebPasswordlessClient.tssrc/platforms/web/adapters/WebWebAuthProvider.tssrc/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.tssrc/specs/NativeA0Auth0.ts
Changes
The platform contracts in
src/core/interfaces/no longer carry anIprefix. The interface now takes the plain name and the implementations keep their platform prefix —Auth0Clientis the contract,NativeAuth0ClientandWebAuth0Clientimplement it. The same applies toAuthenticationProvider,CredentialsManager,MfaClient,MyAccountClient,PasswordlessClient,WebAuthProvider, and the nativeNativeBridge.Only one of these was ever exported from the package entry point, so there is a single breaking change for consumers:
It's a type-only rename — runtime behaviour is identical.
MIGRATION_GUIDE.mddocuments it. Everything else was internal.Since
Auth0Clientis also the name of the class we import from@auth0/auth0-spa-js, the web adapter now aliases the third-party symbol asSpaAuth0Client. A few local type aliases that used the same retired idiom (Credentials as ICredentials,ApiCredentials as IApiCredentials) becameCredentialsData/ApiCredentialsData, and the naming convention in the contributor docs was updated to match.There is also one unrelated commit: a prettier formatting fix in the TurboModule spec, which was failing
yarn linton this branch's base and blocking the pre-push hook for everyone. The declared type is unchanged, so CodeGen output is unaffected.References
No public issue — this is v6 naming cleanup, driven by the convention no longer matching the codebase's own structure.
Testing
Mechanical rename, verified by the compiler and the existing suite rather than new tests.
yarn typecheckclean.yarn test— 36 suites, 708 tests, 18 snapshots, all passing.yarn buildclean, and the emittedlib/typescript/was checked to confirmexport type { MfaClient }on the public surface and no survivingI-prefixed interfaces.This change adds unit test coverage
This change has been tested on the latest version of the platform/language or why not
Checklist
Summary by CodeRabbit
Breaking Changes
Iprefix, includingAuth0Client,MfaClient,AuthenticationProvider, and related client types.IMfaClienttype must update imports toMfaClient.Documentation