Skip to content

Deduplicate messaging types between core and express #118

Description

@Bccorb

packages/express/src/messaging.ts and packages/core/src/authMessaging.ts are byte-identical (114 lines each, diff reports no changes). Every messaging type is therefore declared twice, and the two copies can drift without anything failing.

The express package already depends on core ("@seamless-auth/core": "workspace:^") and already re-exports from it in src/index.ts:

export type { SeamlessUser } from "@seamless-auth/core";
export { hasScopedRole, roleGrantsAccess } from "@seamless-auth/core";

So the fix follows the pattern already in place:

  1. Delete packages/express/src/messaging.ts.
  2. Point the messaging type re-exports in packages/express/src/index.ts at @seamless-auth/core.
  3. Update the internal importers (src/internal/deliverAuthMessage.ts and anything else resolving ./messaging).

Related: the pure data shapes in this file (MessagingChannel, DeliveryResult, EmailMessage, SmsMessage, SendOtpEmailInput, SendOtpSmsInput, SendMagicLinkEmailInput, AuthDeliveryInstruction) are also duplicated in seamless-messaging/packages/core/src/types.ts, and have now been published from @seamless-auth/types as Zod schemas with inferred types. Core could take them from there instead of declaring them, leaving only the transport interfaces (which carry provider implementations) local to this repo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions