Skip to content

Commit

Permalink
Merge branch 'main' into revert/core-test-skew
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP authored Nov 3, 2023
2 parents 8dd7b9c + 02a91a4 commit 70fe673
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export {
forgetDevice,
fetchDevices,
autoSignIn,
AuthUser,
} from './providers/cognito';

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { assertTokenProviderConfig } from '@aws-amplify/core/internals/utils';
import { assertAuthTokens } from '../../utils/types';
import {
CognitoAuthSignInDetails,
CognitoAuthUser,
AuthUser,
GetCurrentUserOutput,
} from '../../types';

Expand All @@ -21,7 +21,7 @@ export const getCurrentUser = async (
assertAuthTokens(tokens);
const { 'cognito:username': username, sub } = tokens.idToken?.payload ?? {};

const authUser: CognitoAuthUser = {
const authUser: AuthUser = {
username: username as string,
userId: sub as string,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export {
SendUserAttributeVerificationCodeOutput,
FetchDevicesOutput,
} from './types/outputs';
export { CognitoAuthUser } from './types/models';
export { AuthUser } from './types/models';
export {
cognitoCredentialsProvider,
CognitoAWSCredentialsAndIdentityIdProvider,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export {
VerifiableUserAttributeKey,
MFAPreference,
AWSAuthDevice,
CognitoAuthUser,
AuthUser,
CognitoAuthSignInDetails,
} from './models';

Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/providers/cognito/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
AuthStandardAttributeKey,
AuthVerifiableAttributeKey,
} from '@aws-amplify/core/internals/utils';
import { AuthUserAttribute, AuthDevice, AuthUser } from '../../../types';
import { AuthUserAttribute, AuthDevice, AWSAuthUser } from '../../../types';
import { AuthProvider } from '../../../types/inputs';
import { SignUpOutput } from './outputs';

Expand Down Expand Up @@ -92,6 +92,6 @@ export type CognitoAuthSignInDetails = {
/**
* Holds the user information along with the sign in details.
*/
export interface CognitoAuthUser extends AuthUser {
export interface AuthUser extends AWSAuthUser {
signInDetails?: CognitoAuthSignInDetails;
}
5 changes: 2 additions & 3 deletions packages/auth/src/providers/cognito/types/outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AuthVerifiableAttributeKey } from '@aws-amplify/core/internals/utils';
import {
AuthMFAType,
AuthUserAttributes,
AuthUser,
AuthCodeDeliveryDetails,
AuthTOTPSetupDetails,
AuthSignInOutput,
Expand All @@ -14,7 +13,7 @@ import {
AuthUpdateUserAttributesOutput,
AuthUpdateUserAttributeOutput,
} from '../../../types';
import { AWSAuthDevice, CognitoAuthUser, UserAttributeKey } from '../types';
import { AWSAuthDevice, AuthUser, UserAttributeKey } from '../types';

export type FetchMFAPreferenceOutput = {
enabled?: AuthMFAType[];
Expand All @@ -29,7 +28,7 @@ export type FetchUserAttributesOutput = AuthUserAttributes<UserAttributeKey>;
/**
* Output type for Cognito getCurrentUser API.
*/
export type GetCurrentUserOutput = CognitoAuthUser;
export type GetCurrentUserOutput = AuthUser;

/**
* Output type for Cognito confirmSignIn API.
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/providers/cognito/utils/signInHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { AuthError } from '../../../errors/AuthError';
import { InitiateAuthException } from '../types/errors';
import {
AuthUser,
AWSAuthUser,
AuthUserAttributes,
AuthMFAType,
AuthTOTPSetupDetails,
Expand Down Expand Up @@ -1001,7 +1001,7 @@ export function isMFATypeEnabled(
}

export async function assertUserNotAuthenticated() {
let authUser: AuthUser | undefined;
let authUser: AWSAuthUser | undefined;
try {
authUser = await getCurrentUser();
} catch (error) {}
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export {
AuthNextUpdateAttributeStep,
AuthMFAType,
AuthAllowedMFATypes,
AuthUser,
AWSAuthUser,
AuthTOTPSetupDetails,
AuthResetPasswordStep,
AuthUpdateAttributeStep,
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ export type AuthNextUpdateAttributeStep<
};

/**
* The AuthUser object contains username and userId from the idToken.
* The AWSAuthUser object contains username and userId from the idToken.
*/
export type AuthUser = {
export type AWSAuthUser = {
username: string;
userId: string;
};
Expand Down

0 comments on commit 70fe673

Please sign in to comment.