Skip to content

Commit

Permalink
fix(backend): Revert deprecation warnings
Browse files Browse the repository at this point in the history
This reverts commit 00d9d42

Revert "chore(backend): Warn about apiKey deprecation"

This reverts commit 1a2f12b

Revert "chore(backend): Warn about httpOptions deprecation"

This reverts commit 838475b.

Revert "chore(backend): Warn about InterstitialAPI deprecation"

This reverts commit 51a5c39.

Revert "chore(backend): Warn about picture/logoUrl/profileImageUrl (image related) deprecations"

This reverts commit 077ce3a

Revert "chore(backend): Warn about pkgVersion deprecation"

This reverts commit 362caaa.

Revert "chore(backend): Warn about clockSkewInSeconds deprecation"

This reverts commit f500d46.

Revert "chore(backend): Warn about backend api return format deprecation"

This reverts commit c937990.

Revert "chore(backend): Warn about __unstable_options deprecation"

This reverts commit 54ba397.
  • Loading branch information
nikosdouvlis committed Sep 29, 2023
1 parent 01bb8ca commit aae1150
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 80 deletions.
7 changes: 1 addition & 6 deletions packages/backend/src/api/endpoints/InterstitialApi.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { deprecated } from '../../util/shared';
import { AbstractAPI } from './AbstractApi';

/**
* @deprecated Switch to the public interstitial endpoint from Clerk Backend API.
*/
export class InterstitialAPI extends AbstractAPI {
public async getInterstitial() {
deprecated(
'getInterstitial()',
'Switch to `Clerk(...).localInterstitial(...)` from `import { Clerk } from "@clerk/backend"`.',
);

return this.request<string>({
path: 'internal/interstitial',
method: 'GET',
Expand Down
3 changes: 0 additions & 3 deletions packages/backend/src/api/endpoints/OrganizationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
} from '../resources';
import type { OrganizationMembershipRole } from '../resources/Enums';
import { AbstractAPI } from './AbstractApi';
import { deprecated } from '@clerk/shared';

const basePath = '/organizations';

Expand Down Expand Up @@ -256,8 +255,6 @@ export class OrganizationAPI extends AbstractAPI {
* @deprecated Use `getOrganizationInvitationList` instead along with the status parameter.
*/
public async getPendingOrganizationInvitationList(params: GetPendingOrganizationInvitationListParams) {
deprecated('getPendingOrganizationInvitationList', 'Use `getOrganizationInvitationList` instead.');

const { organizationId, limit, offset } = params;
this.requireId(organizationId);

Expand Down
20 changes: 2 additions & 18 deletions packages/backend/src/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { API_URL, API_VERSION, constants, USER_AGENT } from '../constants';
import runtime from '../runtime';
import { assertValidSecretKey } from '../util/assertValidSecretKey';
import { joinPaths } from '../util/path';
import { deprecated } from '../util/shared';
import type { CreateBackendApiOptions } from './factory';
import { deserialize } from './resources/Deserializer';

Expand Down Expand Up @@ -51,11 +50,6 @@ type LegacyRequestFunction = <T>(requestOptions: ClerkBackendApiRequestOptions)
const withLegacyReturn =
(cb: any): LegacyRequestFunction =>
async (...args) => {
deprecated(
'',
'Resources return format will switch to `{ data: any, errors: ClerkAPIError[] }` from `data | never` the next major version.',
'resources-legacy-return',
);
// @ts-ignore
const { data, errors, status, statusText } = await cb<T>(...args);
if (errors === null) {
Expand All @@ -73,21 +67,11 @@ export function buildRequest(options: CreateBackendApiOptions) {
const {
apiKey,
secretKey,
httpOptions,
apiUrl = API_URL,
apiVersion = API_VERSION,
userAgent = USER_AGENT,
httpOptions = {},
} = options;
if (apiKey) {
deprecated('apiKey', 'Use `secretKey` instead.');
}
if (httpOptions) {
deprecated(
'httpOptions',
'This option has been deprecated and will be removed with the next major release.\nA RequestInit init object used by the `request` method.',
);
}

const { path, method, queryParams, headerParams, bodyParams, formData } = requestOptions;
const key = secretKey || apiKey;

Expand Down Expand Up @@ -135,7 +119,7 @@ export function buildRequest(options: CreateBackendApiOptions) {

res = await runtime.fetch(
finalUrl.href,
deepmerge(httpOptions || {}, {
deepmerge(httpOptions, {
method,
headers,
...body,
Expand Down
3 changes: 0 additions & 3 deletions packages/backend/src/api/resources/ExternalAccount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { deprecatedProperty } from '../../util/shared';
import type { ExternalAccountJSON } from './JSON';
import { Verification } from './Verification';

Expand Down Expand Up @@ -42,5 +41,3 @@ export class ExternalAccount {
);
}
}

deprecatedProperty(ExternalAccount, 'picture', 'Use `imageUrl` instead.');
3 changes: 0 additions & 3 deletions packages/backend/src/api/resources/Organization.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { deprecatedProperty } from '../../util/shared';
import type { OrganizationJSON } from './JSON';

export class Organization {
Expand Down Expand Up @@ -41,5 +40,3 @@ export class Organization {
);
}
}

deprecatedProperty(Organization, 'logoUrl', 'Use `imageUrl` instead.');
3 changes: 0 additions & 3 deletions packages/backend/src/api/resources/OrganizationMembership.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { deprecatedProperty } from '../../util/shared';
import { Organization } from '../resources';
import type { OrganizationMembershipRole } from './Enums';
import type { OrganizationMembershipJSON, OrganizationMembershipPublicUserDataJSON } from './JSON';
Expand Down Expand Up @@ -55,5 +54,3 @@ export class OrganizationMembershipPublicUserData {
);
}
}

deprecatedProperty(OrganizationMembershipPublicUserData, 'profileImageUrl', 'Use `imageUrl` instead.');
3 changes: 0 additions & 3 deletions packages/backend/src/api/resources/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { deprecatedProperty } from '../../util/shared';
import { EmailAddress } from './EmailAddress';
import { ExternalAccount } from './ExternalAccount';
import type { ExternalAccountJSON, UserJSON } from './JSON';
Expand Down Expand Up @@ -73,5 +72,3 @@ export class User {
);
}
}

deprecatedProperty(User, 'profileImageUrl', 'Use `imageUrl` instead.');
14 changes: 1 addition & 13 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { deprecatedObjectProperty } from '@clerk/shared';

import type { CreateBackendApiOptions } from './api';
import { createBackendApiClient } from './api';
import type { CreateAuthenticateRequestOptions } from './tokens';
Expand Down Expand Up @@ -28,22 +26,12 @@ export function Clerk(options: ClerkOptions) {
const apiClient = createBackendApiClient(opts);
const requestState = createAuthenticateRequest({ options: opts, apiClient });

const clerkInstance = {
return {
...apiClient,
...requestState,
/**
* @deprecated This prop has been deprecated and will be removed in the next major release.
*/
__unstable_options: opts,
};

// The __unstable_options is not being used internally and
// it's only being set in packages/sdk-node/src/clerkClient.ts#L86
deprecatedObjectProperty(
clerkInstance,
'__unstable_options',
'Use `createClerkClient({...})` to create a new clerk instance instead.',
);

return clerkInstance;
}
18 changes: 0 additions & 18 deletions packages/backend/src/tokens/interstitial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import runtime from '../runtime';
import {
addClerkPrefix,
callWithRetry,
deprecated,
getClerkJsMajorVersionOrTag,
getScriptUrl,
isDevOrStagingUrl,
Expand All @@ -34,13 +33,6 @@ export type LoadInterstitialOptions = {
} & MultiDomainAndOrProxyPrimitives;

export function loadInterstitialFromLocal(options: Omit<LoadInterstitialOptions, 'apiUrl'>) {
if (options.frontendApi) {
deprecated('frontentApi', 'Use `publishableKey` instead.');
}
if (options.pkgVersion) {
deprecated('pkgVersion', 'Use `clerkJSVersion` instead.');
}

options.frontendApi = parsePublishableKey(options.publishableKey)?.frontendApi || options.frontendApi || '';
const domainOnlyInProd = !isDevOrStagingUrl(options.frontendApi) ? addClerkPrefix(options.domain) : '';
const {
Expand Down Expand Up @@ -134,12 +126,6 @@ export function loadInterstitialFromLocal(options: Omit<LoadInterstitialOptions,

// TODO: Add caching to Interstitial
export async function loadInterstitialFromBAPI(options: LoadInterstitialOptions) {
if (options.frontendApi) {
deprecated('frontentApi', 'Use `publishableKey` instead.');
}
if (options.pkgVersion) {
deprecated('pkgVersion', 'Use `clerkJSVersion` instead.');
}
options.frontendApi = parsePublishableKey(options.publishableKey)?.frontendApi || options.frontendApi || '';
const url = buildPublicInterstitialUrl(options);
const response = await callWithRetry(() =>
Expand All @@ -163,10 +149,6 @@ export async function loadInterstitialFromBAPI(options: LoadInterstitialOptions)
}

export function buildPublicInterstitialUrl(options: LoadInterstitialOptions) {
if (options.frontendApi) {
deprecated('frontentApi', 'Use `publishableKey` instead.');
}

options.frontendApi = parsePublishableKey(options.publishableKey)?.frontendApi || options.frontendApi || '';
const { apiUrl, frontendApi, pkgVersion, clerkJSVersion, publishableKey, proxyUrl, isSatellite, domain, signInUrl } =
options;
Expand Down
5 changes: 0 additions & 5 deletions packages/backend/src/tokens/jwt/verifyJwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { Jwt, JwtPayload } from '@clerk/types';
// For more information refer to https://sinonjs.org/how-to/stub-dependency/
import runtime from '../../runtime';
import { base64url } from '../../util/rfc4648';
import { deprecated } from '../../util/shared';
import { TokenVerificationError, TokenVerificationErrorAction, TokenVerificationErrorReason } from '../errors';
import type { IssuerResolver } from './assertions';
import {
Expand Down Expand Up @@ -115,10 +114,6 @@ export async function verifyJwt(
token: string,
{ audience, authorizedParties, clockSkewInSeconds, clockSkewInMs, issuer, key }: VerifyJwtOptions,
): Promise<JwtPayload> {
if (clockSkewInSeconds) {
deprecated('clockSkewInSeconds', 'Use `clockSkewInMs` instead.');
}

const clockSkew = clockSkewInMs || clockSkewInSeconds || DEFAULT_CLOCK_SKEW_IN_SECONDS;

const decoded = decodeJwt(token);
Expand Down
5 changes: 0 additions & 5 deletions packages/backend/src/tokens/verify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { JwtPayload } from '@clerk/types';

import { deprecated } from '../util/shared';
import { TokenVerificationError, TokenVerificationErrorAction, TokenVerificationErrorReason } from './errors';
import type { VerifyJwtOptions } from './jwt';
import { decodeJwt, verifyJwt } from './jwt';
Expand Down Expand Up @@ -34,10 +33,6 @@ export async function verifyToken(token: string, options: VerifyTokenOptions): P
skipJwksCache,
} = options;

if (options.apiKey) {
deprecated('apiKey', 'Use `secretKey` instead.');
}

const { header } = decodeJwt(token);
const { kid } = header;

Expand Down

0 comments on commit aae1150

Please sign in to comment.