@clerk/upgrade 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +25 -0
  2. package/dist/app.js +136 -0
  3. package/dist/cli.js +50 -0
  4. package/dist/constants/sdks.js +46 -0
  5. package/dist/constants/versions.js +7 -0
  6. package/dist/scan.js +103 -0
  7. package/dist/test.js +100 -0
  8. package/dist/util/expandable-list.js +143 -0
  9. package/dist/util/generate-changelog.js +28 -0
  10. package/dist/util/get-clerk-version.js +7 -0
  11. package/dist/util/guess-framework.js +22 -0
  12. package/dist/util/load-change.js +31 -0
  13. package/dist/util/step-sequencer.js +31 -0
  14. package/dist/util/test.js +100 -0
  15. package/dist/versions/v5/backend/clerk-import.md +15 -0
  16. package/dist/versions/v5/backend/clockskewinseconds.md +7 -0
  17. package/dist/versions/v5/backend/createclerkclient-apikey.md +21 -0
  18. package/dist/versions/v5/backend/createclerkclient-frontendapi.md +21 -0
  19. package/dist/versions/v5/backend/externalaccount-picture.md +0 -0
  20. package/dist/versions/v5/backend/externalaccountjson-avatarurl.md +0 -0
  21. package/dist/versions/v5/backend/getpendingorganizationinvitationlist.md +12 -0
  22. package/dist/versions/v5/backend/organization-logourl.md +0 -0
  23. package/dist/versions/v5/backend/organizationjson-logourl.md +0 -0
  24. package/dist/versions/v5/backend/organizationmembershippublicuserdata-profileimageurl.md +0 -0
  25. package/dist/versions/v5/backend/organizationmembershippublicuserdatajson-profileimageurl.md +0 -0
  26. package/dist/versions/v5/backend/pkgversion.md +0 -0
  27. package/dist/versions/v5/backend/user-profileimageurl.md +0 -0
  28. package/dist/versions/v5/backend/userjson-profileimageurl.md +0 -0
  29. package/dist/versions/v5/chromeExtension/clerkprovider-tokencache.md +26 -0
  30. package/dist/versions/v5/common/api-key-to-secret-key.md +6 -0
  31. package/dist/versions/v5/common/clerkprovider-frontendapi.md +7 -0
  32. package/dist/versions/v5/common/frontend-api-to-publishable-key.md +6 -0
  33. package/dist/versions/v5/common/handlemagiclinkverification.md +7 -0
  34. package/dist/versions/v5/common/ismagiclinkerror.md +7 -0
  35. package/dist/versions/v5/common/magiclinkerror.md +7 -0
  36. package/dist/versions/v5/common/magiclinkerrorcode.md +7 -0
  37. package/dist/versions/v5/common/navigate-to-routerpush-routerreplace.md +16 -0
  38. package/dist/versions/v5/common/setsession.md +32 -0
  39. package/dist/versions/v5/common/usemagiclink.md +7 -0
  40. package/dist/versions/v5/expo/apikey-to-publishable-key.md +6 -0
  41. package/dist/versions/v5/expo/clerkprovider-frontendapi.md +17 -0
  42. package/dist/versions/v5/fastify/api-url-value-change.md +6 -0
  43. package/dist/versions/v5/fastify/clerkplugin-frontendapi.md +17 -0
  44. package/dist/versions/v5/fastify/createclerkclient-apikey.md +17 -0
  45. package/dist/versions/v5/fastify/createclerkclient-frontendapi.md +17 -0
  46. package/dist/versions/v5/gatsby/api-url-value-change.md +6 -0
  47. package/dist/versions/v5/gatsby/apikey-to-publishable-key.md +6 -0
  48. package/dist/versions/v5/gatsby/createclerkclient-apikey.md +17 -0
  49. package/dist/versions/v5/gatsby/createclerkclient-frontendapi.md +17 -0
  50. package/dist/versions/v5/gatsby/withserverauth-return-type.md +43 -0
  51. package/dist/versions/v5/index.js +63 -0
  52. package/dist/versions/v5/js/afterswitchorganizationurl.md +15 -0
  53. package/dist/versions/v5/js/appearance-organizationpreview-organizationswitcher.md +8 -0
  54. package/dist/versions/v5/js/experimental-canusecaptcha.md +6 -0
  55. package/dist/versions/v5/js/experimental-captchasitekey.md +6 -0
  56. package/dist/versions/v5/js/experimental-captchaurl.md +6 -0
  57. package/dist/versions/v5/js/external-account-avatarurl.md +7 -0
  58. package/dist/versions/v5/js/getorganizationmemberships.md +14 -0
  59. package/dist/versions/v5/js/lastorganizationinvitation-member.md +6 -0
  60. package/dist/versions/v5/js/organization-create-string.md +15 -0
  61. package/dist/versions/v5/js/organization-getpendinginvitations.md +14 -0
  62. package/dist/versions/v5/js/organization-logourl.md +7 -0
  63. package/dist/versions/v5/js/redirecttohome.md +13 -0
  64. package/dist/versions/v5/js/signup-attemptweb3walletverification-generatedsignature.md +20 -0
  65. package/dist/versions/v5/js/unstable-invitationupdate.md +6 -0
  66. package/dist/versions/v5/js/unstable-membershipupdate.md +6 -0
  67. package/dist/versions/v5/js/useorganization-invitationlist.md +25 -0
  68. package/dist/versions/v5/js/useorganization-membershiplist.md +24 -0
  69. package/dist/versions/v5/js/useorganizations.md +26 -0
  70. package/dist/versions/v5/js/user-createexternalaccount-redirecturl.md +7 -0
  71. package/dist/versions/v5/js/user-orgpublicdata-profileimageurl.md +7 -0
  72. package/dist/versions/v5/js/user-update-password.md +19 -0
  73. package/dist/versions/v5/js/userprofile-prop.md +7 -0
  74. package/dist/versions/v5/next/api-url-value-change.md +6 -0
  75. package/dist/versions/v5/next/auth-middleware-deprecated.md +10 -0
  76. package/dist/versions/v5/next/authmiddleware-apikey.md +17 -0
  77. package/dist/versions/v5/next/authmiddleware-frontendapi.md +9 -0
  78. package/dist/versions/v5/next/clerk-js-version-next-public.md +8 -0
  79. package/dist/versions/v5/next/createclerkclient-apikey.md +17 -0
  80. package/dist/versions/v5/next/createclerkclient-frontendapi.md +17 -0
  81. package/dist/versions/v5/next/getauth-apikey.md +9 -0
  82. package/dist/versions/v5/next/import-api-url.md +7 -0
  83. package/dist/versions/v5/next/import-api-version.md +7 -0
  84. package/dist/versions/v5/next/import-clerk-js-url.md +7 -0
  85. package/dist/versions/v5/next/import-clerk-js-version.md +7 -0
  86. package/dist/versions/v5/next/import-domain.md +7 -0
  87. package/dist/versions/v5/next/import-is-satellite.md +7 -0
  88. package/dist/versions/v5/next/import-nextjs-api.md +22 -0
  89. package/dist/versions/v5/next/import-nextjs-app-beta.md +10 -0
  90. package/dist/versions/v5/next/import-nextjs-edge-middleware.md +6 -0
  91. package/dist/versions/v5/next/import-nextjs-edge-middlewarefiles.md +6 -0
  92. package/dist/versions/v5/next/import-nextjs-ssr.md +7 -0
  93. package/dist/versions/v5/next/import-proxy-url.md +7 -0
  94. package/dist/versions/v5/next/import-publishable-key.md +7 -0
  95. package/dist/versions/v5/next/import-secret-key.md +7 -0
  96. package/dist/versions/v5/next/import-sign-in-url.md +7 -0
  97. package/dist/versions/v5/next/import-sign-up-url.md +6 -0
  98. package/dist/versions/v5/next/with-clerk-middleware-removed.md +10 -0
  99. package/dist/versions/v5/node/api-url-value-change.md +6 -0
  100. package/dist/versions/v5/node/cjs-esm-instance.md +16 -0
  101. package/dist/versions/v5/node/clerkexpressrequireauth-apikey.md +17 -0
  102. package/dist/versions/v5/node/clerkexpressrequireauth-frontendapi.md +17 -0
  103. package/dist/versions/v5/node/clerkexpresswithauth-apikey.md +17 -0
  104. package/dist/versions/v5/node/clerkexpresswithauth-frontendapi.md +17 -0
  105. package/dist/versions/v5/node/createclerkclient-apikey.md +17 -0
  106. package/dist/versions/v5/node/createclerkclient-frontendapi.md +17 -0
  107. package/dist/versions/v5/node/createclerkexpressrequireauth-apikey.md +17 -0
  108. package/dist/versions/v5/node/createclerkexpressrequireauth-frontendapi.md +17 -0
  109. package/dist/versions/v5/node/createclerkexpresswithauth-apikey.md +17 -0
  110. package/dist/versions/v5/node/createclerkexpresswithauth-frontendapi.md +17 -0
  111. package/dist/versions/v5/node/package-rename.md +6 -0
  112. package/dist/versions/v5/node/setclerkapikey.md +17 -0
  113. package/dist/versions/v5/node/setclerkapiversion.md +17 -0
  114. package/dist/versions/v5/node/setclerkhttpoptions.md +17 -0
  115. package/dist/versions/v5/node/setclerkserverapiurl.md +20 -0
  116. package/dist/versions/v5/react/api-url-value-change.md +6 -0
  117. package/dist/versions/v5/shared/buildrequesturl.md +14 -0
  118. package/dist/versions/v5/shared/organizationcontext.md +7 -0
  119. package/dist/versions/v5/shared/useorganizationlist-organizationlist.md +19 -0
  120. package/package.json +63 -0
@@ -0,0 +1,31 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import matter from 'gray-matter';
4
+ import { fileURLToPath } from 'url';
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ export default function createLoader({
7
+ version,
8
+ baseUrl
9
+ }) {
10
+ return function load(sdk, slugs) {
11
+ // Note: This could benefit perf-wise by being converted to async, but it would
12
+ // make the code a decent amount more complex.
13
+ return slugs.map(slug => {
14
+ const sdkPath = path.join(__dirname, '../versions', `v${version}`, sdk, `${slug}.md`);
15
+ const sharedPath = path.join(__dirname, '../versions', `v${version}`, 'common', `${slug}.md`);
16
+ const loadPath = fs.existsSync(sdkPath) ? sdkPath : sharedPath;
17
+ const content = fs.readFileSync(loadPath, 'utf8');
18
+ const parsed = matter(content);
19
+ const fm = parsed.data;
20
+ return {
21
+ title: fm.title,
22
+ matcher: new RegExp(fm.matcher, `g${fm.matcherFlags ? fm.matcherFlags : ''}`),
23
+ replaceWithString: fm.replaceWithString,
24
+ slug,
25
+ sdk: sdk,
26
+ content: parsed.content,
27
+ link: `${baseUrl}#${slug}`
28
+ };
29
+ });
30
+ };
31
+ }
@@ -0,0 +1,31 @@
1
+ import { useState } from 'react';
2
+
3
+ // This was an attempt to write a function that would clean up the step-by-step
4
+ // nature of the CLI but I couldn't get it working the way I wanted quick enough
5
+ // so shelving it for now.
6
+ export function createStepSequence() {
7
+ const [step, setStep] = useState(0);
8
+ const StepSequence = ({
9
+ children
10
+ }) => {
11
+ const stepToRender = [].concat(children).filter((_, idx) => {
12
+ return idx === step;
13
+ });
14
+ if (!stepToRender.length) return [];
15
+ if (stepToRender[0].props.condition === false) {
16
+ setStep(step + 1);
17
+ } else {
18
+ return stepToRender;
19
+ }
20
+ };
21
+ const Step = ({
22
+ condition,
23
+ children
24
+ }) => {
25
+ return children;
26
+ };
27
+ const nextStep = () => {
28
+ setStep(step + 1);
29
+ };
30
+ return [StepSequence, Step, nextStep];
31
+ }
@@ -0,0 +1,100 @@
1
+ import React, { useReducer, useMemo } from 'react';
2
+ import { Text, Newline, useInput, Box, render } from 'ink';
3
+ function ExpandableList({
4
+ items
5
+ }) {
6
+ // add focused/expanded state on the set of items
7
+ const initialItems = useMemo(() => {
8
+ return items.map((i, idx) => {
9
+ i.focused = idx === 0 ? true : false;
10
+ i.expanded = false;
11
+ return i;
12
+ });
13
+ }, [items]);
14
+
15
+ // set up the focus/expanded state machine
16
+ const [state, dispatch] = useReducer(reducer, initialItems);
17
+
18
+ // this is what lets us respond to keyboard input
19
+ useInput((input, key) => {
20
+ if (key.downArrow) {
21
+ dispatch({
22
+ type: 'focus-next-option'
23
+ });
24
+ }
25
+ if (key.upArrow) {
26
+ dispatch({
27
+ type: 'focus-previous-option'
28
+ });
29
+ }
30
+ if (input === ' ') {
31
+ dispatch({
32
+ type: 'toggle-focused-option'
33
+ });
34
+ }
35
+ });
36
+
37
+ // and here's the actual markup we render for each list item!
38
+ return state.map(item => {
39
+ return /*#__PURE__*/React.createElement(Box, {
40
+ borderStyle: "round",
41
+ flexDirection: "column",
42
+ borderColor: item.focused ? 'blue' : 'white',
43
+ key: item.title
44
+ }, /*#__PURE__*/React.createElement(Text, {
45
+ bold: true
46
+ }, item.title), /*#__PURE__*/React.createElement(Text, null, "Location: ", result.file, ":", result.position.line, ":", result.position.column), item.expanded && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Text, {
47
+ color: "gray"
48
+ }, "changed in ", item.sdk, " SDK"), /*#__PURE__*/React.createElement(Link, {
49
+ url: item.link
50
+ }, /*#__PURE__*/React.createElement(Text, null, "Migration guide entry \xBB")), /*#__PURE__*/React.createElement(Text, null, item.content)));
51
+ });
52
+ }
53
+
54
+ // I'd like to recognize that this logic is kinda crazy, but it works 💖
55
+ function reducer(state, action) {
56
+ // if the current item is focused and a next item exists
57
+ // un-focus it and tee up the next one to be focused
58
+ if (action.type === 'focus-next-option') {
59
+ let nextIdx;
60
+ return state.map((item, idx) => {
61
+ if (item.focused && state[idx + 1]) {
62
+ nextIdx = idx + 1;
63
+ item.focused = false;
64
+ return item;
65
+ }
66
+ if (idx === nextIdx) {
67
+ item.focused = true;
68
+ return item;
69
+ }
70
+ return item;
71
+ });
72
+ }
73
+
74
+ // if the next item is focused, focus this one and tee up the next one to be un-focused
75
+ if (action.type === 'focus-previous-option') {
76
+ let nextIdx;
77
+ return state.map((item, idx) => {
78
+ if (state[idx + 1]?.focused) {
79
+ item.focused = true;
80
+ nextIdx = idx + 1;
81
+ return item;
82
+ }
83
+ if (idx === nextIdx) {
84
+ item.focused = false;
85
+ return item;
86
+ }
87
+ return item;
88
+ });
89
+ }
90
+
91
+ // if the space bar is hit, toggle expand/contract on the currently focused item
92
+ if (action.type === 'toggle-focused-option') {
93
+ return state.map(item => {
94
+ if (item.focused) {
95
+ item.expanded = !item.expanded;
96
+ }
97
+ return item;
98
+ });
99
+ }
100
+ }
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: '`Clerk` -> `createClerkClient`'
3
+ matcher: "import\\s+{[\\s\\S]*?Clerk[\\s\\S]*?}\\s+from\\s+['\"]@clerk/backend['\"]"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The top level `Clerk` import was renamed to `createClerkClient`. This is just a name change and can be treated as a text replacement, no changes to the params or return types.
8
+
9
+ ```js
10
+ // before
11
+ import { Clerk } from '@clerk/backend';
12
+
13
+ // after
14
+ import { createClerkClient } from '@clerk/backend';
15
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`clockSkewInSeconds` -> `clockSkewInMs`'
3
+ matcher: 'clockSkewInSeconds'
4
+ replaceWithString: 'clockSkewInMs'
5
+ ---
6
+
7
+ The value stayed the same, only the name changed.
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: '`apiKey` -> `secretKey` as param to createClerkClient'
3
+ matcher: "[createClerkClient|Clerk]\\(\\s*{[\\s\\S]*?frontendApi:[\\s\\S]*?\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`. Also note that the import value has changed for creating a new Clerk client, which will be addressed by a separate line item if relevant to your codebase.
8
+
9
+ ```js
10
+ // before
11
+ import { Clerk } from '@clerk/backend';
12
+
13
+ const clerkClient = Clerk({ apiKey: '...' });
14
+ clerkClient.authenticateRequest({ apiKey: '...' });
15
+
16
+ // after
17
+ import { createClerkClient } from '@clerk/backend';
18
+
19
+ const clerkClient = createClerkClient({ secretKey: '...' });
20
+ clerkClient.authenticateRequest({ secretKey: '...' });
21
+ ```
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as param to createClerkClient'
3
+ matcher: "[createClerkClient|Clerk]\\(\\s*{[\\s\\S]*?frontendApi:[\\s\\S]*?\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard. Also note that the import value has changed for creating a new Clerk client, which will be addressed by a separate line item if relevant to your codebase.
8
+
9
+ ```js
10
+ // before
11
+ import { Clerk } from '@clerk/backend';
12
+
13
+ const clerkClient = Clerk({ frontendApi: '...' });
14
+ clerkClient.authenticateRequest({ frontendApi: '...' });
15
+
16
+ // after
17
+ import { createClerkClient } from '@clerk/backend';
18
+
19
+ const clerkClient = createClerkClient({ publishableKey: '...' });
20
+ clerkClient.authenticateRequest({ publishableKey: '...' });
21
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: '`getPendingOrganizationInvitationList` -> `getOrganizationInvitationList`'
3
+ matcher: 'getPendingOrganizationInvitationList'
4
+ replaceWithString: 'getOrganizationInvitationList'
5
+ ---
6
+
7
+ Use `getOrganizationInvitationList` with a `status` option instead.
8
+
9
+ ```diff
10
+ - getPendingOrganizationInvitationList({ organizationId: "" })
11
+ + getOrganizationInvitationList({ organizationId: "", status: "pending" })
12
+ ```
File without changes
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: '`tokenCache` -> `storageCache` as `<ClerkProvider>` props'
3
+ matcher: "<ClerkProvider[\\s\\S]*?tokenCache=[\\s\\S]*?>"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `tokenCache` prop has been renamed to `storageCache` in order to accomodate the new [WebSSO feature](https://github.com/clerk/javascript/pull/2277). With the prop change from `tokenCache` to `storageCache`, the interface has been expanded to allow for more flexibility. The new interface is as follows:
8
+
9
+ ```ts
10
+ type StorageCache = {
11
+ createKey: (...keys: string[]) => string;
12
+ get: <T = any>(key: string) => Promise<T>;
13
+ remove: (key: string) => Promise<void>;
14
+ set: (key: string, value: string) => Promise<void>;
15
+ };
16
+ ```
17
+
18
+ And here's a full before/after example:
19
+
20
+ ```jsx
21
+ // before
22
+ <ClerkProvider tokenCache={/* ... */}>
23
+
24
+ // after
25
+ <ClerkProvider storageCache={/* ... */}>
26
+ ```
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`CLERK_API_KEY` replaced by `CLERK_SECRET_KEY`'
3
+ matcher: '[^_]CLERK_API_KEY'
4
+ ---
5
+
6
+ The `CLERK_API_KEY` environment variable was renamed to `CLERK_SECRET_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production).
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as prop to `ClerkProvider`'
3
+ matcher: "<ClerkProvider[\\s\\S]*?frontendApi=[\\s\\S]*?>"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` prop passed to `<ClerkProvider>` was renamed to `publishableKey`. **Note:** The values are different, so this is not just a key replacement. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). [More information](/docs/deployments/overview#api-keys-and-environment-variables).
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`CLERK_FRONTEND_API` replaced by `CLERK_PUBLISHABLE_KEY`'
3
+ matcher: '[^_]CLERK_FRONTEND_API'
4
+ ---
5
+
6
+ The `CLERK_FRONTEND_API` environment variable was renamed to `CLERK_PUBLISHABLE_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). **Note:** The values are different, so this is not just a key replacement. [More information](/docs/deployments/overview#api-keys-and-environment-variables).
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`handleMagicLinkVerification` -> `handleEmailLinkVerification`'
3
+ matcher: 'handleMagicLinkVerification'
4
+ replaceWithString: 'handleMagicLinkVerification'
5
+ ---
6
+
7
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`isMagicLinkError` -> `isEmailLinkError`'
3
+ matcher: 'isMagicLinkError'
4
+ replaceWithString: 'isEmailLinkError'
5
+ ---
6
+
7
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`MagicLinkError` -> `EmailLinkError`'
3
+ matcher: 'MagicLinkError'
4
+ replaceWithString: 'EmailLinkError'
5
+ ---
6
+
7
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`MagicLinkErrorCode` -> `EmailLinkErrorCode`'
3
+ matcher: 'MagicLinkErrorCode'
4
+ replaceWithString: 'EmailLinkErrorCode'
5
+ ---
6
+
7
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: '`navigate` prop replaced by `routerPush` and `routerReplace`'
3
+ matcher: "<ClerkProvider[\\s\\S]*?navigate=[\\s\\S]*?>"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `navigate` prop on `<ClerkProvider>` allowed developers to override the default navigation behavior with a custom function. However, `navigate` was only able to push, not replace routes. The router is now able to do both, and as such, the props for `<ClerkProvider>` were updated. The `routerPush` and `routerReplace` props replace the old `navigate` prop.
8
+
9
+ For more information on what push and replace mean in relation to the browser history api, check out the ["Working with the History API"](https://developer.mozilla.org/en-US/docs/Web/API/History_API/Working_with_the_History_API) docs.
10
+
11
+ If you’d like to keep the same behavior as you had with the single `navigate` prop, pass the exact same function to both `routerPush` and `routerReplace`. For example:
12
+
13
+ ```diff
14
+ - <ClerkProvider navigate={x => x} />
15
+ + <ClerkProvider routerPush={x => x} routerReplace={x => x} />
16
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: '`setSession` -> `setActive`'
3
+ matcher: 'setSession'
4
+ ---
5
+
6
+ `setSession` should be replaced with `setActive`. The format of the parameters has changed slightly - `setActive` takes an object where `setSession` took params directly. The `setActive` function also can accept an `organization` param that is used to set the currently active organization. The return signature did not change. Read the [API documentation](/docs/references/javascript/clerk/session-methods#set-active) for more detail. This function should be expected to be returned from one of the following Clerk hooks: `useSessionList`, `useSignUp`, or `useSignIn`. Some migration examples:
7
+
8
+ ```diff
9
+ - await setSession('sessionID', () => void)
10
+ + await setActive({ session: 'sessionID', beforeEmit: () => void })
11
+
12
+ - await setSession(sessionObj)
13
+ + await setActive({ session: sessionObj })
14
+
15
+ - await setSession(sessionObj, () => void)
16
+ + await setActive({ session: sessionObj, beforeEmit: () => void })
17
+ ```
18
+
19
+ `setActive` also supports setting an active organization:
20
+
21
+ ```js
22
+ await setActive({
23
+ session: 'sessionID',
24
+ organization: 'orgID',
25
+ beforeEmit: () => void
26
+ })
27
+ await setActive({
28
+ session: sessionObj,
29
+ organization: orgObj,
30
+ beforeEmit: () => void
31
+ })
32
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`useMagicLink` -> `useEmailLink`'
3
+ matcher: 'useMagicLink'
4
+ replaceWithString: 'useEmailLink'
5
+ ---
6
+
7
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`CLERK_FRONTEND_API` replaced by `CLERK_PUBLISHABLE_KEY`'
3
+ matcher: '[^_]CLERK_FRONTEND_API'
4
+ ---
5
+
6
+ If you are using a `CLERK_FRONTEND_API` environment variable, the name must be changed to `CLERK_PUBLISHABLE_KEY` instead. Note that the values are different as well, so this is not just a key replacement. You can find the publishable key in your Clerk dashboard. Make sure you do this in both your dev and production environments.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as prop to `ClerkProvider`'
3
+ matcher: "<ClerkProvider[\\s\\S]*?frontendApi=[\\s\\S]*?>"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` prop passed to `ClerkProvider` must be changed to `publishableKey`. The value also must be updated to be a publishable key rather than a frontend API key, [here’s more information on how to do this](TODO)
8
+
9
+ ```js
10
+ import { ClerkProvider } from '@clerk/clerk-expo';
11
+
12
+ // before
13
+ <ClerkProvider frontendApi='...' />
14
+
15
+ // after
16
+ <ClerkProvider publishableKey='...' />
17
+ ```
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`API_URL` value has changed'
3
+ matcher: "API_URL.*?from\\s['\"]@clerk\\/fastify\\/constants['\"]"
4
+ ---
5
+
6
+ The value of this export has changed from `https://api.clerk.dev` to `https://api.clerk.com`. If you were relying on the text content of this value not changing, you may need to make adjustments.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as param to clerkPlugin'
3
+ matcher: "fastify\\.register\\(clerkPlugin,.*?{.*?frontendApi:.*?}\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` argument passed to `clerkPlugin` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
8
+
9
+ ```js
10
+ import { clerkPlugin } from '@clerk/fastify';
11
+
12
+ // before
13
+ fastify.register(clerkPlugin, { frontendApi: '...' });
14
+
15
+ // after
16
+ fastify.register(clerkPlugin, { publishableKey: '...' });
17
+ ```
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`apiKey` -> `secretKey` as param to createClerkClient'
3
+ matcher: "createClerkClient\\({.*?apiKey:.*?}\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
8
+
9
+ ```js
10
+ import { createClerkClient } from '@clerk/fastify';
11
+
12
+ // before
13
+ createClerkClient({ apiKey: '...' });
14
+
15
+ // after
16
+ createClerkClient({ secretKey: '...' });
17
+ ```
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as param to createClerkClient'
3
+ matcher: "createClerkClient\\({.*?frontendApi:.*?}\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
8
+
9
+ ```js
10
+ import { createClerkClient } from '@clerk/fastify';
11
+
12
+ // before
13
+ createClerkClient({ frontendApi: '...' });
14
+
15
+ // after
16
+ createClerkClient({ publishableKey: '...' });
17
+ ```
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`API_URL` value has changed'
3
+ matcher: "API_URL.*?from\\s['\"]gatsby-plugin-clerk\\/constants['\"]"
4
+ ---
5
+
6
+ - The value of this export has changed from `https://api.clerk.dev` to `https://api.clerk.com`. If you were relying on the text content of this value not changing, you may need to make adjustments.
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`GASTBY_CLERK_FRONTEND_API` replaced by `GATSBY_CLERK_PUBLISHABLE_KEY`'
3
+ matcher: '[^_]GATSBY_CLERK_FRONTEND_API'
4
+ ---
5
+
6
+ If you are using a `GATSBY_CLERK_FRONTEND_API` environment variable, the name must be changed to `GATSBY_CLERK_PUBLISHABLE_KEY` instead. Note that the values are different as well, so this is not just a key replacement. You can find the publishable key in your Clerk dashboard. Make sure you do this in both your dev and production environments.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`apiKey` -> `secretKey` as param to createClerkClient'
3
+ matcher: "createClerkClient\\({.*?apiKey:.*?}\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
8
+
9
+ ```js
10
+ import { createClerkClient } from 'gatsby-plugin-clerk/api';
11
+
12
+ // before
13
+ createClerkClient({ apiKey: '...' });
14
+
15
+ // after
16
+ createClerkClient({ secretKey: '...' });
17
+ ```
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: '`frontendApi` -> `publishableKey` as param to createClerkClient'
3
+ matcher: "createClerkClient\\({.*?frontendApi:.*?}\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
8
+
9
+ ```js
10
+ import { createClerkClient } from 'gatsby-plugin-clerk/api';
11
+
12
+ // before
13
+ createClerkClient({ frontendApi: '...' });
14
+
15
+ // after
16
+ createClerkClient({ publishableKey: '...' });
17
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ title: '`withServerAuth` props.auth return type changed'
3
+ matcher: "withServerAuth\\("
4
+ ---
5
+
6
+ When utilizing the `withServerAuth` helper in Gatsby, it expects a callback function that is called with props from Clerk internals. The `.auth` property on the returned object from the callback has seen a substantial change in its return type. Note specifically that the property `auth.claims` was changed to `auth.sessionClaims` in addition to the other typing changes. A full example of how this looks and how the types differ can be seen below:
7
+
8
+ ```js
9
+ import { withServerAuth } from 'gatsby-plugin-clerk/ssr';
10
+
11
+ export const getServerData: GetServerData<any> = withServerAuth(async props => {
12
+ return { props: { data: '1', auth: props.auth } };
13
+ });
14
+ // props.auth : v4 exported type
15
+ /*
16
+ {
17
+ sessionId: string | null;
18
+ userId: string | null;
19
+ actor: ActJWTClaim | null;
20
+ getToken: ServerGetToken;
21
+ claims: ClerkJWTClaims | null;
22
+ };
23
+ */
24
+
25
+ // props.auth : v5 exported type
26
+ /*
27
+ {
28
+ sessionClaims: JwtPayload;
29
+ sessionId: string | null;
30
+ session: Session | undefined | null;
31
+ actor: ActClaim | undefined | null;
32
+ userId: string | null;
33
+ user: User | undefined | null;
34
+ orgId: string | undefined | null;
35
+ orgRole: string | undefined | null;
36
+ orgSlug: string | undefined | null;
37
+ organization: Organization | undefined | null;
38
+ getToken: ServerGetToken;
39
+ experimental__has: experimental__CheckAuthorizationWithoutPermission;
40
+ debug: AuthObjectDebug;
41
+ };
42
+ */
43
+ ```