UNPKG

@aws-amplify/core

Version:

Core category of aws-amplify

1 lines • 1.73 kB
{"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { resolveCtxArgs } from '../../context/resolveCtxArgs';\nimport { isUnconfiguredNoCtxCall } from './isUnconfiguredNoCtxCall';\nexport function fetchAuthSession(...args) {\n // Back-compat: before the context migration, `fetchAuthSession()` on an\n // unconfigured Amplify resolved with an empty session (the unconfigured\n // `AuthClass` optional-chains its missing providers) rather than throwing.\n // Preserve that for the no-context form; the typed guards in\n // `resolveCtxArgs` still apply to explicit / mis-ordered context arguments.\n if (isUnconfiguredNoCtxCall(args)) {\n return Promise.resolve({\n tokens: undefined,\n credentials: undefined,\n identityId: undefined,\n userSub: undefined,\n });\n }\n // `resolveCtxArgs` handles the global-context fallback plus the\n // mis-ordered / undefined-context guards used across all category APIs.\n const [ctx, options] = resolveCtxArgs(args);\n return ctx.fetchAuthSession(options);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,gBAAgB,CAAC,GAAG,IAAI,EAAE;AAC1C;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,EAAE;AACvC,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC;AAC/B,YAAY,MAAM,EAAE,SAAS;AAC7B,YAAY,WAAW,EAAE,SAAS;AAClC,YAAY,UAAU,EAAE,SAAS;AACjC,YAAY,OAAO,EAAE,SAAS;AAC9B,SAAS,CAAC;AACV,IAAI;AACJ;AACA;AACA,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC;AAC/C,IAAI,OAAO,GAAG,CAAC,gBAAgB,CAAC,OAAO,CAAC;AACxC;;;;"}