Skip to content

Commit

Permalink
fix: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sridhar committed Aug 15, 2023
1 parent 4554869 commit dc7f292
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/storage/src/providers/s3/apis/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
// SPDX-License-Identifier: Apache-2.0

import { AmplifyV6, ConsoleLogger as Logger } from '@aws-amplify/core';
import { StorageListRequest, StorageListOptions } from '../../../types';
import { S3ListOutputItem, S3ListResult, storageException } from '../types';
import { ListObjectsV2Input, listObjectsV2 } from '../../../AwsClients/S3';
import { StorageListRequest, StorageListOptions } from '../../../types';
import { S3ListOutputItem, S3ListResult, StorageException } from '../types';
import { StorageValidationErrorCode } from '../../../errors/types/validation';

// TODO are we using Logger in V6
const MAX_PAGE_SIZE = 1000;

/**
* List bucket objects
* @param {StorageListRequest<StorageListOptions>} req - The request object
* @return {Promise<StorageListResult>} - Promise resolves to list of keys and metadata for all objects in path
* additionally the result will include a nextToken if there are more items to retrieve
* @throws service: {@link storageException} - S3 service errors thrown while getting properties
* @throws service: {@link StorageException} - S3 service errors thrown while getting properties
* @throws validation: {@link StorageValidationErrorCode } - Validation errors thrown
*/
export const list = async (
Expand Down Expand Up @@ -55,7 +54,7 @@ const _listAll = async (
listOptions,
listParams: ListObjectsV2Input
): Promise<S3ListResult> => {
// TODO replace with V6 logger
// TODO(ashwinkumar6) replace with V6 logger
// if (listParams.MaxKeys || listParams.ContinuationToken) {
// logger.warn(`pageSize should be from 0 - ${MAX_PAGE_SIZE}.`);
// }
Expand Down Expand Up @@ -88,8 +87,8 @@ const _list = async (
const listParamsClone = { ...listParams };
if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {
listParamsClone.MaxKeys = MAX_PAGE_SIZE;
// TODO replace with V6 logger
// logger.warn(`pageSize should be from 0 - ${MAX_PAGE_SIZE}.`);
// TODO(ashwinkumar6) replace with V6 logger
// logger.warn(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);
}

const response = await listObjectsV2(listOptions, listParamsClone);
Expand Down

0 comments on commit dc7f292

Please sign in to comment.