Skip to content

Conversation

@nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Sep 2, 2025

Description

  • Fixes clerk/types tsconfig
  • Fixes a few remaining absolute imports
  • Moves all runtime values to runtime-values
  • Exports the saml values from clerk/shared

You can validate that there aren't any other runtime values present in clerk/types by commenting out export * from './runtime-values'; in types/src/index.ts and then building the pkg:

CleanShot 2025-09-02 at 13 54 05## Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added SAML identity provider mapping in the shared package and included it in published artifacts.
    • Introduced a temporary export for runtime provider data and helpers (OAuth/Web3/SAML).
  • Refactor

    • Relocated SAML_IDPS to the shared package; previous import path is deprecated.
    • Removed legacy OAuth/Web3 provider lists and helpers from types; use runtime-values instead.
    • Updated module settings to NodeNext and cleaned up import paths.
  • Chores

    • Added a changeset and bumped patch versions.

@changeset-bot
Copy link

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: 0344588

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/shared Patch
@clerk/types Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue Patch
@clerk/localizations Patch
@clerk/themes Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Sep 2, 2025 10:56am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Relocates SAML_IDPS from @clerk/types to @clerk/shared/saml and publishes the shared saml module. Introduces deprecated runtime-values in @clerk/types and re-exports them from index. Removes OAuth/Web3 provider data and helpers from types. Adjusts multiple import paths to relative. Updates types tsconfig to NodeNext.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/new-deer-attend.md
Documents SAML_IDPS relocation, deprecates old export, and bumps patch versions for @clerk/shared and @clerk/types.
Shared SAML module
packages/shared/package.json, packages/shared/src/saml.ts
Publishes saml directory; adds static SAML_IDPS map in shared.
Types import path fixes
packages/types/src/authConfig.ts, packages/types/src/commerceSettings.ts, packages/types/src/hooks.ts, packages/types/src/phoneNumber.ts, packages/types/src/signUp.ts, packages/types/src/telemetry.ts, packages/types/src/userSettings.ts
Switches various type imports from bare specifiers to relative paths; no API/signature changes.
Types runtime values (deprecated) and re-export
packages/types/src/runtime-values.ts, packages/types/src/index.ts
Adds deprecated runtime constants/utilities for Web3, OAuth, SAML; re-exports via index.ts with TODO to drop next major.
Remove legacy runtime constants from types
packages/types/src/oauth.ts, packages/types/src/web3.ts, packages/types/src/saml.ts
Deletes OAUTH_PROVIDERS, related helpers; removes WEB3_PROVIDERS and lookup; removes SAML_IDPS from types. Types remain.
Types compiler config
packages/types/tsconfig.json
Changes baseUrl to project root; switches module and resolution to NodeNext.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nudge the maps from burrow to the glade,
SAML hops to shared, where shadows fade.
Old trails marked “deprecated,” softly shown,
OAuth and Web3 seeds freshly sown.
NodeNext moon rises, paths turn right—
Thump-thump! I sign the commit by night. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nikos/move-runtime-vals-from-types-to-shared

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 2, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6682

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6682

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6682

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6682

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6682

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6682

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6682

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6682

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6682

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6682

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6682

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6682

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6682

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6682

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6682

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6682

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6682

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6682

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6682

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6682

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6682

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6682

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6682

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6682

commit: 0344588

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (9)
packages/shared/package.json (1)

118-118: Ensure SAML artifacts are published and consider explicit subpath export

  • Verify your local build of @clerk/shared emits packages/shared/dist/saml.* artifacts (e.g. .js, .mjs, .d.ts, .d.mts).
  • Optionally add a ./saml export entry in the exports field for stricter tooling compatibility:
   "exports": {
     ".": { … },
+    "./saml": {
+      "import":   { "types": "./dist/saml.d.mts", "default": "./dist/saml.mjs" },
+      "require":  { "types": "./dist/saml.d.ts",  "default": "./dist/saml.js" }
+    },
     "./*": { … }
   }
packages/types/tsconfig.json (1)

4-7: Enable optional NodeNext compiler knobs in packages/types/tsconfig.json
Confirmed no absolute intra-package imports (only external csstype) or .ts-extension imports in packages/types/src; you can safely add:

     "moduleResolution": "NodeNext",
+    "verbatimModuleSyntax": true,
+    "moduleDetection": "force",
packages/shared/src/saml.ts (2)

3-20: Prefer satisfies + as const for safer, immutable, tree-shakeable data.
Locks the shape to SamlIdpMap, prevents accidental mutation in TS, and keeps literal types.

-export const SAML_IDPS: SamlIdpMap = {
+export const SAML_IDPS = {
   saml_okta: {
     name: 'Okta Workforce',
     logo: 'okta',
   },
   saml_google: {
     name: 'Google Workspace',
     logo: 'google',
   },
   saml_microsoft: {
-    name: 'Microsoft Entra ID (Formerly AD)',
+    name: 'Microsoft Entra ID (Formerly AD)',
     logo: 'azure',
   },
   saml_custom: {
     name: 'SAML',
     logo: 'saml',
   },
-};
+} as const satisfies SamlIdpMap;

Optionally freeze at runtime (shallow):

export const SAML_IDPS = Object.freeze({
  /* ... */
}) as const satisfies SamlIdpMap;

Add minimal JSDoc (outside diff range shown):

/**
 * Canonical SAML IdP metadata.
 * Public API: import from '@clerk/shared/saml'.
 */

13-14: Fix product naming for clarity.
Use “formerly Azure AD” to match Microsoft’s terminology.

-    name: 'Microsoft Entra ID (Formerly AD)',
+    name: 'Microsoft Entra ID (formerly Azure AD)',
packages/types/src/index.ts (1)

53-56: Strengthen deprecation banner on root re-export
Update the comment in packages/types/src/index.ts (≈ lines 53–56) to:

/**
 * DEPRECATED: Transitional re-export for backward compatibility only.
 * Will be removed in the next major release.
 * Migrate to:
 * - @clerk/shared/oauth for OAuth provider data and utils
 * - @clerk/shared/web3 for Web3 provider data and utils
 * - @clerk/shared/saml for SAML_IDPS
 */
export * from './runtime-values';

Optionally narrow this export * to only the symbols needed for BC once those migration paths are in place. No local index-import cycles detected.

.changeset/new-deer-attend.md (1)

1-8: Expand the changeset to cover OAuth/Web3 deprecations and migration steps

The body mentions only SAML_IDPS. Since OAuth/Web3 runtime values and helpers are also deprecated in @clerk/types and moved to @clerk/shared, document that and provide migration snippets.

Apply this diff:

 ---
 '@clerk/shared': patch
 '@clerk/types': patch
 ---
 
-The `SAML_IDPS` export was moved from `@clerk/types` to `@clerk/shared/saml` and was marked as deprecated.
-
-Please use `import { SAML_IDPS } from "@clerk/shared/saml"` instead.
+The `SAML_IDPS` export was moved from `@clerk/types` to `@clerk/shared/saml` and is deprecated in `@clerk/types`.
+In addition, OAuth and Web3 runtime values and helpers were moved to `@clerk/shared` and are deprecated in `@clerk/types`.
+
+Migration:
+
+```ts
+// Before
+import { SAML_IDPS, OAUTH_PROVIDERS, WEB3_PROVIDERS, getOAuthProviderData, getWeb3ProviderData, sortedOAuthProviders } from '@clerk/types';
+
+// After
+import { SAML_IDPS } from '@clerk/shared/saml';
+import { OAUTH_PROVIDERS, getOAuthProviderData, sortedOAuthProviders } from '@clerk/shared/oauth';
+import { WEB3_PROVIDERS, getWeb3ProviderData } from '@clerk/shared/web3';
+```
+
+Note: `@clerk/types` temporarily re-exports these for backward compatibility and will remove them in the next major release.
packages/types/src/runtime-values.ts (3)

11-32: Make the provider list immutable at the type level

Prevent accidental mutation by using as const with satisfies readonly Web3ProviderData[].

-export const WEB3_PROVIDERS: Web3ProviderData[] = [
+export const WEB3_PROVIDERS = [
   {
     provider: 'metamask',
     strategy: 'web3_metamask_signature',
     name: 'MetaMask',
   },
   {
     provider: 'base',
     strategy: 'web3_base_signature',
     name: 'Base',
   },
   {
     provider: 'coinbase_wallet',
     strategy: 'web3_coinbase_wallet_signature',
     name: 'Coinbase Wallet',
   },
   {
     provider: 'okx_wallet',
     strategy: 'web3_okx_wallet_signature',
     name: 'OKX Wallet',
   },
-];
+] as const satisfies readonly Web3ProviderData[];

56-225: Apply immutability pattern to OAuth providers

Same rationale as WEB3_PROVIDERS.

-export const OAUTH_PROVIDERS: OAuthProviderData[] = [
+export const OAUTH_PROVIDERS = [
   {
     provider: 'google',
     strategy: 'oauth_google',
     name: 'Google',
     docsUrl: 'https://clerk.com/docs/authentication/social-connections/google',
   },
   {
     provider: 'discord',
     strategy: 'oauth_discord',
     name: 'Discord',
     docsUrl: 'https://clerk.com/docs/authentication/social-connections/discord',
   },
   ...
-];
+] as const satisfies readonly OAuthProviderData[];

270-287: Mark SAML_IDPS immutable at the type level

Keep parity with the provider lists and make intent explicit.

-export const SAML_IDPS: SamlIdpMap = {
+export const SAML_IDPS = {
   saml_okta: {
     name: 'Okta Workforce',
     logo: 'okta',
   },
   saml_google: {
     name: 'Google Workspace',
     logo: 'google',
   },
   saml_microsoft: {
     name: 'Microsoft Entra ID (Formerly AD)',
     logo: 'azure',
   },
   saml_custom: {
     name: 'SAML',
     logo: 'saml',
   },
-};
+} as const satisfies SamlIdpMap;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a50cfc8 and 0344588.

📒 Files selected for processing (16)
  • .changeset/new-deer-attend.md (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/shared/src/saml.ts (1 hunks)
  • packages/types/src/authConfig.ts (1 hunks)
  • packages/types/src/commerceSettings.ts (1 hunks)
  • packages/types/src/hooks.ts (1 hunks)
  • packages/types/src/index.ts (1 hunks)
  • packages/types/src/oauth.ts (0 hunks)
  • packages/types/src/phoneNumber.ts (1 hunks)
  • packages/types/src/runtime-values.ts (1 hunks)
  • packages/types/src/saml.ts (0 hunks)
  • packages/types/src/signUp.ts (2 hunks)
  • packages/types/src/telemetry.ts (1 hunks)
  • packages/types/src/userSettings.ts (1 hunks)
  • packages/types/src/web3.ts (0 hunks)
  • packages/types/tsconfig.json (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/types/src/oauth.ts
  • packages/types/src/saml.ts
  • packages/types/src/web3.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/types/src/telemetry.ts
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/types/src/telemetry.ts
  • packages/shared/package.json
  • packages/types/tsconfig.json
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/telemetry.ts
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/src/telemetry.ts
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/types/src/telemetry.ts
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/types/src/telemetry.ts
  • packages/types/src/userSettings.ts
  • packages/types/src/authConfig.ts
  • packages/types/src/hooks.ts
  • packages/types/src/commerceSettings.ts
  • packages/shared/src/saml.ts
  • packages/types/src/phoneNumber.ts
  • packages/types/src/index.ts
  • packages/types/src/signUp.ts
  • packages/types/src/runtime-values.ts
packages/*/package.json

📄 CodeRabbit inference engine (.cursor/rules/global.mdc)

All publishable packages should be placed under the packages/ directory

packages/*/package.json: All publishable packages must be located in the 'packages/' directory.
All packages must be published under the @clerk namespace on npm.
Semantic versioning must be used across all packages.

Files:

  • packages/shared/package.json
packages/*/tsconfig.json

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Type checking must be performed with TypeScript and publint.

Files:

  • packages/types/tsconfig.json
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/new-deer-attend.md
packages/**/index.{js,ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use tree-shaking friendly exports

Files:

  • packages/types/src/index.ts
**/index.ts

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

Use index.ts files for clean imports but avoid deep barrel exports

Avoid barrel files (index.ts re-exports) as they can cause circular dependencies

Files:

  • packages/types/src/index.ts
🧬 Code graph analysis (2)
packages/shared/src/saml.ts (1)
packages/types/src/saml.ts (1)
  • SamlIdpMap (8-8)
packages/types/src/runtime-values.ts (4)
packages/types/src/web3.ts (2)
  • Web3ProviderData (3-7)
  • Web3Provider (14-14)
packages/types/src/strategies.ts (1)
  • Web3Strategy (19-19)
packages/types/src/oauth.ts (2)
  • OAuthProviderData (5-10)
  • OAuthProvider (42-71)
packages/types/src/saml.ts (1)
  • SamlIdpMap (8-8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/telemetry.ts (1)

1-1: Relative import under NodeNext: LGTM. No bare local imports remain in packages/types/src.

packages/types/src/phoneNumber.ts (1)

2-2: PhoneCodeChannel import normalized: LGTM.
Consistent with NodeNext + type-only import usage.

packages/types/src/authConfig.ts (1)

1-1: Approve: import path normalization complete
Verified no bare PhoneCodeChannel imports remain; all references use ./phoneCodeChannel.

packages/types/src/commerceSettings.ts (1)

3-3: LGTM: path normalization is correct and type-only import fits NodeNext.

packages/shared/src/saml.ts (3)

1-1: No cross-package cycle detected between @clerk/shared and @clerk/types. packages/types/src contains no runtime imports from @clerk/shared (only deprecation comments), and only @clerk/shared lists @clerk/types as a dependency.


3-20: SAML_IDPS keys exhaustively match SamlIdpSlug.


3-3: Wildcard export covers saml subpath
The existing "./*" export mapping in packages/shared/package.json already exposes dist/saml.*, so import { SAML_IDPS } from '@clerk/shared/saml' works without adding an explicit ./saml export.

packages/types/src/userSettings.ts (1)

2-2: LGTM: relative, type-only import; keeps barrels clean and aligns with NodeNext.

packages/types/src/hooks.ts (1)

3-3: LGTM: path corrections to local type-only imports.
No API changes; ESLint-friendly.

Also applies to: 10-10

packages/types/src/signUp.ts (1)

1-5: LGTM: explicit imports and local paths reduce barrel coupling.
Type-only usage is correct; should be emission-free.

Also applies to: 16-16

Comment on lines +39 to +49
export function getWeb3ProviderData(params: {
provider?: Web3Provider;
strategy?: Web3Strategy;
}): Web3ProviderData | undefined | null {
const { provider, strategy } = params;
if (provider) {
return WEB3_PROVIDERS.find(p => p.provider == provider);
}

return WEB3_PROVIDERS.find(p => p.strategy == strategy);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix return type and use strict equality

The function never returns null and eqeqeq will likely flag ==. Also guard when both params are absent.

-export function getWeb3ProviderData(params: {
+export function getWeb3ProviderData(params: {
   provider?: Web3Provider;
   strategy?: Web3Strategy;
-}): Web3ProviderData | undefined | null {
+}): Web3ProviderData | undefined {
   const { provider, strategy } = params;
-  if (provider) {
-    return WEB3_PROVIDERS.find(p => p.provider == provider);
-  }
-
-  return WEB3_PROVIDERS.find(p => p.strategy == strategy);
+  if (provider) {
+    return WEB3_PROVIDERS.find(p => p.provider === provider);
+  }
+  if (strategy) {
+    return WEB3_PROVIDERS.find(p => p.strategy === strategy);
+  }
+  return undefined;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function getWeb3ProviderData(params: {
provider?: Web3Provider;
strategy?: Web3Strategy;
}): Web3ProviderData | undefined | null {
const { provider, strategy } = params;
if (provider) {
return WEB3_PROVIDERS.find(p => p.provider == provider);
}
return WEB3_PROVIDERS.find(p => p.strategy == strategy);
}
export function getWeb3ProviderData(params: {
provider?: Web3Provider;
strategy?: Web3Strategy;
}): Web3ProviderData | undefined {
const { provider, strategy } = params;
if (provider) {
return WEB3_PROVIDERS.find(p => p.provider === provider);
}
if (strategy) {
return WEB3_PROVIDERS.find(p => p.strategy === strategy);
}
return undefined;
}
🤖 Prompt for AI Agents
In packages/types/src/runtime-values.ts around lines 39 to 49, the function
signature and logic are incorrect: it declares a possible null return and uses
non-strict equality; also it doesn't explicitly handle the case when neither
param is provided. Update the return type to only allow Web3ProviderData |
undefined, add an early guard that returns undefined if both provider and
strategy are absent, and replace any == comparisons with strict === when
matching provider or strategy against entries in WEB3_PROVIDERS.

Comment on lines +232 to +242
export function getOAuthProviderData(params: {
provider?: OAuthProvider;
strategy?: OAuthStrategy;
}): OAuthProviderData | undefined | null {
const { provider, strategy } = params;
if (provider) {
return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider == provider);
}

return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy == strategy);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix return type and use strict equality

Align with the Web3 helper.

-export function getOAuthProviderData(params: {
+export function getOAuthProviderData(params: {
   provider?: OAuthProvider;
   strategy?: OAuthStrategy;
-}): OAuthProviderData | undefined | null {
+}): OAuthProviderData | undefined {
   const { provider, strategy } = params;
   if (provider) {
-    return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider == provider);
+    return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider === provider);
   }
-
-  return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy == strategy);
+  if (strategy) {
+    return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy === strategy);
+  }
+  return undefined;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function getOAuthProviderData(params: {
provider?: OAuthProvider;
strategy?: OAuthStrategy;
}): OAuthProviderData | undefined | null {
const { provider, strategy } = params;
if (provider) {
return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider == provider);
}
return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy == strategy);
}
export function getOAuthProviderData(params: {
provider?: OAuthProvider;
strategy?: OAuthStrategy;
}): OAuthProviderData | undefined {
const { provider, strategy } = params;
if (provider) {
return OAUTH_PROVIDERS.find(
oauth_provider => oauth_provider.provider === provider
);
}
if (strategy) {
return OAUTH_PROVIDERS.find(
oauth_provider => oauth_provider.strategy === strategy
);
}
return undefined;
}
🤖 Prompt for AI Agents
In packages/types/src/runtime-values.ts around lines 232 to 242, the function
return type and equality checks are incorrect: change the signature to return
OAuthProviderData | null (remove undefined), replace == with strict === for both
provider and strategy comparisons, and ensure you return null when no match is
found (do not let find return undefined).

Comment on lines +249 to +263
export function sortedOAuthProviders(sortingArray: OAuthStrategy[]) {
return OAUTH_PROVIDERS.slice().sort((a, b) => {
let aPos = sortingArray.indexOf(a.strategy);
if (aPos == -1) {
aPos = Number.MAX_SAFE_INTEGER;
}

let bPos = sortingArray.indexOf(b.strategy);
if (bPos == -1) {
bPos = Number.MAX_SAFE_INTEGER;
}

return aPos - bPos;
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add explicit return type and simplify sentinel logic

Public API should declare explicit return types. Using Infinity reads clearer than Number.MAX_SAFE_INTEGER.

-export function sortedOAuthProviders(sortingArray: OAuthStrategy[]) {
-  return OAUTH_PROVIDERS.slice().sort((a, b) => {
-    let aPos = sortingArray.indexOf(a.strategy);
-    if (aPos == -1) {
-      aPos = Number.MAX_SAFE_INTEGER;
-    }
-
-    let bPos = sortingArray.indexOf(b.strategy);
-    if (bPos == -1) {
-      bPos = Number.MAX_SAFE_INTEGER;
-    }
-
-    return aPos - bPos;
-  });
+export function sortedOAuthProviders(sortingArray: OAuthStrategy[]): OAuthProviderData[] {
+  return [...OAUTH_PROVIDERS].sort((a, b) => {
+    const aPos = sortingArray.indexOf(a.strategy);
+    const bPos = sortingArray.indexOf(b.strategy);
+    return (aPos === -1 ? Infinity : aPos) - (bPos === -1 ? Infinity : bPos);
+  });
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function sortedOAuthProviders(sortingArray: OAuthStrategy[]) {
return OAUTH_PROVIDERS.slice().sort((a, b) => {
let aPos = sortingArray.indexOf(a.strategy);
if (aPos == -1) {
aPos = Number.MAX_SAFE_INTEGER;
}
let bPos = sortingArray.indexOf(b.strategy);
if (bPos == -1) {
bPos = Number.MAX_SAFE_INTEGER;
}
return aPos - bPos;
});
}
export function sortedOAuthProviders(sortingArray: OAuthStrategy[]): OAuthProviderData[] {
return [...OAUTH_PROVIDERS].sort((a, b) => {
const aPos = sortingArray.indexOf(a.strategy);
const bPos = sortingArray.indexOf(b.strategy);
return (aPos === -1 ? Infinity : aPos) - (bPos === -1 ? Infinity : bPos);
});
}
🤖 Prompt for AI Agents
In packages/types/src/runtime-values.ts around lines 249 to 263, add an explicit
return type (e.g., OAuthProvider[] or the correct provider element type used by
OAUTH_PROVIDERS) to the sortedOAuthProviders signature and simplify the sentinel
logic by using Infinity instead of Number.MAX_SAFE_INTEGER; compute positions
with a concise expression like const aPos = (sortingArray.indexOf(a.strategy)
=== -1 ? Infinity : sortingArray.indexOf(a.strategy)) (or call indexOf once into
a temp and map -1 -> Infinity) and do the same for b, then return aPos - bPos.

@nikosdouvlis nikosdouvlis merged commit cda5d7b into main Sep 2, 2025
39 of 40 checks passed
@nikosdouvlis nikosdouvlis deleted the nikos/move-runtime-vals-from-types-to-shared branch September 2, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants