UNPKG

@aws-amplify/core

Version:

Core category of aws-amplify

23 lines (20 loc) • 1.05 kB
import { resolveCtxArgs } from '../../context/resolveCtxArgs.mjs'; import { isUnconfiguredNoCtxCall } from './isUnconfiguredNoCtxCall.mjs'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 function clearCredentials(...args) { // Back-compat: before the context migration, `clearCredentials()` on an // unconfigured Amplify resolved harmlessly (the unconfigured `AuthClass` // optional-chains its missing credentials provider) rather than throwing. // Preserve that for the no-context form; the typed guards in // `resolveCtxArgs` still apply to explicit / mis-ordered context arguments. if (isUnconfiguredNoCtxCall(args)) { return Promise.resolve(); } // `resolveCtxArgs` handles the global-context fallback plus the // mis-ordered / undefined-context guards used across all category APIs. const [ctx] = resolveCtxArgs(args); return ctx.clearCredentials(); } export { clearCredentials }; //# sourceMappingURL=clearCredentials.mjs.map