New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(backend,nextjs): Revert { data, errors }
return values to v4 format for clerkClient methods and jwt/token helpers
#2633
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change will make all the BackendAPI methods to either return the value or throw error instead of returning `{ data, errors }`. We also (temporarily) added the `totalCount` property when we expect an array of resources to allow passing the `total_count` of paginated responses from the response body to the return value.
…elpers The following helpers were reverted to return their `data` or throw an error. Internally we will keep the `{ data, errors }` format but added a compatibility layer to avoid exposing this breaking change: - `import { verifyToken } from '@clerk/backend'` - `import { signJwt, hasValidSignature, decodeJwt, verifyJwt } from '@clerk/backend/jwt'`
… value compat layer
🦋 Changeset detectedLatest commit: fbd13ce The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 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 |
nikosdouvlis
approved these changes
Jan 19, 2024
nikosdouvlis
force-pushed
the
revert-data-errors-format
branch
from
January 19, 2024 01:46
1f72fae
to
9fc0ee1
Compare
nikosdouvlis
approved these changes
Jan 19, 2024
…stead of an array
nikosdouvlis
force-pushed
the
revert-data-errors-format
branch
from
January 19, 2024 01:56
9fc0ee1
to
fbd13ce
Compare
This was referenced Jan 19, 2024
BRKalow
pushed a commit
that referenced
this pull request
Jan 19, 2024
…rmat for clerkClient methods and jwt/token helpers (#2633) * fix(backend): Make signJwt consistent by returning error instead of throwing * fix(backend): Revert `{ data, errors }` return value from api client This change will make all the BackendAPI methods to either return the value or throw error instead of returning `{ data, errors }`. We also (temporarily) added the `totalCount` property when we expect an array of resources to allow passing the `total_count` of paginated responses from the response body to the return value. * fix(backend): Revert `{ data, errors }` return value from jwt/token helpers The following helpers were reverted to return their `data` or throw an error. Internally we will keep the `{ data, errors }` format but added a compatibility layer to avoid exposing this breaking change: - `import { verifyToken } from '@clerk/backend'` - `import { signJwt, hasValidSignature, decodeJwt, verifyJwt } from '@clerk/backend/jwt'` * fix(nextjs): Apply changes related to adding legacy return value compat layer * fix(clerk-sdk-node): Update examples related to backend legacy return value compat layer * chore(repo): Add changeset * feat(backend): Paginated responses now return { data, totalCount } instead of an array --------- Co-authored-by: Nikos Douvlis <nikosdouvlis@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Revert changing the
{ data, errors }
return value of the following helpers. Instead those helpers return the values or throw error (same behaviour with v4):import { verifyToken } from '@clerk/backend'
import { signJwt, hasValidSignature, decodeJwt, verifyJwt } from '@clerk/backend/jwt'
clerkClient
methods eg (clerkClient.users.getUserList(...)
)Also fixed the following BAPI methods to return the correct PaginatedResources. This is a breaking change and converts the return value of the following methods from
T[]
to{ data: T[], totalCount: number }
:clerkClient.users.getOrganizationMembershipList(...)
clerkClient.organization.getOrganizationList(...)
clerkClient.organization.getOrganizationInvitationList(...)
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore