Skip to content

Commit 4eaecb2

Browse files
authored
docs(storage): enhance storage docs (#1865)
1 parent 683e69e commit 4eaecb2

File tree

9 files changed

+876
-71
lines changed

9 files changed

+876
-71
lines changed

packages/core/storage-js/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,17 @@ await storageClient.analytics.deleteBucket('analytics-data')
209209
- Retrieve the details of all Storage buckets within an existing project:
210210

211211
```js
212+
// List all buckets
212213
const { data, error } = await storageClient.listBuckets()
214+
215+
// List buckets with options (pagination, sorting, search)
216+
const { data, error } = await storageClient.listBuckets({
217+
limit: 10,
218+
offset: 0,
219+
sortColumn: 'created_at',
220+
sortOrder: 'desc',
221+
search: 'prod',
222+
})
213223
```
214224

215225
#### Handling Files

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class StorageClient extends StorageBucketApi {
1212
/**
1313
* Creates a client for Storage buckets, files, analytics, and vectors.
1414
*
15+
* @category File Buckets
1516
* @example
1617
* ```ts
1718
* import { StorageClient } from '@supabase/storage-js'
@@ -34,17 +35,27 @@ export class StorageClient extends StorageBucketApi {
3435
/**
3536
* Perform file operation in a bucket.
3637
*
38+
* @category File Buckets
3739
* @param id The bucket id to operate on.
40+
*
41+
* @example
42+
* ```typescript
43+
* const avatars = storage.from('avatars')
44+
* ```
3845
*/
3946
from(id: string): StorageFileApi {
4047
return new StorageFileApi(this.url, this.headers, id, this.fetch)
4148
}
4249

4350
/**
51+
*
52+
* @alpha
53+
*
4454
* Access vector storage operations.
4555
*
46-
* **Private alpha:** This API is part of a private alpha release and may change or be removed without notice.
56+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
4757
*
58+
* @category Vector Buckets
4859
* @returns A StorageVectorsClient instance configured with the current storage settings.
4960
*/
5061
get vectors(): StorageVectorsClient {
@@ -57,6 +68,9 @@ export class StorageClient extends StorageBucketApi {
5768
/**
5869
* Access analytics storage operations using Iceberg tables.
5970
*
71+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
72+
*
73+
* @category Analytics Buckets
6074
* @returns A StorageAnalyticsApi instance configured with the current storage settings.
6175
* @example
6276
* ```typescript

packages/core/storage-js/src/lib/vectors/StorageVectorsClient.ts

Lines changed: 99 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ import {
1212
} from './types'
1313

1414
/**
15+
*
16+
* @alpha
17+
*
1518
* Configuration options for the Storage Vectors client
1619
*
17-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
20+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1821
*/
1922
export interface StorageVectorsClientOptions {
2023
/**
@@ -29,10 +32,13 @@ export interface StorageVectorsClientOptions {
2932
}
3033

3134
/**
35+
*
36+
* @alpha
37+
*
3238
* Main client for interacting with S3 Vectors API
3339
* Provides access to bucket, index, and vector data operations
3440
*
35-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
41+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
3642
*
3743
* **Usage Patterns:**
3844
*
@@ -87,24 +93,36 @@ export interface StorageVectorsClientOptions {
8793
*/
8894
export class StorageVectorsClient extends VectorBucketApi {
8995
/**
96+
* @alpha
97+
*
9098
* Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.
9199
*
92-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
100+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
93101
*
102+
* @category Vector Buckets
94103
* @param url - Base URL of the Storage Vectors REST API.
95104
* @param options.headers - Optional headers (for example `Authorization`) applied to every request.
96105
* @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
106+
*
107+
* @example
108+
* ```typescript
109+
* const client = new StorageVectorsClient(url, options)
110+
* ```
97111
*/
98112
constructor(url: string, options: StorageVectorsClientOptions = {}) {
99113
super(url, options.headers || {}, options.fetch)
100114
}
101115

102116
/**
117+
*
118+
* @alpha
119+
*
103120
* Access operations for a specific vector bucket
104121
* Returns a scoped client for index and vector operations within the bucket
105122
*
106-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
123+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
107124
*
125+
* @category Vector Buckets
108126
* @param vectorBucketName - Name of the vector bucket
109127
* @returns Bucket-scoped client with index and vector operations
110128
*
@@ -130,18 +148,29 @@ export class StorageVectorsClient extends VectorBucketApi {
130148
}
131149

132150
/**
151+
*
152+
* @alpha
153+
*
133154
* Scoped client for operations within a specific vector bucket
134155
* Provides index management and access to vector operations
135156
*
136-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
157+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
137158
*/
138159
export class VectorBucketScope extends VectorIndexApi {
139160
private vectorBucketName: string
140161

141162
/**
163+
* @alpha
164+
*
142165
* Creates a helper that automatically scopes all index operations to the provided bucket.
143166
*
144-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
167+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
168+
*
169+
* @category Vector Buckets
170+
* @example
171+
* ```typescript
172+
* const bucket = client.bucket('embeddings-prod')
173+
* ```
145174
*/
146175
constructor(
147176
url: string,
@@ -154,11 +183,15 @@ export class VectorBucketScope extends VectorIndexApi {
154183
}
155184

156185
/**
186+
*
187+
* @alpha
188+
*
157189
* Creates a new vector index in this bucket
158190
* Convenience method that automatically includes the bucket name
159191
*
160-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
192+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
161193
*
194+
* @category Vector Buckets
162195
* @param options - Index configuration (vectorBucketName is automatically set)
163196
* @returns Promise with empty response on success or error
164197
*
@@ -184,11 +217,15 @@ export class VectorBucketScope extends VectorIndexApi {
184217
}
185218

186219
/**
220+
*
221+
* @alpha
222+
*
187223
* Lists indexes in this bucket
188224
* Convenience method that automatically includes the bucket name
189225
*
190-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
226+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
191227
*
228+
* @category Vector Buckets
192229
* @param options - Listing options (vectorBucketName is automatically set)
193230
* @returns Promise with list of indexes or error
194231
*
@@ -206,11 +243,15 @@ export class VectorBucketScope extends VectorIndexApi {
206243
}
207244

208245
/**
246+
*
247+
* @alpha
248+
*
209249
* Retrieves metadata for a specific index in this bucket
210250
* Convenience method that automatically includes the bucket name
211251
*
212-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
252+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
213253
*
254+
* @category Vector Buckets
214255
* @param indexName - Name of the index to retrieve
215256
* @returns Promise with index metadata or error
216257
*
@@ -226,11 +267,15 @@ export class VectorBucketScope extends VectorIndexApi {
226267
}
227268

228269
/**
270+
*
271+
* @alpha
272+
*
229273
* Deletes an index from this bucket
230274
* Convenience method that automatically includes the bucket name
231275
*
232-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
276+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
233277
*
278+
* @category Vector Buckets
234279
* @param indexName - Name of the index to delete
235280
* @returns Promise with empty response on success or error
236281
*
@@ -245,11 +290,15 @@ export class VectorBucketScope extends VectorIndexApi {
245290
}
246291

247292
/**
293+
*
294+
* @alpha
295+
*
248296
* Access operations for a specific index within this bucket
249297
* Returns a scoped client for vector data operations
250298
*
251-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
299+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
252300
*
301+
* @category Vector Buckets
253302
* @param indexName - Name of the index
254303
* @returns Index-scoped client with vector data operations
255304
*
@@ -283,19 +332,31 @@ export class VectorBucketScope extends VectorIndexApi {
283332
}
284333

285334
/**
335+
*
336+
* @alpha
337+
*
286338
* Scoped client for operations within a specific vector index
287339
* Provides vector data operations (put, get, list, query, delete)
288340
*
289-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
341+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
290342
*/
291343
export class VectorIndexScope extends VectorDataApi {
292344
private vectorBucketName: string
293345
private indexName: string
294346

295347
/**
348+
*
349+
* @alpha
350+
*
296351
* Creates a helper that automatically scopes all vector operations to the provided bucket/index names.
297352
*
298-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
353+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
354+
*
355+
* @category Vector Buckets
356+
* @example
357+
* ```typescript
358+
* const index = client.bucket('embeddings-prod').index('documents-openai')
359+
* ```
299360
*/
300361
constructor(
301362
url: string,
@@ -310,11 +371,15 @@ export class VectorIndexScope extends VectorDataApi {
310371
}
311372

312373
/**
374+
*
375+
* @alpha
376+
*
313377
* Inserts or updates vectors in this index
314378
* Convenience method that automatically includes bucket and index names
315379
*
316-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
380+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
317381
*
382+
* @category Vector Buckets
318383
* @param options - Vector insertion options (bucket and index names automatically set)
319384
* @returns Promise with empty response on success or error
320385
*
@@ -341,11 +406,15 @@ export class VectorIndexScope extends VectorDataApi {
341406
}
342407

343408
/**
409+
*
410+
* @alpha
411+
*
344412
* Retrieves vectors by keys from this index
345413
* Convenience method that automatically includes bucket and index names
346414
*
347-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
415+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
348416
*
417+
* @category Vector Buckets
349418
* @param options - Vector retrieval options (bucket and index names automatically set)
350419
* @returns Promise with array of vectors or error
351420
*
@@ -367,11 +436,15 @@ export class VectorIndexScope extends VectorDataApi {
367436
}
368437

369438
/**
439+
*
440+
* @alpha
441+
*
370442
* Lists vectors in this index with pagination
371443
* Convenience method that automatically includes bucket and index names
372444
*
373-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
445+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
374446
*
447+
* @category Vector Buckets
375448
* @param options - Listing options (bucket and index names automatically set)
376449
* @returns Promise with array of vectors and pagination token
377450
*
@@ -395,11 +468,15 @@ export class VectorIndexScope extends VectorDataApi {
395468
}
396469

397470
/**
471+
*
472+
* @alpha
473+
*
398474
* Queries for similar vectors in this index
399475
* Convenience method that automatically includes bucket and index names
400476
*
401-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
477+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
402478
*
479+
* @category Vector Buckets
403480
* @param options - Query options (bucket and index names automatically set)
404481
* @returns Promise with array of similar vectors ordered by distance
405482
*
@@ -426,11 +503,15 @@ export class VectorIndexScope extends VectorDataApi {
426503
}
427504

428505
/**
506+
*
507+
* @alpha
508+
*
429509
* Deletes vectors by keys from this index
430510
* Convenience method that automatically includes bucket and index names
431511
*
432-
* **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
512+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
433513
*
514+
* @category Vector Buckets
434515
* @param options - Deletion options (bucket and index names automatically set)
435516
* @returns Promise with empty response on success or error
436517
*

0 commit comments

Comments
 (0)