@supabase/storage-js 2.76.2-canary.0 → 2.76.2-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/lib/types.d.ts +7 -0
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/packages/StorageBucketApi.d.ts +3 -2
- package/dist/main/packages/StorageBucketApi.d.ts.map +1 -1
- package/dist/main/packages/StorageBucketApi.js +26 -2
- package/dist/main/packages/StorageBucketApi.js.map +1 -1
- package/dist/module/lib/types.d.ts +7 -0
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/packages/StorageBucketApi.d.ts +3 -2
- package/dist/module/packages/StorageBucketApi.d.ts.map +1 -1
- package/dist/module/packages/StorageBucketApi.js +26 -2
- package/dist/module/packages/StorageBucketApi.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +1 -1
- package/src/lib/types.ts +8 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageBucketApi.ts +28 -3
package/src/lib/types.ts
CHANGED
|
@@ -19,6 +19,14 @@ export interface Bucket {
|
|
|
19
19
|
public: boolean
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface ListBucketOptions {
|
|
23
|
+
limit?: number
|
|
24
|
+
offset?: number
|
|
25
|
+
sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'
|
|
26
|
+
sortOrder?: 'asc' | 'desc'
|
|
27
|
+
search?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
/**
|
|
23
31
|
* Represents an Analytics Bucket using Apache Iceberg table format.
|
|
24
32
|
* Analytics buckets are optimized for analytical queries and data processing.
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.76.2-canary.
|
|
7
|
+
export const version = '2.76.2-canary.1'
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_HEADERS } from '../lib/constants'
|
|
|
2
2
|
import { isStorageError, StorageError } from '../lib/errors'
|
|
3
3
|
import { Fetch, get, post, put, remove } from '../lib/fetch'
|
|
4
4
|
import { resolveFetch } from '../lib/helpers'
|
|
5
|
-
import { Bucket, BucketType } from '../lib/types'
|
|
5
|
+
import { Bucket, BucketType, ListBucketOptions } from '../lib/types'
|
|
6
6
|
import { StorageClientOptions } from '../StorageClient'
|
|
7
7
|
|
|
8
8
|
export default class StorageBucketApi {
|
|
@@ -44,7 +44,7 @@ export default class StorageBucketApi {
|
|
|
44
44
|
/**
|
|
45
45
|
* Retrieves the details of all Storage buckets within an existing project.
|
|
46
46
|
*/
|
|
47
|
-
async listBuckets(): Promise<
|
|
47
|
+
async listBuckets(options?: ListBucketOptions): Promise<
|
|
48
48
|
| {
|
|
49
49
|
data: Bucket[]
|
|
50
50
|
error: null
|
|
@@ -55,7 +55,10 @@ export default class StorageBucketApi {
|
|
|
55
55
|
}
|
|
56
56
|
> {
|
|
57
57
|
try {
|
|
58
|
-
const
|
|
58
|
+
const queryString = this.listBucketOptionsToQueryString(options)
|
|
59
|
+
const data = await get(this.fetch, `${this.url}/bucket${queryString}`, {
|
|
60
|
+
headers: this.headers,
|
|
61
|
+
})
|
|
59
62
|
return { data, error: null }
|
|
60
63
|
} catch (error) {
|
|
61
64
|
if (this.shouldThrowOnError) {
|
|
@@ -286,4 +289,26 @@ export default class StorageBucketApi {
|
|
|
286
289
|
throw error
|
|
287
290
|
}
|
|
288
291
|
}
|
|
292
|
+
|
|
293
|
+
private listBucketOptionsToQueryString(options?: ListBucketOptions): string {
|
|
294
|
+
const params: Record<string, string> = {}
|
|
295
|
+
if (options) {
|
|
296
|
+
if ('limit' in options) {
|
|
297
|
+
params.limit = String(options.limit)
|
|
298
|
+
}
|
|
299
|
+
if ('offset' in options) {
|
|
300
|
+
params.offset = String(options.offset)
|
|
301
|
+
}
|
|
302
|
+
if (options.search) {
|
|
303
|
+
params.search = options.search
|
|
304
|
+
}
|
|
305
|
+
if (options.sortColumn) {
|
|
306
|
+
params.sortColumn = options.sortColumn
|
|
307
|
+
}
|
|
308
|
+
if (options.sortOrder) {
|
|
309
|
+
params.sortOrder = options.sortOrder
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return Object.keys(params).length > 0 ? '?' + new URLSearchParams(params).toString() : ''
|
|
313
|
+
}
|
|
289
314
|
}
|