Skip to content

Commit

Permalink
chore(backend): Moved shared module to util/shared and drop unused
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkl committed Sep 27, 2023
1 parent 20c2997 commit dfbc1b5
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-lions-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/shared': minor
---

Introduce `getClerkJsMajorVersionOrTag()`, `getScriptUrl()`, `callWithRetry()`
5 changes: 5 additions & 0 deletions .changeset/silent-fishes-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Replace utilities with @clerk/shared exports
2 changes: 1 addition & 1 deletion packages/backend/src/redirections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { errorThrower, parsePublishableKey } from './shared';
import { errorThrower, parsePublishableKey } from './util/shared';

type RedirectAdapter = (url: string) => any;

Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/tokens/interstitial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { API_VERSION, USER_AGENT } from '../constants';
// DO NOT CHANGE: Runtime needs to be imported as a default export so that we can stub its dependencies with Sinon.js
// For more information refer to https://sinonjs.org/how-to/stub-dependency/
import runtime from '../runtime';
import { joinPaths } from '../util/path';
import {
addClerkPrefix,
callWithRetry,
getClerkJsMajorVersionOrTag,
getScriptUrl,
isDevOrStagingUrl,
parsePublishableKey,
} from '../shared';
import { joinPaths } from '../util/path';
} from '../util/shared';
import { TokenVerificationError, TokenVerificationErrorAction, TokenVerificationErrorReason } from './errors';
import type { DebugRequestSate } from './request';

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/tokens/interstitialRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isDevelopmentFromApiKey, isProductionFromApiKey } from '../shared';
import { checkCrossOrigin } from '../util/request';
import { isDevelopmentFromApiKey, isProductionFromApiKey } from '../util/shared';
import type { RequestState } from './authStatus';
import { AuthErrorReason, interstitial, signedIn, signedOut } from './authStatus';
import type { AuthenticateRequestOptions } from './request';
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/tokens/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { API_URL, API_VERSION, MAX_CACHE_LAST_UPDATED_AT_SECONDS } from '../cons
// DO NOT CHANGE: Runtime needs to be imported as a default export so that we can stub its dependencies with Sinon.js
// For more information refer to https://sinonjs.org/how-to/stub-dependency/
import runtime from '../runtime';
import { callWithRetry } from '../shared';
import { joinPaths } from '../util/path';
import { getErrorObjectByCode } from '../util/request';
import { callWithRetry } from '../util/shared';
import {
TokenVerificationError,
TokenVerificationErrorAction,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/tokens/request.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { API_URL, API_VERSION, constants } from '../constants';
import { isDevelopmentFromApiKey, parsePublishableKey } from '../shared';
import { assertValidSecretKey } from '../util/assertValidSecretKey';
import { buildRequest, stripAuthorizationHeader } from '../util/IsomorphicRequest';
import { isDevelopmentFromApiKey, parsePublishableKey } from '../util/shared';
import type { RequestState } from './authStatus';
import { AuthErrorReason, interstitial, signedOut, unknownState } from './authStatus';
import type { TokenCarrier } from './errors';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
export {
addClerkPrefix,
buildPublishableKey,
callWithRetry,
getClerkJsMajorVersionOrTag,
getScriptUrl,
isDevelopmentFromApiKey,
isProductionFromApiKey,
isPublishableKey,
isStaging,
parsePublishableKey,
} from '@clerk/shared';

Expand Down

0 comments on commit dfbc1b5

Please sign in to comment.