@aws-amplify/core
Version:
Core category of aws-amplify
1 lines • 1.61 kB
Source Map (JSON)
{"version":3,"file":"isUnconfiguredNoCtxCall.mjs","sources":["../../../../src/singleton/apis/isUnconfiguredNoCtxCall.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isAmplifyContext } from '../../context/contextBrand';\nimport { hasGlobalContext } from '../../context/globalContext';\n/**\n * Returns `true` when a call would fall back to the global `AmplifyContext`\n * but none has been set yet (i.e. `Amplify.configure()` has not run).\n *\n * The pre-context library did not throw for this case — it operated on the\n * unconfigured singleton, whose `AuthClass` optional-chains its (missing)\n * providers. `fetchAuthSession`/`clearCredentials` use this predicate to\n * preserve that behavior for the no-context form.\n *\n * The `resolveCtxArgs` guard cases are deliberately excluded so their typed\n * errors keep throwing:\n * - a branded context anywhere in `args` (explicit-context or mis-ordered);\n * - an explicitly-`undefined` leading context followed by more arguments.\n *\n * @internal\n */\nexport function isUnconfiguredNoCtxCall(args) {\n return (!hasGlobalContext() &&\n !args.some(isAmplifyContext) &&\n !(args.length > 1 && args[0] === undefined));\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,IAAI,EAAE;AAC9C,IAAI,QAAQ,CAAC,gBAAgB,EAAE;AAC/B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;AACpC,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;AACnD;;;;"}