Skip to content

Commit 3cf50f2

Browse files
fenosinian
andauthored
fix: allow null on bucket constraints (#160)
Co-authored-by: Inian <[email protected]>
1 parent 88928fd commit 3cf50f2

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/packages/StorageBucketApi.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,21 @@ export default class StorageBucketApi {
7474
*
7575
* @param id A unique identifier for the bucket you are creating.
7676
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
77-
* @param options.fileSizeLimit specifies the file size limit that this bucket can accept during upload
78-
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload
77+
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
78+
* The global file size limit takes precedence over this value.
79+
* The default value is null, which doesn't set a per bucket file size limit.
80+
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
81+
* The default value is null, which allows files with all mime types to be uploaded.
82+
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
7983
* @returns newly created bucket id
8084
*/
8185
async createBucket(
8286
id: string,
83-
options: { public: boolean; fileSizeLimit?: number | string; allowedMimeTypes?: string[] } = {
87+
options: {
88+
public: boolean
89+
fileSizeLimit?: number | string | null
90+
allowedMimeTypes?: string[] | null
91+
} = {
8492
public: false,
8593
}
8694
): Promise<
@@ -121,12 +129,20 @@ export default class StorageBucketApi {
121129
*
122130
* @param id A unique identifier for the bucket you are updating.
123131
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
124-
* @param options.fileSizeLimit specifies the file size limit that this bucket can accept during upload
125-
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload
132+
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
133+
* The global file size limit takes precedence over this value.
134+
* The default value is null, which doesn't set a per bucket file size limit.
135+
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
136+
* The default value is null, which allows files with all mime types to be uploaded.
137+
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
126138
*/
127139
async updateBucket(
128140
id: string,
129-
options: { public: boolean; fileSizeLimit?: number | string; allowedMimeTypes?: string[] }
141+
options: {
142+
public: boolean
143+
fileSizeLimit?: number | string | null
144+
allowedMimeTypes?: string[] | null
145+
}
130146
): Promise<
131147
| {
132148
data: { message: string }

0 commit comments

Comments
 (0)