Skip to content

Commit

Permalink
chore: flatten out the /core from foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Aug 22, 2024
1 parent 1c88336 commit 49c28c7
Show file tree
Hide file tree
Showing 34 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AmplifyUrl } from '@aws-amplify/core/internals/utils';

import { cognitoUserPoolEndpointResolver } from '../../../src/foundation/core/cognitoUserPoolEndpointResolver';
import { COGNITO_IDP_SERVICE_NAME } from '../../../src/foundation/core/constants';
import { cognitoUserPoolEndpointResolver } from '../../../src/foundation/cognitoUserPoolEndpointResolver';
import { COGNITO_IDP_SERVICE_NAME } from '../../../src/foundation/constants';

describe('cognitoUserPoolEndpointResolver', () => {
it('should return the Cognito User Pool endpoint', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AuthError } from '../../../../src/errors/AuthError';
import {
getRegionFromIdentityPoolId,
getRegionFromUserPoolId,
} from '../../../../src/foundation/core/parsers/regionParsers';
} from '../../../../src/foundation/parsers/regionParsers';

describe('getRegionFromIdentityPoolId()', () => {
it('returns the region from the identity pool id', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AmplifyUrl } from '@aws-amplify/core/internals/utils';

import { cognitoUserPoolEndpointResolver } from '../../../../src/foundation/core/cognitoUserPoolEndpointResolver';
import { cognitoUserPoolEndpointResolver } from '../../../../src/foundation/cognitoUserPoolEndpointResolver';
import { createCognitoUserPoolEndpointResolver } from '../../../../src/providers/cognito/factories/createCognitoUserPoolEndpointResolver';

jest.mock('../../../../src/foundation/core/cognitoUserPoolEndpointResolver');
jest.mock('../../../../src/foundation/cognitoUserPoolEndpointResolver');

const mockCognitoUserPoolEndpointResolver = jest.mocked(
cognitoUserPoolEndpointResolver,
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/__tests__/providers/cognito/signOut.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
createGlobalSignOutClient,
createRevokeTokenClient,
} from '../../../src/foundation/factories/serviceClients/cognitoIdentityProvider';
import { getRegionFromUserPoolId } from '../../../src/foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../src/foundation/parsers';
import { createCognitoUserPoolEndpointResolver } from '../../../src/providers/cognito/factories';

jest.mock('@aws-amplify/core');
Expand All @@ -29,7 +29,7 @@ jest.mock('../../../src/utils');
jest.mock(
'../../../src/foundation/factories/serviceClients/cognitoIdentityProvider',
);
jest.mock('../../../src/foundation/core/parsers');
jest.mock('../../../src/foundation/parsers');
jest.mock('../../../src/providers/cognito/factories');

describe('signOut', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@aws-amplify/core/internals/aws-client-utils';
import { getAmplifyUserAgent } from '@aws-amplify/core/internals/utils';

import { COGNITO_IDP_SERVICE_NAME } from '../../../core/constants';
import { COGNITO_IDP_SERVICE_NAME } from '../../../constants';

export const DEFAULT_SERVICE_CLIENT_API_CONFIG = {
service: COGNITO_IDP_SERVICE_NAME,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { AuthError } from '../../../errors/AuthError';
import { AuthError } from '../../errors/AuthError';

export function getRegionFromUserPoolId(userPoolId?: string): string {
const region = userPoolId?.split('_')[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getAuthUserAgentValue } from '../../../utils';
import { getUserContextData } from '../utils/userContextData';
import { createConfirmForgotPasswordClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
import { createCognitoUserPoolEndpointResolver } from '../factories';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
/**
* Confirms the new password and verification code to reset the password.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/confirmSignUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ConfirmSignUpInput, ConfirmSignUpOutput } from '../types';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { ConfirmSignUpException } from '../types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { AutoSignInEventData } from '../types/models';
import {
isAutoSignInStarted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { VerifyUserAttributeException } from '../types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { ConfirmUserAttributeInput } from '../types';
import { getAuthUserAgentValue } from '../../../utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/deleteUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
assertTokenProviderConfig,
} from '@aws-amplify/core/internals/utils';

import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { DeleteUserException } from '../types/errors';
import { tokenOrchestrator } from '../tokenProvider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
assertTokenProviderConfig,
} from '@aws-amplify/core/internals/utils';

import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { DeleteUserAttributesInput } from '../types';
import { DeleteUserAttributesException } from '../types/errors';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/fetchDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { FetchDevicesOutput } from '../types';
import { DeviceType } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
import { assertAuthTokens } from '../utils/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { rememberDevice } from '..';
import { getAuthUserAgentValue } from '../../../utils';
import { createListDevicesClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { FetchMFAPreferenceOutput } from '../types';
import { getMFAType, getMFATypes } from '../utils/signInHelpers';
import { GetUserException } from '../types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { getAuthUserAgentValue } from '../../../utils';
import { createGetUserClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/forgetDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@aws-amplify/core/internals/utils';

import { assertAuthTokens, assertDeviceMetadata } from '../utils/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { tokenOrchestrator } from '../tokenProvider';
import { ForgetDeviceInput } from '../types';
import { ForgetDeviceException } from '../../cognito/types/errors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
fetchAuthSession,
} from '@aws-amplify/core/internals/utils';

import { getRegionFromUserPoolId } from '../../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../../foundation/parsers';
import { assertAuthTokens } from '../../utils/types';
import { FetchUserAttributesOutput } from '../../types';
import { toAuthUserAttribute } from '../../utils/apiHelpers';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/rememberDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@aws-amplify/core/internals/utils';

import { assertAuthTokens, assertDeviceMetadata } from '../utils/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { tokenOrchestrator } from '../tokenProvider';
import { UpdateDeviceStatusException } from '../../cognito/types/errors';
import { getAuthUserAgentValue } from '../../../utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AuthDeliveryMedium } from '../../../types';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { ResendSignUpCodeInput, ResendSignUpCodeOutput } from '../types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { getAuthUserAgentValue } from '../../../utils';
import { getUserContextData } from '../utils/userContextData';
import { ResendConfirmationException } from '../types/errors';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/resetPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { AuthDeliveryMedium } from '../../../types';
import { ResetPasswordInput, ResetPasswordOutput } from '../types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { ForgotPasswordException } from '../../cognito/types/errors';
import { getAuthUserAgentValue } from '../../../utils';
import { getUserContextData } from '../utils/userContextData';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SendUserAttributeVerificationCodeOutput,
} from '../types';
import { assertAuthTokens } from '../utils/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { GetUserAttributeVerificationException } from '../types/errors';
import { getAuthUserAgentValue } from '../../../utils';
import { createGetUserAttributeVerificationCodeClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/setUpTOTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '../types/errors';
import { SetUpTOTPOutput } from '../types';
import { getTOTPSetupDetails } from '../utils/signInHelpers';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { getAuthUserAgentValue } from '../../../utils';
import { createAssociateSoftwareTokenClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/signOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { getAuthUserAgentValue } from '../../../utils';
import { SignOutInput } from '../types';
import { tokenOrchestrator } from '../tokenProvider';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import {
assertAuthTokens,
assertAuthTokensWithRefreshToken,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/signUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SignInInput, SignUpInput, SignUpOutput } from '../types';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { SignUpException } from '../types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { toAttributeType } from '../utils/apiHelpers';
import {
autoSignInUserConfirmed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { UpdateMFAPreferenceInput } from '../types';
import { SetUserMFAPreferenceException } from '../types/errors';
import { MFAPreference } from '../types/models';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { CognitoMFASettings } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
import { assertAuthTokens } from '../utils/types';
import { getAuthUserAgentValue } from '../../../utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/apis/updatePassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { UpdatePasswordInput } from '../types';
import { ChangePasswordException } from '../../cognito/types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { getAuthUserAgentValue } from '../../../utils';
import { createChangePasswordClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
UpdateUserAttributesOutput,
} from '../types';
import { assertAuthTokens } from '../utils/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { toAttributeType } from '../utils/apiHelpers';
import { CodeDeliveryDetailsType } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
import { UpdateUserAttributesException } from '../types/errors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AuthValidationErrorCode } from '../../../errors/types/validation';
import { assertValidationError } from '../../../errors/utils/assertValidationError';
import { VerifyTOTPSetupInput } from '../types';
import { VerifySoftwareTokenException } from '../types/errors';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokens } from '../utils/types';
import { getAuthUserAgentValue } from '../../../utils';
import { createVerifySoftwareTokenClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AuthTokens, ConsoleLogger, Identity, getId } from '@aws-amplify/core';
import { CognitoIdentityPoolConfig } from '@aws-amplify/core/internals/utils';

import { AuthError } from '../../../errors/AuthError';
import { getRegionFromIdentityPoolId } from '../../../foundation/core/parsers';
import { getRegionFromIdentityPoolId } from '../../../foundation/parsers';
import { GetIdException } from '../types/errors';

import { IdentityIdStore } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@aws-amplify/core/internals/utils';

import { AuthError } from '../../../errors/AuthError';
import { getRegionFromIdentityPoolId } from '../../../foundation/core/parsers';
import { getRegionFromIdentityPoolId } from '../../../foundation/parsers';
import { assertIdTokenInAuthTokens } from '../utils/types';

import { IdentityIdStore } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { EndpointResolverOptions } from '@aws-amplify/core/internals/aws-client-utils';
import { AmplifyUrl } from '@aws-amplify/core/internals/utils';

import { cognitoUserPoolEndpointResolver } from '../../../foundation/core/cognitoUserPoolEndpointResolver';
import { cognitoUserPoolEndpointResolver } from '../../../foundation/cognitoUserPoolEndpointResolver';

export const createCognitoUserPoolEndpointResolver =
({ endpointOverride }: { endpointOverride: string | undefined }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@aws-amplify/core/internals/utils';

import { CognitoAuthTokens, TokenRefresher } from '../tokenProvider/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';
import { assertAuthTokensWithRefreshToken } from '../utils/types';
import { AuthError } from '../../../errors/AuthError';
import { createInitiateAuthClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/utils/signInHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
RespondToAuthChallengeCommandInput,
RespondToAuthChallengeCommandOutput,
} from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
import { getRegionFromUserPoolId } from '../../../foundation/core/parsers';
import { getRegionFromUserPoolId } from '../../../foundation/parsers';

import { signInStore } from './signInStore';
import { assertDeviceMetadata } from './types';
Expand Down

0 comments on commit 49c28c7

Please sign in to comment.