Skip to content

Commit

Permalink
chore(backend): Drop api/resources from exports
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkl committed Dec 15, 2023
1 parent 7e76b41 commit 1ee0cf1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 49 deletions.
45 changes: 45 additions & 0 deletions .changeset/silver-weeks-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
'gatsby-plugin-clerk': major
'@clerk/clerk-sdk-node': major
'@clerk/backend': major
'@clerk/fastify': major
'@clerk/nextjs': major
'@clerk/remix': major
---


Changes in exports of `@clerk/backend`:
- Drop the following internal exports from the top-level api:
```typescript
// Before
import {
AllowlistIdentifier,
Client,
DeletedObject,
Email,
EmailAddress,
ExternalAccount,
IdentificationLink,
Invitation,
OauthAccessToken,
ObjectType,
Organization,
OrganizationInvitation,
OrganizationMembership,
OrganizationMembershipPublicUserData,
PhoneNumber,
RedirectUrl,
SMSMessage,
Session,
SignInToken,
Token,
User,
Verification } from '@clerk/backend';
// After : no alternative since there is no need to use those classes
```
Dropping those exports results in also dropping the exports from `gatsby-plugin-clerk`, `@clerk/clerk-sdk-node`, `@clerk/backend`, `@clerk/fastify`, `@clerk/nextjs`, `@clerk/remix` packages.
- Keep those 3 resource related type exports
```typescript
import type { Organization, Session, User, WebhookEvent,
WebhookEventType } from '@clerk/backend'
```
27 changes: 1 addition & 26 deletions packages/backend/src/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,7 @@ export default (QUnit: QUnit) => {

module('public exports', () => {
test('should not include a breaking change', assert => {
const exportedApiKeys = [
'AllowlistIdentifier',
'Client',
'DeletedObject',
'Email',
'EmailAddress',
'ExternalAccount',
'IdentificationLink',
'Invitation',
'OauthAccessToken',
'ObjectType',
'Organization',
'OrganizationInvitation',
'OrganizationMembership',
'OrganizationMembershipPublicUserData',
'PhoneNumber',
'RedirectUrl',
'SMSMessage',
'Session',
'SignInToken',
'Token',
'User',
'Verification',
'createClerkClient',
'verifyToken',
];
const exportedApiKeys = ['createClerkClient', 'verifyToken'];
assert.deepEqual(Object.keys(publicExports).sort(), exportedApiKeys);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createBackendApiClient } from './api';
import type { CreateAuthenticateRequestOptions } from './tokens/factory';
import { createAuthenticateRequest } from './tokens/factory';

export * from './api/resources';
export type { Organization, Session, User, WebhookEvent, WebhookEventType } from './api/resources';
export type { VerifyTokenOptions } from './tokens/verify';
export { verifyToken } from './tokens/verify';

Expand Down
22 changes: 0 additions & 22 deletions packages/sdk-node/src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,8 @@

exports[`module exports should not change unless explicitly set 1`] = `
[
"AllowlistIdentifier",
"ClerkExpressRequireAuth",
"ClerkExpressWithAuth",
"Client",
"DeletedObject",
"Email",
"EmailAddress",
"ExternalAccount",
"IdentificationLink",
"Invitation",
"OauthAccessToken",
"ObjectType",
"Organization",
"OrganizationInvitation",
"OrganizationMembership",
"OrganizationMembershipPublicUserData",
"PhoneNumber",
"RedirectUrl",
"SMSMessage",
"Session",
"SignInToken",
"Token",
"User",
"Verification",
"clerkClient",
"createClerkClient",
"createClerkExpressRequireAuth",
Expand Down

0 comments on commit 1ee0cf1

Please sign in to comment.