refactor(js): extract key derivation into a KeyResolver#9032
Conversation
Lift TokenCacheKeyJSON and the prefix::tokenId::audience serialization out of tokenCache.ts into core/keyResolver.ts (createKeyResolver), so the cache and store layers deal only in opaque string keys. No behavioral change; audience stays a key dimension (currently unused by production). Drops the dead TokenCacheKey.fromKey parser, which had no callers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: fd6e335 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
📝 WalkthroughWalkthroughExtracts token cache key construction into ChangesKey Resolver Extraction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
Step 3 of the TokenCache decouple (SDK-117 landed steps 1-2). This lifts the
prefix::tokenId::audiencekey construction out oftokenCache.tsinto a smallcreateKeyResolvermodule, so the cache and store layers only pass opaque string keys around. The serialization moves verbatim, so there's no behavior change; the existing audience/coalescing tests intokenCache.test.tsand theSessionconsumer suite are the regression bar and stay green.One judgment call worth a look: I dropped
TokenCacheKey.fromKey(the string-to-object parser) instead of porting it into the new module. It had zero callers repo-wide, so this removes dead code rather than relocating it. Trivial to add back if SDK-141's cross-tab coordinator ends up needing to parse a stored key.audiencestays a key dimension (nothing in production sets it today) with the empty-string/undefined coalescing preserved. Shipped as aclerk-jspatch so the refactor shows up in the changelog, though it is internal-only with no observable change.Closes SDK-139.
Summary by CodeRabbit
New Features
Bug Fixes
Tests