From d30b77eeb2aae6ff2de7520fc779f6b70c301017 Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Wed, 21 Aug 2024 16:59:54 -0700 Subject: [PATCH] chore: resolve most of the comments from cshfang --- .../foundation/core/parsers/getRegion.test.ts | 2 +- .../cognitoUserPoolTransferHandler.test.ts | 1 - .../buildEmptyResponseDeserializer.test.ts | 4 ++-- .../buildUserPoolDeserializer.test.ts | 4 ++-- .../buildUserPoolSerializer.test.ts | 4 ++-- .../cognitoIdentityProvider/testUtils/data.ts | 6 +++--- .../auth/src/foundation/core/parsers/index.ts | 2 +- .../{getRegion.ts => regionParsers.ts} | 0 .../createAssociateSoftwareTokenClient.ts | 20 +++++++++---------- .../createChangePasswordClient.ts | 14 ++++++------- .../createConfirmDeviceClient.ts | 14 ++++++------- .../createConfirmForgotPasswordClient.ts | 20 +++++++++---------- .../createConfirmSignUpClient.ts | 14 ++++++------- .../createDeleteUserAttributesClient.ts | 20 +++++++++---------- .../createDeleteUserClient.ts | 17 +++++++++------- .../createForgetDeviceClient.ts | 14 ++++++------- .../createForgotPasswordClient.ts | 20 +++++++++---------- ...eGetUserAttributeVerificationCodeClient.ts | 20 +++++++++---------- .../createGetUserClient.ts | 17 +++++++++------- .../createGlobalSignOutClient.ts | 20 +++++++++---------- .../createInitiateAuthClient.ts | 18 ++++++++--------- .../createListDevicesClient.ts | 17 +++++++++------- .../createResendConfirmationCodeClient.ts | 20 +++++++++---------- .../createRespondToAuthChallengeClient.ts | 20 +++++++++---------- .../createRevokeTokenClient.ts | 12 +++++------ .../createSetUserMFAPreferenceClient.ts | 16 +++++++-------- .../createSignUpClient.ts | 17 +++++++++------- .../createUpdateDeviceStatusClient.ts | 20 +++++++++---------- .../createUpdateUserAttributesClient.ts | 20 +++++++++---------- .../createVerifySoftwareTokenClient.ts | 20 +++++++++---------- .../createVerifyUserAttributeClient.ts | 20 +++++++++---------- ....ts => createEmptyResponseDeserializer.ts} | 12 ++++------- ...lizer.ts => createUserPoolDeserializer.ts} | 8 +++++--- ...ializer.ts => createUserPoolSerializer.ts} | 2 +- .../shared/serialization/index.ts | 6 +++--- .../cognitoIdentityProvider/types/index.ts | 4 ++-- .../types/{Sdk.ts => sdk.ts} | 0 .../{ServiceClient.ts => serviceClient.ts} | 2 +- 38 files changed, 238 insertions(+), 229 deletions(-) rename packages/auth/src/foundation/core/parsers/{getRegion.ts => regionParsers.ts} (100%) rename packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/{buildUserPoolDeserializer.ts => createEmptyResponseDeserializer.ts} (72%) rename packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/{buildEmptyResponseDeserializer.ts => createUserPoolDeserializer.ts} (85%) rename packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/{buildUserPoolSerializer.ts => createUserPoolSerializer.ts} (97%) rename packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/{Sdk.ts => sdk.ts} (100%) rename packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/{ServiceClient.ts => serviceClient.ts} (85%) diff --git a/packages/auth/__tests__/foundation/core/parsers/getRegion.test.ts b/packages/auth/__tests__/foundation/core/parsers/getRegion.test.ts index f5b2aac720b..6a5780e8d18 100644 --- a/packages/auth/__tests__/foundation/core/parsers/getRegion.test.ts +++ b/packages/auth/__tests__/foundation/core/parsers/getRegion.test.ts @@ -2,7 +2,7 @@ import { AuthError } from '../../../../src/errors/AuthError'; import { getRegionFromIdentityPoolId, getRegionFromUserPoolId, -} from '../../../../src/foundation/core/parsers/getRegion'; +} from '../../../../src/foundation/core/parsers/regionParsers'; describe('getRegionFromIdentityPoolId()', () => { it('returns the region from the identity pool id', () => { diff --git a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.test.ts b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.test.ts index cca1b86ce04..8f5bbc8c7f9 100644 --- a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.test.ts +++ b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.test.ts @@ -17,7 +17,6 @@ describe('cognitoUserPoolTransferHandler', () => { }); it('adds the disableCacheMiddlewareFactory at module loading', () => { - console.log(mockComposeTransferHandler); expect(mockComposeTransferHandler).toHaveBeenCalledTimes(1); const [core, middleware] = mockComposeTransferHandler.mock.calls[0]; diff --git a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.test.ts b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.test.ts index 32a2c6c1e2b..9bfb5fa1391 100644 --- a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.test.ts +++ b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.test.ts @@ -3,7 +3,7 @@ import { parseJsonError, } from '@aws-amplify/core/internals/aws-client-utils'; -import { buildEmptyResponseDeserializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer'; +import { createEmptyResponseDeserializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createEmptyResponseDeserializer'; import { AuthError } from '../../../../../../../src/errors/AuthError'; jest.mock('@aws-amplify/core/internals/aws-client-utils'); @@ -11,7 +11,7 @@ jest.mock('@aws-amplify/core/internals/aws-client-utils'); const mockParseJsonError = jest.mocked(parseJsonError); describe('buildEmptyResponseDeserializer created response deserializer', () => { - const deserializer = buildEmptyResponseDeserializer(); + const deserializer = createEmptyResponseDeserializer(); it('returns undefined for 2xx status code', async () => { const response: HttpResponse = { diff --git a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.test.ts b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.test.ts index 03696f3b894..065d2a548bf 100644 --- a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.test.ts +++ b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.test.ts @@ -4,7 +4,7 @@ import { parseJsonError, } from '@aws-amplify/core/internals/aws-client-utils'; -import { buildUserPoolDeserializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer'; +import { createUserPoolDeserializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolDeserializer'; import { AuthError } from '../../../../../../../src/errors/AuthError'; jest.mock('@aws-amplify/core/internals/aws-client-utils'); @@ -13,7 +13,7 @@ const mockParseJsonBody = jest.mocked(parseJsonBody); const mockParseJsonError = jest.mocked(parseJsonError); describe('buildUserPoolDeserializer created response deserializer', () => { - const deserializer = buildUserPoolDeserializer(); + const deserializer = createUserPoolDeserializer(); it('returns body for 2xx status code', async () => { const expectedBody = { test: 'test' }; diff --git a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.test.ts b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.test.ts index 594d3f2ceaf..3b48d1a5a04 100644 --- a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.test.ts +++ b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.test.ts @@ -1,6 +1,6 @@ import { AmplifyUrl } from '@aws-amplify/core/internals/utils'; -import { buildUserPoolSerializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer'; +import { createUserPoolSerializer } from '../../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolSerializer'; describe('buildUserPoolSerializer created request serializer', () => { test.each(['SignUp', 'InitiateAuth', 'RevokeToken'] as const)( @@ -10,7 +10,7 @@ describe('buildUserPoolSerializer created request serializer', () => { const testEndpoint = { url: new AmplifyUrl('http://test.com'), }; - const serializer = buildUserPoolSerializer(operation); + const serializer = createUserPoolSerializer(operation); const result = serializer(testInput, testEndpoint); expect(result).toEqual({ diff --git a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/testUtils/data.ts b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/testUtils/data.ts index efe5657d084..33a9a3d5534 100644 --- a/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/testUtils/data.ts +++ b/packages/auth/__tests__/foundation/factories/serviceClients/cognitoIdentityProvider/testUtils/data.ts @@ -1,7 +1,7 @@ -import { ServiceClientAPIConfig } from '../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/types/ServiceClient'; +import { ServiceClientFactoryInput } from '../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/types'; -export const mockServiceClientAPIConfig: ServiceClientAPIConfig = { +export const mockServiceClientAPIConfig: ServiceClientFactoryInput = { endpointResolver: jest.fn() as jest.MockedFunction< - ServiceClientAPIConfig['endpointResolver'] + ServiceClientFactoryInput['endpointResolver'] >, }; diff --git a/packages/auth/src/foundation/core/parsers/index.ts b/packages/auth/src/foundation/core/parsers/index.ts index f90234201e7..901f99a010e 100644 --- a/packages/auth/src/foundation/core/parsers/index.ts +++ b/packages/auth/src/foundation/core/parsers/index.ts @@ -3,4 +3,4 @@ export { getRegionFromUserPoolId, getRegionFromIdentityPoolId, -} from './getRegion'; +} from './regionParsers'; diff --git a/packages/auth/src/foundation/core/parsers/getRegion.ts b/packages/auth/src/foundation/core/parsers/regionParsers.ts similarity index 100% rename from packages/auth/src/foundation/core/parsers/getRegion.ts rename to packages/auth/src/foundation/core/parsers/regionParsers.ts diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.ts index 82c6e03aa1d..757f6bea2d1 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { AssociateSoftwareTokenCommandInput, AssociateSoftwareTokenCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createAssociateSoftwareTokenClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'AssociateSoftwareToken', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.ts index 12a47bb05dc..ea5a4f0aa90 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.ts @@ -4,21 +4,21 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/ import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; import { ChangePasswordCommandInput, ChangePasswordCommandOutput, -} from './types/Sdk'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; + ServiceClientFactoryInput, +} from './types'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createChangePasswordClient = (config: ServiceClientAPIConfig) => +export const createChangePasswordClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ChangePassword'), - buildUserPoolDeserializer(), + createUserPoolSerializer('ChangePassword'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.ts index cdc90e53334..fb5fd05e7c1 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.ts @@ -4,21 +4,21 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/ import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; import { ConfirmDeviceCommandInput, ConfirmDeviceCommandOutput, -} from './types/Sdk'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; + ServiceClientFactoryInput, +} from './types'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createConfirmDeviceClient = (config: ServiceClientAPIConfig) => +export const createConfirmDeviceClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ConfirmDevice'), - buildUserPoolDeserializer(), + createUserPoolSerializer('ConfirmDevice'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.ts index 5e60c29802e..ca64848ad74 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { ConfirmForgotPasswordCommandInput, ConfirmForgotPasswordCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createConfirmForgotPasswordClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'ConfirmForgotPassword', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.ts index 5ccfb89e470..1eee1f81f94 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.ts @@ -5,20 +5,20 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/ import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; import { ConfirmSignUpCommandInput, ConfirmSignUpCommandOutput, -} from './types/Sdk'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; + ServiceClientFactoryInput, +} from './types'; -export const createConfirmSignUpClient = (config: ServiceClientAPIConfig) => +export const createConfirmSignUpClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ConfirmSignUp'), - buildUserPoolDeserializer(), + createUserPoolSerializer('ConfirmSignUp'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.ts index 00a38e7350f..b9e0c5c021a 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { DeleteUserAttributesCommandInput, DeleteUserAttributesCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createDeleteUserAttributesClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'DeleteUserAttributes', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.ts index 234de9b8404..39c3db1efce 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.ts @@ -2,20 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; +import { + DeleteUserCommandInput, + DeleteUserCommandOutput, + ServiceClientFactoryInput, +} from './types'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildEmptyResponseDeserializer, - buildUserPoolSerializer, + createEmptyResponseDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { DeleteUserCommandInput, DeleteUserCommandOutput } from './types/Sdk'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createDeleteUserClient = (config: ServiceClientAPIConfig) => +export const createDeleteUserClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('DeleteUser'), - buildEmptyResponseDeserializer(), + createUserPoolSerializer('DeleteUser'), + createEmptyResponseDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.ts index bbb18ddda8c..009d888c2b7 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.ts @@ -4,21 +4,21 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/ import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildEmptyResponseDeserializer, - buildUserPoolSerializer, + createEmptyResponseDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; import { ForgetDeviceCommandInput, ForgetDeviceCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createForgetDeviceClient = (config: ServiceClientAPIConfig) => +export const createForgetDeviceClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ForgetDevice'), - buildEmptyResponseDeserializer(), + createUserPoolSerializer('ForgetDevice'), + createEmptyResponseDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.ts index db1a70af4d1..a381b0209f0 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.ts @@ -2,23 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { ForgotPasswordCommandInput, ForgotPasswordCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createForgotPasswordClient = (config: ServiceClientAPIConfig) => +export const createForgotPasswordClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ForgotPassword'), - buildUserPoolDeserializer(), + createUserPoolSerializer('ForgotPassword'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.ts index 6e07a050516..1354ed2c93e 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { GetUserAttributeVerificationCodeCommandInput, GetUserAttributeVerificationCodeCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createGetUserAttributeVerificationCodeClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'GetUserAttributeVerificationCode', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.ts index a5d816a4806..aa38363567e 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.ts @@ -2,20 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; +import { + GetUserCommandInput, + GetUserCommandOutput, + ServiceClientFactoryInput, +} from './types'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { GetUserCommandInput, GetUserCommandOutput } from './types/Sdk'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createGetUserClient = (config: ServiceClientAPIConfig) => +export const createGetUserClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('GetUser'), - buildUserPoolDeserializer(), + createUserPoolSerializer('GetUser'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.ts index 96f0b20eb6e..422cb43f406 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.ts @@ -2,23 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { GlobalSignOutCommandInput, GlobalSignOutCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createGlobalSignOutClient = (config: ServiceClientAPIConfig) => +export const createGlobalSignOutClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('GlobalSignOut'), - buildUserPoolDeserializer(), + createUserPoolSerializer('GlobalSignOut'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.ts index 9bffc384a85..eef86cb6304 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.ts @@ -3,23 +3,23 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { InitiateAuthCommandInput, InitiateAuthCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createInitiateAuthClient = (config: ServiceClientAPIConfig) => +export const createInitiateAuthClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('InitiateAuth'), - buildUserPoolDeserializer(), + createUserPoolSerializer('InitiateAuth'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.ts index b0667a2e0b3..ce784df5e6a 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.ts @@ -2,20 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; +import { + ListDevicesCommandInput, + ListDevicesCommandOutput, + ServiceClientFactoryInput, +} from './types'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { ListDevicesCommandInput, ListDevicesCommandOutput } from './types/Sdk'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; -export const createListDevicesClient = (config: ServiceClientAPIConfig) => +export const createListDevicesClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('ListDevices'), - buildUserPoolDeserializer(), + createUserPoolSerializer('ListDevices'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.ts index d96771bf1b7..a94b9b1347c 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { ResendConfirmationCodeCommandInput, ResendConfirmationCodeCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createResendConfirmationCodeClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'ResendConfirmationCode', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.ts index d0fcd9c2d1e..24baa618f6f 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { RespondToAuthChallengeCommandInput, RespondToAuthChallengeCommandOutput, -} from './types/Sdk'; + ServiceClientFactoryInput, +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createRespondToAuthChallengeClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'RespondToAuthChallenge', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.ts index 2d1757adb49..4e4f1232eaf 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.ts @@ -4,10 +4,10 @@ import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/ import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; +import { ServiceClientFactoryInput } from './types'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; interface RevokeTokenInput { @@ -17,11 +17,11 @@ interface RevokeTokenInput { type RevokeTokenOutput = Record; -export const createRevokeTokenClient = (config: ServiceClientAPIConfig) => +export const createRevokeTokenClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('RevokeToken'), - buildUserPoolDeserializer(), + createUserPoolSerializer('RevokeToken'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.ts index 868e3f973b1..9ffdc31fc1e 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; import { + ServiceClientFactoryInput, SetUserMFAPreferenceCommandInput, SetUserMFAPreferenceCommandOutput, -} from './types/Sdk'; +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createSetUserMFAPreferenceClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'SetUserMFAPreference', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts index 718603e2757..93880c56702 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts @@ -2,20 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; +import { + ServiceClientFactoryInput, + SignUpCommandInput, + SignUpCommandOutput, +} from './types'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; import { cognitoUserPoolTransferHandler } from './shared/handler'; import { - buildUserPoolDeserializer, - buildUserPoolSerializer, + createUserPoolDeserializer, + createUserPoolSerializer, } from './shared/serialization'; -import { SignUpCommandInput, SignUpCommandOutput } from './types/Sdk'; -export const createSignUpClient = (config: ServiceClientAPIConfig) => +export const createSignUpClient = (config: ServiceClientFactoryInput) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer('SignUp'), - buildUserPoolDeserializer(), + createUserPoolSerializer('SignUp'), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.ts index a2a6020c3c1..32b4471fbf7 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { + ServiceClientFactoryInput, UpdateDeviceStatusCommandInput, UpdateDeviceStatusCommandOutput, -} from './types/Sdk'; +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createUpdateDeviceStatusClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'UpdateDeviceStatus', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.ts index 0691e99a006..c37329a47dc 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { + ServiceClientFactoryInput, UpdateUserAttributesCommandInput, UpdateUserAttributesCommandOutput, -} from './types/Sdk'; +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createUpdateUserAttributesClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'UpdateUserAttributes', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.ts index 00bcac6b69f..355e2dc224e 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { + ServiceClientFactoryInput, VerifySoftwareTokenCommandInput, VerifySoftwareTokenCommandOutput, -} from './types/Sdk'; +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createVerifySoftwareTokenClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'VerifySoftwareToken', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.ts index 96729eaa85a..5417839112c 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.ts @@ -2,27 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers'; -import { ServiceClientAPIConfig } from './types/ServiceClient'; -import { cognitoUserPoolTransferHandler } from './shared/handler'; -import { - buildUserPoolDeserializer, - buildUserPoolSerializer, -} from './shared/serialization'; import { + ServiceClientFactoryInput, VerifyUserAttributeCommandInput, VerifyUserAttributeCommandOutput, -} from './types/Sdk'; +} from './types'; +import { cognitoUserPoolTransferHandler } from './shared/handler'; +import { + createUserPoolDeserializer, + createUserPoolSerializer, +} from './shared/serialization'; import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants'; export const createVerifyUserAttributeClient = ( - config: ServiceClientAPIConfig, + config: ServiceClientFactoryInput, ) => composeServiceApi( cognitoUserPoolTransferHandler, - buildUserPoolSerializer( + createUserPoolSerializer( 'VerifyUserAttribute', ), - buildUserPoolDeserializer(), + createUserPoolDeserializer(), { ...DEFAULT_SERVICE_CLIENT_API_CONFIG, ...config, diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createEmptyResponseDeserializer.ts similarity index 72% rename from packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.ts rename to packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createEmptyResponseDeserializer.ts index cc68d55cb94..005c28e4570 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolDeserializer.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createEmptyResponseDeserializer.ts @@ -1,27 +1,23 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 - import { HttpResponse, - parseJsonBody, parseJsonError, } from '@aws-amplify/core/internals/aws-client-utils'; import { assertServiceError } from '../../../../../../errors/utils/assertServiceError'; import { AuthError } from '../../../../../../errors/AuthError'; -export const buildUserPoolDeserializer = (): (( +export const createEmptyResponseDeserializer = (): (( response: HttpResponse, -) => Promise) => { - return async (response: HttpResponse): Promise => { +) => Promise) => { + return async (response: HttpResponse): Promise => { if (response.statusCode >= 300) { const error = await parseJsonError(response); assertServiceError(error); throw new AuthError({ name: error.name, message: error.message }); } else { - const body = await parseJsonBody(response); - - return body; + return undefined; } }; }; diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolDeserializer.ts similarity index 85% rename from packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.ts rename to packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolDeserializer.ts index 8c2a9063164..07a4214f5f0 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildEmptyResponseDeserializer.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolDeserializer.ts @@ -1,14 +1,16 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + import { HttpResponse, + parseJsonBody, parseJsonError, } from '@aws-amplify/core/internals/aws-client-utils'; import { assertServiceError } from '../../../../../../errors/utils/assertServiceError'; import { AuthError } from '../../../../../../errors/AuthError'; -export const buildEmptyResponseDeserializer = (): (( +export const createUserPoolDeserializer = (): (( response: HttpResponse, ) => Promise) => { return async (response: HttpResponse): Promise => { @@ -16,8 +18,8 @@ export const buildEmptyResponseDeserializer = (): (( const error = await parseJsonError(response); assertServiceError(error); throw new AuthError({ name: error.name, message: error.message }); - } else { - return undefined as any; } + + return parseJsonBody(response); }; }; diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolSerializer.ts similarity index 97% rename from packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.ts rename to packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolSerializer.ts index ae9c9c64225..81f22df9312 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/buildUserPoolSerializer.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/createUserPoolSerializer.ts @@ -32,7 +32,7 @@ type ClientOperation = | 'ListDevices' | 'RevokeToken'; -export const buildUserPoolSerializer = +export const createUserPoolSerializer = (operation: ClientOperation) => (input: Input, endpoint: Endpoint): HttpRequest => { const headers = getSharedHeaders(operation); diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/index.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/index.ts index c0e4ae9b71f..bb805866e28 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/index.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serialization/index.ts @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -export { buildUserPoolSerializer } from './buildUserPoolSerializer'; -export { buildUserPoolDeserializer } from './buildUserPoolDeserializer'; -export { buildEmptyResponseDeserializer } from './buildEmptyResponseDeserializer'; +export { createUserPoolSerializer } from './createUserPoolSerializer'; +export { createUserPoolDeserializer } from './createUserPoolDeserializer'; +export { createEmptyResponseDeserializer } from './createEmptyResponseDeserializer'; diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts index 1df781ff734..3374c6b6194 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts @@ -1,4 +1,4 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -export * from './Sdk'; -export * from './ServiceClient'; +export * from './sdk'; +export * from './serviceClient'; diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/Sdk.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.ts similarity index 100% rename from packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/Sdk.ts rename to packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.ts diff --git a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/ServiceClient.ts b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/serviceClient.ts similarity index 85% rename from packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/ServiceClient.ts rename to packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/serviceClient.ts index 3f3821222b7..0f358133832 100644 --- a/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/ServiceClient.ts +++ b/packages/auth/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/serviceClient.ts @@ -3,6 +3,6 @@ import { EndpointResolverOptions } from '@aws-amplify/core/internals/aws-client-utils'; -export interface ServiceClientAPIConfig { +export interface ServiceClientFactoryInput { endpointResolver(options: EndpointResolverOptions): { url: URL }; }