@aws-amplify/storage
Version:
Storage category of aws-amplify
1 lines • 1.8 kB
Source Map (JSON)
{"version":3,"file":"listPaths.mjs","sources":["../../../../../src/internals/apis/listPaths/listPaths.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 { resolveLocationsForCurrentSession } from './resolveLocationsForCurrentSession';\nimport { getHighestPrecedenceUserGroup } from './getHighestPrecedenceUserGroup';\nexport const listPaths = async () => {\n const { buckets } = Amplify.getConfig().Storage.S3;\n const { groups } = Amplify.getConfig().Auth.Cognito;\n if (!buckets) {\n return { locations: [] };\n }\n const { tokens, identityId } = await fetchAuthSession();\n const currentUserGroups = tokens?.accessToken.payload['cognito:groups'];\n const userGroupToUse = getHighestPrecedenceUserGroup(groups, currentUserGroups);\n const locations = resolveLocationsForCurrentSession({\n buckets,\n isAuthenticated: !!tokens,\n identityId,\n userGroup: userGroupToUse,\n });\n return { locations };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,SAAS,GAAG,YAAY;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE;AACtD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO;AACvD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;AAChC;AACA,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,gBAAgB,EAAE;AAC3D,IAAI,MAAM,iBAAiB,GAAG,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAC3E,IAAI,MAAM,cAAc,GAAG,6BAA6B,CAAC,MAAM,EAAE,iBAAiB,CAAC;AACnF,IAAI,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACxD,QAAQ,OAAO;AACf,QAAQ,eAAe,EAAE,CAAC,CAAC,MAAM;AACjC,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,cAAc;AACjC,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,SAAS,EAAE;AACxB;;;;"}