Skip to content
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

Version Packages (alpha-v5) #2308

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Version Packages (alpha-v5) #2308

merged 1 commit into from
Dec 14, 2023

Conversation

clerk-cookie
Copy link
Collaborator

@clerk-cookie clerk-cookie commented Dec 11, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@clerk/[email protected]

Major Changes

  • Remove the named Clerk import from @clerk/backend and import createClerkClient instead. The latter is a factory method that will create a Clerk client instance for you. This aligns usage across our SDKs and will enable us to better ship DX improvements in the future. (#2317) by @tmilewski

    Inside your code, search for occurrences like these:

    import { Clerk } from '@clerk/backend';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from '@clerk/backend';
    const clerk = createClerkClient({ secretKey: '...' });
    • Refactor the authenticateRequest() flow to use the new client handshake endpoint. This replaces the previous "interstitial"-based flow. This should improve performance and overall reliability of Clerk's server-side request authentication functionality. (#2300) by @BRKalow

    • authenticateRequest() now accepts two arguments, a Request object to authenticate and options:

      authenticateRequest(new Request(...), { secretKey: '...' })

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

@clerk/[email protected]

Major Changes

    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

  • Expand the ability for @clerk/chrome-extension WebSSO to sync with host applications which use URL-based session syncing. (#2277) by @tmilewski

    How to Update

    WebSSO Host Permissions:

    Local Development: You must have your explicit development domain added to your manifest.json file in order to use the WebSSO flow.

    Example:

    {
      "host_permissions": [
        // ...
        "http://localhost"
        // ...
      ]
    }

    Production: You must have your explicit Clerk Frontend API domain added to your manifest.json file in order to use the WebSSO flow.

    Example:

    {
      "host_permissions": [
        // ...
        "https://clerk.example.com"
        // ...
      ]
    }

    WebSSO Provider settings:

    <ClerkProvider
      publishableKey={publishableKey}
      routerPush={to => navigate(to)}
      routerReplace={to => navigate(to, { replace: true })}
      syncSessionWithTab
    
      // tokenCache is now storageCache (See below)
      storageCache={/* ... */}
    >

    WebSSO Storage Cache Interface:

    With the prop change from tokenCache to storageCache, the interface has been expanded to allow for more flexibility.

    The new interface is as follows:

    type StorageCache = {
      createKey: (...keys: string[]) => string;
      get: <T = any>(key: string) => Promise<T>;
      remove: (key: string) => Promise<void>;
      set: (key: string, value: string) => Promise<void>;
    };

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

@clerk/[email protected]

Major Changes

  • Drop redirectToHome redirect method in favour of redirectToAfterSignUp or redirectToAfterSignIn. (#2251) by @octoper

    When the <SignIn/> and <SignUp/> components are rendered while a user is already logged in, they will now redirect to the configured afterSignIn and afterSignUp URLs, respectively. Previously, the redirect URL was set to the home URL configured in the dashboard.

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

@clerk/[email protected]

Major Changes

    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

Patch Changes

@clerk/[email protected]

Major Changes

  • (Note: This is only relevant if, in the unlikely case, you are using Clerk from @clerk/fastify directly. If not, you can safely ignore this change.) (#2317) by @tmilewski

    Remove the named Clerk import from @clerk/fastify and import createClerkClient instead. The latter is a factory method to create a Clerk client instance for you. This update aligns usage across our SDKs and will enable us to ship DX improvements better in the future.

    import { Clerk } from '@clerk/fastify';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from '@clerk/fastify';
    const clerk = createClerkClient({ secretKey: '...' });

Patch Changes

[email protected]

Major Changes

  • Remove the named Clerk import from gatsby-plugin-clerk and import createClerkClient instead. The latter is a factory method to create a Clerk client instance for you. This update aligns usage across our SDKs and will enable us to ship DX improvements better in the future. (#2317) by @tmilewski

    Inside your code, search for occurrences like these:

    import { Clerk } from 'gatsby-plugin-clerk';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from 'gatsby-plugin-clerk';
    const clerk = createClerkClient({ secretKey: '...' });
    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

Patch Changes

@clerk/[email protected]

Major Changes

    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

  • (Note: This is only relevant if, in the unlikely case, you are using Clerk from @clerk/nextjs directly. If not, you can safely ignore this change.) (#2317) by @tmilewski

    Remove the named Clerk import from @clerk/nextjs and import createClerkClient instead. The latter is a factory method to create a Clerk client instance for you. This update aligns usage across our SDKs and will enable us to ship DX improvements better in the future.

    import { Clerk } from '@clerk/nextjs';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from '@clerk/nextjs';
    const clerk = createClerkClient({ secretKey: '...' });

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

@clerk/[email protected]

Major Changes

    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

  • Drop redirectToHome redirect method in favour of redirectToAfterSignUp or redirectToAfterSignIn. (#2251) by @octoper

    When the <SignIn/> and <SignUp/> components are rendered while a user is already logged in, they will now redirect to the configured afterSignIn and afterSignUp URLs, respectively. Previously, the redirect URL was set to the home URL configured in the dashboard.

  • Align return types for redirectTo* methods in ClerkJS SDK-1037 by @tmilewski

    Breaking Changes:

    • redirectToUserProfile now returns Promise<unknown> instead of void
    • redirectToOrganizationProfile now returns Promise<unknown> instead of void
    • redirectToCreateOrganization now returns Promise<unknown> instead of void
    • redirectToHome now returns Promise<unknown> instead of void

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

@clerk/[email protected]

Major Changes

    • Introduce @clerk/clerk-react/errors and @clerk/clerk-react/internal subpath exports to expose some internal utilities. Eg (#2328) by @dimkl

      // Before
      import { __internal__setErrorThrowerOptions } from '@clerk/clerk-react';
      // After
      import { setErrorThrowerOptions } from '@clerk/clerk-react/internal';
      
      // Before
      import { isClerkAPIResponseError, isEmailLinkError, isKnownError, isMetamaskError } from '@clerk/clerk-react';
      // After
      import {
        isClerkAPIResponseError,
        isEmailLinkError,
        isKnownError,
        isMetamaskError,
      } from '@clerk/clerk-react/errors';
      
      // Before
      import { MultisessionAppSupport } from '@clerk/clerk-react';
      // After
      import { MultisessionAppSupport } from '@clerk/clerk-react/internal';
    • Drop from the @clerk/clerk-react and all other clerk-react wrapper packages:

      • __internal__setErrorThrowerOptions internal utility (moved to /internal subpath)
      • WithClerkProp type
      • MultisessionAppSupport component (moved to /internal subpath)
      • EmailLinkErrorCode enum
    • Drop StructureContext and related errors to reduce to reduce code complexity since it seems that it was not being used.

    • Drop withUser, WithUser, withClerk HOFs and WithClerk, withSession, WithSession HOCs from the @clerk/clerk-react
      to reduce the export surface since it's trivial to implement if needed.

  • (Note: This is only relevant if, in the unlikely case, you are using Clerk from @clerk/remix directly. If not, you can safely ignore this change.) (#2317) by @tmilewski

    Remove the named Clerk import from @clerk/remix and import createClerkClient instead. The latter is a factory method to create a Clerk client instance for you. This update aligns usage across our SDKs and will enable us to ship DX improvements better in the future.

    import { Clerk } from '@clerk/remix';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from '@clerk/remix';
    const clerk = createClerkClient({ secretKey: '...' });

Patch Changes

@clerk/[email protected]

Major Changes

  • (Note: This is only relevant if, in the unlikely case, you are using Clerk from @clerk/clerk-sdk-node directly. If not, you can safely ignore this change.) (#2317) by @tmilewski

    Remove the named Clerk import from @clerk/clerk-sdk-node and import createClerkClient instead. The latter is a factory method to create a Clerk client instance for you. This update aligns usage across our SDKs and will enable us to ship DX improvements better in the future.

    import { Clerk } from '@clerk/clerk-sdk-node';
    const clerk = Clerk({ secretKey: '...' });

    You need to rename the import from Clerk to createClerkClient and change its usage:

    import { createClerkClient } from '@clerk/clerk-sdk-node';
    const clerk = createClerkClient({ secretKey: '...' });

Patch Changes

@clerk/[email protected]

Major Changes

  • Align return types for redirectTo* methods in ClerkJS SDK-1037 by @tmilewski

    Breaking Changes:

    • redirectToUserProfile now returns Promise<unknown> instead of void
    • redirectToOrganizationProfile now returns Promise<unknown> instead of void
    • redirectToCreateOrganization now returns Promise<unknown> instead of void
    • redirectToHome now returns Promise<unknown> instead of void

Minor Changes

  • Introduce Protect for authorization. (#2170) by @panteliselef

    Changes in public APIs:

    • Rename Gate to Protect
    • Support for permission checks. (Previously only roles could be used)
    • Remove the experimental tags and prefixes
    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.
    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.
    • has will throw an error if neither permission or role is passed.
    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.
      • inside a page or layout file it will render the nearest not-found component set by the developer
      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

  • Adjust ZxcvbnResult interface to use current feedback.warning type as used in the upstream @zxcvbn-ts/core library. (#2326) by @LekoArts

  • Drop redirectToHome redirect method in favour of redirectToAfterSignUp or redirectToAfterSignIn. (#2251) by @octoper

    When the <SignIn/> and <SignUp/> components are rendered while a user is already logged in, they will now redirect to the configured afterSignIn and afterSignUp URLs, respectively. Previously, the redirect URL was set to the home URL configured in the dashboard.

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

  • Add react-dom to peerDependenciesMeta key inside package.json (#2322) by @LekoArts

  • Add useAssertWrappedByClerkProvider to internal code. If you use hooks like useAuth outside of the <ClerkProvider /> context an error will be thrown. For example: (#2299) by @tmilewski

    @clerk/clerk-react: useAuth can only be used within the <ClerkProvider /> component

@nikosdouvlis nikosdouvlis reopened this Dec 13, 2023
@github-actions github-actions bot force-pushed the changeset-release/main branch 19 times, most recently from a917c67 to d7faad4 Compare December 14, 2023 22:15
@dimkl dimkl closed this Dec 14, 2023
@dimkl dimkl reopened this Dec 14, 2023
@dimkl dimkl enabled auto-merge December 14, 2023 23:34
@dimkl dimkl added this pull request to the merge queue Dec 14, 2023
Merged via the queue into main with commit 9869cb8 Dec 14, 2023
8 checks passed
@dimkl dimkl deleted the changeset-release/main branch December 14, 2023 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants