From 61b7acd5427120355521d0cec29f9ec62f2326fa Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Fri, 27 Sep 2024 16:19:25 -0500 Subject: [PATCH 1/2] chore: Refactor contents of `storage-browser/` path into `internals/` --- .../apis/_getDataAccess.test.ts} | 10 +- .../apis/_listCallerAccessGrants.test.ts} | 8 +- .../locationCredentialsStore/create.test.ts | 8 +- .../locationCredentialsStore/registry.test.ts | 6 +- .../locationCredentialsStore/store.test.ts | 4 +- .../createListLocationsHandler.test.ts | 10 +- .../createManagedAuthConfigAdapter.test.ts | 10 +- packages/storage/package.json | 10 +- .../apis/_getDataAccess.ts} | 11 +- .../apis/_listCallerAccessGrants.ts} | 17 +-- packages/storage/src/internals/index.ts | 42 +++++++ .../locationCredentialsStore/constants.ts | 0 .../locationCredentialsStore/create.ts | 2 +- .../locationCredentialsStore/index.ts | 0 .../locationCredentialsStore/registry.ts | 5 +- .../locationCredentialsStore/store.ts | 4 +- .../createListLocationsHandler.ts | 6 +- .../createLocationCredentialsHandler.ts | 6 +- .../createManagedAuthConfigAdapter.ts | 2 +- .../managedAuthConfigAdapter/index.ts | 0 .../storage/src/internals/types/common.ts | 22 ++++ .../types/credentials.ts} | 110 ++++++++---------- packages/storage/src/internals/types/index.ts | 2 - .../types.ts => internals/types/inputs.ts} | 21 ++-- .../{apis/index.ts => types/options.ts} | 0 .../storage/src/internals/types/outputs.ts | 14 +++ .../apis => internals/utils}/constants.ts | 0 packages/storage/src/storageBrowser/index.ts | 25 ---- packages/storage/storage-browser/package.json | 7 -- 29 files changed, 196 insertions(+), 166 deletions(-) rename packages/storage/__tests__/{storageBrowser/apis/getDataAccess.test.ts => internals/apis/_getDataAccess.test.ts} (91%) rename packages/storage/__tests__/{storageBrowser/apis/listCallerAccessGrants.test.ts => internals/apis/_listCallerAccessGrants.test.ts} (93%) rename packages/storage/__tests__/{storageBrowser => internals}/locationCredentialsStore/create.test.ts (88%) rename packages/storage/__tests__/{storageBrowser => internals}/locationCredentialsStore/registry.test.ts (95%) rename packages/storage/__tests__/{storageBrowser => internals}/locationCredentialsStore/store.test.ts (97%) rename packages/storage/__tests__/{storageBrowser => internals}/managedAuthAdapter/createListLocationsHandler.test.ts (67%) rename packages/storage/__tests__/{storageBrowser => internals}/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts (72%) rename packages/storage/src/{storageBrowser/apis/getDataAccess.ts => internals/apis/_getDataAccess.ts} (90%) rename packages/storage/src/{storageBrowser/apis/listCallerAccessGrants.ts => internals/apis/_listCallerAccessGrants.ts} (87%) rename packages/storage/src/{storageBrowser => internals}/locationCredentialsStore/constants.ts (100%) rename packages/storage/src/{storageBrowser => internals}/locationCredentialsStore/create.ts (97%) rename packages/storage/src/{storageBrowser => internals}/locationCredentialsStore/index.ts (100%) rename packages/storage/src/{storageBrowser => internals}/locationCredentialsStore/registry.ts (96%) rename packages/storage/src/{storageBrowser => internals}/locationCredentialsStore/store.ts (98%) rename packages/storage/src/{storageBrowser => internals}/managedAuthConfigAdapter/createListLocationsHandler.ts (65%) rename packages/storage/src/{storageBrowser => internals}/managedAuthConfigAdapter/createLocationCredentialsHandler.ts (89%) rename packages/storage/src/{storageBrowser => internals}/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts (97%) rename packages/storage/src/{storageBrowser => internals}/managedAuthConfigAdapter/index.ts (100%) create mode 100644 packages/storage/src/internals/types/common.ts rename packages/storage/src/{storageBrowser/types.ts => internals/types/credentials.ts} (91%) delete mode 100644 packages/storage/src/internals/types/index.ts rename packages/storage/src/{storageBrowser/apis/types.ts => internals/types/inputs.ts} (64%) rename packages/storage/src/internals/{apis/index.ts => types/options.ts} (100%) create mode 100644 packages/storage/src/internals/types/outputs.ts rename packages/storage/src/{storageBrowser/apis => internals/utils}/constants.ts (100%) delete mode 100644 packages/storage/src/storageBrowser/index.ts delete mode 100644 packages/storage/storage-browser/package.json diff --git a/packages/storage/__tests__/storageBrowser/apis/getDataAccess.test.ts b/packages/storage/__tests__/internals/apis/_getDataAccess.test.ts similarity index 91% rename from packages/storage/__tests__/storageBrowser/apis/getDataAccess.test.ts rename to packages/storage/__tests__/internals/apis/_getDataAccess.test.ts index c43f9b004ba..785051d3be6 100644 --- a/packages/storage/__tests__/storageBrowser/apis/getDataAccess.test.ts +++ b/packages/storage/__tests__/internals/apis/_getDataAccess.test.ts @@ -3,9 +3,9 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-client-utils'; -import { getDataAccess } from '../../../src/storageBrowser/apis/getDataAccess'; +import { _getDataAccess } from '../../../src/internals/apis/_getDataAccess'; import { getDataAccess as getDataAccessClient } from '../../../src/providers/s3/utils/client/s3control'; -import { GetDataAccessInput } from '../../../src/storageBrowser/apis/types'; +import { GetDataAccessInput } from '../../../src/internals/types/inputs'; jest.mock('../../../src/providers/s3/utils/client/s3control'); @@ -57,7 +57,7 @@ describe('getDataAccess', () => { it('should invoke the getDataAccess client correctly', async () => { expect.assertions(6); - const result = await getDataAccess(sharedGetDataAccessParams); + const result = await _getDataAccess(sharedGetDataAccessParams); expect(getDataAccessClientMock).toHaveBeenCalledWith( expect.objectContaining({ @@ -96,7 +96,7 @@ describe('getDataAccess', () => { $metadata: {}, }); - expect(getDataAccess(sharedGetDataAccessParams)).rejects.toThrow( + expect(_getDataAccess(sharedGetDataAccessParams)).rejects.toThrow( 'Service did not return valid temporary credentials.', ); }); @@ -110,7 +110,7 @@ describe('getDataAccess', () => { $metadata: {}, }); - const result = await getDataAccess({ + const result = await _getDataAccess({ ...sharedGetDataAccessParams, scope: MOCK_OBJECT_SCOPE, }); diff --git a/packages/storage/__tests__/storageBrowser/apis/listCallerAccessGrants.test.ts b/packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts similarity index 93% rename from packages/storage/__tests__/storageBrowser/apis/listCallerAccessGrants.test.ts rename to packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts index 54a90d66206..a7ed073f593 100644 --- a/packages/storage/__tests__/storageBrowser/apis/listCallerAccessGrants.test.ts +++ b/packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts @@ -3,7 +3,7 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-client-utils'; -import { listCallerAccessGrants } from '../../../src/storageBrowser/apis/listCallerAccessGrants'; +import { _listCallerAccessGrants } from '../../../src/internals/apis/_listCallerAccessGrants'; import { listCallerAccessGrants as listCallerAccessGrantsClient } from '../../../src/providers/s3/utils/client/s3control'; jest.mock('../../../src/providers/s3/utils/client/s3control'); @@ -34,7 +34,7 @@ describe('listCallerAccessGrants', () => { CallerAccessGrantsList: [], $metadata: {} as any, }); - await listCallerAccessGrants({ + await _listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, @@ -72,7 +72,7 @@ describe('listCallerAccessGrants', () => { CallerAccessGrantsList: [], $metadata: {} as any, }); - await listCallerAccessGrants({ + await _listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, @@ -106,7 +106,7 @@ describe('listCallerAccessGrants', () => { ], $metadata: {} as any, }); - const { locations, nextToken } = await listCallerAccessGrants({ + const { locations, nextToken } = await _listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, diff --git a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/create.test.ts b/packages/storage/__tests__/internals/locationCredentialsStore/create.test.ts similarity index 88% rename from packages/storage/__tests__/storageBrowser/locationCredentialsStore/create.test.ts rename to packages/storage/__tests__/internals/locationCredentialsStore/create.test.ts index 1bebd3772bf..206a2573fa5 100644 --- a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/create.test.ts +++ b/packages/storage/__tests__/internals/locationCredentialsStore/create.test.ts @@ -1,20 +1,20 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { createLocationCredentialsStore } from '../../../src/storageBrowser/locationCredentialsStore/create'; +import { createLocationCredentialsStore } from '../../../src/internals/locationCredentialsStore/create'; import { createStore, getValue, removeStore, -} from '../../../src/storageBrowser/locationCredentialsStore/registry'; -import { LocationCredentialsStore } from '../../../src/storageBrowser/types'; +} from '../../../src/internals/locationCredentialsStore/registry'; +import { LocationCredentialsStore } from '../../../src/internals/types/credentials'; import { StorageValidationErrorCode, validationErrorMap, } from '../../../src/errors/types/validation'; import { AWSTemporaryCredentials } from '../../../src/providers/s3/types/options'; -jest.mock('../../../src/storageBrowser/locationCredentialsStore/registry'); +jest.mock('../../../src/internals/locationCredentialsStore/registry'); const mockedCredentials = 'MOCK_CREDS' as any as AWSTemporaryCredentials; diff --git a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/registry.test.ts b/packages/storage/__tests__/internals/locationCredentialsStore/registry.test.ts similarity index 95% rename from packages/storage/__tests__/storageBrowser/locationCredentialsStore/registry.test.ts rename to packages/storage/__tests__/internals/locationCredentialsStore/registry.test.ts index 9f2cfcfc742..9aa5b0c305a 100644 --- a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/registry.test.ts +++ b/packages/storage/__tests__/internals/locationCredentialsStore/registry.test.ts @@ -10,15 +10,15 @@ import { createStore, getValue, removeStore, -} from '../../../src/storageBrowser/locationCredentialsStore/registry'; +} from '../../../src/internals/locationCredentialsStore/registry'; import { LruLocationCredentialsStore, fetchNewValue, getCacheValue, initStore, -} from '../../../src/storageBrowser/locationCredentialsStore/store'; +} from '../../../src/internals/locationCredentialsStore/store'; -jest.mock('../../../src/storageBrowser/locationCredentialsStore/store'); +jest.mock('../../../src/internals/locationCredentialsStore/store'); const mockedStore = 'MOCKED_STORE' as any as LruLocationCredentialsStore; diff --git a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/store.test.ts b/packages/storage/__tests__/internals/locationCredentialsStore/store.test.ts similarity index 97% rename from packages/storage/__tests__/storageBrowser/locationCredentialsStore/store.test.ts rename to packages/storage/__tests__/internals/locationCredentialsStore/store.test.ts index 81ca4702417..6bc34132147 100644 --- a/packages/storage/__tests__/storageBrowser/locationCredentialsStore/store.test.ts +++ b/packages/storage/__tests__/internals/locationCredentialsStore/store.test.ts @@ -9,8 +9,8 @@ import { fetchNewValue, getCacheValue, initStore, -} from '../../../src/storageBrowser/locationCredentialsStore/store'; -import { CredentialsLocation } from '../../../src/storageBrowser/types'; +} from '../../../src/internals/locationCredentialsStore/store'; +import { CredentialsLocation } from '../../../src/internals/types/credentials'; const mockCredentials = { expiration: new Date(Date.now() + 60 * 60_1000), diff --git a/packages/storage/__tests__/storageBrowser/managedAuthAdapter/createListLocationsHandler.test.ts b/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts similarity index 67% rename from packages/storage/__tests__/storageBrowser/managedAuthAdapter/createListLocationsHandler.test.ts rename to packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts index c2104ce728a..8ab0c66b1c1 100644 --- a/packages/storage/__tests__/storageBrowser/managedAuthAdapter/createListLocationsHandler.test.ts +++ b/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts @@ -1,12 +1,12 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { createListLocationsHandler } from '../../../src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler'; -import { listCallerAccessGrants } from '../../../src/storageBrowser/apis/listCallerAccessGrants'; +import { createListLocationsHandler } from '../../../src/internals/managedAuthConfigAdapter/createListLocationsHandler'; +import { _listCallerAccessGrants } from '../../../src/internals/apis/_listCallerAccessGrants'; -jest.mock('../../../src/storageBrowser/apis/listCallerAccessGrants'); +jest.mock('../../../src/internals/apis/_listCallerAccessGrants'); -jest.mocked(listCallerAccessGrants).mockResolvedValue({ +jest.mocked(_listCallerAccessGrants).mockResolvedValue({ locations: [], }); @@ -23,7 +23,7 @@ describe('createListLocationsHandler', () => { credentialsProvider: mockCredentialsProvider, }); await handler({ nextToken: mockNextToken, pageSize: mockPageSize }); - expect(listCallerAccessGrants).toHaveBeenCalledWith({ + expect(_listCallerAccessGrants).toHaveBeenCalledWith({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, diff --git a/packages/storage/__tests__/storageBrowser/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts b/packages/storage/__tests__/internals/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts similarity index 72% rename from packages/storage/__tests__/storageBrowser/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts rename to packages/storage/__tests__/internals/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts index 124fc16cd7a..74bf7e10bd7 100644 --- a/packages/storage/__tests__/storageBrowser/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts +++ b/packages/storage/__tests__/internals/managedAuthAdapter/createManagedAuthConfigAdapter.test.ts @@ -1,15 +1,15 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { createManagedAuthConfigAdapter } from '../../../src/storageBrowser/managedAuthConfigAdapter'; -import { createListLocationsHandler } from '../../../src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler'; -import { createLocationCredentialsHandler } from '../../../src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler'; +import { createManagedAuthConfigAdapter } from '../../../src/internals/managedAuthConfigAdapter'; +import { createListLocationsHandler } from '../../../src/internals/managedAuthConfigAdapter/createListLocationsHandler'; +import { createLocationCredentialsHandler } from '../../../src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler'; jest.mock( - '../../../src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler', + '../../../src/internals/managedAuthConfigAdapter/createListLocationsHandler', ); jest.mock( - '../../../src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler', + '../../../src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler', ); describe('createManagedAuthConfigAdapter', () => { diff --git a/packages/storage/package.json b/packages/storage/package.json index 6fc3fca7011..cede9aae2f7 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -48,10 +48,7 @@ ], "s3/server": [ "./dist/esm/providers/s3/server.d.ts" - ], - "storage-browser": [ - "./dist/esm/storageBrowser/index.d.ts" - ] + ] } }, "repository": { @@ -108,11 +105,6 @@ "import": "./dist/esm/providers/s3/server.mjs", "require": "./dist/cjs/providers/s3/server.js" }, - "./storage-browser": { - "types": "./dist/esm/storageBrowser/index.d.ts", - "import": "./dist/esm/storageBrowser/index.mjs", - "require": "./dist/cjs/storageBrowser/index.js" - }, "./package.json": "./package.json" }, "peerDependencies": { diff --git a/packages/storage/src/storageBrowser/apis/getDataAccess.ts b/packages/storage/src/internals/apis/_getDataAccess.ts similarity index 90% rename from packages/storage/src/storageBrowser/apis/getDataAccess.ts rename to packages/storage/src/internals/apis/_getDataAccess.ts index b5d511c8e0d..c449bae1399 100644 --- a/packages/storage/src/storageBrowser/apis/getDataAccess.ts +++ b/packages/storage/src/internals/apis/_getDataAccess.ts @@ -10,12 +10,15 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-clie import { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent'; import { getDataAccess as getDataAccessClient } from '../../providers/s3/utils/client/s3control'; import { StorageError } from '../../errors/StorageError'; +import { GetDataAccessInput } from '../types/inputs'; +import { GetDataAccessOutput } from '../types/outputs'; import { logger } from '../../utils'; +import { DEFAULT_CRED_TTL } from '../utils/constants'; -import { GetDataAccessInput, GetDataAccessOutput } from './types'; -import { DEFAULT_CRED_TTL } from './constants'; - -export const getDataAccess = async ( +/** + * @internal + */ +export const _getDataAccess = async ( input: GetDataAccessInput, ): Promise => { const targetType = input.scope.endsWith('*') ? undefined : 'Object'; diff --git a/packages/storage/src/storageBrowser/apis/listCallerAccessGrants.ts b/packages/storage/src/internals/apis/_listCallerAccessGrants.ts similarity index 87% rename from packages/storage/src/storageBrowser/apis/listCallerAccessGrants.ts rename to packages/storage/src/internals/apis/_listCallerAccessGrants.ts index 255837dc25c..2c3fe9bdc7c 100644 --- a/packages/storage/src/storageBrowser/apis/listCallerAccessGrants.ts +++ b/packages/storage/src/internals/apis/_listCallerAccessGrants.ts @@ -6,17 +6,18 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-clie import { logger } from '../../utils'; import { listCallerAccessGrants as listCallerAccessGrantsClient } from '../../providers/s3/utils/client/s3control'; -import { LocationAccess, LocationType } from '../types'; import { StorageError } from '../../errors/StorageError'; import { getStorageUserAgentValue } from '../../providers/s3/utils/userAgent'; +import { LocationType } from '../types/common'; +import { LocationAccess } from '../types/credentials'; +import { ListCallerAccessGrantsInput } from '../types/inputs'; +import { ListCallerAccessGrantsOutput } from '../types/outputs'; +import { MAX_PAGE_SIZE } from '../utils/constants'; -import { - ListCallerAccessGrantsInput, - ListCallerAccessGrantsOutput, -} from './types'; -import { MAX_PAGE_SIZE } from './constants'; - -export const listCallerAccessGrants = async ( +/** + * @internal + */ +export const _listCallerAccessGrants = async ( input: ListCallerAccessGrantsInput, ): Promise => { const { credentialsProvider, accountId, region, nextToken, pageSize } = input; diff --git a/packages/storage/src/internals/index.ts b/packages/storage/src/internals/index.ts index cf1406c9425..5260e27fd45 100644 --- a/packages/storage/src/internals/index.ts +++ b/packages/storage/src/internals/index.ts @@ -1,2 +1,44 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + +export { LocationCredentialsProvider } from '../providers/s3/types/options'; +export { StorageSubpathStrategy } from '../types/options'; + +export { Permission } from './types/common'; + +/* +Internal APIs +*/ +export { + GetDataAccessInput, + ListCallerAccessGrantsInput, +} from './types/inputs'; +export { + GetDataAccessOutput, + ListCallerAccessGrantsOutput, +} from './types/outputs'; + +export { _getDataAccess } from './apis/_getDataAccess'; +export { _listCallerAccessGrants } from './apis/_listCallerAccessGrants'; + +/* +CredentialsStore exports +*/ +export { createLocationCredentialsStore } from './locationCredentialsStore'; +export { + AuthConfigAdapter, + createManagedAuthConfigAdapter, + CreateManagedAuthConfigAdapterInput, +} from './managedAuthConfigAdapter'; +export { + GetLocationCredentials, + ListLocations, + LocationCredentialsStore, + CreateLocationCredentialsStoreInput, + LocationCredentials, + ListLocationsInput, + ListLocationsOutput, + GetLocationCredentialsInput, + GetLocationCredentialsOutput, +} from './types/credentials'; +export { AWSTemporaryCredentials } from '../providers/s3/types/options'; diff --git a/packages/storage/src/storageBrowser/locationCredentialsStore/constants.ts b/packages/storage/src/internals/locationCredentialsStore/constants.ts similarity index 100% rename from packages/storage/src/storageBrowser/locationCredentialsStore/constants.ts rename to packages/storage/src/internals/locationCredentialsStore/constants.ts diff --git a/packages/storage/src/storageBrowser/locationCredentialsStore/create.ts b/packages/storage/src/internals/locationCredentialsStore/create.ts similarity index 97% rename from packages/storage/src/storageBrowser/locationCredentialsStore/create.ts rename to packages/storage/src/internals/locationCredentialsStore/create.ts index 05d68004f43..dab4539025e 100644 --- a/packages/storage/src/storageBrowser/locationCredentialsStore/create.ts +++ b/packages/storage/src/internals/locationCredentialsStore/create.ts @@ -5,7 +5,7 @@ import { CreateLocationCredentialsStoreInput, CredentialsLocation, LocationCredentialsStore, -} from '../types'; +} from '../types/credentials'; import { StorageValidationErrorCode } from '../../errors/types/validation'; import { assertValidationError } from '../../errors/utils/assertValidationError'; import { LocationCredentialsProvider } from '../../providers/s3/types/options'; diff --git a/packages/storage/src/storageBrowser/locationCredentialsStore/index.ts b/packages/storage/src/internals/locationCredentialsStore/index.ts similarity index 100% rename from packages/storage/src/storageBrowser/locationCredentialsStore/index.ts rename to packages/storage/src/internals/locationCredentialsStore/index.ts diff --git a/packages/storage/src/storageBrowser/locationCredentialsStore/registry.ts b/packages/storage/src/internals/locationCredentialsStore/registry.ts similarity index 96% rename from packages/storage/src/storageBrowser/locationCredentialsStore/registry.ts rename to packages/storage/src/internals/locationCredentialsStore/registry.ts index 41b7c101b82..90d511c36fe 100644 --- a/packages/storage/src/storageBrowser/locationCredentialsStore/registry.ts +++ b/packages/storage/src/internals/locationCredentialsStore/registry.ts @@ -3,7 +3,10 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { AWSTemporaryCredentials } from '../../providers/s3/types/options'; -import { CredentialsLocation, GetLocationCredentials } from '../types'; +import { + CredentialsLocation, + GetLocationCredentials, +} from '../types/credentials'; import { assertValidationError } from '../../errors/utils/assertValidationError'; import { StorageValidationErrorCode } from '../../errors/types/validation'; diff --git a/packages/storage/src/storageBrowser/locationCredentialsStore/store.ts b/packages/storage/src/internals/locationCredentialsStore/store.ts similarity index 98% rename from packages/storage/src/storageBrowser/locationCredentialsStore/store.ts rename to packages/storage/src/internals/locationCredentialsStore/store.ts index c5effe0f91e..64c26d5c5a4 100644 --- a/packages/storage/src/storageBrowser/locationCredentialsStore/store.ts +++ b/packages/storage/src/internals/locationCredentialsStore/store.ts @@ -6,8 +6,8 @@ import { CredentialsLocation, GetLocationCredentials, - Permission, -} from '../types'; +} from '../types/credentials'; +import { Permission } from '../types/common'; import { AWSTemporaryCredentials } from '../../providers/s3/types/options'; import { assertValidationError } from '../../errors/utils/assertValidationError'; import { StorageValidationErrorCode } from '../../errors/types/validation'; diff --git a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.ts b/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts similarity index 65% rename from packages/storage/src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.ts rename to packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts index e246a2bdc27..c33644cc8dd 100644 --- a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createListLocationsHandler.ts +++ b/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts @@ -1,8 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { CredentialsProvider, ListLocations } from '../types'; -import { listCallerAccessGrants } from '../apis/listCallerAccessGrants'; +import { CredentialsProvider, ListLocations } from '../types/credentials'; +import { _listCallerAccessGrants } from '../apis/_listCallerAccessGrants'; interface CreateListLocationsHandlerInput { accountId: string; @@ -14,7 +14,7 @@ export const createListLocationsHandler = ( handlerInput: CreateListLocationsHandlerInput, ): ListLocations => { return async function listLocations(input = {}) { - const result = await listCallerAccessGrants({ ...input, ...handlerInput }); + const result = await _listCallerAccessGrants({ ...input, ...handlerInput }); return result; }; diff --git a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.ts b/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts similarity index 89% rename from packages/storage/src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.ts rename to packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts index 248e81882ac..23cfef46e7c 100644 --- a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createLocationCredentialsHandler.ts +++ b/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts @@ -1,12 +1,12 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { getDataAccess } from '../apis/getDataAccess'; +import { _getDataAccess } from '../apis/_getDataAccess'; import { CredentialsProvider, GetLocationCredentials, GetLocationCredentialsInput, -} from '../types'; +} from '../types/credentials'; interface CreateLocationCredentialsHandlerInput { accountId: string; @@ -29,7 +29,7 @@ export const createLocationCredentialsHandler = ( return (input: GetLocationCredentialsInput) => { const { scope, permission } = input; - return getDataAccess({ + return _getDataAccess({ accountId, credentialsProvider, permission, diff --git a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts b/packages/storage/src/internals/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts similarity index 97% rename from packages/storage/src/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts rename to packages/storage/src/internals/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts index 3d41d93e2b3..8b622baaee8 100644 --- a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts +++ b/packages/storage/src/internals/managedAuthConfigAdapter/createManagedAuthConfigAdapter.ts @@ -4,7 +4,7 @@ import { CredentialsProvider, GetLocationCredentials, ListLocations, -} from '../types'; +} from '../types/credentials'; import { createListLocationsHandler } from './createListLocationsHandler'; import { createLocationCredentialsHandler } from './createLocationCredentialsHandler'; diff --git a/packages/storage/src/storageBrowser/managedAuthConfigAdapter/index.ts b/packages/storage/src/internals/managedAuthConfigAdapter/index.ts similarity index 100% rename from packages/storage/src/storageBrowser/managedAuthConfigAdapter/index.ts rename to packages/storage/src/internals/managedAuthConfigAdapter/index.ts diff --git a/packages/storage/src/internals/types/common.ts b/packages/storage/src/internals/types/common.ts new file mode 100644 index 00000000000..2fd32ca6d8c --- /dev/null +++ b/packages/storage/src/internals/types/common.ts @@ -0,0 +1,22 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +/** + * @internal + */ +export type Permission = 'READ' | 'READWRITE' | 'WRITE'; + +/** + * @internal + */ +export type LocationType = 'BUCKET' | 'PREFIX' | 'OBJECT'; + +/** + * @internal + */ +export type Privilege = 'Default' | 'Minimal'; + +/** + * @internal + */ +export type PrefixType = 'Object'; diff --git a/packages/storage/src/storageBrowser/types.ts b/packages/storage/src/internals/types/credentials.ts similarity index 91% rename from packages/storage/src/storageBrowser/types.ts rename to packages/storage/src/internals/types/credentials.ts index 94d0c1f6eac..95d6de8a00e 100644 --- a/packages/storage/src/storageBrowser/types.ts +++ b/packages/storage/src/internals/types/credentials.ts @@ -4,33 +4,74 @@ import { AWSTemporaryCredentials, LocationCredentialsProvider, -} from '../providers/s3/types/options'; +} from '../../providers/s3/types/options'; + +import { LocationType, Permission } from './common'; /** * @internal */ -export type Permission = 'READ' | 'READWRITE' | 'WRITE'; +export type CredentialsProvider = LocationCredentialsProvider; + +export interface CreateLocationCredentialsStoreInput { + handler: GetLocationCredentials; +} + +export interface LocationCredentialsStore { + /** + * Get location-specific credentials. It uses a cache internally to optimize performance when + * getting credentials for the same location. It will refresh credentials if they expire or + * when forced to. + */ + getProvider(option: CredentialsLocation): LocationCredentialsProvider; + /** + * Invalidate cached credentials and force subsequent calls to get location-specific + * credentials to throw. It also makes subsequent calls to `getCredentialsProviderForLocation` + * to throw. + */ + destroy(): void; +} + +export interface LocationCredentials extends Partial { + /** + * AWS credentials which can be used to access the specified location. + */ + readonly credentials: AWSTemporaryCredentials; +} + +export type GetLocationCredentialsInput = CredentialsLocation; +export type GetLocationCredentialsOutput = LocationCredentials; + +export type GetLocationCredentials = ( + input: GetLocationCredentialsInput, +) => Promise; /** * @internal */ -export type CredentialsProvider = LocationCredentialsProvider; +export interface ListLocationsInput { + pageSize?: number; + nextToken?: string; +} /** * @internal */ -export type LocationType = 'BUCKET' | 'PREFIX' | 'OBJECT'; +export interface ListLocationsOutput { + locations: LocationAccess[]; + nextToken?: string; +} /** * @internal */ -export type Privilege = 'Default' | 'Minimal'; +export type ListLocations = ( + input?: ListLocationsInput, +) => Promise; /** * @internal */ -export type PrefixType = 'Object'; - export interface LocationScope { /** * Scope of storage location. For S3 service, it's the S3 path of the data to @@ -43,6 +84,9 @@ export interface LocationScope { readonly scope: string; } +/** + * @internal + */ export interface CredentialsLocation extends LocationScope { /** * The type of access granted to your Storage data. Can be either of READ, @@ -63,55 +107,3 @@ export interface LocationAccess extends CredentialsLocation { */ readonly type: LocationType; } - -export interface LocationCredentials extends Partial { - /** - * AWS credentials which can be used to access the specified location. - */ - readonly credentials: AWSTemporaryCredentials; -} - -/** - * @internal - */ -export interface ListLocationsInput { - pageSize?: number; - nextToken?: string; -} -/** - * @internal - */ -export interface ListLocationsOutput { - locations: LocationAccess[]; - nextToken?: string; -} - -export type ListLocations = ( - input?: ListLocationsInput, -) => Promise; - -export type GetLocationCredentialsInput = CredentialsLocation; -export type GetLocationCredentialsOutput = LocationCredentials; - -export type GetLocationCredentials = ( - input: GetLocationCredentialsInput, -) => Promise; - -export interface CreateLocationCredentialsStoreInput { - handler: GetLocationCredentials; -} - -export interface LocationCredentialsStore { - /** - * Get location-specific credentials. It uses a cache internally to optimize performance when - * getting credentials for the same location. It will refresh credentials if they expire or - * when forced to. - */ - getProvider(option: CredentialsLocation): LocationCredentialsProvider; - /** - * Invalidate cached credentials and force subsequent calls to get location-specific - * credentials to throw. It also makes subsequent calls to `getCredentialsProviderForLocation` - * to throw. - */ - destroy(): void; -} diff --git a/packages/storage/src/internals/types/index.ts b/packages/storage/src/internals/types/index.ts deleted file mode 100644 index cf1406c9425..00000000000 --- a/packages/storage/src/internals/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 diff --git a/packages/storage/src/storageBrowser/apis/types.ts b/packages/storage/src/internals/types/inputs.ts similarity index 64% rename from packages/storage/src/storageBrowser/apis/types.ts rename to packages/storage/src/internals/types/inputs.ts index d0892c42b52..51d04acf9c6 100644 --- a/packages/storage/src/storageBrowser/apis/types.ts +++ b/packages/storage/src/internals/types/inputs.ts @@ -1,24 +1,21 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { - CredentialsProvider, - ListLocationsInput, - ListLocationsOutput, - LocationCredentials, - Permission, - PrefixType, - Privilege, -} from '../types'; +import { CredentialsProvider, ListLocationsInput } from './credentials'; +import { Permission, PrefixType, Privilege } from './common'; +/** + * @internal + */ export interface ListCallerAccessGrantsInput extends ListLocationsInput { accountId: string; credentialsProvider: CredentialsProvider; region: string; } -export type ListCallerAccessGrantsOutput = ListLocationsOutput; - +/** + * @internal + */ export interface GetDataAccessInput { accountId: string; credentialsProvider: CredentialsProvider; @@ -29,5 +26,3 @@ export interface GetDataAccessInput { region: string; scope: string; } - -export type GetDataAccessOutput = LocationCredentials; diff --git a/packages/storage/src/internals/apis/index.ts b/packages/storage/src/internals/types/options.ts similarity index 100% rename from packages/storage/src/internals/apis/index.ts rename to packages/storage/src/internals/types/options.ts diff --git a/packages/storage/src/internals/types/outputs.ts b/packages/storage/src/internals/types/outputs.ts new file mode 100644 index 00000000000..09eecb7cfc2 --- /dev/null +++ b/packages/storage/src/internals/types/outputs.ts @@ -0,0 +1,14 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { ListLocationsOutput, LocationCredentials } from './credentials'; + +/** + * @internal + */ +export type ListCallerAccessGrantsOutput = ListLocationsOutput; + +/** + * @internal + */ +export type GetDataAccessOutput = LocationCredentials; diff --git a/packages/storage/src/storageBrowser/apis/constants.ts b/packages/storage/src/internals/utils/constants.ts similarity index 100% rename from packages/storage/src/storageBrowser/apis/constants.ts rename to packages/storage/src/internals/utils/constants.ts diff --git a/packages/storage/src/storageBrowser/index.ts b/packages/storage/src/storageBrowser/index.ts deleted file mode 100644 index 94c741b857c..00000000000 --- a/packages/storage/src/storageBrowser/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -export { LocationCredentialsProvider } from '../providers/s3/types/options'; -export { StorageSubpathStrategy } from '../types/options'; - -export { createLocationCredentialsStore } from './locationCredentialsStore'; -export { - AuthConfigAdapter, - createManagedAuthConfigAdapter, - CreateManagedAuthConfigAdapterInput, -} from './managedAuthConfigAdapter'; -export { - GetLocationCredentials, - ListLocations, - LocationCredentialsStore, - CreateLocationCredentialsStoreInput, - LocationCredentials, - ListLocationsInput, - ListLocationsOutput, - GetLocationCredentialsInput, - GetLocationCredentialsOutput, - Permission, -} from './types'; -export { AWSTemporaryCredentials } from '../providers/s3/types/options'; diff --git a/packages/storage/storage-browser/package.json b/packages/storage/storage-browser/package.json deleted file mode 100644 index f492f32d490..00000000000 --- a/packages/storage/storage-browser/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@aws-amplify/storage/storage-browser", - "main": "../dist/cjs/storageBrowser/index.js", - "browser": "../dist/esm/storageBrowser/index.mjs", - "module": "../dist/esm/storageBrowser/index.mjs", - "typings": "../dist/esm/storageBrowser/index.d.ts" -} From fa6a99c0bbd458b8d9838ef852aa68982cb8730b Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Fri, 27 Sep 2024 17:16:10 -0500 Subject: [PATCH 2/2] Revert naming changes. --- .../{_getDataAccess.test.ts => getDataAccess.test.ts} | 8 ++++---- ...ccessGrants.test.ts => listCallerAccessGrants.test.ts} | 8 ++++---- .../managedAuthAdapter/createListLocationsHandler.test.ts | 8 ++++---- .../apis/{_getDataAccess.ts => getDataAccess.ts} | 2 +- ...istCallerAccessGrants.ts => listCallerAccessGrants.ts} | 2 +- packages/storage/src/internals/index.ts | 4 ++-- .../createListLocationsHandler.ts | 4 ++-- .../createLocationCredentialsHandler.ts | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) rename packages/storage/__tests__/internals/apis/{_getDataAccess.test.ts => getDataAccess.test.ts} (93%) rename packages/storage/__tests__/internals/apis/{_listCallerAccessGrants.test.ts => listCallerAccessGrants.test.ts} (93%) rename packages/storage/src/internals/apis/{_getDataAccess.ts => getDataAccess.ts} (98%) rename packages/storage/src/internals/apis/{_listCallerAccessGrants.ts => listCallerAccessGrants.ts} (98%) diff --git a/packages/storage/__tests__/internals/apis/_getDataAccess.test.ts b/packages/storage/__tests__/internals/apis/getDataAccess.test.ts similarity index 93% rename from packages/storage/__tests__/internals/apis/_getDataAccess.test.ts rename to packages/storage/__tests__/internals/apis/getDataAccess.test.ts index 785051d3be6..630e7835f9e 100644 --- a/packages/storage/__tests__/internals/apis/_getDataAccess.test.ts +++ b/packages/storage/__tests__/internals/apis/getDataAccess.test.ts @@ -3,7 +3,7 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-client-utils'; -import { _getDataAccess } from '../../../src/internals/apis/_getDataAccess'; +import { getDataAccess } from '../../../src/internals/apis/getDataAccess'; import { getDataAccess as getDataAccessClient } from '../../../src/providers/s3/utils/client/s3control'; import { GetDataAccessInput } from '../../../src/internals/types/inputs'; @@ -57,7 +57,7 @@ describe('getDataAccess', () => { it('should invoke the getDataAccess client correctly', async () => { expect.assertions(6); - const result = await _getDataAccess(sharedGetDataAccessParams); + const result = await getDataAccess(sharedGetDataAccessParams); expect(getDataAccessClientMock).toHaveBeenCalledWith( expect.objectContaining({ @@ -96,7 +96,7 @@ describe('getDataAccess', () => { $metadata: {}, }); - expect(_getDataAccess(sharedGetDataAccessParams)).rejects.toThrow( + expect(getDataAccess(sharedGetDataAccessParams)).rejects.toThrow( 'Service did not return valid temporary credentials.', ); }); @@ -110,7 +110,7 @@ describe('getDataAccess', () => { $metadata: {}, }); - const result = await _getDataAccess({ + const result = await getDataAccess({ ...sharedGetDataAccessParams, scope: MOCK_OBJECT_SCOPE, }); diff --git a/packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts b/packages/storage/__tests__/internals/apis/listCallerAccessGrants.test.ts similarity index 93% rename from packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts rename to packages/storage/__tests__/internals/apis/listCallerAccessGrants.test.ts index a7ed073f593..f5067843129 100644 --- a/packages/storage/__tests__/internals/apis/_listCallerAccessGrants.test.ts +++ b/packages/storage/__tests__/internals/apis/listCallerAccessGrants.test.ts @@ -3,7 +3,7 @@ import { CredentialsProviderOptions } from '@aws-amplify/core/internals/aws-client-utils'; -import { _listCallerAccessGrants } from '../../../src/internals/apis/_listCallerAccessGrants'; +import { listCallerAccessGrants } from '../../../src/internals/apis/listCallerAccessGrants'; import { listCallerAccessGrants as listCallerAccessGrantsClient } from '../../../src/providers/s3/utils/client/s3control'; jest.mock('../../../src/providers/s3/utils/client/s3control'); @@ -34,7 +34,7 @@ describe('listCallerAccessGrants', () => { CallerAccessGrantsList: [], $metadata: {} as any, }); - await _listCallerAccessGrants({ + await listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, @@ -72,7 +72,7 @@ describe('listCallerAccessGrants', () => { CallerAccessGrantsList: [], $metadata: {} as any, }); - await _listCallerAccessGrants({ + await listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, @@ -106,7 +106,7 @@ describe('listCallerAccessGrants', () => { ], $metadata: {} as any, }); - const { locations, nextToken } = await _listCallerAccessGrants({ + const { locations, nextToken } = await listCallerAccessGrants({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, diff --git a/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts b/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts index 8ab0c66b1c1..26a81b10c3d 100644 --- a/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts +++ b/packages/storage/__tests__/internals/managedAuthAdapter/createListLocationsHandler.test.ts @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 import { createListLocationsHandler } from '../../../src/internals/managedAuthConfigAdapter/createListLocationsHandler'; -import { _listCallerAccessGrants } from '../../../src/internals/apis/_listCallerAccessGrants'; +import { listCallerAccessGrants } from '../../../src/internals/apis/listCallerAccessGrants'; -jest.mock('../../../src/internals/apis/_listCallerAccessGrants'); +jest.mock('../../../src/internals/apis/listCallerAccessGrants'); -jest.mocked(_listCallerAccessGrants).mockResolvedValue({ +jest.mocked(listCallerAccessGrants).mockResolvedValue({ locations: [], }); @@ -23,7 +23,7 @@ describe('createListLocationsHandler', () => { credentialsProvider: mockCredentialsProvider, }); await handler({ nextToken: mockNextToken, pageSize: mockPageSize }); - expect(_listCallerAccessGrants).toHaveBeenCalledWith({ + expect(listCallerAccessGrants).toHaveBeenCalledWith({ accountId: mockAccountId, region: mockRegion, credentialsProvider: mockCredentialsProvider, diff --git a/packages/storage/src/internals/apis/_getDataAccess.ts b/packages/storage/src/internals/apis/getDataAccess.ts similarity index 98% rename from packages/storage/src/internals/apis/_getDataAccess.ts rename to packages/storage/src/internals/apis/getDataAccess.ts index c449bae1399..3a6af14441a 100644 --- a/packages/storage/src/internals/apis/_getDataAccess.ts +++ b/packages/storage/src/internals/apis/getDataAccess.ts @@ -18,7 +18,7 @@ import { DEFAULT_CRED_TTL } from '../utils/constants'; /** * @internal */ -export const _getDataAccess = async ( +export const getDataAccess = async ( input: GetDataAccessInput, ): Promise => { const targetType = input.scope.endsWith('*') ? undefined : 'Object'; diff --git a/packages/storage/src/internals/apis/_listCallerAccessGrants.ts b/packages/storage/src/internals/apis/listCallerAccessGrants.ts similarity index 98% rename from packages/storage/src/internals/apis/_listCallerAccessGrants.ts rename to packages/storage/src/internals/apis/listCallerAccessGrants.ts index 2c3fe9bdc7c..3f8601fdaaa 100644 --- a/packages/storage/src/internals/apis/_listCallerAccessGrants.ts +++ b/packages/storage/src/internals/apis/listCallerAccessGrants.ts @@ -17,7 +17,7 @@ import { MAX_PAGE_SIZE } from '../utils/constants'; /** * @internal */ -export const _listCallerAccessGrants = async ( +export const listCallerAccessGrants = async ( input: ListCallerAccessGrantsInput, ): Promise => { const { credentialsProvider, accountId, region, nextToken, pageSize } = input; diff --git a/packages/storage/src/internals/index.ts b/packages/storage/src/internals/index.ts index 5260e27fd45..279ef2afd3b 100644 --- a/packages/storage/src/internals/index.ts +++ b/packages/storage/src/internals/index.ts @@ -18,8 +18,8 @@ export { ListCallerAccessGrantsOutput, } from './types/outputs'; -export { _getDataAccess } from './apis/_getDataAccess'; -export { _listCallerAccessGrants } from './apis/_listCallerAccessGrants'; +export { getDataAccess } from './apis/getDataAccess'; +export { listCallerAccessGrants } from './apis/listCallerAccessGrants'; /* CredentialsStore exports diff --git a/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts b/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts index c33644cc8dd..b34dff9848c 100644 --- a/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts +++ b/packages/storage/src/internals/managedAuthConfigAdapter/createListLocationsHandler.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { CredentialsProvider, ListLocations } from '../types/credentials'; -import { _listCallerAccessGrants } from '../apis/_listCallerAccessGrants'; +import { listCallerAccessGrants } from '../apis/listCallerAccessGrants'; interface CreateListLocationsHandlerInput { accountId: string; @@ -14,7 +14,7 @@ export const createListLocationsHandler = ( handlerInput: CreateListLocationsHandlerInput, ): ListLocations => { return async function listLocations(input = {}) { - const result = await _listCallerAccessGrants({ ...input, ...handlerInput }); + const result = await listCallerAccessGrants({ ...input, ...handlerInput }); return result; }; diff --git a/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts b/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts index 23cfef46e7c..944a25206fa 100644 --- a/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts +++ b/packages/storage/src/internals/managedAuthConfigAdapter/createLocationCredentialsHandler.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { _getDataAccess } from '../apis/_getDataAccess'; +import { getDataAccess } from '../apis/getDataAccess'; import { CredentialsProvider, GetLocationCredentials, @@ -29,7 +29,7 @@ export const createLocationCredentialsHandler = ( return (input: GetLocationCredentialsInput) => { const { scope, permission } = input; - return _getDataAccess({ + return getDataAccess({ accountId, credentialsProvider, permission,