1 | import { GetObjectRequest, GetObjectCommandOutput, PutObjectRequest, CopyObjectRequest, _Object, DeleteObjectCommandOutput } from '@aws-sdk/client-s3';
|
2 | import { StorageOptions, StorageAccessLevel } from './Storage';
|
3 | import { UploadTaskCompleteEvent, UploadTaskProgressEvent } from '../providers/AWSS3UploadTask';
|
4 | import { UploadTask } from './Provider';
|
5 | import { ICredentials } from '@aws-amplify/core';
|
6 | declare type ListObjectsCommandOutputContent = _Object;
|
7 | export interface FileMetadata {
|
8 | bucket: string;
|
9 | fileName: string;
|
10 | key: string;
|
11 | lastTouched: number;
|
12 | uploadId: string;
|
13 | }
|
14 | export declare type CommonStorageOptions = Omit<StorageOptions, 'credentials' | 'region' | 'bucket' | 'dangerouslyConnectToHttpEndpointForTesting'>;
|
15 | export declare type S3ProviderGetConfig = CommonStorageOptions & {
|
16 | download?: boolean;
|
17 | track?: boolean;
|
18 | expires?: number;
|
19 | provider?: 'AWSS3';
|
20 | identityId?: string;
|
21 | progressCallback?: (progress: any) => any;
|
22 | cacheControl?: GetObjectRequest['ResponseCacheControl'];
|
23 | contentDisposition?: GetObjectRequest['ResponseContentDisposition'];
|
24 | contentEncoding?: GetObjectRequest['ResponseContentEncoding'];
|
25 | contentLanguage?: GetObjectRequest['ResponseContentLanguage'];
|
26 | contentType?: GetObjectRequest['ResponseContentType'];
|
27 | SSECustomerAlgorithm?: GetObjectRequest['SSECustomerAlgorithm'];
|
28 | SSECustomerKey?: GetObjectRequest['SSECustomerKey'];
|
29 | SSECustomerKeyMD5?: GetObjectRequest['SSECustomerKeyMD5'];
|
30 | };
|
31 | export declare type S3ProviderGetOuput<T> = T extends {
|
32 | download: true;
|
33 | } ? GetObjectCommandOutput : string;
|
34 | declare type _S3ProviderPutConfig = {
|
35 | progressCallback?: (progress: any) => any;
|
36 | provider?: 'AWSS3';
|
37 | track?: boolean;
|
38 | serverSideEncryption?: PutObjectRequest['ServerSideEncryption'];
|
39 | SSECustomerAlgorithm?: PutObjectRequest['SSECustomerAlgorithm'];
|
40 | SSECustomerKey?: PutObjectRequest['SSECustomerKey'];
|
41 | SSECustomerKeyMD5?: PutObjectRequest['SSECustomerKeyMD5'];
|
42 | SSEKMSKeyId?: PutObjectRequest['SSEKMSKeyId'];
|
43 | acl?: PutObjectRequest['ACL'];
|
44 | bucket?: PutObjectRequest['Bucket'];
|
45 | cacheControl?: PutObjectRequest['CacheControl'];
|
46 | contentDisposition?: PutObjectRequest['ContentDisposition'];
|
47 | contentEncoding?: PutObjectRequest['ContentEncoding'];
|
48 | contentType?: PutObjectRequest['ContentType'];
|
49 | expires?: PutObjectRequest['Expires'];
|
50 | metadata?: PutObjectRequest['Metadata'];
|
51 | tagging?: PutObjectRequest['Tagging'];
|
52 | useAccelerateEndpoint?: boolean;
|
53 | resumable?: boolean;
|
54 | };
|
55 | export declare type ResumableUploadConfig = {
|
56 | resumable: true;
|
57 | progressCallback?: (progress: UploadTaskProgressEvent) => any;
|
58 | completeCallback?: (event: UploadTaskCompleteEvent) => any;
|
59 | errorCallback?: (err: any) => any;
|
60 | };
|
61 | export declare type S3ProviderPutConfig = CommonStorageOptions & (_S3ProviderPutConfig | (_S3ProviderPutConfig & ResumableUploadConfig));
|
62 | export declare type S3ProviderRemoveConfig = CommonStorageOptions & {
|
63 | bucket?: string;
|
64 | provider?: 'AWSS3';
|
65 | };
|
66 | export declare type S3ProviderListOutputWithToken = {
|
67 | contents: S3ProviderListOutputItem[];
|
68 | nextToken: string;
|
69 | };
|
70 | export declare type S3ProviderRemoveOutput = DeleteObjectCommandOutput;
|
71 | export declare type S3ProviderListConfig = CommonStorageOptions & {
|
72 | bucket?: string;
|
73 | maxKeys?: number | 'ALL';
|
74 | provider?: 'AWSS3';
|
75 | identityId?: string;
|
76 | };
|
77 | export declare type S3ClientOptions = StorageOptions & {
|
78 | credentials: ICredentials;
|
79 | } & S3ProviderListConfig;
|
80 | export interface S3ProviderListOutputItem {
|
81 | key: ListObjectsCommandOutputContent['Key'];
|
82 | eTag: ListObjectsCommandOutputContent['ETag'];
|
83 | lastModified: ListObjectsCommandOutputContent['LastModified'];
|
84 | size: ListObjectsCommandOutputContent['Size'];
|
85 | }
|
86 | export declare type S3ProviderListOutput = S3ProviderListOutputItem[];
|
87 | export interface S3CopyTarget {
|
88 | key: string;
|
89 | level?: StorageAccessLevel;
|
90 | identityId?: string;
|
91 | }
|
92 | export declare type S3CopySource = S3CopyTarget;
|
93 | export declare type S3CopyDestination = Omit<S3CopyTarget, 'identityId'>;
|
94 | export declare type S3ProviderCopyConfig = Omit<CommonStorageOptions, 'level'> & {
|
95 | provider?: 'AWSS3';
|
96 | bucket?: CopyObjectRequest['Bucket'];
|
97 | cacheControl?: CopyObjectRequest['CacheControl'];
|
98 | contentDisposition?: CopyObjectRequest['ContentDisposition'];
|
99 | contentLanguage?: CopyObjectRequest['ContentLanguage'];
|
100 | contentType?: CopyObjectRequest['ContentType'];
|
101 | expires?: CopyObjectRequest['Expires'];
|
102 | tagging?: CopyObjectRequest['Tagging'];
|
103 | acl?: CopyObjectRequest['ACL'];
|
104 | metadata?: CopyObjectRequest['Metadata'];
|
105 | serverSideEncryption?: CopyObjectRequest['ServerSideEncryption'];
|
106 | SSECustomerAlgorithm?: CopyObjectRequest['SSECustomerAlgorithm'];
|
107 | SSECustomerKey?: CopyObjectRequest['SSECustomerKey'];
|
108 | SSECustomerKeyMD5?: CopyObjectRequest['SSECustomerKeyMD5'];
|
109 | SSEKMSKeyId?: CopyObjectRequest['SSEKMSKeyId'];
|
110 | };
|
111 | export declare type S3ProviderCopyOutput = {
|
112 | key: string;
|
113 | };
|
114 | export declare type PutResult = {
|
115 | key: string;
|
116 | };
|
117 | export declare type S3ProviderPutOutput<T> = T extends {
|
118 | resumable: true;
|
119 | } ? UploadTask : Promise<PutResult>;
|
120 | export {};
|