Skip to content

refactor(core): take the remaining duplicated types from @seamless-auth/types - #135

Merged
Bccorb merged 1 commit into
mainfrom
refactor/dedupe-remaining-types
Jul 30, 2026
Merged

refactor(core): take the remaining duplicated types from @seamless-auth/types#135
Bccorb merged 1 commit into
mainfrom
refactor/dedupe-remaining-types

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #133.

Change

Two duplications removed, both types that @seamless-auth/types already defines:

SeamlessUser is now an alias of MeUser. The name stays SeamlessUser here because that is what adapters and adopters import, so nothing renames.

Eight messaging wire shapes are re-exported rather than declared: MessagingChannel, DeliveryResult, EmailMessage, SmsMessage, SendOtpEmailInput, SendOtpSmsInput, SendMagicLinkEmailInput, AuthDeliveryInstruction.

I compared each against the upstream schema field by field before substituting, including the ones easy to get wrong: SendOtpSmsInput.token is string | number on both sides, DeliveryResult.raw is optional unknown, and AuthDeliveryInstruction is the same three-member discriminated union on kind.

What stays here, deliberately

EmailTransport, SmsTransport, AuthMessageOverrideContext, AuthMessageOverrides, AuthMessagingHandlers, SeamlessAuthMessagingOptions. These carry provider implementations and adopter configuration rather than wire shapes, so they belong to this package. That split is what the "Related" note on #118 predicted.

packages/core/src/authMessaging.ts drops from 114 to 83 lines and now reads as the contract it is: the wire shapes come from upstream, the transports are ours.

No public API change, no runtime cost

Verified rather than assumed:

  • Every name is still exported from @seamless-auth/core and both adapters. Compiled the whole public type surface against real values (constructing an EmailMessage, a SendOtpSmsInput with a numeric token, an AuthDeliveryInstruction, a SeamlessAuthMessagingOptions with transports, overrides and handlers) and it all still type-checks.
  • The re-exports are type-only, so they are erased. The built output across all three packages still imports only @seamless-auth/types/role/matching at runtime; there is no root import anywhere in dist, so neither zod nor the schema barrel enters the module graph. Cold import of core is unchanged.

That distinction is the rule worth keeping: types can come from the package root freely because they vanish at build time, but runtime values need the zod-free entry point, which is why fells-code/seamless-auth-types#7 existed.

Checks

pnpm build clean. pnpm test passes: 361 tests across the three packages.

…th/types

SeamlessUser is now an alias of the types package's MeUser, and the eight
messaging wire shapes are re-exported rather than declared again. Each was
field for field identical to a definition that already existed upstream,
which is the drift that package exists to prevent.

The transport interfaces and adopter-facing configuration stay here: they
carry provider implementations and adapter options, not wire shapes.

No public API change and no runtime cost. Every name is still exported under
the same name, the re-exports are type-only, and the built output still
imports only @seamless-auth/types/role/matching. Verified by compiling the
whole public type surface against real values.

Closes #133
@Bccorb
Bccorb merged commit 9e04625 into main Jul 30, 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.

Take the remaining duplicated types from @seamless-auth/types

1 participant