Skip to content

refactor: align auth types with @wxyc/shared#209

Merged
jakebromberg merged 3 commits intomainfrom
refactor/shared-auth-types
Mar 10, 2026
Merged

refactor: align auth types with @wxyc/shared#209
jakebromberg merged 3 commits intomainfrom
refactor/shared-auth-types

Conversation

@jakebromberg
Copy link
Member

Summary

  • Add @wxyc/shared dependency and re-export WXYCRole, Authorization, and roleToAuthorization from the shared package
  • Add compile-time assertion that local roles are valid shared roles
  • Introduce ImplementedRole type for roles with better-auth access control implementations
  • Set up .npmrc and CI NPM_TOKEN for GitHub Packages authentication

Closes #208

Test plan

  • All 49 auth unit tests pass (4 test suites)
  • New compatibility test verifies WXYCRoles alignment with shared types
  • Full typecheck passes across all workspaces
  • Full build succeeds (ESM + CJS)
  • Verify NPM_TOKEN secret exists in Backend-Service repo settings (required for CI)

Copy link
Collaborator

@AyBruno AyBruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but we may want another pass to use secrets instead of build args for the npm token.

#Build stage
FROM node:22-alpine AS builder

ARG NPM_TOKEN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We may want to make use of dockerfile secrets instead of args here: https://docs.docker.com/build/building/secrets/

If nothing else, but to shut up the linter.

@AyBruno
Copy link
Collaborator

AyBruno commented Mar 9, 2026

ALSO, merge conflicts

Jake Bromberg added 3 commits March 9, 2026 21:28
Add @wxyc/shared as a dependency and re-export WXYCRole,
Authorization, and roleToAuthorization from the shared package.
This ensures a single source of truth for auth types across
the stack.

Changes:
- Add .npmrc for GitHub Packages registry authentication
- Add @wxyc/shared to shared/authentication dependencies
- Re-export WXYCRole type from shared (replaces local definition)
- Add compile-time assertion that local roles are valid shared roles
- Introduce ImplementedRole type for roles with better-auth impls
- Add NPM_TOKEN env to all CI install steps
- Add @wxyc/shared to jest transform and tsup externals
- Add shared type compatibility tests
- Fix lint error: replace non-null assertion with proper guard
- Suppress no-unused-vars warning on compile-time assertion
- Pass NPM_TOKEN build arg to Docker builds for @wxyc/shared
- Copy .npmrc into Docker images, remove from production stage
- Format test file with Prettier
- Pass NPM_TOKEN build-arg in workspace docker:build scripts
- Add NPM_TOKEN env to Set Up Test Environment CI step
@jakebromberg jakebromberg force-pushed the refactor/shared-auth-types branch from e1c4a55 to e2bc13a Compare March 10, 2026 04:32
@jakebromberg jakebromberg merged commit 8e15cfa into main Mar 10, 2026
4 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.

Align auth types with @wxyc/shared

2 participants