From 0cde71a6ab7875cd365f848eb76a1773211fcc26 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Thu, 26 Sep 2024 14:51:57 +0300 Subject: [PATCH] chore(nextjs): Remove unused utilities (#4230) --- .changeset/odd-days-obey.md | 2 ++ packages/nextjs/src/server/utils.ts | 17 ----------------- 2 files changed, 2 insertions(+), 17 deletions(-) create mode 100644 .changeset/odd-days-obey.md diff --git a/.changeset/odd-days-obey.md b/.changeset/odd-days-obey.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/odd-days-obey.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/nextjs/src/server/utils.ts b/packages/nextjs/src/server/utils.ts index 44e72d05df4..29b558f2e42 100644 --- a/packages/nextjs/src/server/utils.ts +++ b/packages/nextjs/src/server/utils.ts @@ -16,10 +16,6 @@ import { authSignatureInvalid, encryptionKeyInvalid, missingDomainAndProxy, miss import { errorThrower } from './errorThrower'; import type { RequestLike } from './types'; -export function setCustomAttributeOnRequest(req: RequestLike, key: string, value: string): void { - Object.assign(req, { [key]: value }); -} - export function getCustomAttributeFromRequest(req: RequestLike, key: string): string | null | undefined { // @ts-expect-error - TS doesn't like indexing into RequestLike return key in req ? req[key] : undefined; @@ -32,13 +28,6 @@ export function getAuthKeyFromRequest( return getCustomAttributeFromRequest(req, constants.Attributes[key]) || getHeader(req, constants.Headers[key]); } -// TODO: Rename Auth status and align the naming across media -export function getAuthStatusFromRequest(req: RequestLike): string | null | undefined { - return ( - getCustomAttributeFromRequest(req, constants.Attributes.AuthStatus) || getHeader(req, constants.Headers.AuthStatus) - ); -} - export function getHeader(req: RequestLike, name: string): string | null | undefined { if (isNextRequest(req)) { return req.headers.get(name); @@ -173,12 +162,6 @@ export const apiEndpointUnauthorizedNextResponse = () => { return NextResponse.json(null, { status: 401, statusText: 'Unauthorized' }); }; -export const isCrossOrigin = (from: string | URL, to: string | URL) => { - const fromUrl = new URL(from); - const toUrl = new URL(to); - return fromUrl.origin !== toUrl.origin; -}; - export const handleMultiDomainAndProxy = (clerkRequest: ClerkRequest, opts: AuthenticateRequestOptions) => { const relativeOrAbsoluteProxyUrl = handleValueOrFn(opts?.proxyUrl, clerkRequest.clerkUrl, PROXY_URL);