Skip to content
9 changes: 9 additions & 0 deletions .changeset/green-starfishes-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/backend': minor
---

Add waitlist entry types
- `WaitlistEntryJSON`
- `WaitlistEntryWebhookEvent`

Update `WebhookEvent` to include `WaitlistEntryWebhookEvent`
5 changes: 5 additions & 0 deletions .changeset/tender-suits-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/nextjs": patch
---

Re-export `WaitlistEntryJSON` from `@clerk/nextjs/server`.
12 changes: 12 additions & 0 deletions packages/backend/src/api/resources/JSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const ObjectType = {
SignUpAttempt: 'sign_up_attempt',
SmsMessage: 'sms_message',
User: 'user',
WaitlistEntry: 'waitlist_entry',
Web3Wallet: 'web3_wallet',
Token: 'token',
TotalCount: 'total_count',
Expand Down Expand Up @@ -382,6 +383,17 @@ export interface VerificationJSON extends ClerkResourceJSON {
message?: string | null;
}

export interface WaitlistEntryJSON extends ClerkResourceJSON {
created_at: number;
email_address: string;
id: string;
invitation: InvitationJSON | null;
is_locked: boolean;
object: typeof ObjectType.WaitlistEntry;
status: string;
updated_at: number;
}

export interface Web3WalletJSON extends ClerkResourceJSON {
object: typeof ObjectType.Web3Wallet;
web3_wallet: string;
Expand Down
6 changes: 5 additions & 1 deletion packages/backend/src/api/resources/Webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
SessionJSON,
SMSMessageJSON,
UserJSON,
WaitlistEntryJSON,
} from './JSON';

type Webhook<EvtType, Data> = { type: EvtType; object: 'event'; data: Data };
Expand Down Expand Up @@ -52,6 +53,8 @@ export type PermissionWebhookEvent = Webhook<
PermissionJSON
>;

export type WaitlistEntryWebhookEvent = Webhook<'waitlistEntry.created' | 'waitlistEntry.updated', WaitlistEntryJSON>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mackenzienolan,
can you include the WaitlistEntryWebhookEvent in the webhooks export we have in packages/backend/src/api/resources/index.ts? :)

export type {
  EmailWebhookEvent,
  OrganizationWebhookEvent,
  OrganizationDomainWebhookEvent,
  OrganizationInvitationWebhookEvent,
  OrganizationMembershipWebhookEvent,
  PermissionWebhookEvent,
  RoleWebhookEvent,
  SessionWebhookEvent,
  SMSWebhookEvent,
  UserWebhookEvent,
  WebhookEvent,
  WebhookEventType,
  WaitlistEntryWebhookEvent,
} from './Webhooks';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikospapcom added 👍


export type WebhookEvent =
| UserWebhookEvent
| SessionWebhookEvent
Expand All @@ -62,6 +65,7 @@ export type WebhookEvent =
| OrganizationMembershipWebhookEvent
| OrganizationInvitationWebhookEvent
| RoleWebhookEvent
| PermissionWebhookEvent;
| PermissionWebhookEvent
| WaitlistEntryWebhookEvent;

export type WebhookEventType = WebhookEvent['type'];
1 change: 1 addition & 0 deletions packages/backend/src/api/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type {
SessionWebhookEvent,
SMSWebhookEvent,
UserWebhookEvent,
WaitlistEntryWebhookEvent,
WebhookEvent,
WebhookEventType,
} from './Webhooks';
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export type {
SMSMessageJSON,
UserJSON,
VerificationJSON,
WaitlistEntryJSON,
Web3WalletJSON,
DeletedObjectJSON,
PaginatedResponseJSON,
Expand Down Expand Up @@ -126,6 +127,7 @@ export type {
SessionWebhookEvent,
SMSWebhookEvent,
UserWebhookEvent,
WaitlistEntryWebhookEvent,
WebhookEvent,
WebhookEventType,
} from './api/resources/Webhooks';
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type {
SessionJSON,
SMSMessageJSON,
UserJSON,
WaitlistEntryJSON,
WebhookEvent,
WebhookEventType,
UserWebhookEvent,
Expand All @@ -32,6 +33,7 @@ export type {
RoleWebhookEvent,
SessionWebhookEvent,
SMSWebhookEvent,
WaitlistEntryWebhookEvent,
} from '@clerk/backend';

/**
Expand Down