UNPKG

@aws-amplify/core

Version:

Core category of aws-amplify

24 lines (22 loc) • 1.19 kB
'use strict'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.clearCredentials = clearCredentials; const resolveCtxArgs_1 = require("../../context/resolveCtxArgs"); const isUnconfiguredNoCtxCall_1 = require("./isUnconfiguredNoCtxCall"); 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 ((0, isUnconfiguredNoCtxCall_1.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] = (0, resolveCtxArgs_1.resolveCtxArgs)(args); return ctx.clearCredentials(); } //# sourceMappingURL=clearCredentials.js.map