@clerk/upgrade 0.0.2 → 0.1.0

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 (182) hide show
  1. package/dist/app.js +10 -2
  2. package/dist/cli.js +15 -6
  3. package/dist/img/alternativemethods-backlink.png +0 -0
  4. package/dist/img/button-to-organizationlistcreateorganizationactionbutton.png +0 -0
  5. package/dist/img/connected-accounts-dropdown.png +0 -0
  6. package/dist/img/mfa-dropdown.png +0 -0
  7. package/dist/img/organizationprofile-settings.png +0 -0
  8. package/dist/img/remove-identitypreview-avatar.png +0 -0
  9. package/dist/img/remove-socialbuttonsblockbuttonarrow.png +0 -0
  10. package/dist/img/userbuttonpopoveractionbuttontext-removed.png +0 -0
  11. package/dist/img/userprofile-security.png +0 -0
  12. package/dist/scan.js +50 -23
  13. package/dist/util/expandable-list.js +12 -5
  14. package/dist/util/generate-export-change.js +10 -0
  15. package/dist/util/guess-framework.js +8 -3
  16. package/dist/util/load-change.js +2 -1
  17. package/dist/versions/v5/backend/api-url-value-changed.md +7 -0
  18. package/dist/versions/v5/backend/authenticaterequest-params-change.md +12 -0
  19. package/dist/versions/v5/backend/buildrequesturl-removed.md +7 -0
  20. package/dist/versions/v5/backend/clerk-import.md +2 -2
  21. package/dist/versions/v5/backend/client-unstableoptions-removed.md +15 -0
  22. package/dist/versions/v5/backend/clockskewinseconds.md +10 -2
  23. package/dist/versions/v5/backend/constants-import-path-move.md +13 -0
  24. package/dist/versions/v5/backend/createauthenticaterequest-import-path-move.md +13 -0
  25. package/dist/versions/v5/backend/createclerkclient-apikey.md +8 -11
  26. package/dist/versions/v5/backend/createclerkclient-frontendapi.md +7 -10
  27. package/dist/versions/v5/backend/createemail-removed.md +7 -0
  28. package/dist/versions/v5/backend/createisomorphicrequest-import-path-move.md +13 -0
  29. package/dist/versions/v5/backend/createisomorphicrequest-removed.md +13 -0
  30. package/dist/versions/v5/backend/decodeJwt-import-path-move.md +13 -0
  31. package/dist/versions/v5/backend/externalaccount-picture.md +6 -0
  32. package/dist/versions/v5/backend/externalaccountjson-avatarurl.md +6 -0
  33. package/dist/versions/v5/backend/getorganizationinvitationlist-return-signature.md +14 -0
  34. package/dist/versions/v5/backend/getorganizationlist-return-signature.md +14 -0
  35. package/dist/versions/v5/backend/getorganizationmembershiplist-return-signature.md +14 -0
  36. package/dist/versions/v5/backend/getpendingorganizationinvitationlist.md +5 -5
  37. package/dist/versions/v5/backend/httpoptions-removed.md +15 -0
  38. package/dist/versions/v5/backend/membershiprole.md +21 -0
  39. package/dist/versions/v5/backend/organization-logourl.md +6 -0
  40. package/dist/versions/v5/backend/organizationjson-logourl.md +6 -0
  41. package/dist/versions/v5/backend/organizationmembershippublicuserdata-profileimageurl.md +6 -0
  42. package/dist/versions/v5/backend/organizationmembershippublicuserdatajson-profileimageurl.md +6 -0
  43. package/dist/versions/v5/backend/pkgversion.md +15 -0
  44. package/dist/versions/v5/backend/redirect-import-path-move.md +13 -0
  45. package/dist/versions/v5/backend/return-signature-change.md +14 -0
  46. package/dist/versions/v5/backend/signjwt-import-path-move +0 -0
  47. package/dist/versions/v5/backend/signjwt-import-path-move.md +13 -0
  48. package/dist/versions/v5/backend/signjwterror-import-move.md +13 -0
  49. package/dist/versions/v5/backend/tokenverificationerror-import-move.md +13 -0
  50. package/dist/versions/v5/backend/tokenverificationerroraction-import-move.md +13 -0
  51. package/dist/versions/v5/backend/tokenverificationerrorcode-import-move.md +13 -0
  52. package/dist/versions/v5/backend/tokenverificationerrorreason-import-move.md +13 -0
  53. package/dist/versions/v5/backend/user-profileimageurl.md +6 -0
  54. package/dist/versions/v5/backend/userjson-profileimageurl.md +6 -0
  55. package/dist/versions/v5/backend/verifyjwt-import-path-move.md +13 -0
  56. package/dist/versions/v5/common/aftersigninouturl-behavior-change.md +7 -0
  57. package/dist/versions/v5/common/aftersigninurl-behavior-change +7 -0
  58. package/dist/versions/v5/common/aftersigninurl-behavior-change-2.md +7 -0
  59. package/dist/versions/v5/common/aftersigninurl-behavior-change.md +7 -0
  60. package/dist/versions/v5/common/aftersignouturl-behavior-change.md +7 -0
  61. package/dist/versions/v5/common/aftersignupurl-behavior-change.md +7 -0
  62. package/dist/versions/v5/common/afterswitchorganizationurl.md +16 -0
  63. package/dist/versions/v5/common/alternativemethods-backlink.md +18 -0
  64. package/dist/versions/v5/common/api-key-to-secret-key.md +1 -1
  65. package/dist/versions/v5/common/appearance-organizationpreview-organizationswitcher.md +8 -0
  66. package/dist/versions/v5/common/button-to-organizationlistcreateorganizationactionbutton.md +11 -0
  67. package/dist/versions/v5/common/card-changes.md +14 -0
  68. package/dist/versions/v5/common/changed-localization-keys.md +179 -0
  69. package/dist/versions/v5/common/clerkprovider-frontendapi-2.md +7 -0
  70. package/dist/versions/v5/common/clerkprovideroptionswrapper-dropped.md +6 -0
  71. package/dist/versions/v5/common/connected-accounts-dropdown.md +15 -0
  72. package/dist/versions/v5/common/emaillinkerrorcode-import-change.md +13 -0
  73. package/dist/versions/v5/common/external-account-avatarurl.md +7 -0
  74. package/dist/versions/v5/common/frontend-api-to-publishable-key.md +1 -1
  75. package/dist/versions/v5/common/isclerkapiresponserror-import-change.md +13 -0
  76. package/dist/versions/v5/common/isemaillinkerror-import-change.md +13 -0
  77. package/dist/versions/v5/common/isknownerror-import-change.md +13 -0
  78. package/dist/versions/v5/common/ismetamaskerror-import-change.md +13 -0
  79. package/dist/versions/v5/common/mfa-dropdown.md +11 -0
  80. package/dist/versions/v5/common/multi-session-ui-changes.md +0 -0
  81. package/dist/versions/v5/common/multisessionappsupport-import-change.md +12 -0
  82. package/dist/versions/v5/common/new-localization-keys.md +133 -0
  83. package/dist/versions/v5/common/organization-getdomains-arguments-change.md +20 -0
  84. package/dist/versions/v5/common/organization-getmembershiprequests-arguments-changed.md +20 -0
  85. package/dist/versions/v5/common/organization-getroles-arguments-changed.md +20 -0
  86. package/dist/versions/v5/common/organization-getroles-return-type.md +0 -0
  87. package/dist/versions/v5/common/organizationprofile-general.md +0 -0
  88. package/dist/versions/v5/common/organizationprofile-settings.md +12 -0
  89. package/dist/versions/v5/common/organizationswitcherpopoveractionbuttontext-removed.md +14 -0
  90. package/dist/versions/v5/common/remove-identitypreview-avatar.md +12 -0
  91. package/dist/versions/v5/common/remove-socialbuttonsblockbuttonarrow.md +10 -0
  92. package/dist/versions/v5/common/removed-localization-keys.md +166 -0
  93. package/dist/versions/v5/common/signoutcallback-to-redirecturl.md +22 -0
  94. package/dist/versions/v5/common/useorganization-invitationlist.md +25 -0
  95. package/dist/versions/v5/common/useorganization-membershiplist.md +25 -0
  96. package/dist/versions/v5/common/useorganizations.md +26 -0
  97. package/dist/versions/v5/common/userbuttonpopoveractionbuttontext-removed.md +14 -0
  98. package/dist/versions/v5/common/userbuttonpopoveractionbuttontext.md +7 -0
  99. package/dist/versions/v5/common/userbuttontrigger-userbuttonbox-invert.md +12 -0
  100. package/dist/versions/v5/common/userprofile-prop.md +8 -0
  101. package/dist/versions/v5/common/userprofile-security.md +8 -0
  102. package/dist/versions/v5/common/withclerk-hof-removed.md +29 -0
  103. package/dist/versions/v5/common/withclerk-removed.md +16 -0
  104. package/dist/versions/v5/common/withsession-hof-removed.md +29 -0
  105. package/dist/versions/v5/common/withsession-removed.md +16 -0
  106. package/dist/versions/v5/common/withuser-hof-removed.md +29 -0
  107. package/dist/versions/v5/common/withuser-removed-2.md +18 -0
  108. package/dist/versions/v5/common/withuser-removed.md +16 -0
  109. package/dist/versions/v5/expo/apikey-to-publishable-key.md +1 -1
  110. package/dist/versions/v5/gatsby/apikey-to-publishable-key.md +1 -1
  111. package/dist/versions/v5/index.js +12 -31
  112. package/dist/versions/v5/js/aftersigninout-behavior-change.md +7 -0
  113. package/dist/versions/v5/js/aftersigninouturl-behavior-change.md +7 -0
  114. package/dist/versions/v5/js/aftersigninurl-behavior-change.md +0 -0
  115. package/dist/versions/v5/js/clerk-isready-removed.md +6 -0
  116. package/dist/versions/v5/js/lastorganizationinvitation-member.md +1 -1
  117. package/dist/versions/v5/js/organization-getdomains-arguments-change.md +20 -0
  118. package/dist/versions/v5/js/organization-getinvitations-arguments-changed.md +20 -0
  119. package/dist/versions/v5/js/organization-getmembershiprequests-arguments-changed.md +20 -0
  120. package/dist/versions/v5/js/organization-getmemberships-arguments-changed.md +20 -0
  121. package/dist/versions/v5/js/organization-getroles-arguments-changed.md +20 -0
  122. package/dist/versions/v5/js/user-getorganizationinvitations-arguments-chanaged.md +20 -0
  123. package/dist/versions/v5/js/user-getorganizationmemberships-arguments-chanaged +0 -0
  124. package/dist/versions/v5/js/user-getorganizationmemberships-arguments-chanaged.md +20 -0
  125. package/dist/versions/v5/js/user-getorganizationsuggestions-arguments-chanaged.md +20 -0
  126. package/dist/versions/v5/next/api-url-value-change.md +1 -0
  127. package/dist/versions/v5/next/auth-import-change.md +13 -0
  128. package/dist/versions/v5/next/auth-middleware-deprecated.md +43 -4
  129. package/dist/versions/v5/next/authmiddleware-import-change.md +13 -0
  130. package/dist/versions/v5/next/buildclerkprops-import-change.md +13 -0
  131. package/dist/versions/v5/next/clerk-import-change.md +12 -0
  132. package/dist/versions/v5/next/clerk-js-version-next-public.md +1 -1
  133. package/dist/versions/v5/next/constants-import-change.md +13 -0
  134. package/dist/versions/v5/next/createauthenticaterequest-import-change.md +13 -0
  135. package/dist/versions/v5/next/createisomorphicrequest-import-change.md +13 -0
  136. package/dist/versions/v5/next/currentuser-import-change.md +13 -0
  137. package/dist/versions/v5/next/decodejwt-import-change.md +13 -0
  138. package/dist/versions/v5/next/emaillinkerrorcode-import-change.md +13 -0
  139. package/dist/versions/v5/next/import-api-url.md +1 -1
  140. package/dist/versions/v5/next/import-api-version.md +1 -1
  141. package/dist/versions/v5/next/import-clerk-js-url.md +1 -1
  142. package/dist/versions/v5/next/import-clerk-js-version.md +1 -1
  143. package/dist/versions/v5/next/import-domain.md +1 -1
  144. package/dist/versions/v5/next/import-is-satellite.md +1 -1
  145. package/dist/versions/v5/next/import-proxy-url.md +1 -1
  146. package/dist/versions/v5/next/import-publishable-key.md +1 -1
  147. package/dist/versions/v5/next/import-secret-key.md +1 -1
  148. package/dist/versions/v5/next/import-sign-in-url.md +1 -1
  149. package/dist/versions/v5/next/import-sign-up-url.md +2 -1
  150. package/dist/versions/v5/next/isclerkapiresponserror-import-change.md +13 -0
  151. package/dist/versions/v5/next/isemaillinkerror-import-change.md +13 -0
  152. package/dist/versions/v5/next/isknownerror-import-change.md +13 -0
  153. package/dist/versions/v5/next/ismetamaskerror-import-change.md +13 -0
  154. package/dist/versions/v5/next/multisessionappsupport-import-change.md +13 -0
  155. package/dist/versions/v5/next/next-public-clerk-js-url.md +6 -0
  156. package/dist/versions/v5/next/redirect-import-change.md +13 -0
  157. package/dist/versions/v5/next/signjwt-import-change.md +13 -0
  158. package/dist/versions/v5/next/verify +0 -0
  159. package/dist/versions/v5/next/verifyjwt-import-change.md +13 -0
  160. package/dist/versions/v5/next/verifytoken-import-change.md +13 -0
  161. package/dist/versions/v5/next/withclerk-removed.md +15 -0
  162. package/dist/versions/v5/next/withsession-removed.md +15 -0
  163. package/dist/versions/v5/next/withuser-removed.md +0 -0
  164. package/dist/versions/v5/node/legacyauthobject-removed.md +26 -0
  165. package/dist/versions/v5/react/afterswitchorganizationurl.md +15 -0
  166. package/dist/versions/v5/react/appearance-organizationpreview-organizationswitcher.md +8 -0
  167. package/dist/versions/v5/react/router-navigate.md +18 -0
  168. package/dist/versions/v5/react/signoutcallback-to- +0 -0
  169. package/dist/versions/v5/react/signoutcallback-to-redirecturl.md +22 -0
  170. package/dist/versions/v5/react/useorganization-invitationlist.md +25 -0
  171. package/dist/versions/v5/react/useorganization-membershiplist.md +24 -0
  172. package/dist/versions/v5/react/useorganizations.md +26 -0
  173. package/dist/versions/v5/react/userprofile-prop.md +7 -0
  174. package/dist/versions/v5/remix/clerkerrorboundary-removed.md +22 -0
  175. package/dist/versions/v5/remix/clerkprovider-frontendapi.md +0 -0
  176. package/dist/versions/v5/remix/createclerkclient-apikey.md +14 -0
  177. package/dist/versions/v5/remix/getauth-apikey.md +16 -0
  178. package/dist/versions/v5/remix/rootauthloader-apikey.md +14 -0
  179. package/dist/versions/v5/remix/rootauthloader-frontendapi.md +14 -0
  180. package/dist/versions/v5/shared/buildrequesturl.md +6 -8
  181. package/dist/versions/v5/shared/getrequesturl.md +6 -0
  182. package/package.json +1 -1
package/dist/app.js CHANGED
@@ -13,8 +13,11 @@ export default function App({
13
13
  _toVersion,
14
14
  _sdk,
15
15
  _dir = false,
16
- _ignore = []
16
+ _ignore = [],
17
+ _yolo = false,
18
+ noWarnings = false
17
19
  }) {
20
+ const [yolo, setYolo] = useState(_yolo);
18
21
  const [sdks, setSdks] = useState(_sdk ? [_sdk] : []);
19
22
  const [sdkGuesses, setSdkGuesses] = useState([]);
20
23
  const [sdkGuessConfirmed, setSdkGuessConfirmed] = useState(false);
@@ -27,6 +30,10 @@ export default function App({
27
30
  const [configComplete, setConfigComplete] = useState(false);
28
31
  const [configVerified, setConfigVerified] = useState(false);
29
32
  let fromVersionGuess = false;
33
+ if (yolo) {
34
+ setSdks(SDKS.map(s => s.value));
35
+ setYolo(false);
36
+ }
30
37
 
31
38
  // We try to guess which SDK they are using
32
39
  if (isEmpty(sdks) && isEmpty(sdkGuesses) && !sdkGuessAttempted) {
@@ -126,7 +133,8 @@ export default function App({
126
133
  toVersion,
127
134
  sdks,
128
135
  dir,
129
- ignore
136
+ ignore,
137
+ noWarnings
130
138
  })));
131
139
  }
132
140
 
package/dist/cli.js CHANGED
@@ -9,11 +9,12 @@ const cli = meow(`
9
9
  $ clerk-upgrade
10
10
 
11
11
  Options
12
- --from Major version number you're upgrading from
13
- --to Major version number you're upgrading to
14
- --sdk Name of the SDK you're upgrading
15
- --dir Directory you'd like to scan for files
16
- --ignore Any files or directories you'd like to ignore
12
+ --from Major version number you're upgrading from
13
+ --to Major version number you're upgrading to
14
+ --sdk Name of the SDK you're upgrading
15
+ --dir Directory you'd like to scan for files
16
+ --ignore Any files or directories you'd like to ignore
17
+ --noWarnings Do not print warnings, only items that must be fixed
17
18
 
18
19
  Examples
19
20
  $ clerk-upgrade --from=4 --to=5 --sdk=nextjs --dir=src/**
@@ -39,6 +40,12 @@ const cli = meow(`
39
40
  ignore: {
40
41
  type: 'string',
41
42
  isMultiple: true
43
+ },
44
+ yolo: {
45
+ type: 'boolean'
46
+ },
47
+ noWarnings: {
48
+ type: 'boolean'
42
49
  }
43
50
  }
44
51
  });
@@ -46,5 +53,7 @@ render( /*#__PURE__*/React.createElement(App, {
46
53
  _fromVersion: cli.flags.from,
47
54
  _toVersion: cli.flags.to,
48
55
  _sdk: cli.flags.sdk,
49
- _dir: cli.flags.dir
56
+ _dir: cli.flags.dir,
57
+ _yolo: cli.flags.yolo,
58
+ noWarnings: cli.flags.noWarnings
50
59
  }));
Binary file
package/dist/scan.js CHANGED
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
  import { Text, Newline, Box } from 'ink';
3
3
  import { globby } from 'globby';
4
4
  import fs from 'fs/promises';
5
+ import path from 'path';
5
6
  import { ProgressBar } from '@inkjs/ui';
6
7
  import indexToPosition from 'index-to-position';
7
8
  import ExpandableList from './util/expandable-list.js';
@@ -10,7 +11,8 @@ export default function Scan({
10
11
  toVersion,
11
12
  sdks,
12
13
  dir,
13
- ignore
14
+ ignore,
15
+ noWarnings
14
16
  }) {
15
17
  // NOTE: if the difference between fromVersion and toVersion is greater than 1
16
18
  // we need to do a little extra work here and import two matchers,
@@ -45,10 +47,16 @@ export default function Scan({
45
47
  // result = `files` set to format: ['/filename', '/other/filename']
46
48
  useEffect(() => {
47
49
  setStatus('Collecting files to scan');
48
- ignore.push('node_modules/**', '**/node_modules/**', '.git/**', 'package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml');
49
- globby(dir, {
50
+ ignore.push('node_modules/**', '**/node_modules/**', '.git/**', 'package.json', '**/package.json', 'package-lock.json', '**/package-lock.json', 'yarn.lock', '**/yarn.lock', 'pnpm-lock.yaml', '**/pnpm-lock.yaml', '**/*.(png|webp|svg|gif|jpg|jpeg)+',
51
+ // common image files
52
+ '**/*.(mp4|mkv|wmv|m4v|mov|avi|flv|webm|flac|mka|m4a|aac|ogg)+' // common video files
53
+ );
54
+
55
+ globby(path.resolve(dir), {
50
56
  ignore: [...ignore.filter(x => x)]
51
- }).then(files => setFiles(files));
57
+ }).then(files => {
58
+ setFiles(files);
59
+ });
52
60
  }, [dir, ignore]);
53
61
 
54
62
  // Read files and scan regexes
@@ -57,34 +65,53 @@ export default function Scan({
57
65
  //
58
66
  useEffect(() => {
59
67
  if (!matchers || !files) return;
68
+ const allResults = {};
60
69
  Promise.all(
61
70
  // first we read all the files
62
71
  files.map(async (file, idx) => {
63
- setStatus(`Scanning ${file}`);
64
- setProgress(Math.ceil(idx / files.length * 100));
65
72
  const content = await fs.readFile(file, 'utf8');
66
73
 
67
74
  // then we run each of the matchers against the file contents
68
- // TODO: combine results on the same match, add multiple file/positions
69
75
  for (const sdk in matchers) {
70
- matchers[sdk].map(matcher => {
71
- const matches = content.matchAll(matcher.matcher);
72
- if (!matches) return;
73
- Array.from(matches).map(match => {
74
- // TODO: index should be converted to line/col
75
- results.push({
76
+ // returns [{ ...matcher, instances: [{sdk, file, position}] }]
77
+ matchers[sdk].map(matcherConfig => {
78
+ // run regex against file content, return array of matches
79
+ // matcher can be an array or string
80
+ let matches = [];
81
+ if (Array.isArray(matcherConfig.matcher)) {
82
+ matcherConfig.matcher.map(m => {
83
+ matches = matches.concat(Array.from(content.matchAll(m)));
84
+ });
85
+ } else {
86
+ matches = Array.from(content.matchAll(matcherConfig.matcher));
87
+ }
88
+ if (matches.length < 1) return;
89
+
90
+ // for each match, add to `instances` array of a key, create if not exists
91
+ matches.map(match => {
92
+ if (noWarnings && matcherConfig.warning) return;
93
+ if (!allResults[matcherConfig.title]) allResults[matcherConfig.title] = {
94
+ instances: [],
95
+ ...matcherConfig
96
+ };
97
+
98
+ // TODO: there's a small bug where we can see multiple instances of the same position
99
+ allResults[matcherConfig.title].instances.push({
76
100
  sdk,
77
- file,
78
- position: indexToPosition(content, match.index),
79
- ...matcher
101
+ file: path.relative(process.cwd(), file),
102
+ position: indexToPosition(content, match.index, {
103
+ oneBased: true
104
+ })
80
105
  });
81
- setResults(results);
82
106
  });
83
107
  });
84
108
  }
109
+ setStatus(`Scanning ${file}`);
110
+ setProgress(Math.ceil(idx / files.length * 100));
85
111
  })).then(() => {
112
+ setResults([...results, ...Object.keys(allResults).map(k => allResults[k])]);
86
113
  setComplete(true);
87
- if (results.length < 1) {
114
+ if (Object.keys(allResults).length < 1) {
88
115
  setStatus('It looks like you have nothing you need to change, upgrade away!');
89
116
  } else {
90
117
  setStatus('File scan complete. See results below!');
@@ -93,11 +120,11 @@ export default function Scan({
93
120
  console.error(err);
94
121
  });
95
122
  }, [matchers, files]);
96
- return /*#__PURE__*/React.createElement(React.Fragment, null, complete ? /*#__PURE__*/React.createElement(Text, {
123
+ return /*#__PURE__*/React.createElement(React.Fragment, null, complete ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
97
124
  color: "green"
98
- }, "\u2713 ", status) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProgressBar, {
99
- value: progress
100
- }), /*#__PURE__*/React.createElement(Text, null, status)), /*#__PURE__*/React.createElement(Newline, null), !!results.length && /*#__PURE__*/React.createElement(ExpandableList, {
125
+ }, "\u2713 ", status), /*#__PURE__*/React.createElement(Newline, null), !!results.length && /*#__PURE__*/React.createElement(ExpandableList, {
101
126
  items: results
102
- }));
127
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProgressBar, {
128
+ value: progress
129
+ }), /*#__PURE__*/React.createElement(Text, null, status)));
103
130
  }
@@ -52,19 +52,25 @@ export default function ExpandableList({
52
52
  color: "blue"
53
53
  }, "Navigation Instructions:"), /*#__PURE__*/React.createElement(Text, null, "Navigate through items with \u2191 and \u2193 arrow keys. Expand the details of any item with space bar. \u2193 key on the last item goes to the next page, \u2191 on the first item goes to the previous page. To exit this interface, use \"control + c\"."), /*#__PURE__*/React.createElement(Newline, null), state.all.reduce((memo, item, idx) => {
54
54
  if (idx < state.visible[0] || idx >= state.visible[1]) return memo;
55
- const loc = `${item.file}:${item.position.line}:${item.position.column}`;
55
+ const locations = item.instances.map(instance => `${instance.file}:${instance.position.line}:${instance.position.column}`);
56
56
  memo.push( /*#__PURE__*/React.createElement(Box, {
57
57
  borderStyle: item.focused ? 'double' : 'single',
58
58
  flexDirection: "column",
59
59
  borderColor: item.focused ? 'blue' : 'white',
60
60
  paddingX: 1,
61
- key: loc
62
- }, /*#__PURE__*/React.createElement(Markdown, null, item.title), /*#__PURE__*/React.createElement(Text, null, "Location: ", loc), item.expanded && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Markdown, null, item.content), /*#__PURE__*/React.createElement(Link, {
63
- url: item.link
64
- }, /*#__PURE__*/React.createElement(Text, null, "See in migration guide \xBB")))));
61
+ key: item.title
62
+ }, /*#__PURE__*/React.createElement(Markdown, null, item.title), locations.length > 1 ? /*#__PURE__*/React.createElement(Text, null, "Found ", locations.length, " instances, expand for detail") : /*#__PURE__*/React.createElement(Text, null, "Location: ", locations[0]), item.expanded && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line, null), locations.length > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, "Locations:"), locations.map(loc => /*#__PURE__*/React.createElement(Text, null, ' ', "- ", loc)), /*#__PURE__*/React.createElement(Line, null)), item.warning && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
63
+ color: "yellow"
64
+ }, "\u26A0\uFE0F This is a WARNING and will still match even if you corrected the issue or if no correction is necessary. To dismiss warnings, pass the `--noWarnings` flag to the CLI when running."), /*#__PURE__*/React.createElement(Line, null)), /*#__PURE__*/React.createElement(Newline, null), /*#__PURE__*/React.createElement(Markdown, null, item.content))));
65
65
  return memo;
66
66
  }, []), state.all.length > state.numberVisible && /*#__PURE__*/React.createElement(Text, null, "Showing ", state.visible[0] + 1, " - ", Math.min(state.visible[1], state.all.length), " of ", state.all.length));
67
67
  }
68
+ const Line = () => /*#__PURE__*/React.createElement(Box, {
69
+ borderStyle: "single",
70
+ borderRight: false,
71
+ borderLeft: false,
72
+ borderBottom: false
73
+ });
68
74
 
69
75
  // I'd like to recognize that this logic is kinda crazy, but it works 💖
70
76
  function reducer(state, action) {
@@ -134,6 +140,7 @@ function reducer(state, action) {
134
140
  }
135
141
  return item;
136
142
  });
143
+ console.log(''); // this is strange but seems to solve a rendering bug
137
144
  return {
138
145
  all,
139
146
  visible: state.visible,
@@ -0,0 +1,10 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ // WIP, a util script used for quickly generating a large number of nearly identical change files
5
+ const movedToServer = ['MultisessionAppSupport', 'auth', 'currentUser', 'authMiddleware',
6
+ // deprecated
7
+ 'clerkMiddleware',
8
+ // new
9
+ 'redirectToSignIn', 'redirectToSignUp', 'buildClerkProps', 'verifyToken', 'isClerkAPIResponseError', 'isEmailLinkError', 'isKnownError', 'isMetamaskError', 'EmailLinkErrorCode', 'withClerk', 'withSession', 'withUser', 'WithClerk', 'WithSession', 'WithUser'];
10
+ const clerkBackendExports = ['createClerkClient', 'verifyToken'];
@@ -1,9 +1,14 @@
1
1
  import { readPackageSync } from 'read-pkg';
2
2
  import SDKS from '../constants/sdks.js';
3
3
  export default function guessFrameworks(dir) {
4
- const pkg = readPackageSync({
5
- cwd: dir
6
- });
4
+ let pkg;
5
+ try {
6
+ pkg = readPackageSync({
7
+ cwd: dir
8
+ });
9
+ } catch (err) {
10
+ return [];
11
+ }
7
12
 
8
13
  // no guessing if there are no deps
9
14
  if (!pkg.dependencies && !pkg.devDependencies) return [];
@@ -19,11 +19,12 @@ export default function createLoader({
19
19
  const fm = parsed.data;
20
20
  return {
21
21
  title: fm.title,
22
- matcher: new RegExp(fm.matcher, `g${fm.matcherFlags ? fm.matcherFlags : ''}`),
22
+ matcher: Array.isArray(fm.matcher) ? fm.matcher.map(m => new RegExp(m, `g${fm.matcherFlags ? fm.matcherFlags : ''}`)) : new RegExp(fm.matcher, `g${fm.matcherFlags ? fm.matcherFlags : ''}`),
23
23
  replaceWithString: fm.replaceWithString,
24
24
  slug,
25
25
  sdk: sdk,
26
26
  content: parsed.content,
27
+ warning: fm.warning,
27
28
  link: `${baseUrl}#${slug}`
28
29
  };
29
30
  });
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`API_URL` value has changed'
3
+ matcher: "API_URL[\\s\\S]*?from\\s+['\"]@clerk\\/backend\\/constants['\"]"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ 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,12 @@
1
+ ---
2
+ title: '`request` separated from `options` as params to `authenticateRequest`'
3
+ warning: true
4
+ matcher: "authenticateRequest\\("
5
+ ---
6
+
7
+ There has been a change to the way the params of the `authenticateRequest` function are structured. The `request` param, formerly included in an `options` object, has been moved to stand on its own as the first param to the function, while the `options` object remains as the second param. Example below:
8
+
9
+ ```diff
10
+ - clerkClient.authenticateRequest({ ...opts, request })
11
+ + clerkClient.authenticateRequest(request, { ...opts })
12
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`buildRequestUrl` import removed'
3
+ matcher: "import\\s+{[\\s\\S]*?buildRequestUrl[\\s\\S]*?}\\s+from\\s+['\"]@clerk\/backend['\"]"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `buildRequestUrl` import was intended for those building custom Clerk integrations for frameworks and has been removed in favor of other methods internally. If you were relying on this function and this is an issue, please [reach out to Clerk support](https://clerk.com/support).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: '`Clerk` -> `createClerkClient`'
3
- matcher: "import\\s+{[\\s\\S]*?Clerk[\\s\\S]*?}\\s+from\\s+['\"]@clerk/backend['\"]"
3
+ matcher: "import\\s+{*[\\s\\S]*?Clerk[\\s\\S]*?}*\\s+from\\s+['\"]@clerk\\/backend['\"]"
4
4
  matcherFlags: 'm'
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ The top level `Clerk` import was renamed to `createClerkClient`. This is just a
8
8
 
9
9
  ```js
10
10
  // before
11
- import { Clerk } from '@clerk/backend';
11
+ import Clerk from '@clerk/backend';
12
12
 
13
13
  // after
14
14
  import { createClerkClient } from '@clerk/backend';
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: '`clerkClient.__unstable_options` removed'
3
+ matcher: "\\.__unstable_options"
4
+ ---
5
+
6
+ The `clerkClient.__unstable_options` property was removed. Previously, you could use it to update the internal options. Instead, create a new ` clerkClient` instance using `createClerkClient` and pass the options in this way. For example:
7
+
8
+ ```diff
9
+ import { createClerkClient } from "@clerk/backend"
10
+
11
+ const clerkClient = createClerkClient({ secretKey: "old" })
12
+
13
+ - clerkClient.__unstable_options.secretKey = "new"
14
+ + const newClerkClient = createClerkClient({ secretKey: "new" })
15
+ ```
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  title: '`clockSkewInSeconds` -> `clockSkewInMs`'
3
- matcher: 'clockSkewInSeconds'
3
+ matcher:
4
+ - "verifyJwt\\([\\s\\S]*?(clockSkewInSeconds):[\\s\\S]*?\\)"
5
+ - "verifyToken\\([\\s\\S]*?(clockSkewInSeconds):[\\s\\S]*?\\)"
6
+ - "authenticateRequest\\([\\s\\S]*?(clockSkewInSeconds):[\\s\\S]*?\\)"
7
+ matcherFlags: 'm'
4
8
  replaceWithString: 'clockSkewInMs'
5
9
  ---
6
10
 
7
- The value stayed the same, only the name changed.
11
+ The `clockSkewInSeconds` option has been renamed to `clockSkewInMs` in order to accurately reflect that its value is expected to be in milliseconds rather than seconds. The value does not need to change here, only the name. This change affects the following imports:
12
+
13
+ - `verifyJwt`
14
+ - `verifyToken`
15
+ - `Clerk.authenticateRequest`
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: '`constants` import moved to `@clerk/backend/internal`'
3
+ matcher: "import\\s+{[\\s\\S]*?constants[\\s\\S]*?}\\s+from\\s+['\"]@clerk\\/(backend)['\"]"
4
+ matcherFlags: 'm'
5
+ replaceWithString: 'backend/internal'
6
+ ---
7
+
8
+ The `constants` import path has changed from `@clerk/backend` to `@clerk/backend/internal`. You must update your import path in order for it to work correctly. Note that internal imports are not intended for usage and are outside the scope of semver. Example below of the fix that needs to be made:
9
+
10
+ ```diff
11
+ - import { constants } from "@clerk/backend"
12
+ + import { constants } from "@clerk/backend/internal"
13
+ ```
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: '`createAuthenticateRequest` import moved to `@clerk/backend/internal`'
3
+ matcher: "import\\s+{[\\s\\S]*?createAuthenticateRequest[\\s\\S]*?}\\s+from\\s+['\"]@clerk\\/(backend)['\"]"
4
+ matcherFlags: 'm'
5
+ replaceWithString: 'backend/internal'
6
+ ---
7
+
8
+ The `createAuthenticateRequest` import path has changed from `@clerk/backend` to `@clerk/backend/internal`. You must update your import path in order for it to work correctly. Note that internal imports are not intended for usage and are outside the scope of semver. Example below of the fix that needs to be made:
9
+
10
+ ```diff
11
+ - import { createAuthenticateRequest } from "@clerk/backend"
12
+ + import { createAuthenticateRequest } from "@clerk/backend/internal"
13
+ ```
@@ -1,21 +1,18 @@
1
1
  ---
2
2
  title: '`apiKey` -> `secretKey` as param to createClerkClient'
3
- matcher: "[createClerkClient|Clerk]\\(\\s*{[\\s\\S]*?frontendApi:[\\s\\S]*?\\)"
3
+ matcher: "(?:createClerkClient|Clerk)\\(\\s*{[\\s\\S]*?frontendApi:[\\s\\S]*?\\)"
4
4
  matcherFlags: 'm'
5
5
  ---
6
6
 
7
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
8
 
9
- ```js
10
- // before
11
- import { Clerk } from '@clerk/backend';
9
+ ```diff
10
+ - import { Clerk } from '@clerk/backend';
11
+ + import { createClerkClient } from '@clerk/backend';
12
12
 
13
- const clerkClient = Clerk({ apiKey: '...' });
14
- clerkClient.authenticateRequest({ apiKey: '...' });
13
+ - const clerkClient = Clerk({ apiKey: '...' });
14
+ + const clerkClient = createClerkClient({ secretKey: '...' });
15
15
 
16
- // after
17
- import { createClerkClient } from '@clerk/backend';
18
-
19
- const clerkClient = createClerkClient({ secretKey: '...' });
20
- clerkClient.authenticateRequest({ secretKey: '...' });
16
+ - clerkClient.authenticateRequest({ apiKey: '...' });
17
+ + clerkClient.authenticateRequest({ secretKey: '...' });
21
18
  ```
@@ -6,16 +6,13 @@ matcherFlags: 'm'
6
6
 
7
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
8
 
9
- ```js
10
- // before
11
- import { Clerk } from '@clerk/backend';
9
+ ```diff
10
+ - import { Clerk } from '@clerk/backend';
11
+ + import { createClerkClient } from '@clerk/backend';
12
12
 
13
- const clerkClient = Clerk({ frontendApi: '...' });
14
- clerkClient.authenticateRequest({ frontendApi: '...' });
13
+ - const clerkClient = Clerk({ frontendApi: '...' });
14
+ + const clerkClient = createClerkClient({ publishableKey: '...' });
15
15
 
16
- // after
17
- import { createClerkClient } from '@clerk/backend';
18
-
19
- const clerkClient = createClerkClient({ publishableKey: '...' });
20
- clerkClient.authenticateRequest({ publishableKey: '...' });
16
+ - clerkClient.authenticateRequest({ frontendApi: '...' });
17
+ + clerkClient.authenticateRequest({ publishableKey: '...' });
21
18
  ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: '`createEmail` import removed'
3
+ matcher: "import\\s+{[\\s\\S]*?createEmail[\\s\\S]*?}\\s+from\\s+['\"]@clerk\/backend['\"]"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `createEmail` import has been removed. There is no replacement at this time because we need to rethink how `createEmail` behaves and align it with the newer `sendSms` method. If this is an issue for your implementation, please contact [Clerk support](https://clerk.com/contact).
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: '`createIsomorphicRequest` import moved to `@clerk/backend/internal`'
3
+ matcher: "import\\s+{[\\s\\S]*?createIsomorphicRequest[\\s\\S]*?}\\s+from\\s+['\"]@clerk\\/(backend)['\"]"
4
+ matcherFlags: 'm'
5
+ replaceWithString: 'backend/internal'
6
+ ---
7
+
8
+ The `createIsomorphicRequest` import path has changed from `@clerk/backend` to `@clerk/backend/internal`. You must update your import path in order for it to work correctly. Note that internal imports are not intended for usage and are outside the scope of semver. Example below of the fix that needs to be made:
9
+
10
+ ```diff
11
+ - import { createIsomorphicRequest } from "@clerk/backend"
12
+ + import { createIsomorphicRequest } from "@clerk/backend/internal"
13
+ ```
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: '`createIsomorphicRequest` import moved to `/internal`'
3
+ matcher: "import\\s+{[\\s\\S]*?createIsomorphicRequest[\\s\\S]*?}\\s+from\\s+['\"]@clerk\/(backend)['\"]"
4
+ replaceWithString: 'backend/internal'
5
+ matcherFlags: 'm'
6
+ ---
7
+
8
+ The `createIsomorphicRequest` import was intended for those building custom Clerk integrations for frameworks and has been moved to `@clerk/backend/internal` to reflect this. Please use caution when using internal imports as they are outside the bounds of semver.
9
+
10
+ ```diff
11
+ - import { createIsomorphicRequest } from "@clerk/backend"
12
+ + import { createIsomorphicRequest } from "@clerk/backend/internal"
13
+ ```
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: '`decodeJwt` import moved to `@clerk/backend/tokens`'
3
+ matcher: "import\\s+{[\\s\\S]*?decodeJwt[\\s\\S]*?}\\s+from\\s+['\"]@clerk\\/(backend)['\"]"
4
+ matcherFlags: 'm'
5
+ replaceWithString: 'backend/tokens'
6
+ ---
7
+
8
+ The `decodeJwt` import path has changed from `@clerk/backend` to `@clerk/backend/tokens`. You must update your import path in order for it to work correctly. Example below of the fix that needs to be made
9
+
10
+ ```diff
11
+ - import { decodeJwt } from "@clerk/backend"
12
+ + import { decodeJwt } from "@clerk/backend/tokens"
13
+ ```
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`ExternalAccount.picture` -> `.imageUrl`'
3
+ matcher: "\\.picture"
4
+ ---
5
+
6
+ The `picture` property of any [`ExternalAcccount` object](https://clerk.com/docs/references/javascript/external-account) has been changed to `imageUrl`.
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: '`ExternalAccountJSON.avatar_url` -> `.imageUrl`'
3
+ matcher: "\\.avatar_url"
4
+ ---
5
+
6
+ The `avatarUrl` property of any `ExternalAcccountJSON` object has been changed to `imageUrl`.
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: '`Users.getOrganizationInvitationList` return signature changed'
3
+ matcher: "\\.users\\.getOrganizationInvitationList\\("
4
+ warning: true
5
+ ---
6
+
7
+ The response payload of `Users.getOrganizationInvitationList` was changed as part of the v5 release. Rather than directly returning ` data`, the return signature is now `{ data, totalCount }`. Since backend API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily, and this change in the backend SDK aligns the response shape with what the backend API returns directly.
8
+
9
+ Here's an example of how the response shape would change with this modification:
10
+
11
+ ```diff
12
+ - const data = await clerkClient.users.getOrganizationInvitationList()
13
+ + const { data, totalCount } = await clerkClient.users.getOrganizationInvitationList()
14
+ ```
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: '`Users.getOrganizationList` return signature changed'
3
+ matcher: "\\.users\\.getOrganizationList\\("
4
+ warning: true
5
+ ---
6
+
7
+ The response payload of `Users.getOrganizationList` was changed as part of the v5 release. Rather than directly returning ` data`, the return signature is now `{ data, totalCount }`. Since backend API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily, and this change in the backend SDK aligns the response shape with what the backend API returns directly.
8
+
9
+ Here's an example of how the response shape would change with this modification:
10
+
11
+ ```diff
12
+ - const data = await clerkClient.users.getOrganizationList()
13
+ + const { data, totalCount } = await clerkClient.users.getOrganizationList()
14
+ ```
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: '`Users.getOrganizationMembershipList` return signature changed'
3
+ matcher: "\\.users\\.getOrganizationMembershipList\\("
4
+ warning: true
5
+ ---
6
+
7
+ The response payload of `Users.getOrganizationMembershipList` was changed as part of the v5 release. Rather than directly returning ` data`, the return signature is now `{ data, totalCount }`. Since backend API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily, and this change in the backend SDK aligns the response shape with what the backend API returns directly.
8
+
9
+ Here's an example of how the response shape would change with this modification:
10
+
11
+ ```diff
12
+ - const data = await clerkClient.users.getOrganizationMembershipList()
13
+ + const { data, totalCount } = await clerkClient.users.getOrganizationMembershipList()
14
+ ```
@@ -1,12 +1,12 @@
1
1
  ---
2
- title: '`getPendingOrganizationInvitationList` -> `getOrganizationInvitationList`'
3
- matcher: 'getPendingOrganizationInvitationList'
2
+ title: '`Organizations.getPendingOrganizationInvitationList` -> `getOrganizationInvitationList`'
3
+ matcher: "\\.(getPendingOrganizationInvitationList)\\("
4
4
  replaceWithString: 'getOrganizationInvitationList'
5
5
  ---
6
6
 
7
- Use `getOrganizationInvitationList` with a `status` option instead.
7
+ The `Organizations.getPendingOrganizationInvitationList` method has been removed. To match the same functionality, use `Organizations.getOrganizationInvitationList` and pass in `status` option as "pending" instead.
8
8
 
9
9
  ```diff
10
- - getPendingOrganizationInvitationList({ organizationId: "" })
11
- + getOrganizationInvitationList({ organizationId: "", status: "pending" })
10
+ - clerkClient.organizations.getPendingOrganizationInvitationList()
11
+ + clerkClient.organizations.getOrganizationInvitationList({ status: "pending" })
12
12
  ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: '`httpOptions` parameter removed'
3
+ matcher: "\\([\\s\\S]*?httpOptions:\\s\\S]*?\\)"
4
+ matcherFlags: 'm'
5
+ ---
6
+
7
+ The `httpOptions` parameter was removed from the internal `buildRequest` function but it is used by most public facing APIs. Hence you were able to pass `httpOptions` to some functions which is not possible anymore. If you're currently relying on this functionality and wish to update, please reach out to Clerk's support.
8
+
9
+ The internal change looks like this:
10
+
11
+ ```diff
12
+ - const r = buildRequest({ httpsOptions: { headers: {} }})
13
+ + const request = buildRequest()
14
+ + request({ headerParams: {} })
15
+ ```