-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.ts
100 lines (86 loc) · 2.89 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { Body, BucketName, ObjectKey } from 'aws-sdk/clients/s3';
import { DiskConfig } from '../..';
export interface S3DiskConfig extends DiskConfig {
/**
* The S3 bucket to use.
*/
bucket: string;
/**
* The prefix to use for object keys.
*
* If not provided, object keys will have no prefix and be stored relative to the root of the bucket.
* Relative paths and absolute paths are treated identically.
*/
root?: string;
/**
* The base url from which objects in the bucket can be accessed with no trailing slash.
*
* The root path will not automatically be prepended to object paths when generating URLs so if you override
* this be sure to include it too: `'https://<bucket>.s3.amazonaws.com/<root>'`.
*
* This is useful to override if, for example, you've put CloudFront in front of the bucket.
*/
url?: string;
/**
* S3 listObject results are returned in pages of max 1000 objects. In order to get a listing of all objects
* in a prefix, you have to page through 1000 at a time (the default). Set this to page through with smaller
* pages; max is 1000.
*/
pagingLimit?: number | string;
/**
* The number of seconds from the time of upload to set the `Expires` option for `putObject`.
* Will also automatically set the `Cache-Control`
*/
expires?: number | string;
/**
* An object of additional options to merge into the `putObject` params when uploading
*/
putParams?: {};
/**
* An object of additional config options to pass into the `AWS.S3` client during setup.
*
* If you're not using environment variables to authenticate the AWS client, you can provide credentials here.
*/
clientConfig?: {};
/**
* Should we use the `mime` library to automatically determine `ContentType` for write operations?
*/
autoContentType?: boolean;
}
/**
* Contains all information needed to identify a globally unique S3 bucket object.
*/
export interface S3ObjectParams {
/**
* The name of the s3 bucket.
*/
Bucket: BucketName;
/**
* The key of the object within the bucket.
*/
Key: ObjectKey;
}
/**
* We exclude the Blob type from our consideration since that's only ever returned by the client version of the
* aws-sdk. On Node it returns a buffer.
*/
export type S3NodeBody = Exclude<Body, Blob>;
export interface S3BucketListing {
/**
* An array of object names that are files.
*/
files: string[];
/**
* An array of object names that are directories.
*/
directories: string[];
}
/**
* Represents a single page of objects (separate into files and directories) using the listObjectsV2 S3 API.
*/
export interface S3BucketListingPage extends S3BucketListing {
/**
* A listObjectsV2 ContinuationToken or null if no next page.
*/
next: string | null;
}