From 0c367c048c22d8c3e4c74947d828ac7bbc5fb0ce Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Tue, 1 Oct 2024 09:34:26 -0700 Subject: [PATCH] chore: address feedbacks Co-authored-by: Jim Blanchard --- .../src/internals/apis/getProperties.ts | 2 ++ packages/storage/src/internals/index.ts | 1 - packages/storage/src/internals/types/inputs.ts | 4 ++-- .../src/providers/s3/apis/internal/copy.ts | 6 +++--- .../s3/apis/internal/getProperties.ts | 18 +++++++++--------- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/storage/src/internals/apis/getProperties.ts b/packages/storage/src/internals/apis/getProperties.ts index dbb41859402..871d3a54c7a 100644 --- a/packages/storage/src/internals/apis/getProperties.ts +++ b/packages/storage/src/internals/apis/getProperties.ts @@ -11,6 +11,8 @@ import { GetPropertiesOutput } from '../types/outputs'; * Gets the properties of a file. The properties include S3 system metadata and * the user metadata that was provided when uploading the file. * + * @internal + * * @param input - The `GetPropertiesWithPathInput` object. * @returns Requested object properties. * @throws An `S3Exception` when the underlying S3 service returned error. diff --git a/packages/storage/src/internals/index.ts b/packages/storage/src/internals/index.ts index 2296b0a926a..a02225f6bac 100644 --- a/packages/storage/src/internals/index.ts +++ b/packages/storage/src/internals/index.ts @@ -9,7 +9,6 @@ export { Permission } from './types/common'; Internal APIs */ export { - ExtendInputWithAdvancedOptions, GetDataAccessInput, ListCallerAccessGrantsInput, GetPropertiesInput, diff --git a/packages/storage/src/internals/types/inputs.ts b/packages/storage/src/internals/types/inputs.ts index a46e647b4d3..192e800d2c1 100644 --- a/packages/storage/src/internals/types/inputs.ts +++ b/packages/storage/src/internals/types/inputs.ts @@ -45,8 +45,8 @@ export type GetPropertiesInput = ExtendInputWithAdvancedOptions< >; /** - * Generic types that extend the public API input type with extended options. By default the - * extended options are locationCredentialsProvider. + * Generic types that extend the public API input type with extended options. + * This is a temporary solution to support advanced options from internal APIs. * * @internal */ diff --git a/packages/storage/src/providers/s3/apis/internal/copy.ts b/packages/storage/src/providers/s3/apis/internal/copy.ts index ccdf0d9497f..1b932bb03a5 100644 --- a/packages/storage/src/providers/s3/apis/internal/copy.ts +++ b/packages/storage/src/providers/s3/apis/internal/copy.ts @@ -25,10 +25,10 @@ import { assertValidationError } from '../../../../errors/utils/assertValidation import { copyObject } from '../../utils/client/s3data'; import { getStorageUserAgentValue } from '../../utils/userAgent'; import { logger } from '../../../../utils'; -/** FIXME: remove this interface when we move to public advanced APIs */ -import { ExtendInputWithAdvancedOptions } from '../../../../internals'; +// TODO: Remove this interface when we move to public advanced APIs. +import { ExtendInputWithAdvancedOptions } from '../../../../internals/types/inputs'; -/** FIXME: change this interface back to CopyWithPathInput when we move to public advanced APIs */ +// TODO: Change this interface back to CopyWithPathInput when we move to public advanced APIs. type InputWithPathAndAdvancedOptions = ExtendInputWithAdvancedOptions< CopyWithPathInput, { diff --git a/packages/storage/src/providers/s3/apis/internal/getProperties.ts b/packages/storage/src/providers/s3/apis/internal/getProperties.ts index ff61aeb1405..3ee52de3839 100644 --- a/packages/storage/src/providers/s3/apis/internal/getProperties.ts +++ b/packages/storage/src/providers/s3/apis/internal/getProperties.ts @@ -18,20 +18,20 @@ import { headObject } from '../../utils/client/s3data'; import { getStorageUserAgentValue } from '../../utils/userAgent'; import { logger } from '../../../../utils'; import { STORAGE_INPUT_KEY } from '../../utils/constants'; -/** FIXME: remove this interface when we move to public advanced APIs */ +// TODO: Remove this interface when we move to public advanced APIs. import { ExtendInputWithAdvancedOptions } from '../../../../internals/types/inputs'; import { LocationCredentialsProvider } from '../../types/options'; +type InputWithPathAndAdvancedOptions = ExtendInputWithAdvancedOptions< + GetPropertiesWithPathInput, + { + locationCredentialsProvider?: LocationCredentialsProvider; + } +>; + export const getProperties = async ( amplify: AmplifyClassV6, - input: - | GetPropertiesInput - | ExtendInputWithAdvancedOptions< - GetPropertiesWithPathInput, - { - locationCredentialsProvider?: LocationCredentialsProvider; - } - >, + input: GetPropertiesInput | InputWithPathAndAdvancedOptions, action?: StorageAction, ): Promise => { const { s3Config, bucket, keyPrefix, identityId } =