') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); chore(backend): Drop deprecations by dimkl · Pull Request #1899 · clerk/javascript · GitHub
Skip to content

chore(backend): Drop deprecations - #1899

Merged
dimkl merged 15 commits into
mainfrom
sdk-782-drop-deprecations-backend
Nov 16, 2023
Merged

chore(backend): Drop deprecations#1899
dimkl merged 15 commits into
mainfrom
sdk-782-drop-deprecations-backend

Conversation

@dimkl

@dimkldimkl commented Oct 17, 2023

Copy link
Copy Markdown
Contributor

Description

Drop deprecated properties. Migration steps:

  • use createClerkClient instead of __unstable_options
  • use publishableKey instead of frontendApi
  • use clockSkewInMs instead of clockSkewInSeconds
  • use apiKey instead of secretKey
  • drop httpOptions
  • use *.image instead of
    • ExternalAccount.picture
    • ExternalAccountJSON.avatar_url
    • Organization.logoUrl
    • OrganizationJSON.logo_url
    • User.profileImageUrl
    • UserJSON.profile_image_url
    • OrganizationMembershipPublicUserData.profileImageUrl
    • OrganizationMembershipPublicUserDataJSON.profile_image_url
  • drop pkgVersion
  • use Organization.getOrganizationInvitationList with status instead of getPendingOrganizationInvitationList
  • drop orgs claim (if required, can be manually added by using user.organizations in a jwt template)

Internal changes:

  • replaced error enum (and it's) SetClerkSecretKeyOrAPIKey with SetClerkSecretKey

TODO

  • drop Interstitial deprecation (will be done in a separate PR since we will probably keep only the local interstitial based on the SDK public APIs for v5 RFC)

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@dimkldimkl self-assigned this Oct 17, 2023
@changeset-bot

changeset-botBot commented Oct 17, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 53bef9c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
NameType
@clerk/backendMajor
@clerk/fastifyPatch
gatsby-plugin-clerkPatch
@clerk/nextjsPatch
@clerk/remixPatch
@clerk/clerk-sdk-nodePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch from 505650d to 57684e7CompareOctober 19, 2023 13:32
@dimkl
dimkl marked this pull request as ready for review October 19, 2023 13:33
@dimkl
dimkl requested a review from a team as a code ownerOctober 19, 2023 13:33
@dimkl
dimkl marked this pull request as draft October 19, 2023 13:33
@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch 3 times, most recently from 4d64e56 to f95ab26CompareOctober 26, 2023 21:24
@dimkldimkl changed the title chore(backend): Drop clerk@v4 deprecationschore(backend): Drop deprecationsOct 31, 2023
@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch from f95ab26 to 526a49cCompareNovember 7, 2023 12:52
@dimkl
dimkl marked this pull request as ready for review November 7, 2023 12:57
@dimkldimkl closed this Nov 7, 2023
@dimkldimkl reopened this Nov 7, 2023
@dimkldimkl closed this Nov 7, 2023
@dimkl
dimkl deleted the sdk-782-drop-deprecations-backend branch November 7, 2023 13:27
@dimkl
dimkl restored the sdk-782-drop-deprecations-backend branch November 7, 2023 13:27
@dimkl
dimkl deleted the sdk-782-drop-deprecations-backend branch November 7, 2023 13:27
@dimkl
dimkl restored the sdk-782-drop-deprecations-backend branch November 7, 2023 13:28
@dimkldimkl reopened this Nov 7, 2023
@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch 3 times, most recently from c9f2381 to 18dabbcCompareNovember 8, 2023 13:36
const noSchemeFrontendApi = frontendApi.replace(/http(s)?:\/\//, '');
const major = getClerkJsMajorVersionOrTag(frontendApi, pkgVersion);
const major = getClerkJsMajorVersionOrTag(frontendApi, clerkJSVersion);
return `https://${noSchemeFrontendApi}/npm/@clerk/clerk-js@${clerkJSVersion || major}/dist/clerk.browser.js`;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikosdouvlis Since we are dropping the pkgVersion we won't be able to load the major version of a version provided implicitly because the clerkJSVersion || major where the major version is being calculated using the clerkJSVersion.
This is the reason behind dropping the test in packages/shared/src/__tests__/url.test.ts.

We will be able to use:

  • the latest or canary tag or
  • the explicit version passed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I undertand why we are making this change. Could you please share more context? We need to be able to load version 4 for example, otherwise each clerk-react major version will not be able to load the correct clerk-js package.

We cannot rely on latest for this - what will happen when we release v6?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikosdouvlis the clerk-react does not use this script to load the clerk-js. This is used to load ClerkJS in interstitial and it seems to be an existing issue that needs to be solved.
I will merge this an open a ticket to validate and handle the clerkJS version loaded in the interstitial

@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch 6 times, most recently from a6d5666 to 6b8d70bCompareNovember 15, 2023 12:53

@nikosdouvlisnikosdouvlis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments and a question - appart from that, everything looks good. Approving in order to unblock!

Comment threadpackages/backend/src/tokens/factory.ts
Comment threadpackages/backend/src/tokens/interstitialRule.ts Outdated
Comment threadpackages/backend/src/tokens/interstitialRule.ts Outdated
const noSchemeFrontendApi = frontendApi.replace(/http(s)?:\/\//, '');
const major = getClerkJsMajorVersionOrTag(frontendApi, pkgVersion);
const major = getClerkJsMajorVersionOrTag(frontendApi, clerkJSVersion);
return `https://${noSchemeFrontendApi}/npm/@clerk/clerk-js@${clerkJSVersion || major}/dist/clerk.browser.js`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I undertand why we are making this change. Could you please share more context? We need to be able to load version 4 for example, otherwise each clerk-react major version will not be able to load the correct clerk-js package.

We cannot rely on latest for this - what will happen when we release v6?

@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch from 6b8d70b to 92bbeb9CompareNovember 15, 2023 14:16
- `ExternalAccount.picture`
- `ExternalAccountJSON.avatar_url`
- `Organization.logoUrl`
- `OrganizationJSON.logo_url`
- `User.profileImageUrl`
- `UserJSON.profile_image_url`
- `OrganizationMembershipPublicUserData.profileImageUrl`
- `OrganizationMembershipPublicUserDataJSON.profile_image_url`
The `as string` silents the typescript error but in the runtime
the code fails if the value of `null` or `undefined` is passed
in a function that expects a string to be passed.
Failures may be caused by invoking string specific methods (eg `startsWith`)
which raise a `Cannot read properties of undefined` error.
@dimkl
dimklforce-pushed the sdk-782-drop-deprecations-backend branch from 92bbeb9 to 53bef9cCompareNovember 16, 2023 10:47
@dimkl
dimkl added this pull request to the merge queue Nov 16, 2023
Merged via the queue into main with commit cace853Nov 16, 2023
@dimkl
dimkl deleted the sdk-782-drop-deprecations-backend branch November 16, 2023 11:41
Sign up for freeto 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

@dimkl@nikosdouvlis@clerk-cookie