Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many types not exposed #14082

Open
3 tasks done
Akkuma opened this issue Dec 16, 2024 · 3 comments
Open
3 tasks done

Many types not exposed #14082

Akkuma opened this issue Dec 16, 2024 · 3 comments
Labels
Auth Related to Auth components/category feature-request Request a new feature TypeScript Related to TypeScript issues

Comments

@Akkuma
Copy link

Akkuma commented Dec 16, 2024

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

None

Environment information

# Put output below this line
System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 62.05 MB / 32.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 22.5.1 - /opt/homebrew/bin/node
    npm: 10.8.2 - /opt/homebrew/bin/npm
    pnpm: 9.9.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.0 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 131.1.73.91
    Chrome: 131.0.6778.86
    Safari: 17.4.1
  npmPackages:
    @aws-amplify/auth: ^6.8.3 => 6.8.3 
    @circle9r/gigashad: catalog: => 2.6.5 
    @circle9r/sst-util-lib: catalog: => 1.2.1 
    @remix-run/router: catalog: => 1.15.3 
    @types/react: ^18.2.71 => 18.2.72 
    @types/react-dom: catalog: => 18.2.22 
    @urql/exchange-auth: catalog: => 2.2.0 
    @urql/exchange-graphcache: ^6.5.1 => 6.5.1 
    @vitejs/plugin-react-swc: catalog: => 3.7.0 
    aws-amplify: catalog: => 6.10.2 
    dotenv: catalog: => 16.4.5 
    glob: catalog: => 10.3.10 
    pino: catalog: => 8.21.0 
    postcss: ^8.4.35 => 8.4.49 
    prettier: catalog: => 3.2.5 
    react: catalog: => 18.3.1 
    react-dom: catalog: => 18.2.0 
    react-router-dom: catalog: => 6.22.3 
    tailwind-merge: catalog: => 2.5.4 
    tailwindcss: ^3.4.1 => 3.4.3 
    tailwindcss-animate: ^1.0.7 => 1.0.7 
    type-fest: catalog: => 4.20.1 
    typescript: catalog: => 5.5.4 
    urql: ^4.0.6 => 4.0.7 
    valtio: catalog: => 1.13.2 
    vite: catalog: => 5.4.3 
    vite-tsconfig-paths: catalog: => 5.0.1 
  npmGlobalPackages:
    @circle9r/bison-cicd: 2.3.0
    @circle9r/gigashad: 2.5.4
    npm: 10.8.2
    test-mui: 1.0.0

Describe the bug

Types such as AuthFlowType are not being exported. Only a subset of types are being re-exported through the re-export chain of files.

Expected behavior

All exported types should be accessible without having to use other types to derive the type we're interested in utilizing.

Reproduction steps

  1. Attempt to utilize AuthFlowType
  2. Find it is never exported, but exists off of SignInOptions, which exists on SignInInput, but only after manually doing NonNullable<SignInInput['options']>

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Dec 16, 2024
@cwomack cwomack self-assigned this Dec 16, 2024
@cwomack cwomack added the Auth Related to Auth components/category label Dec 16, 2024
@cwomack
Copy link
Member

cwomack commented Dec 16, 2024

Hello, @Akkuma 👋. Going to initially mark this as a feature request to capture how we can make the use of the AuthFlowType more efficient. Currently, you'd need to access the nested type definitions within SignInOptions (like you've described above) which makes the API surface a little harder to use or discover.

I'll review this with the team internally, but could you also just give a little more context on the use case here and what you're looking to do with the AuthFlowType? Thanks!

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 16, 2024
@cwomack cwomack added feature-request Request a new feature pending-community-response Issue is pending a response from the author or community. and removed pending-triage Issue is pending triage labels Dec 16, 2024
@Akkuma
Copy link
Author

Akkuma commented Dec 17, 2024

Thanks @cwomack.

I'm upgrading from v5 to v6. I'm implementing this in React w/our own UI. We allowed at one point a user to choose email, phone, or password logins and each of those are mapped to the appropriate AuthFlowType. I'm using these types as such:

export const loginTypes = ['email', 'password', 'phone'] as const;
export type LoginType = (typeof loginTypes)[number];
const defaultLoginType: LoginType = 'email';

type AuthFlowType = NonNullable<NonNullable<SignInInput['options']>['authFlowType']>;
export const loginTypeToFlow: Record<LoginType, AuthFlowType> = {
	email: 'CUSTOM_WITHOUT_SRP',
	password: 'USER_PASSWORD_AUTH',
	phone: 'CUSTOM_WITHOUT_SRP',
};

This same problem exists for any types only accessible in the manner above (type AuthFlowType = NonNullable<NonNullable<SignInInput['options']>['authFlowType']>;). Unfortunately, how important all of them are is largely up to the need of each individual. In this case I'm comfortable with TS and can get to the type(s) I care about.

@github-actions github-actions bot added pending-maintainer-response Issue is pending a response from the Amplify team. and removed pending-community-response Issue is pending a response from the author or community. labels Dec 17, 2024
@cwomack
Copy link
Member

cwomack commented Dec 17, 2024

Appreciate the follow up here, @Akkuma. Will review this with the team and reach out with any further questions or updates!

@cwomack cwomack removed their assignment Dec 17, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 17, 2024
@cwomack cwomack added the TypeScript Related to TypeScript issues label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category feature-request Request a new feature TypeScript Related to TypeScript issues
Projects
None yet
Development

No branches or pull requests

2 participants