Skip to content
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
22 changes: 22 additions & 0 deletions src/user-management/fixtures/list-waitlist-entries.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"object": "list",
"data": [
{
"object": "waitlist_entry",
"id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
"email": "marcelina.davis@example.com",
"state": "pending",
"approved_at": null,
"additional_fields": {
"company": "Example Corp"
},
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
],
"list_metadata": {
"before": null,
"after": null
}
}
15 changes: 15 additions & 0 deletions src/user-management/fixtures/list-waitlists.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"object": "list",
"data": [
{
"object": "waitlist",
"id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
],
"list_metadata": {
"before": null,
"after": null
}
}
13 changes: 13 additions & 0 deletions src/user-management/fixtures/waitlist-entry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"object": "waitlist_entry",
"id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5",
"email": "marcelina.davis@example.com",
"state": "pending",
"approved_at": null,
"additional_fields": {
"company": "Example Corp"
},
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
6 changes: 6 additions & 0 deletions src/user-management/fixtures/waitlist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"object": "waitlist",
"id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface CreateWaitlistEntryOptions {
/** The email address of the user joining the waitlist. */
email: string;
/** Additional key/value pairs collected with the waitlist entry. Supports up to 50 string pairs, with keys up to 40 characters and values up to 600 characters. */
additionalFields?: Record<string, string>;
/** Whether to send the waitlist confirmation email to the user. Defaults to `false`. No email is sent when the waitlist confirmation email is disabled in the environment, even if `sendConfirmationEmail` is `true`. */
sendConfirmationEmail?: boolean;
}

export interface SerializedCreateWaitlistEntryOptions {
email: string;
additional_fields?: Record<string, string>;
send_confirmation_email?: boolean;
}
4 changes: 4 additions & 0 deletions src/user-management/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from './create-organization-membership-options.interface';
export * from './create-password-reset-options.interface';
export * from './create-user-api-key-options.interface';
export * from './create-user-options.interface';
export * from './create-waitlist-entry-options.interface';
export * from './email-verification.interface';
export * from './enroll-auth-factor.interface';
export * from './identity.interface';
Expand All @@ -34,6 +35,7 @@ export * from './list-sessions-options.interface';
export * from './list-user-feature-flags-options.interface';
export * from './list-user-api-keys-options.interface';
export * from './list-users-options.interface';
export * from './list-waitlist-entries-options.interface';
export * from './locale.interface';
export * from './logout-url-options.interface';
export * from './magic-auth.interface';
Expand All @@ -55,3 +57,5 @@ export * from './user.interface';
export * from './user-api-key.interface';
export * from './user-api-key-with-value.interface';
export * from './verify-email-options.interface';
export * from './waitlist.interface';
export * from './waitlist-entry.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PaginationOptions } from '../../common/interfaces';
import { WaitlistEntryState } from './waitlist-entry.interface';

export interface ListWaitlistEntriesOptions extends PaginationOptions {
/** Filter entries by state. */
state?: WaitlistEntryState;
/** Filter entries by email address. */
email?: string;
}

export interface SerializedListWaitlistEntriesOptions extends PaginationOptions {
state?: WaitlistEntryState;
email?: string;
}
34 changes: 34 additions & 0 deletions src/user-management/interfaces/waitlist-entry.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export type WaitlistEntryState = 'pending' | 'approved' | 'denied';

export interface WaitlistEntry {
/** Distinguishes the Waitlist Entry object. */
object: 'waitlist_entry';
/** The unique ID of the waitlist entry. */
id: string;
/** The email address of the user on the waitlist. */
email: string;
/** The state of the waitlist entry. */
state: WaitlistEntryState;
/** The timestamp when the entry was approved, or null if not yet approved. */
approvedAt: string | null;
/** Additional fields submitted when the user joined the waitlist. Values are user-provided — treat them as untrusted input when rendering or exporting. */
additionalFields?: Record<string, string>;
/** The unique ID of the waitlist the entry belongs to. */
waitlistId: string | null;
/** An ISO 8601 timestamp. */
createdAt: string;
/** An ISO 8601 timestamp. */
updatedAt: string;
}

export interface WaitlistEntryResponse {
object: 'waitlist_entry';
id: string;
email: string;
state: WaitlistEntryState;
approved_at: string | null;
additional_fields?: Record<string, string>;
waitlist_id?: string | null;
created_at: string;
updated_at: string;
}
17 changes: 17 additions & 0 deletions src/user-management/interfaces/waitlist.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface Waitlist {
/** Distinguishes the Waitlist object. */
object: 'waitlist';
/** The unique ID of the Waitlist. */
id: string;
/** An ISO 8601 timestamp. */
createdAt: string;
/** An ISO 8601 timestamp. */
updatedAt: string;
}

export interface WaitlistResponse {
object: 'waitlist';
id: string;
created_at: string;
updated_at: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
CreateWaitlistEntryOptions,
SerializedCreateWaitlistEntryOptions,
} from '../interfaces/create-waitlist-entry-options.interface';

export const serializeCreateWaitlistEntryOptions = (
options: CreateWaitlistEntryOptions,
): SerializedCreateWaitlistEntryOptions => ({
email: options.email,
additional_fields: options.additionalFields,
send_confirmation_email: options.sendConfirmationEmail,
});
2 changes: 2 additions & 0 deletions src/user-management/serializers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ export * from './update-user-password-options.serializer';
export * from './user.serializer';
export * from './user-api-key.serializer';
export * from './user-api-key-with-value.serializer';
export * from './waitlist.serializer';
export * from './waitlist-entry.serializer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
ListWaitlistEntriesOptions,
SerializedListWaitlistEntriesOptions,
} from '../interfaces/list-waitlist-entries-options.interface';

export const serializeListWaitlistEntriesOptions = (
options: ListWaitlistEntriesOptions,
): SerializedListWaitlistEntriesOptions => ({
state: options.state,
email: options.email,
limit: options.limit,
before: options.before,
after: options.after,
order: options.order,
});
18 changes: 18 additions & 0 deletions src/user-management/serializers/waitlist-entry.serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
WaitlistEntry,
WaitlistEntryResponse,
} from '../interfaces/waitlist-entry.interface';

export const deserializeWaitlistEntry = (
waitlistEntry: WaitlistEntryResponse,
): WaitlistEntry => ({
object: waitlistEntry.object,
id: waitlistEntry.id,
email: waitlistEntry.email,
state: waitlistEntry.state,
approvedAt: waitlistEntry.approved_at,
additionalFields: waitlistEntry.additional_fields,
waitlistId: waitlistEntry.waitlist_id ?? null,
createdAt: waitlistEntry.created_at,
updatedAt: waitlistEntry.updated_at,
});
8 changes: 8 additions & 0 deletions src/user-management/serializers/waitlist.serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Waitlist, WaitlistResponse } from '../interfaces/waitlist.interface';

export const deserializeWaitlist = (waitlist: WaitlistResponse): Waitlist => ({
object: waitlist.object,
id: waitlist.id,
createdAt: waitlist.created_at,
updatedAt: waitlist.updated_at,
});
Loading