Skip to content

refactor!: drop the I prefix from TypeScript interfaces - #1636

Open
subhankarmaiti wants to merge 2 commits into
v6-developmentfrom
refactor/drop-interface-i-prefix
Open

refactor!: drop the I prefix from TypeScript interfaces#1636
subhankarmaiti wants to merge 2 commits into
v6-developmentfrom
refactor/drop-interface-i-prefix

Conversation

@subhankarmaiti

@subhankarmaiti subhankarmaiti commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Changes

The platform contracts in src/core/interfaces/ no longer carry an I prefix. The interface now takes the plain name and the implementations keep their platform prefix — Auth0Client is the contract, NativeAuth0Client and WebAuth0Client implement it. The same applies to AuthenticationProvider, CredentialsManager, MfaClient, MyAccountClient, PasswordlessClient, WebAuthProvider, and the native NativeBridge.

Only one of these was ever exported from the package entry point, so there is a single breaking change for consumers:

- import type { IMfaClient } from 'react-native-auth0';
+ import type { MfaClient } from 'react-native-auth0';

It's a type-only rename — runtime behaviour is identical. MIGRATION_GUIDE.md documents it. Everything else was internal.

Since Auth0Client is also the name of the class we import from @auth0/auth0-spa-js, the web adapter now aliases the third-party symbol as SpaAuth0Client. A few local type aliases that used the same retired idiom (Credentials as ICredentials, ApiCredentials as IApiCredentials) became CredentialsData / 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 lint on 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 typecheck clean.

  • yarn test — 36 suites, 708 tests, 18 snapshots, all passing.

  • yarn build clean, and the emitted lib/typescript/ was checked to confirm export type { MfaClient } on the public surface and no surviving I-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

    • Renamed public interfaces to remove the I prefix, including Auth0Client, MfaClient, AuthenticationProvider, and related client types.
    • Consumers using the exported IMfaClient type must update imports to MfaClient.
  • Documentation

    • Added a v6 migration guide explaining the interface renames and confirming unchanged runtime behavior.
    • Updated naming guidance and project documentation to reflect the new conventions.

@subhankarmaiti
subhankarmaiti requested a review from a team as a code owner August 12, 2026 15:53
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 56b8cb09-b25a-4129-b9dc-a4454192ee06

📥 Commits

Reviewing files that changed from the base of the PR and between 3f04576 and ee20e8e.

📒 Files selected for processing (44)
  • CLAUDE.md
  • MIGRATION_GUIDE.md
  • references/code-style.md
  • src/Auth0.ts
  • src/core/interfaces/Auth0Client.ts
  • src/core/interfaces/AuthenticationProvider.ts
  • src/core/interfaces/CredentialsManager.ts
  • src/core/interfaces/MfaClient.ts
  • src/core/interfaces/MyAccountClient.ts
  • src/core/interfaces/PasswordlessClient.ts
  • src/core/interfaces/WebAuthProvider.ts
  • src/core/interfaces/index.ts
  • src/core/models/ApiCredentials.ts
  • src/core/models/Credentials.ts
  • src/core/services/AuthenticationOrchestrator.ts
  • src/factory/Auth0ClientFactory.ts
  • src/factory/Auth0ClientFactory.web.ts
  • src/hooks/Auth0Context.ts
  • src/hooks/Auth0Provider.tsx
  • src/index.ts
  • src/platforms/native/adapters/NativeAuth0Client.ts
  • src/platforms/native/adapters/NativeCredentialsManager.ts
  • src/platforms/native/adapters/NativeMfaClient.ts
  • src/platforms/native/adapters/NativeMyAccountClient.ts
  • src/platforms/native/adapters/NativePasswordlessClient.ts
  • src/platforms/native/adapters/NativeWebAuthProvider.ts
  • src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts
  • src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts
  • src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts
  • src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts
  • src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts
  • src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts
  • src/platforms/native/bridge/NativeBridge.ts
  • src/platforms/native/bridge/NativeBridgeManager.ts
  • src/platforms/native/bridge/index.ts
  • src/platforms/web/adapters/WebAuth0Client.ts
  • src/platforms/web/adapters/WebAuthenticationProvider.ts
  • src/platforms/web/adapters/WebCredentialsManager.ts
  • src/platforms/web/adapters/WebMfaClient.ts
  • src/platforms/web/adapters/WebMyAccountClient.ts
  • src/platforms/web/adapters/WebPasswordlessClient.ts
  • src/platforms/web/adapters/WebWebAuthProvider.ts
  • src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts
  • src/specs/NativeA0Auth0.ts
 _______________________________________________________________
< You're one `console.log` away from enlightenment. Keep going. >
 ---------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/drop-interface-i-prefix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Complete the NativeBridge mock.

NativeBridge defines 42 required methods, but this mock defines only 16. Add jest.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 win

Complete the bridge mock and use a type-only import.

  • jest.Mocked<NativeBridge> requires 26 missing methods. Add stubs or narrow the injected bridge contract.
  • NativeBridge is type-only, and verbatimModuleSyntax is enabled. Use import 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f04576 and ee20e8e.

📒 Files selected for processing (44)
  • CLAUDE.md
  • MIGRATION_GUIDE.md
  • references/code-style.md
  • src/Auth0.ts
  • src/core/interfaces/Auth0Client.ts
  • src/core/interfaces/AuthenticationProvider.ts
  • src/core/interfaces/CredentialsManager.ts
  • src/core/interfaces/MfaClient.ts
  • src/core/interfaces/MyAccountClient.ts
  • src/core/interfaces/PasswordlessClient.ts
  • src/core/interfaces/WebAuthProvider.ts
  • src/core/interfaces/index.ts
  • src/core/models/ApiCredentials.ts
  • src/core/models/Credentials.ts
  • src/core/services/AuthenticationOrchestrator.ts
  • src/factory/Auth0ClientFactory.ts
  • src/factory/Auth0ClientFactory.web.ts
  • src/hooks/Auth0Context.ts
  • src/hooks/Auth0Provider.tsx
  • src/index.ts
  • src/platforms/native/adapters/NativeAuth0Client.ts
  • src/platforms/native/adapters/NativeCredentialsManager.ts
  • src/platforms/native/adapters/NativeMfaClient.ts
  • src/platforms/native/adapters/NativeMyAccountClient.ts
  • src/platforms/native/adapters/NativePasswordlessClient.ts
  • src/platforms/native/adapters/NativeWebAuthProvider.ts
  • src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts
  • src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts
  • src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts
  • src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts
  • src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts
  • src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts
  • src/platforms/native/bridge/NativeBridge.ts
  • src/platforms/native/bridge/NativeBridgeManager.ts
  • src/platforms/native/bridge/index.ts
  • src/platforms/web/adapters/WebAuth0Client.ts
  • src/platforms/web/adapters/WebAuthenticationProvider.ts
  • src/platforms/web/adapters/WebCredentialsManager.ts
  • src/platforms/web/adapters/WebMfaClient.ts
  • src/platforms/web/adapters/WebMyAccountClient.ts
  • src/platforms/web/adapters/WebPasswordlessClient.ts
  • src/platforms/web/adapters/WebWebAuthProvider.ts
  • src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts
  • src/specs/NativeA0Auth0.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant