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
5 changes: 5 additions & 0 deletions .changeset/shared-message-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@seamless-auth/messaging": minor
---

The message data shapes (`MessagingChannel`, `DeliveryResult`, `EmailMessage`, `SmsMessage`, `SendOtpEmailInput`, `SendOtpSmsInput` and `SendMagicLinkEmailInput`) now come from `@seamless-auth/types`, the same definitions the auth API and server adapters use. `AuthDeliveryInstruction`, the delivery payload the API returns when the adopter owns delivery, is now exported too. The shapes are unchanged, and `@seamless-auth/types` is only referenced by the type declarations, so nothing new loads at runtime.
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@seamless-auth/types": "^0.33.0"
}
}
26 changes: 6 additions & 20 deletions packages/core/src/messages.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
export interface SendOtpEmailInput {
to: string;
token: string;
from?: string;
subject?: string;
}

export interface SendOtpSmsInput {
to: string;
token: string | number;
from?: string;
}

export interface SendMagicLinkEmailInput {
to: string;
magicLinkUrl: string;
token?: string;
from?: string;
subject?: string;
}
export type {
AuthDeliveryInstruction,
SendMagicLinkEmailInput,
SendOtpEmailInput,
SendOtpSmsInput,
} from "@seamless-auth/types";

/**
* Asks a user to sign in and add a passkey, for example after their account was
Expand Down
25 changes: 4 additions & 21 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
export type MessagingChannel = "email" | "sms";
import type { EmailMessage as SharedEmailMessage } from "@seamless-auth/types";

export interface DeliveryResult {
accepted: boolean;
provider: string;
channel: MessagingChannel;
messageId?: string;
raw?: unknown;
}
export type { DeliveryResult, MessagingChannel, SmsMessage } from "@seamless-auth/types";

export interface EmailMessage {
to: string;
from?: string;
subject: string;
text: string;
html?: string;
export type EmailMessage = SharedEmailMessage & {
/**
* Extra headers to send with the message, such as `List-Unsubscribe`. Names
* and values are passed through as given; a transport that cannot send
* custom headers ignores them.
*/
headers?: Record<string, string>;
}

export interface SmsMessage {
to: string;
from?: string;
body: string;
}
};
Loading