diff --git a/.changeset/heavy-apes-remember.md b/.changeset/heavy-apes-remember.md new file mode 100644 index 0000000..b4c5f65 --- /dev/null +++ b/.changeset/heavy-apes-remember.md @@ -0,0 +1,5 @@ +--- +"@effect-aws/client-s3": minor +--- + +extended errors in s3 service diff --git a/packages/client-s3/src/Errors.ts b/packages/client-s3/src/Errors.ts index 2ceaa8f..2558a19 100644 --- a/packages/client-s3/src/Errors.ts +++ b/packages/client-s3/src/Errors.ts @@ -1,10 +1,34 @@ -import { S3ServiceException } from "@aws-sdk/client-s3"; +import type { + S3ServiceException, + BucketAlreadyExists, + BucketAlreadyOwnedByYou, + InvalidObjectState, + NoSuchBucket, + NoSuchKey, + NoSuchUpload, + NotFound, + ObjectAlreadyInActiveTierError as ObjectAlreadyInActiveTierException, + ObjectNotInActiveTierError as ObjectNotInActiveTierException, +} from "@aws-sdk/client-s3"; import * as Data from "effect/Data"; export type TaggedException = T & { readonly _tag: T["name"]; }; +export type BucketAlreadyExistsError = TaggedException; +export type BucketAlreadyOwnedByYouError = + TaggedException; +export type InvalidObjectStateError = TaggedException; +export type NoSuchBucketError = TaggedException; +export type NoSuchKeyError = TaggedException; +export type NoSuchUploadError = TaggedException; +export type NotFoundError = TaggedException; +export type ObjectAlreadyInActiveTierError = + TaggedException; +export type ObjectNotInActiveTierError = + TaggedException; + export type S3ServiceError = TaggedException< S3ServiceException & { name: "S3ServiceError" } >; diff --git a/packages/client-s3/src/S3ClientInstanceConfig.ts b/packages/client-s3/src/S3ClientInstanceConfig.ts index 396f594..02a4eec 100644 --- a/packages/client-s3/src/S3ClientInstanceConfig.ts +++ b/packages/client-s3/src/S3ClientInstanceConfig.ts @@ -26,11 +26,21 @@ export const makeDefaultS3ClientInstanceConfig: Effect.Effect = return { logger: { - info: (m) => Effect.logInfo(m).pipe(runSync), - warn: (m) => Effect.logWarning(m).pipe(runSync), - error: (m) => Effect.logError(m).pipe(runSync), - debug: (m) => Effect.logDebug(m).pipe(runSync), - trace: (m) => Effect.logTrace(m).pipe(runSync), + info(m) { + Effect.logInfo(m).pipe(runSync); + }, + warn(m) { + Effect.logWarning(m).pipe(runSync); + }, + error(m) { + Effect.logError(m).pipe(runSync); + }, + debug(m) { + Effect.logDebug(m).pipe(runSync); + }, + trace(m) { + Effect.logTrace(m).pipe(runSync); + }, }, }; }); diff --git a/packages/client-s3/src/S3Service.ts b/packages/client-s3/src/S3Service.ts index e7f469a..bffae78 100644 --- a/packages/client-s3/src/S3Service.ts +++ b/packages/client-s3/src/S3Service.ts @@ -2,294 +2,313 @@ * @since 1.0.0 */ import { + S3ServiceException, AbortMultipartUploadCommand, - AbortMultipartUploadCommandInput, - AbortMultipartUploadCommandOutput, + type AbortMultipartUploadCommandInput, + type AbortMultipartUploadCommandOutput, CompleteMultipartUploadCommand, - CompleteMultipartUploadCommandInput, - CompleteMultipartUploadCommandOutput, + type CompleteMultipartUploadCommandInput, + type CompleteMultipartUploadCommandOutput, CopyObjectCommand, - CopyObjectCommandInput, - CopyObjectCommandOutput, + type CopyObjectCommandInput, + type CopyObjectCommandOutput, CreateBucketCommand, - CreateBucketCommandInput, - CreateBucketCommandOutput, + type CreateBucketCommandInput, + type CreateBucketCommandOutput, CreateMultipartUploadCommand, - CreateMultipartUploadCommandInput, - CreateMultipartUploadCommandOutput, - DeleteBucketAnalyticsConfigurationCommand, - DeleteBucketAnalyticsConfigurationCommandInput, - DeleteBucketAnalyticsConfigurationCommandOutput, + type CreateMultipartUploadCommandInput, + type CreateMultipartUploadCommandOutput, + CreateSessionCommand, + type CreateSessionCommandInput, + type CreateSessionCommandOutput, DeleteBucketCommand, - DeleteBucketCommandInput, - DeleteBucketCommandOutput, + type DeleteBucketCommandInput, + type DeleteBucketCommandOutput, + DeleteBucketAnalyticsConfigurationCommand, + type DeleteBucketAnalyticsConfigurationCommandInput, + type DeleteBucketAnalyticsConfigurationCommandOutput, DeleteBucketCorsCommand, - DeleteBucketCorsCommandInput, - DeleteBucketCorsCommandOutput, + type DeleteBucketCorsCommandInput, + type DeleteBucketCorsCommandOutput, DeleteBucketEncryptionCommand, - DeleteBucketEncryptionCommandInput, - DeleteBucketEncryptionCommandOutput, + type DeleteBucketEncryptionCommandInput, + type DeleteBucketEncryptionCommandOutput, DeleteBucketIntelligentTieringConfigurationCommand, - DeleteBucketIntelligentTieringConfigurationCommandInput, - DeleteBucketIntelligentTieringConfigurationCommandOutput, + type DeleteBucketIntelligentTieringConfigurationCommandInput, + type DeleteBucketIntelligentTieringConfigurationCommandOutput, DeleteBucketInventoryConfigurationCommand, - DeleteBucketInventoryConfigurationCommandInput, - DeleteBucketInventoryConfigurationCommandOutput, + type DeleteBucketInventoryConfigurationCommandInput, + type DeleteBucketInventoryConfigurationCommandOutput, DeleteBucketLifecycleCommand, - DeleteBucketLifecycleCommandInput, - DeleteBucketLifecycleCommandOutput, + type DeleteBucketLifecycleCommandInput, + type DeleteBucketLifecycleCommandOutput, DeleteBucketMetricsConfigurationCommand, - DeleteBucketMetricsConfigurationCommandInput, - DeleteBucketMetricsConfigurationCommandOutput, + type DeleteBucketMetricsConfigurationCommandInput, + type DeleteBucketMetricsConfigurationCommandOutput, DeleteBucketOwnershipControlsCommand, - DeleteBucketOwnershipControlsCommandInput, - DeleteBucketOwnershipControlsCommandOutput, + type DeleteBucketOwnershipControlsCommandInput, + type DeleteBucketOwnershipControlsCommandOutput, DeleteBucketPolicyCommand, - DeleteBucketPolicyCommandInput, - DeleteBucketPolicyCommandOutput, + type DeleteBucketPolicyCommandInput, + type DeleteBucketPolicyCommandOutput, DeleteBucketReplicationCommand, - DeleteBucketReplicationCommandInput, - DeleteBucketReplicationCommandOutput, + type DeleteBucketReplicationCommandInput, + type DeleteBucketReplicationCommandOutput, DeleteBucketTaggingCommand, - DeleteBucketTaggingCommandInput, - DeleteBucketTaggingCommandOutput, + type DeleteBucketTaggingCommandInput, + type DeleteBucketTaggingCommandOutput, DeleteBucketWebsiteCommand, - DeleteBucketWebsiteCommandInput, - DeleteBucketWebsiteCommandOutput, + type DeleteBucketWebsiteCommandInput, + type DeleteBucketWebsiteCommandOutput, DeleteObjectCommand, - DeleteObjectCommandInput, - DeleteObjectCommandOutput, + type DeleteObjectCommandInput, + type DeleteObjectCommandOutput, DeleteObjectsCommand, - DeleteObjectsCommandInput, - DeleteObjectsCommandOutput, + type DeleteObjectsCommandInput, + type DeleteObjectsCommandOutput, DeleteObjectTaggingCommand, - DeleteObjectTaggingCommandInput, - DeleteObjectTaggingCommandOutput, + type DeleteObjectTaggingCommandInput, + type DeleteObjectTaggingCommandOutput, DeletePublicAccessBlockCommand, - DeletePublicAccessBlockCommandInput, - DeletePublicAccessBlockCommandOutput, + type DeletePublicAccessBlockCommandInput, + type DeletePublicAccessBlockCommandOutput, GetBucketAccelerateConfigurationCommand, - GetBucketAccelerateConfigurationCommandInput, - GetBucketAccelerateConfigurationCommandOutput, + type GetBucketAccelerateConfigurationCommandInput, + type GetBucketAccelerateConfigurationCommandOutput, GetBucketAclCommand, - GetBucketAclCommandInput, - GetBucketAclCommandOutput, + type GetBucketAclCommandInput, + type GetBucketAclCommandOutput, GetBucketAnalyticsConfigurationCommand, - GetBucketAnalyticsConfigurationCommandInput, - GetBucketAnalyticsConfigurationCommandOutput, + type GetBucketAnalyticsConfigurationCommandInput, + type GetBucketAnalyticsConfigurationCommandOutput, GetBucketCorsCommand, - GetBucketCorsCommandInput, - GetBucketCorsCommandOutput, + type GetBucketCorsCommandInput, + type GetBucketCorsCommandOutput, GetBucketEncryptionCommand, - GetBucketEncryptionCommandInput, - GetBucketEncryptionCommandOutput, + type GetBucketEncryptionCommandInput, + type GetBucketEncryptionCommandOutput, GetBucketIntelligentTieringConfigurationCommand, - GetBucketIntelligentTieringConfigurationCommandInput, - GetBucketIntelligentTieringConfigurationCommandOutput, + type GetBucketIntelligentTieringConfigurationCommandInput, + type GetBucketIntelligentTieringConfigurationCommandOutput, GetBucketInventoryConfigurationCommand, - GetBucketInventoryConfigurationCommandInput, - GetBucketInventoryConfigurationCommandOutput, + type GetBucketInventoryConfigurationCommandInput, + type GetBucketInventoryConfigurationCommandOutput, GetBucketLifecycleConfigurationCommand, - GetBucketLifecycleConfigurationCommandInput, - GetBucketLifecycleConfigurationCommandOutput, + type GetBucketLifecycleConfigurationCommandInput, + type GetBucketLifecycleConfigurationCommandOutput, GetBucketLocationCommand, - GetBucketLocationCommandInput, - GetBucketLocationCommandOutput, + type GetBucketLocationCommandInput, + type GetBucketLocationCommandOutput, GetBucketLoggingCommand, - GetBucketLoggingCommandInput, - GetBucketLoggingCommandOutput, + type GetBucketLoggingCommandInput, + type GetBucketLoggingCommandOutput, GetBucketMetricsConfigurationCommand, - GetBucketMetricsConfigurationCommandInput, - GetBucketMetricsConfigurationCommandOutput, + type GetBucketMetricsConfigurationCommandInput, + type GetBucketMetricsConfigurationCommandOutput, GetBucketNotificationConfigurationCommand, - GetBucketNotificationConfigurationCommandInput, - GetBucketNotificationConfigurationCommandOutput, + type GetBucketNotificationConfigurationCommandInput, + type GetBucketNotificationConfigurationCommandOutput, GetBucketOwnershipControlsCommand, - GetBucketOwnershipControlsCommandInput, - GetBucketOwnershipControlsCommandOutput, + type GetBucketOwnershipControlsCommandInput, + type GetBucketOwnershipControlsCommandOutput, GetBucketPolicyCommand, - GetBucketPolicyCommandInput, - GetBucketPolicyCommandOutput, + type GetBucketPolicyCommandInput, + type GetBucketPolicyCommandOutput, GetBucketPolicyStatusCommand, - GetBucketPolicyStatusCommandInput, - GetBucketPolicyStatusCommandOutput, + type GetBucketPolicyStatusCommandInput, + type GetBucketPolicyStatusCommandOutput, GetBucketReplicationCommand, - GetBucketReplicationCommandInput, - GetBucketReplicationCommandOutput, + type GetBucketReplicationCommandInput, + type GetBucketReplicationCommandOutput, GetBucketRequestPaymentCommand, - GetBucketRequestPaymentCommandInput, - GetBucketRequestPaymentCommandOutput, + type GetBucketRequestPaymentCommandInput, + type GetBucketRequestPaymentCommandOutput, GetBucketTaggingCommand, - GetBucketTaggingCommandInput, - GetBucketTaggingCommandOutput, + type GetBucketTaggingCommandInput, + type GetBucketTaggingCommandOutput, GetBucketVersioningCommand, - GetBucketVersioningCommandInput, - GetBucketVersioningCommandOutput, + type GetBucketVersioningCommandInput, + type GetBucketVersioningCommandOutput, GetBucketWebsiteCommand, - GetBucketWebsiteCommandInput, - GetBucketWebsiteCommandOutput, + type GetBucketWebsiteCommandInput, + type GetBucketWebsiteCommandOutput, + GetObjectCommand, + type GetObjectCommandInput, + type GetObjectCommandOutput, GetObjectAclCommand, - GetObjectAclCommandInput, - GetObjectAclCommandOutput, + type GetObjectAclCommandInput, + type GetObjectAclCommandOutput, GetObjectAttributesCommand, - GetObjectAttributesCommandInput, - GetObjectAttributesCommandOutput, - GetObjectCommand, - GetObjectCommandInput, - GetObjectCommandOutput, + type GetObjectAttributesCommandInput, + type GetObjectAttributesCommandOutput, GetObjectLegalHoldCommand, - GetObjectLegalHoldCommandInput, - GetObjectLegalHoldCommandOutput, + type GetObjectLegalHoldCommandInput, + type GetObjectLegalHoldCommandOutput, GetObjectLockConfigurationCommand, - GetObjectLockConfigurationCommandInput, - GetObjectLockConfigurationCommandOutput, + type GetObjectLockConfigurationCommandInput, + type GetObjectLockConfigurationCommandOutput, GetObjectRetentionCommand, - GetObjectRetentionCommandInput, - GetObjectRetentionCommandOutput, + type GetObjectRetentionCommandInput, + type GetObjectRetentionCommandOutput, GetObjectTaggingCommand, - GetObjectTaggingCommandInput, - GetObjectTaggingCommandOutput, + type GetObjectTaggingCommandInput, + type GetObjectTaggingCommandOutput, GetObjectTorrentCommand, - GetObjectTorrentCommandInput, - GetObjectTorrentCommandOutput, + type GetObjectTorrentCommandInput, + type GetObjectTorrentCommandOutput, GetPublicAccessBlockCommand, - GetPublicAccessBlockCommandInput, - GetPublicAccessBlockCommandOutput, + type GetPublicAccessBlockCommandInput, + type GetPublicAccessBlockCommandOutput, HeadBucketCommand, - HeadBucketCommandInput, - HeadBucketCommandOutput, + type HeadBucketCommandInput, + type HeadBucketCommandOutput, HeadObjectCommand, - HeadObjectCommandInput, - HeadObjectCommandOutput, + type HeadObjectCommandInput, + type HeadObjectCommandOutput, ListBucketAnalyticsConfigurationsCommand, - ListBucketAnalyticsConfigurationsCommandInput, - ListBucketAnalyticsConfigurationsCommandOutput, + type ListBucketAnalyticsConfigurationsCommandInput, + type ListBucketAnalyticsConfigurationsCommandOutput, ListBucketIntelligentTieringConfigurationsCommand, - ListBucketIntelligentTieringConfigurationsCommandInput, - ListBucketIntelligentTieringConfigurationsCommandOutput, + type ListBucketIntelligentTieringConfigurationsCommandInput, + type ListBucketIntelligentTieringConfigurationsCommandOutput, ListBucketInventoryConfigurationsCommand, - ListBucketInventoryConfigurationsCommandInput, - ListBucketInventoryConfigurationsCommandOutput, + type ListBucketInventoryConfigurationsCommandInput, + type ListBucketInventoryConfigurationsCommandOutput, ListBucketMetricsConfigurationsCommand, - ListBucketMetricsConfigurationsCommandInput, - ListBucketMetricsConfigurationsCommandOutput, + type ListBucketMetricsConfigurationsCommandInput, + type ListBucketMetricsConfigurationsCommandOutput, ListBucketsCommand, - ListBucketsCommandInput, - ListBucketsCommandOutput, + type ListBucketsCommandInput, + type ListBucketsCommandOutput, + ListDirectoryBucketsCommand, + type ListDirectoryBucketsCommandInput, + type ListDirectoryBucketsCommandOutput, ListMultipartUploadsCommand, - ListMultipartUploadsCommandInput, - ListMultipartUploadsCommandOutput, + type ListMultipartUploadsCommandInput, + type ListMultipartUploadsCommandOutput, ListObjectsCommand, - ListObjectsCommandInput, - ListObjectsCommandOutput, + type ListObjectsCommandInput, + type ListObjectsCommandOutput, ListObjectsV2Command, - ListObjectsV2CommandInput, - ListObjectsV2CommandOutput, + type ListObjectsV2CommandInput, + type ListObjectsV2CommandOutput, ListObjectVersionsCommand, - ListObjectVersionsCommandInput, - ListObjectVersionsCommandOutput, + type ListObjectVersionsCommandInput, + type ListObjectVersionsCommandOutput, ListPartsCommand, - ListPartsCommandInput, - ListPartsCommandOutput, + type ListPartsCommandInput, + type ListPartsCommandOutput, PutBucketAccelerateConfigurationCommand, - PutBucketAccelerateConfigurationCommandInput, - PutBucketAccelerateConfigurationCommandOutput, + type PutBucketAccelerateConfigurationCommandInput, + type PutBucketAccelerateConfigurationCommandOutput, PutBucketAclCommand, - PutBucketAclCommandInput, - PutBucketAclCommandOutput, + type PutBucketAclCommandInput, + type PutBucketAclCommandOutput, PutBucketAnalyticsConfigurationCommand, - PutBucketAnalyticsConfigurationCommandInput, - PutBucketAnalyticsConfigurationCommandOutput, + type PutBucketAnalyticsConfigurationCommandInput, + type PutBucketAnalyticsConfigurationCommandOutput, PutBucketCorsCommand, - PutBucketCorsCommandInput, - PutBucketCorsCommandOutput, + type PutBucketCorsCommandInput, + type PutBucketCorsCommandOutput, PutBucketEncryptionCommand, - PutBucketEncryptionCommandInput, - PutBucketEncryptionCommandOutput, + type PutBucketEncryptionCommandInput, + type PutBucketEncryptionCommandOutput, PutBucketIntelligentTieringConfigurationCommand, - PutBucketIntelligentTieringConfigurationCommandInput, - PutBucketIntelligentTieringConfigurationCommandOutput, + type PutBucketIntelligentTieringConfigurationCommandInput, + type PutBucketIntelligentTieringConfigurationCommandOutput, PutBucketInventoryConfigurationCommand, - PutBucketInventoryConfigurationCommandInput, - PutBucketInventoryConfigurationCommandOutput, + type PutBucketInventoryConfigurationCommandInput, + type PutBucketInventoryConfigurationCommandOutput, PutBucketLifecycleConfigurationCommand, - PutBucketLifecycleConfigurationCommandInput, - PutBucketLifecycleConfigurationCommandOutput, + type PutBucketLifecycleConfigurationCommandInput, + type PutBucketLifecycleConfigurationCommandOutput, PutBucketLoggingCommand, - PutBucketLoggingCommandInput, - PutBucketLoggingCommandOutput, + type PutBucketLoggingCommandInput, + type PutBucketLoggingCommandOutput, PutBucketMetricsConfigurationCommand, - PutBucketMetricsConfigurationCommandInput, - PutBucketMetricsConfigurationCommandOutput, + type PutBucketMetricsConfigurationCommandInput, + type PutBucketMetricsConfigurationCommandOutput, PutBucketNotificationConfigurationCommand, - PutBucketNotificationConfigurationCommandInput, - PutBucketNotificationConfigurationCommandOutput, + type PutBucketNotificationConfigurationCommandInput, + type PutBucketNotificationConfigurationCommandOutput, PutBucketOwnershipControlsCommand, - PutBucketOwnershipControlsCommandInput, - PutBucketOwnershipControlsCommandOutput, + type PutBucketOwnershipControlsCommandInput, + type PutBucketOwnershipControlsCommandOutput, PutBucketPolicyCommand, - PutBucketPolicyCommandInput, - PutBucketPolicyCommandOutput, + type PutBucketPolicyCommandInput, + type PutBucketPolicyCommandOutput, PutBucketReplicationCommand, - PutBucketReplicationCommandInput, - PutBucketReplicationCommandOutput, + type PutBucketReplicationCommandInput, + type PutBucketReplicationCommandOutput, PutBucketRequestPaymentCommand, - PutBucketRequestPaymentCommandInput, - PutBucketRequestPaymentCommandOutput, + type PutBucketRequestPaymentCommandInput, + type PutBucketRequestPaymentCommandOutput, PutBucketTaggingCommand, - PutBucketTaggingCommandInput, - PutBucketTaggingCommandOutput, + type PutBucketTaggingCommandInput, + type PutBucketTaggingCommandOutput, PutBucketVersioningCommand, - PutBucketVersioningCommandInput, - PutBucketVersioningCommandOutput, + type PutBucketVersioningCommandInput, + type PutBucketVersioningCommandOutput, PutBucketWebsiteCommand, - PutBucketWebsiteCommandInput, - PutBucketWebsiteCommandOutput, - PutObjectAclCommand, - PutObjectAclCommandInput, - PutObjectAclCommandOutput, + type PutBucketWebsiteCommandInput, + type PutBucketWebsiteCommandOutput, PutObjectCommand, - PutObjectCommandInput, - PutObjectCommandOutput, + type PutObjectCommandInput, + type PutObjectCommandOutput, + PutObjectAclCommand, + type PutObjectAclCommandInput, + type PutObjectAclCommandOutput, PutObjectLegalHoldCommand, - PutObjectLegalHoldCommandInput, - PutObjectLegalHoldCommandOutput, + type PutObjectLegalHoldCommandInput, + type PutObjectLegalHoldCommandOutput, PutObjectLockConfigurationCommand, - PutObjectLockConfigurationCommandInput, - PutObjectLockConfigurationCommandOutput, + type PutObjectLockConfigurationCommandInput, + type PutObjectLockConfigurationCommandOutput, PutObjectRetentionCommand, - PutObjectRetentionCommandInput, - PutObjectRetentionCommandOutput, + type PutObjectRetentionCommandInput, + type PutObjectRetentionCommandOutput, PutObjectTaggingCommand, - PutObjectTaggingCommandInput, - PutObjectTaggingCommandOutput, + type PutObjectTaggingCommandInput, + type PutObjectTaggingCommandOutput, PutPublicAccessBlockCommand, - PutPublicAccessBlockCommandInput, - PutPublicAccessBlockCommandOutput, + type PutPublicAccessBlockCommandInput, + type PutPublicAccessBlockCommandOutput, RestoreObjectCommand, - RestoreObjectCommandInput, - RestoreObjectCommandOutput, - S3ServiceException, + type RestoreObjectCommandInput, + type RestoreObjectCommandOutput, SelectObjectContentCommand, - SelectObjectContentCommandInput, - SelectObjectContentCommandOutput, + type SelectObjectContentCommandInput, + type SelectObjectContentCommandOutput, UploadPartCommand, - UploadPartCommandInput, - UploadPartCommandOutput, + type UploadPartCommandInput, + type UploadPartCommandOutput, UploadPartCopyCommand, - UploadPartCopyCommandInput, - UploadPartCopyCommandOutput, + type UploadPartCopyCommandInput, + type UploadPartCopyCommandOutput, WriteGetObjectResponseCommand, - WriteGetObjectResponseCommandInput, - WriteGetObjectResponseCommandOutput, + type WriteGetObjectResponseCommandInput, + type WriteGetObjectResponseCommandOutput, } from "@aws-sdk/client-s3"; import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; import { - HttpHandlerOptions as __HttpHandlerOptions, + type HttpHandlerOptions as __HttpHandlerOptions, RequestPresigningArguments, } from "@aws-sdk/types"; -import { Context, Effect, Layer, ReadonlyRecord } from "effect"; -import { S3ServiceError, SdkError } from "./Errors"; +import { Context, Data, Effect, Layer, ReadonlyRecord } from "effect"; +import { + BucketAlreadyExistsError, + BucketAlreadyOwnedByYouError, + InvalidObjectStateError, + NoSuchBucketError, + NoSuchKeyError, + NoSuchUploadError, + NotFoundError, + ObjectAlreadyInActiveTierError, + ObjectNotInActiveTierError, + S3ServiceError, + SdkError, + TaggedException, +} from "./Errors"; import { DefaultS3ClientInstanceLayer, S3ClientInstance, @@ -303,6 +322,7 @@ const commands = { CopyObjectCommand, CreateBucketCommand, CreateMultipartUploadCommand, + CreateSessionCommand, DeleteBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCorsCommand, @@ -356,6 +376,7 @@ const commands = { ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, + ListDirectoryBucketsCommand, ListMultipartUploadsCommand, ListObjectsCommand, ListObjectsV2Command, @@ -403,21 +424,21 @@ export interface S3Service { /** * @see {@link AbortMultipartUploadCommand} */ - readonly abortMultipartUpload: ( + abortMultipartUpload( args: AbortMultipartUploadCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AbortMultipartUploadCommandOutput, - SdkError | S3ServiceError + SdkError | NoSuchUploadError >; /** * @see {@link CompleteMultipartUploadCommand} */ - readonly completeMultipartUpload: ( + completeMultipartUpload( args: CompleteMultipartUploadCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CompleteMultipartUploadCommandOutput, SdkError | S3ServiceError >; @@ -425,45 +446,59 @@ export interface S3Service { /** * @see {@link CopyObjectCommand} */ - readonly copyObject: ( + copyObject( args: CopyObjectCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect< + CopyObjectCommandOutput, + SdkError | ObjectNotInActiveTierError + >; /** * @see {@link CreateBucketCommand} */ - readonly createBucket: ( + createBucket( args: CreateBucketCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect< + CreateBucketCommandOutput, + SdkError | BucketAlreadyExistsError | BucketAlreadyOwnedByYouError + >; /** * @see {@link CreateMultipartUploadCommand} */ - readonly createMultipartUpload: ( + createMultipartUpload( args: CreateMultipartUploadCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateMultipartUploadCommandOutput, SdkError | S3ServiceError >; + /** + * @see {@link CreateSessionCommand} + */ + createSession( + args: CreateSessionCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link DeleteBucketCommand} */ - readonly deleteBucket: ( + deleteBucket( args: DeleteBucketCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteBucketAnalyticsConfigurationCommand} */ - readonly deleteBucketAnalyticsConfiguration: ( + deleteBucketAnalyticsConfiguration( args: DeleteBucketAnalyticsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketAnalyticsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -471,18 +506,18 @@ export interface S3Service { /** * @see {@link DeleteBucketCorsCommand} */ - readonly deleteBucketCors: ( + deleteBucketCors( args: DeleteBucketCorsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteBucketEncryptionCommand} */ - readonly deleteBucketEncryption: ( + deleteBucketEncryption( args: DeleteBucketEncryptionCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketEncryptionCommandOutput, SdkError | S3ServiceError >; @@ -490,10 +525,10 @@ export interface S3Service { /** * @see {@link DeleteBucketIntelligentTieringConfigurationCommand} */ - readonly deleteBucketIntelligentTieringConfiguration: ( + deleteBucketIntelligentTieringConfiguration( args: DeleteBucketIntelligentTieringConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketIntelligentTieringConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -501,10 +536,10 @@ export interface S3Service { /** * @see {@link DeleteBucketInventoryConfigurationCommand} */ - readonly deleteBucketInventoryConfiguration: ( + deleteBucketInventoryConfiguration( args: DeleteBucketInventoryConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketInventoryConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -512,10 +547,10 @@ export interface S3Service { /** * @see {@link DeleteBucketLifecycleCommand} */ - readonly deleteBucketLifecycle: ( + deleteBucketLifecycle( args: DeleteBucketLifecycleCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketLifecycleCommandOutput, SdkError | S3ServiceError >; @@ -523,10 +558,10 @@ export interface S3Service { /** * @see {@link DeleteBucketMetricsConfigurationCommand} */ - readonly deleteBucketMetricsConfiguration: ( + deleteBucketMetricsConfiguration( args: DeleteBucketMetricsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketMetricsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -534,10 +569,10 @@ export interface S3Service { /** * @see {@link DeleteBucketOwnershipControlsCommand} */ - readonly deleteBucketOwnershipControls: ( + deleteBucketOwnershipControls( args: DeleteBucketOwnershipControlsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketOwnershipControlsCommandOutput, SdkError | S3ServiceError >; @@ -545,21 +580,18 @@ export interface S3Service { /** * @see {@link DeleteBucketPolicyCommand} */ - readonly deleteBucketPolicy: ( + deleteBucketPolicy( args: DeleteBucketPolicyCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - DeleteBucketPolicyCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link DeleteBucketReplicationCommand} */ - readonly deleteBucketReplication: ( + deleteBucketReplication( args: DeleteBucketReplicationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteBucketReplicationCommandOutput, SdkError | S3ServiceError >; @@ -567,59 +599,50 @@ export interface S3Service { /** * @see {@link DeleteBucketTaggingCommand} */ - readonly deleteBucketTagging: ( + deleteBucketTagging( args: DeleteBucketTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - DeleteBucketTaggingCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link DeleteBucketWebsiteCommand} */ - readonly deleteBucketWebsite: ( + deleteBucketWebsite( args: DeleteBucketWebsiteCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - DeleteBucketWebsiteCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link DeleteObjectCommand} */ - readonly deleteObject: ( + deleteObject( args: DeleteObjectCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteObjectsCommand} */ - readonly deleteObjects: ( + deleteObjects( args: DeleteObjectsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteObjectTaggingCommand} */ - readonly deleteObjectTagging: ( + deleteObjectTagging( args: DeleteObjectTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - DeleteObjectTaggingCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link DeletePublicAccessBlockCommand} */ - readonly deletePublicAccessBlock: ( + deletePublicAccessBlock( args: DeletePublicAccessBlockCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeletePublicAccessBlockCommandOutput, SdkError | S3ServiceError >; @@ -627,10 +650,10 @@ export interface S3Service { /** * @see {@link GetBucketAccelerateConfigurationCommand} */ - readonly getBucketAccelerateConfiguration: ( + getBucketAccelerateConfiguration( args: GetBucketAccelerateConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketAccelerateConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -638,18 +661,18 @@ export interface S3Service { /** * @see {@link GetBucketAclCommand} */ - readonly getBucketAcl: ( + getBucketAcl( args: GetBucketAclCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketAnalyticsConfigurationCommand} */ - readonly getBucketAnalyticsConfiguration: ( + getBucketAnalyticsConfiguration( args: GetBucketAnalyticsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketAnalyticsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -657,29 +680,26 @@ export interface S3Service { /** * @see {@link GetBucketCorsCommand} */ - readonly getBucketCors: ( + getBucketCors( args: GetBucketCorsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketEncryptionCommand} */ - readonly getBucketEncryption: ( + getBucketEncryption( args: GetBucketEncryptionCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - GetBucketEncryptionCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link GetBucketIntelligentTieringConfigurationCommand} */ - readonly getBucketIntelligentTieringConfiguration: ( + getBucketIntelligentTieringConfiguration( args: GetBucketIntelligentTieringConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketIntelligentTieringConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -687,10 +707,10 @@ export interface S3Service { /** * @see {@link GetBucketInventoryConfigurationCommand} */ - readonly getBucketInventoryConfiguration: ( + getBucketInventoryConfiguration( args: GetBucketInventoryConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketInventoryConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -698,10 +718,10 @@ export interface S3Service { /** * @see {@link GetBucketLifecycleConfigurationCommand} */ - readonly getBucketLifecycleConfiguration: ( + getBucketLifecycleConfiguration( args: GetBucketLifecycleConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketLifecycleConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -709,26 +729,26 @@ export interface S3Service { /** * @see {@link GetBucketLocationCommand} */ - readonly getBucketLocation: ( + getBucketLocation( args: GetBucketLocationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketLoggingCommand} */ - readonly getBucketLogging: ( + getBucketLogging( args: GetBucketLoggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketMetricsConfigurationCommand} */ - readonly getBucketMetricsConfiguration: ( + getBucketMetricsConfiguration( args: GetBucketMetricsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketMetricsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -736,10 +756,10 @@ export interface S3Service { /** * @see {@link GetBucketNotificationConfigurationCommand} */ - readonly getBucketNotificationConfiguration: ( + getBucketNotificationConfiguration( args: GetBucketNotificationConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketNotificationConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -747,10 +767,10 @@ export interface S3Service { /** * @see {@link GetBucketOwnershipControlsCommand} */ - readonly getBucketOwnershipControls: ( + getBucketOwnershipControls( args: GetBucketOwnershipControlsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketOwnershipControlsCommandOutput, SdkError | S3ServiceError >; @@ -758,18 +778,18 @@ export interface S3Service { /** * @see {@link GetBucketPolicyCommand} */ - readonly getBucketPolicy: ( + getBucketPolicy( args: GetBucketPolicyCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketPolicyStatusCommand} */ - readonly getBucketPolicyStatus: ( + getBucketPolicyStatus( args: GetBucketPolicyStatusCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketPolicyStatusCommandOutput, SdkError | S3ServiceError >; @@ -777,10 +797,10 @@ export interface S3Service { /** * @see {@link GetBucketReplicationCommand} */ - readonly getBucketReplication: ( + getBucketReplication( args: GetBucketReplicationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketReplicationCommandOutput, SdkError | S3ServiceError >; @@ -788,10 +808,10 @@ export interface S3Service { /** * @see {@link GetBucketRequestPaymentCommand} */ - readonly getBucketRequestPayment: ( + getBucketRequestPayment( args: GetBucketRequestPaymentCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetBucketRequestPaymentCommandOutput, SdkError | S3ServiceError >; @@ -799,81 +819,73 @@ export interface S3Service { /** * @see {@link GetBucketTaggingCommand} */ - readonly getBucketTagging: ( + getBucketTagging( args: GetBucketTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetBucketVersioningCommand} */ - readonly getBucketVersioning: ( + getBucketVersioning( args: GetBucketVersioningCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - GetBucketVersioningCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link GetBucketWebsiteCommand} */ - readonly getBucketWebsite: ( + getBucketWebsite( args: GetBucketWebsiteCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetObjectCommand} */ - readonly getObject: { - ( - args: GetObjectCommandInput, - options?: { readonly presigned?: false } & __HttpHandlerOptions, - ): Effect.Effect; - ( - args: GetObjectCommandInput, - options?: { readonly presigned: true } & RequestPresigningArguments, - ): Effect.Effect; - }; + getObject( + args: GetObjectCommandInput, + options?: { readonly presigned?: false } & __HttpHandlerOptions, + ): Effect.Effect< + GetObjectCommandOutput, + SdkError | InvalidObjectStateError | NoSuchKeyError + >; + getObject( + args: GetObjectCommandInput, + options?: { readonly presigned: true } & RequestPresigningArguments, + ): Effect.Effect; /** * @see {@link GetObjectAclCommand} */ - readonly getObjectAcl: ( + getObjectAcl( args: GetObjectAclCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetObjectAttributesCommand} */ - readonly getObjectAttributes: ( + getObjectAttributes( args: GetObjectAttributesCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - GetObjectAttributesCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link GetObjectLegalHoldCommand} */ - readonly getObjectLegalHold: ( + getObjectLegalHold( args: GetObjectLegalHoldCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - GetObjectLegalHoldCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link GetObjectLockConfigurationCommand} */ - readonly getObjectLockConfiguration: ( + getObjectLockConfiguration( args: GetObjectLockConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetObjectLockConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -881,37 +893,34 @@ export interface S3Service { /** * @see {@link GetObjectRetentionCommand} */ - readonly getObjectRetention: ( + getObjectRetention( args: GetObjectRetentionCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - GetObjectRetentionCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link GetObjectTaggingCommand} */ - readonly getObjectTagging: ( + getObjectTagging( args: GetObjectTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetObjectTorrentCommand} */ - readonly getObjectTorrent: ( + getObjectTorrent( args: GetObjectTorrentCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetPublicAccessBlockCommand} */ - readonly getPublicAccessBlock: ( + getPublicAccessBlock( args: GetPublicAccessBlockCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetPublicAccessBlockCommandOutput, SdkError | S3ServiceError >; @@ -919,26 +928,26 @@ export interface S3Service { /** * @see {@link HeadBucketCommand} */ - readonly headBucket: ( + headBucket( args: HeadBucketCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link HeadObjectCommand} */ - readonly headObject: ( + headObject( args: HeadObjectCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ListBucketAnalyticsConfigurationsCommand} */ - readonly listBucketAnalyticsConfigurations: ( + listBucketAnalyticsConfigurations( args: ListBucketAnalyticsConfigurationsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListBucketAnalyticsConfigurationsCommandOutput, SdkError | S3ServiceError >; @@ -946,10 +955,10 @@ export interface S3Service { /** * @see {@link ListBucketIntelligentTieringConfigurationsCommand} */ - readonly listBucketIntelligentTieringConfigurations: ( + listBucketIntelligentTieringConfigurations( args: ListBucketIntelligentTieringConfigurationsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListBucketIntelligentTieringConfigurationsCommandOutput, SdkError | S3ServiceError >; @@ -957,10 +966,10 @@ export interface S3Service { /** * @see {@link ListBucketInventoryConfigurationsCommand} */ - readonly listBucketInventoryConfigurations: ( + listBucketInventoryConfigurations( args: ListBucketInventoryConfigurationsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListBucketInventoryConfigurationsCommandOutput, SdkError | S3ServiceError >; @@ -968,10 +977,10 @@ export interface S3Service { /** * @see {@link ListBucketMetricsConfigurationsCommand} */ - readonly listBucketMetricsConfigurations: ( + listBucketMetricsConfigurations( args: ListBucketMetricsConfigurationsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListBucketMetricsConfigurationsCommandOutput, SdkError | S3ServiceError >; @@ -979,18 +988,29 @@ export interface S3Service { /** * @see {@link ListBucketsCommand} */ - readonly listBuckets: ( + listBuckets( args: ListBucketsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link ListDirectoryBucketsCommand} + */ + listDirectoryBuckets( + args: ListDirectoryBucketsCommandInput, + options?: __HttpHandlerOptions, + ): Effect.Effect< + ListDirectoryBucketsCommandOutput, + SdkError | S3ServiceError + >; /** * @see {@link ListMultipartUploadsCommand} */ - readonly listMultipartUploads: ( + listMultipartUploads( args: ListMultipartUploadsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListMultipartUploadsCommandOutput, SdkError | S3ServiceError >; @@ -998,45 +1018,42 @@ export interface S3Service { /** * @see {@link ListObjectsCommand} */ - readonly listObjects: ( + listObjects( args: ListObjectsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ListObjectsV2Command} */ - readonly listObjectsV2: ( + listObjectsV2( args: ListObjectsV2CommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ListObjectVersionsCommand} */ - readonly listObjectVersions: ( + listObjectVersions( args: ListObjectVersionsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - ListObjectVersionsCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link ListPartsCommand} */ - readonly listParts: ( + listParts( args: ListPartsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketAccelerateConfigurationCommand} */ - readonly putBucketAccelerateConfiguration: ( + putBucketAccelerateConfiguration( args: PutBucketAccelerateConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketAccelerateConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1044,18 +1061,18 @@ export interface S3Service { /** * @see {@link PutBucketAclCommand} */ - readonly putBucketAcl: ( + putBucketAcl( args: PutBucketAclCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketAnalyticsConfigurationCommand} */ - readonly putBucketAnalyticsConfiguration: ( + putBucketAnalyticsConfiguration( args: PutBucketAnalyticsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketAnalyticsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1063,29 +1080,26 @@ export interface S3Service { /** * @see {@link PutBucketCorsCommand} */ - readonly putBucketCors: ( + putBucketCors( args: PutBucketCorsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketEncryptionCommand} */ - readonly putBucketEncryption: ( + putBucketEncryption( args: PutBucketEncryptionCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - PutBucketEncryptionCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link PutBucketIntelligentTieringConfigurationCommand} */ - readonly putBucketIntelligentTieringConfiguration: ( + putBucketIntelligentTieringConfiguration( args: PutBucketIntelligentTieringConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketIntelligentTieringConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1093,10 +1107,10 @@ export interface S3Service { /** * @see {@link PutBucketInventoryConfigurationCommand} */ - readonly putBucketInventoryConfiguration: ( + putBucketInventoryConfiguration( args: PutBucketInventoryConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketInventoryConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1104,10 +1118,10 @@ export interface S3Service { /** * @see {@link PutBucketLifecycleConfigurationCommand} */ - readonly putBucketLifecycleConfiguration: ( + putBucketLifecycleConfiguration( args: PutBucketLifecycleConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketLifecycleConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1115,18 +1129,18 @@ export interface S3Service { /** * @see {@link PutBucketLoggingCommand} */ - readonly putBucketLogging: ( + putBucketLogging( args: PutBucketLoggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketMetricsConfigurationCommand} */ - readonly putBucketMetricsConfiguration: ( + putBucketMetricsConfiguration( args: PutBucketMetricsConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketMetricsConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1134,10 +1148,10 @@ export interface S3Service { /** * @see {@link PutBucketNotificationConfigurationCommand} */ - readonly putBucketNotificationConfiguration: ( + putBucketNotificationConfiguration( args: PutBucketNotificationConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketNotificationConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1145,10 +1159,10 @@ export interface S3Service { /** * @see {@link PutBucketOwnershipControlsCommand} */ - readonly putBucketOwnershipControls: ( + putBucketOwnershipControls( args: PutBucketOwnershipControlsCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketOwnershipControlsCommandOutput, SdkError | S3ServiceError >; @@ -1156,18 +1170,18 @@ export interface S3Service { /** * @see {@link PutBucketPolicyCommand} */ - readonly putBucketPolicy: ( + putBucketPolicy( args: PutBucketPolicyCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketReplicationCommand} */ - readonly putBucketReplication: ( + putBucketReplication( args: PutBucketReplicationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketReplicationCommandOutput, SdkError | S3ServiceError >; @@ -1175,10 +1189,10 @@ export interface S3Service { /** * @see {@link PutBucketRequestPaymentCommand} */ - readonly putBucketRequestPayment: ( + putBucketRequestPayment( args: PutBucketRequestPaymentCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutBucketRequestPaymentCommandOutput, SdkError | S3ServiceError >; @@ -1186,70 +1200,62 @@ export interface S3Service { /** * @see {@link PutBucketTaggingCommand} */ - readonly putBucketTagging: ( + putBucketTagging( args: PutBucketTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutBucketVersioningCommand} */ - readonly putBucketVersioning: ( + putBucketVersioning( args: PutBucketVersioningCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - PutBucketVersioningCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link PutBucketWebsiteCommand} */ - readonly putBucketWebsite: ( + putBucketWebsite( args: PutBucketWebsiteCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutObjectCommand} */ - readonly putObject: { - ( - args: PutObjectCommandInput, - options?: { readonly presigned?: false } & __HttpHandlerOptions, - ): Effect.Effect; - ( - args: PutObjectCommandInput, - options?: { readonly presigned: true } & RequestPresigningArguments, - ): Effect.Effect; - }; + putObject( + args: PutObjectCommandInput, + options?: { readonly presigned?: false } & __HttpHandlerOptions, + ): Effect.Effect; + putObject( + args: PutObjectCommandInput, + options?: { readonly presigned: true } & RequestPresigningArguments, + ): Effect.Effect; /** * @see {@link PutObjectAclCommand} */ - readonly putObjectAcl: ( + putObjectAcl( args: PutObjectAclCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutObjectLegalHoldCommand} */ - readonly putObjectLegalHold: ( + putObjectLegalHold( args: PutObjectLegalHoldCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - PutObjectLegalHoldCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link PutObjectLockConfigurationCommand} */ - readonly putObjectLockConfiguration: ( + putObjectLockConfiguration( args: PutObjectLockConfigurationCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutObjectLockConfigurationCommandOutput, SdkError | S3ServiceError >; @@ -1257,29 +1263,26 @@ export interface S3Service { /** * @see {@link PutObjectRetentionCommand} */ - readonly putObjectRetention: ( + putObjectRetention( args: PutObjectRetentionCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - PutObjectRetentionCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link PutObjectTaggingCommand} */ - readonly putObjectTagging: ( + putObjectTagging( args: PutObjectTaggingCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link PutPublicAccessBlockCommand} */ - readonly putPublicAccessBlock: ( + putPublicAccessBlock( args: PutPublicAccessBlockCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PutPublicAccessBlockCommandOutput, SdkError | S3ServiceError >; @@ -1287,45 +1290,45 @@ export interface S3Service { /** * @see {@link RestoreObjectCommand} */ - readonly restoreObject: ( + restoreObject( args: RestoreObjectCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect< + RestoreObjectCommandOutput, + SdkError | ObjectAlreadyInActiveTierError + >; /** * @see {@link SelectObjectContentCommand} */ - readonly selectObjectContent: ( + selectObjectContent( args: SelectObjectContentCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< - SelectObjectContentCommandOutput, - SdkError | S3ServiceError - >; + ): Effect.Effect; /** * @see {@link UploadPartCommand} */ - readonly uploadPart: ( + uploadPart( args: UploadPartCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link UploadPartCopyCommand} */ - readonly uploadPartCopy: ( + uploadPartCopy( args: UploadPartCopyCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link WriteGetObjectResponseCommand} */ - readonly writeGetObjectResponse: ( + writeGetObjectResponse( args: WriteGetObjectResponseCommandInput, options?: __HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< WriteGetObjectResponseCommandOutput, SdkError | S3ServiceError >; @@ -1348,9 +1351,12 @@ export const makeS3Service = Effect.gen(function* (_) { const catchErrors = (e: unknown) => { if (e instanceof S3ServiceException) { - return S3ServiceError({ + const ServiceException = Data.tagged>( + e.name, + ); + + return ServiceException({ ...e, - name: "S3ServiceError", message: e.message, stack: e.stack, }); diff --git a/packages/client-s3/test/S3.test.ts b/packages/client-s3/test/S3.test.ts index f51687c..f5d5ef9 100644 --- a/packages/client-s3/test/S3.test.ts +++ b/packages/client-s3/test/S3.test.ts @@ -1,7 +1,8 @@ import { GetObjectCommand, - GetObjectCommandInput, + type GetObjectCommandInput, HeadObjectCommand, + type HeadObjectCommandInput, S3Client, } from "@aws-sdk/client-s3"; import { mockClient } from "aws-sdk-client-mock"; @@ -32,15 +33,17 @@ import { import "aws-sdk-client-mock-jest"; -const s3Mock = mockClient(S3Client); +const clientMock = mockClient(S3Client); describe("S3ClientImpl", () => { it("default", async () => { - s3Mock.reset().on(HeadObjectCommand).resolves({}); + clientMock.reset().on(HeadObjectCommand).resolves({}); - const args = { Key: "test", Bucket: "test" }; + const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); + const program = Effect.flatMap(S3Service, (service) => + service.headObject(args), + ); const result = await pipe( program, @@ -49,16 +52,18 @@ describe("S3ClientImpl", () => { ); expect(result).toEqual(Exit.succeed({})); - expect(s3Mock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); - expect(s3Mock).toHaveReceivedCommandWith(HeadObjectCommand, args); + expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); it("configurable", async () => { - s3Mock.reset().on(HeadObjectCommand).resolves({}); + clientMock.reset().on(HeadObjectCommand).resolves({}); - const args = { Key: "test", Bucket: "test" }; + const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); + const program = Effect.flatMap(S3Service, (service) => + service.headObject(args), + ); const S3ClientConfigLayer = Layer.succeed(S3ClientInstanceConfig, { region: "eu-central-1", @@ -74,16 +79,18 @@ describe("S3ClientImpl", () => { ); expect(result).toEqual(Exit.succeed({})); - expect(s3Mock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); - expect(s3Mock).toHaveReceivedCommandWith(HeadObjectCommand, args); + expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); it("base", async () => { - s3Mock.reset().on(HeadObjectCommand).resolves({}); + clientMock.reset().on(HeadObjectCommand).resolves({}); - const args = { Key: "test", Bucket: "test" }; + const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); + const program = Effect.flatMap(S3Service, (service) => + service.headObject(args), + ); const S3ClientInstanceLayer = Layer.succeed( S3ClientInstance, @@ -100,16 +107,18 @@ describe("S3ClientImpl", () => { ); expect(result).toEqual(Exit.succeed({})); - expect(s3Mock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); - expect(s3Mock).toHaveReceivedCommandWith(HeadObjectCommand, args); + expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); it("extended", async () => { - s3Mock.reset().on(HeadObjectCommand).resolves({}); + clientMock.reset().on(HeadObjectCommand).resolves({}); - const args = { Key: "test", Bucket: "test" }; + const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); + const program = Effect.flatMap(S3Service, (service) => + service.headObject(args), + ); const S3ClientInstanceLayer = Layer.effect( S3ClientInstance, @@ -130,17 +139,17 @@ describe("S3ClientImpl", () => { ); expect(result).toEqual(Exit.succeed({})); - expect(s3Mock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); - expect(s3Mock).toHaveReceivedCommandWith(HeadObjectCommand, args); + expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); it("fail", async () => { - s3Mock.reset().on(HeadObjectCommand).rejects(new Error("test")); + clientMock.reset().on(HeadObjectCommand).rejects(new Error("test")); - const args = { Key: "test", Bucket: "test" }; + const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => - s3.headObject(args, { requestTimeout: 1000 }), + const program = Effect.flatMap(S3Service, (service) => + service.headObject(args, { requestTimeout: 1000 }), ); const result = await pipe( @@ -159,15 +168,15 @@ describe("S3ClientImpl", () => { }), ), ); - expect(s3Mock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); - expect(s3Mock).toHaveReceivedCommandWith(HeadObjectCommand, args); + expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); + expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); it("presigned url", async () => { const args: GetObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (s3) => - s3.getObject(args, { presigned: true, expiresIn: 100 }), + const program = Effect.flatMap(S3Service, (service) => + service.getObject(args, { presigned: true, expiresIn: 100 }), ); const result = await pipe(