Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(*): Improve @clerk/backend DX [Part 5 - Drop api/resources from exports] #2365

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .changeset/silver-weeks-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
'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
Loading