@aws-amplify/auth
Version:
Auth category of aws-amplify
1 lines • 2.75 kB
Source Map (JSON)
{"version":3,"file":"deleteUserAttributes.mjs","sources":["../../../../../src/providers/cognito/apis/deleteUserAttributes.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, fetchAuthSession } from '@aws-amplify/core';\nimport { AuthAction, assertTokenProviderConfig, } from '@aws-amplify/core/internals/utils';\nimport { getRegionFromUserPoolId } from '../../../foundation/parsers';\nimport { assertAuthTokens } from '../utils/types';\nimport { getAuthUserAgentValue } from '../../../utils';\nimport { createDeleteUserAttributesClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';\nimport { createCognitoUserPoolEndpointResolver } from '../factories';\n/**\n * Deletes user attributes.\n *\n * @param input - The DeleteUserAttributesInput object\n * @throws -{@link DeleteUserAttributesException } - Thrown due to invalid attribute.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nexport async function deleteUserAttributes(input) {\n const authConfig = Amplify.getConfig().Auth?.Cognito;\n assertTokenProviderConfig(authConfig);\n const { userAttributeKeys } = input;\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await fetchAuthSession({ forceRefresh: false });\n assertAuthTokens(tokens);\n const deleteUserAttributesClient = createDeleteUserAttributesClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await deleteUserAttributesClient({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.DeleteUserAttributes),\n }, {\n AccessToken: tokens.accessToken.toString(),\n UserAttributeNames: userAttributeKeys,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,oBAAoB,CAAC,KAAK,EAAE;AAClD,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AACxD,IAAI,yBAAyB,CAAC,UAAU,CAAC;AACzC,IAAI,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK;AACvC,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AACtE,IAAI,gBAAgB,CAAC,MAAM,CAAC;AAC5B,IAAI,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AACxE,QAAQ,gBAAgB,EAAE,qCAAqC,CAAC;AAChE,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC;AACN,IAAI,MAAM,0BAA0B,CAAC;AACrC,QAAQ,MAAM,EAAE,uBAAuB,CAAC,UAAU,CAAC;AACnD,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,CAAC;AAC9E,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,kBAAkB,EAAE,iBAAiB;AAC7C,KAAK,CAAC;AACN;;;;"}