UNPKG

@aws-amplify/auth

Version:
1 lines 2.27 kB
{"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 { deleteUserAttributes as deleteUserAttributesClient } from '../utils/clients/CognitoIdentityProvider';\nimport { getRegion } from '../utils/clients/CognitoIdentityProvider/utils';\nimport { assertAuthTokens } from '../utils/types';\nimport { getAuthUserAgentValue } from '../../../utils';\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 { tokens } = await fetchAuthSession({ forceRefresh: false });\n assertAuthTokens(tokens);\n await deleteUserAttributesClient({\n region: getRegion(authConfig.userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.DeleteUserAttributes),\n }, {\n AccessToken: tokens.accessToken.toString(),\n UserAttributeNames: userAttributeKeys,\n });\n}\n"],"names":["deleteUserAttributesClient"],"mappings":";;;;;;;AAAA;AACA;AAOA;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,CAAC;AACzD,IAAI,yBAAyB,CAAC,UAAU,CAAC,CAAC;AAC1C,IAAI,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;AACvE,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,MAAMA,sBAA0B,CAAC;AACrC,QAAQ,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;AAChD,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,CAAC;AACP;;;;"}