Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions packages/core/storage-js/src/StorageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class StorageClient extends StorageBucketApi {
*
* @example
* ```typescript
* const avatars = storage.from('avatars')
* const avatars = supabase.storage.from('avatars')
* ```
*/
from(id: string): StorageFileApi {
Expand Down Expand Up @@ -75,20 +75,6 @@ export class StorageClient extends StorageBucketApi {
*
* @category Analytics Buckets
* @returns A StorageAnalyticsClient instance configured with the current storage settings.
* @example
* ```typescript
* const client = createClient(url, key)
* const analytics = client.storage.analytics
*
* // Create an analytics bucket
* await analytics.createBucket('my-analytics-bucket')
*
* // List all analytics buckets
* const { data: buckets } = await analytics.listBuckets()
*
* // Delete an analytics bucket
* await analytics.deleteBucket('old-analytics-bucket')
* ```
*/
get analytics(): StorageAnalyticsClient {
return new StorageAnalyticsClient(this.url + '/iceberg', this.headers, this.fetch)
Expand Down
65 changes: 18 additions & 47 deletions packages/core/storage-js/src/lib/vectors/StorageVectorsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,14 @@ export interface StorageVectorsClientOptions {
*
* **Usage Patterns:**
*
* 1. **Via StorageClient (recommended for most use cases):**
* ```typescript
* import { StorageClient } from '@supabase/storage-js'
*
* const storageClient = new StorageClient(url, headers)
* const vectors = storageClient.vectors
*
* // Use vector operations
* await vectors.createBucket('embeddings-prod')
* const bucket = vectors.from('embeddings-prod')
* await bucket.createIndex({ ... })
* ```
*
* 2. **Standalone (for vector-only applications):**
* ```typescript
* import { StorageVectorsClient } from '@supabase/storage-js'
*
* const vectorsClient = new StorageVectorsClient('https://api.example.com', {
* headers: { 'Authorization': 'Bearer token' }
* })
*
* // Access bucket operations
* await vectorsClient.createBucket('embeddings-prod')
* const { data, error } = await supabase
* .storage
* .vectors
* .createBucket('embeddings-prod')
*
* // Access index operations via buckets
* const bucket = vectorsClient.from('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* await bucket.createIndex({
* indexName: 'documents',
* dataType: 'float32',
Expand Down Expand Up @@ -128,18 +110,7 @@ export class StorageVectorsClient extends VectorBucketApi {
*
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
*
* // Create an index in this bucket
* await bucket.createIndex({
* indexName: 'documents-openai',
* dataType: 'float32',
* dimension: 1536,
* distanceMetric: 'cosine'
* })
*
* // List indexes in this bucket
* const { data } = await bucket.listIndexes()
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* ```
*/
from(vectorBucketName: string): VectorBucketScope {
Expand Down Expand Up @@ -169,7 +140,7 @@ export class VectorBucketScope extends VectorIndexApi {
* @category Vector Buckets
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* ```
*/
constructor(
Expand Down Expand Up @@ -197,7 +168,7 @@ export class VectorBucketScope extends VectorIndexApi {
*
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* await bucket.createIndex({
* indexName: 'documents-openai',
* dataType: 'float32',
Expand Down Expand Up @@ -231,7 +202,7 @@ export class VectorBucketScope extends VectorIndexApi {
*
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* const { data } = await bucket.listIndexes({ prefix: 'documents-' })
* ```
*/
Expand All @@ -257,7 +228,7 @@ export class VectorBucketScope extends VectorIndexApi {
*
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* const { data } = await bucket.getIndex('documents-openai')
* console.log('Dimension:', data?.index.dimension)
* ```
Expand All @@ -281,7 +252,7 @@ export class VectorBucketScope extends VectorIndexApi {
*
* @example
* ```typescript
* const bucket = client.bucket('embeddings-prod')
* const bucket = supabase.storage.vectors.from('embeddings-prod')
* await bucket.deleteIndex('old-index')
* ```
*/
Expand All @@ -304,7 +275,7 @@ export class VectorBucketScope extends VectorIndexApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
*
* // Insert vectors
* await index.putVectors({
Expand Down Expand Up @@ -355,7 +326,7 @@ export class VectorIndexScope extends VectorDataApi {
* @category Vector Buckets
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* ```
*/
constructor(
Expand Down Expand Up @@ -385,7 +356,7 @@ export class VectorIndexScope extends VectorDataApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* await index.putVectors({
* vectors: [
* {
Expand Down Expand Up @@ -420,7 +391,7 @@ export class VectorIndexScope extends VectorDataApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* const { data } = await index.getVectors({
* keys: ['doc-1', 'doc-2'],
* returnMetadata: true
Expand Down Expand Up @@ -450,7 +421,7 @@ export class VectorIndexScope extends VectorDataApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* const { data } = await index.listVectors({
* maxResults: 500,
* returnMetadata: true
Expand Down Expand Up @@ -482,7 +453,7 @@ export class VectorIndexScope extends VectorDataApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* const { data } = await index.queryVectors({
* queryVector: { float32: [0.1, 0.2, ...] },
* topK: 5,
Expand Down Expand Up @@ -517,7 +488,7 @@ export class VectorIndexScope extends VectorDataApi {
*
* @example
* ```typescript
* const index = client.bucket('embeddings-prod').index('documents-openai')
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
* await index.deleteVectors({
* keys: ['doc-1', 'doc-2', 'doc-3']
* })
Expand Down
Loading