Skip to content

refactor(express): take messaging types from core - #122

Merged
Bccorb merged 1 commit into
mainfrom
fix/dedupe-messaging-types
Jul 29, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/dedupe-messaging-types

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #118

Problem

packages/express/src/messaging.ts and packages/core/src/authMessaging.ts were byte-identical, 114 lines each. Every messaging type was declared twice, and the two copies could drift without anything failing.

Change

Delete the express copy and point everything at @seamless-auth/core, matching the pattern already in src/index.ts for SeamlessUser, hasScopedRole, and roleGrantsAccess:

  • src/index.ts: the messaging type re-exports now come from @seamless-auth/core, folded into the existing SeamlessUser re-export.
  • src/createServer.ts: SeamlessAuthMessagingOptions imported from core.
  • src/internal/deliverAuthMessage.ts: AuthDeliveryInstruction, EmailMessage, SeamlessAuthMessagingOptions, and SmsMessage imported from core.

No public surface change

Verified rather than assumed. Clean-built the emitted .d.ts on main and on this branch and diffed them. The only differences are the module specifier the types are re-exported from; the set of exported names is unchanged:

< export type { AuthMessageOverrides, ..., SmsTransport, } from "./messaging";
< export type { SeamlessUser } from "@seamless-auth/core";
---
> export type { AuthMessageOverrides, ..., SeamlessUser, ..., SmsTransport, } from "@seamless-auth/core";

dist/messaging.d.ts is gone, but it was never reachable by adopters: the package declares only a root . export, no subpaths. @seamless-auth/core is already a real dependencies entry, so the types resolve for consumers.

The types the adapter and core share are now one declaration rather than two structurally identical ones.

Not in scope

The issue's "Related" note suggests core could take the pure data shapes from @seamless-auth/types instead of declaring them. That overlaps #120 and is left for a separate PR. Worth knowing before that one is picked up: the role module is not in the published @seamless-auth/types@0.1.3, so #120 is blocked on a release from that repo.

Checks

pnpm build clean. pnpm test passes: 43 suites, 205 tests. Patch changeset added for @seamless-auth/express.

packages/express/src/messaging.ts was byte-identical to
packages/core/src/authMessaging.ts, so every messaging type was declared
twice with nothing to keep the copies in step.

Delete the express copy and point the re-exports and internal importers at
@seamless-auth/core, matching the pattern already used for SeamlessUser,
hasScopedRole, and roleGrantsAccess. The package root exports the same type
names as before, and the deleted module was never reachable on its own
because the package declares only a root export.

Closes #118
@Bccorb
Bccorb merged commit 0b384e2 into main Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deduplicate messaging types between core and express

1 participant