Skip to content

Commit 5a3da02

Browse files
committed
fix(storage): add custom endpoints for analytics buckets
1 parent 35ace58 commit 5a3da02

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

packages/core/storage-js/src/StorageClient.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import StorageFileApi from './packages/StorageFileApi'
22
import StorageBucketApi from './packages/StorageBucketApi'
3+
import StorageAnalyticsApi from './packages/StorageAnalyticsApi'
34
import { Fetch } from './lib/fetch'
45
import { StorageVectorsClient } from '@supabase/storage-vectors-js'
56

@@ -31,10 +32,33 @@ export class StorageClient extends StorageBucketApi {
3132
*
3233
* @returns A StorageVectorsClient instance configured with the current storage settings.
3334
*/
34-
vectors(): StorageVectorsClient {
35+
get vectors(): StorageVectorsClient {
3536
return new StorageVectorsClient(this.url + '/vector', {
3637
headers: this.headers,
3738
fetch: this.fetch,
3839
})
3940
}
41+
42+
/**
43+
* Access analytics storage operations using Iceberg tables.
44+
*
45+
* @returns A StorageAnalyticsApi instance configured with the current storage settings.
46+
* @example
47+
* ```typescript
48+
* const client = createClient(url, key)
49+
* const analytics = client.storage.analytics
50+
*
51+
* // Create an analytics bucket
52+
* await analytics.createBucket('my-analytics-bucket', { public: false })
53+
*
54+
* // List all analytics buckets
55+
* const { data: buckets } = await analytics.listBuckets()
56+
*
57+
* // Delete an analytics bucket
58+
* await analytics.deleteBucket('old-analytics-bucket')
59+
* ```
60+
*/
61+
get analytics(): StorageAnalyticsApi {
62+
return new StorageAnalyticsApi(this.url + '/iceberg', this.headers, this.fetch)
63+
}
4064
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { StorageClient } from './StorageClient'
22
export type { StorageClientOptions } from './StorageClient'
3+
export { default as StorageAnalyticsApi } from './packages/StorageAnalyticsApi'
34
export * from './lib/types'
45
export * from './lib/errors'
56
export * from '@supabase/storage-vectors-js'

0 commit comments

Comments
 (0)