@supabase/storage-js 2.84.0 → 2.84.1-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.
Files changed (67) hide show
  1. package/dist/main/StorageClient.d.ts +1 -15
  2. package/dist/main/StorageClient.d.ts.map +1 -1
  3. package/dist/main/StorageClient.js +1 -15
  4. package/dist/main/StorageClient.js.map +1 -1
  5. package/dist/main/lib/vectors/StorageVectorsClient.d.ts +18 -47
  6. package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
  7. package/dist/main/lib/vectors/StorageVectorsClient.js +18 -47
  8. package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -1
  9. package/dist/main/lib/vectors/VectorBucketApi.d.ts +9 -153
  10. package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +1 -1
  11. package/dist/main/lib/vectors/VectorBucketApi.js +9 -153
  12. package/dist/main/lib/vectors/VectorBucketApi.js.map +1 -1
  13. package/dist/main/lib/vectors/VectorDataApi.d.ts +10 -258
  14. package/dist/main/lib/vectors/VectorDataApi.d.ts.map +1 -1
  15. package/dist/main/lib/vectors/VectorDataApi.js +10 -258
  16. package/dist/main/lib/vectors/VectorDataApi.js.map +1 -1
  17. package/dist/main/lib/vectors/VectorIndexApi.d.ts +9 -177
  18. package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +1 -1
  19. package/dist/main/lib/vectors/VectorIndexApi.js +9 -176
  20. package/dist/main/lib/vectors/VectorIndexApi.js.map +1 -1
  21. package/dist/main/lib/version.d.ts +1 -1
  22. package/dist/main/lib/version.d.ts.map +1 -1
  23. package/dist/main/lib/version.js +1 -1
  24. package/dist/main/lib/version.js.map +1 -1
  25. package/dist/main/packages/StorageAnalyticsClient.d.ts +6 -2
  26. package/dist/main/packages/StorageAnalyticsClient.d.ts.map +1 -1
  27. package/dist/main/packages/StorageAnalyticsClient.js +6 -2
  28. package/dist/main/packages/StorageAnalyticsClient.js.map +1 -1
  29. package/dist/module/StorageClient.d.ts +1 -15
  30. package/dist/module/StorageClient.d.ts.map +1 -1
  31. package/dist/module/StorageClient.js +1 -15
  32. package/dist/module/StorageClient.js.map +1 -1
  33. package/dist/module/lib/vectors/StorageVectorsClient.d.ts +18 -47
  34. package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
  35. package/dist/module/lib/vectors/StorageVectorsClient.js +18 -47
  36. package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -1
  37. package/dist/module/lib/vectors/VectorBucketApi.d.ts +9 -153
  38. package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +1 -1
  39. package/dist/module/lib/vectors/VectorBucketApi.js +9 -153
  40. package/dist/module/lib/vectors/VectorBucketApi.js.map +1 -1
  41. package/dist/module/lib/vectors/VectorDataApi.d.ts +10 -258
  42. package/dist/module/lib/vectors/VectorDataApi.d.ts.map +1 -1
  43. package/dist/module/lib/vectors/VectorDataApi.js +10 -258
  44. package/dist/module/lib/vectors/VectorDataApi.js.map +1 -1
  45. package/dist/module/lib/vectors/VectorIndexApi.d.ts +9 -177
  46. package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +1 -1
  47. package/dist/module/lib/vectors/VectorIndexApi.js +9 -176
  48. package/dist/module/lib/vectors/VectorIndexApi.js.map +1 -1
  49. package/dist/module/lib/version.d.ts +1 -1
  50. package/dist/module/lib/version.d.ts.map +1 -1
  51. package/dist/module/lib/version.js +1 -1
  52. package/dist/module/lib/version.js.map +1 -1
  53. package/dist/module/packages/StorageAnalyticsClient.d.ts +6 -2
  54. package/dist/module/packages/StorageAnalyticsClient.d.ts.map +1 -1
  55. package/dist/module/packages/StorageAnalyticsClient.js +6 -2
  56. package/dist/module/packages/StorageAnalyticsClient.js.map +1 -1
  57. package/dist/tsconfig.module.tsbuildinfo +1 -1
  58. package/dist/tsconfig.tsbuildinfo +1 -1
  59. package/dist/umd/supabase.js +1 -1
  60. package/package.json +1 -1
  61. package/src/StorageClient.ts +1 -15
  62. package/src/lib/vectors/StorageVectorsClient.ts +18 -47
  63. package/src/lib/vectors/VectorBucketApi.ts +9 -153
  64. package/src/lib/vectors/VectorDataApi.ts +10 -258
  65. package/src/lib/vectors/VectorIndexApi.ts +9 -177
  66. package/src/lib/version.ts +1 -1
  67. package/src/packages/StorageAnalyticsClient.ts +6 -2
@@ -40,7 +40,7 @@ export class StorageClient extends StorageBucketApi {
40
40
  *
41
41
  * @example
42
42
  * ```typescript
43
- * const avatars = storage.from('avatars')
43
+ * const avatars = supabase.storage.from('avatars')
44
44
  * ```
45
45
  */
46
46
  from(id: string): StorageFileApi {
@@ -75,20 +75,6 @@ export class StorageClient extends StorageBucketApi {
75
75
  *
76
76
  * @category Analytics Buckets
77
77
  * @returns A StorageAnalyticsClient instance configured with the current storage settings.
78
- * @example
79
- * ```typescript
80
- * const client = createClient(url, key)
81
- * const analytics = client.storage.analytics
82
- *
83
- * // Create an analytics bucket
84
- * await analytics.createBucket('my-analytics-bucket')
85
- *
86
- * // List all analytics buckets
87
- * const { data: buckets } = await analytics.listBuckets()
88
- *
89
- * // Delete an analytics bucket
90
- * await analytics.deleteBucket('old-analytics-bucket')
91
- * ```
92
78
  */
93
79
  get analytics(): StorageAnalyticsClient {
94
80
  return new StorageAnalyticsClient(this.url + '/iceberg', this.headers, this.fetch)
@@ -42,32 +42,14 @@ export interface StorageVectorsClientOptions {
42
42
  *
43
43
  * **Usage Patterns:**
44
44
  *
45
- * 1. **Via StorageClient (recommended for most use cases):**
46
45
  * ```typescript
47
- * import { StorageClient } from '@supabase/storage-js'
48
- *
49
- * const storageClient = new StorageClient(url, headers)
50
- * const vectors = storageClient.vectors
51
- *
52
- * // Use vector operations
53
- * await vectors.createBucket('embeddings-prod')
54
- * const bucket = vectors.from('embeddings-prod')
55
- * await bucket.createIndex({ ... })
56
- * ```
57
- *
58
- * 2. **Standalone (for vector-only applications):**
59
- * ```typescript
60
- * import { StorageVectorsClient } from '@supabase/storage-js'
61
- *
62
- * const vectorsClient = new StorageVectorsClient('https://api.example.com', {
63
- * headers: { 'Authorization': 'Bearer token' }
64
- * })
65
- *
66
- * // Access bucket operations
67
- * await vectorsClient.createBucket('embeddings-prod')
46
+ * const { data, error } = await supabase
47
+ * .storage
48
+ * .vectors
49
+ * .createBucket('embeddings-prod')
68
50
  *
69
51
  * // Access index operations via buckets
70
- * const bucket = vectorsClient.from('embeddings-prod')
52
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
71
53
  * await bucket.createIndex({
72
54
  * indexName: 'documents',
73
55
  * dataType: 'float32',
@@ -128,18 +110,7 @@ export class StorageVectorsClient extends VectorBucketApi {
128
110
  *
129
111
  * @example
130
112
  * ```typescript
131
- * const bucket = client.bucket('embeddings-prod')
132
- *
133
- * // Create an index in this bucket
134
- * await bucket.createIndex({
135
- * indexName: 'documents-openai',
136
- * dataType: 'float32',
137
- * dimension: 1536,
138
- * distanceMetric: 'cosine'
139
- * })
140
- *
141
- * // List indexes in this bucket
142
- * const { data } = await bucket.listIndexes()
113
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
143
114
  * ```
144
115
  */
145
116
  from(vectorBucketName: string): VectorBucketScope {
@@ -169,7 +140,7 @@ export class VectorBucketScope extends VectorIndexApi {
169
140
  * @category Vector Buckets
170
141
  * @example
171
142
  * ```typescript
172
- * const bucket = client.bucket('embeddings-prod')
143
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
173
144
  * ```
174
145
  */
175
146
  constructor(
@@ -197,7 +168,7 @@ export class VectorBucketScope extends VectorIndexApi {
197
168
  *
198
169
  * @example
199
170
  * ```typescript
200
- * const bucket = client.bucket('embeddings-prod')
171
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
201
172
  * await bucket.createIndex({
202
173
  * indexName: 'documents-openai',
203
174
  * dataType: 'float32',
@@ -231,7 +202,7 @@ export class VectorBucketScope extends VectorIndexApi {
231
202
  *
232
203
  * @example
233
204
  * ```typescript
234
- * const bucket = client.bucket('embeddings-prod')
205
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
235
206
  * const { data } = await bucket.listIndexes({ prefix: 'documents-' })
236
207
  * ```
237
208
  */
@@ -257,7 +228,7 @@ export class VectorBucketScope extends VectorIndexApi {
257
228
  *
258
229
  * @example
259
230
  * ```typescript
260
- * const bucket = client.bucket('embeddings-prod')
231
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
261
232
  * const { data } = await bucket.getIndex('documents-openai')
262
233
  * console.log('Dimension:', data?.index.dimension)
263
234
  * ```
@@ -281,7 +252,7 @@ export class VectorBucketScope extends VectorIndexApi {
281
252
  *
282
253
  * @example
283
254
  * ```typescript
284
- * const bucket = client.bucket('embeddings-prod')
255
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
285
256
  * await bucket.deleteIndex('old-index')
286
257
  * ```
287
258
  */
@@ -304,7 +275,7 @@ export class VectorBucketScope extends VectorIndexApi {
304
275
  *
305
276
  * @example
306
277
  * ```typescript
307
- * const index = client.bucket('embeddings-prod').index('documents-openai')
278
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
308
279
  *
309
280
  * // Insert vectors
310
281
  * await index.putVectors({
@@ -355,7 +326,7 @@ export class VectorIndexScope extends VectorDataApi {
355
326
  * @category Vector Buckets
356
327
  * @example
357
328
  * ```typescript
358
- * const index = client.bucket('embeddings-prod').index('documents-openai')
329
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
359
330
  * ```
360
331
  */
361
332
  constructor(
@@ -385,7 +356,7 @@ export class VectorIndexScope extends VectorDataApi {
385
356
  *
386
357
  * @example
387
358
  * ```typescript
388
- * const index = client.bucket('embeddings-prod').index('documents-openai')
359
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
389
360
  * await index.putVectors({
390
361
  * vectors: [
391
362
  * {
@@ -420,7 +391,7 @@ export class VectorIndexScope extends VectorDataApi {
420
391
  *
421
392
  * @example
422
393
  * ```typescript
423
- * const index = client.bucket('embeddings-prod').index('documents-openai')
394
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
424
395
  * const { data } = await index.getVectors({
425
396
  * keys: ['doc-1', 'doc-2'],
426
397
  * returnMetadata: true
@@ -450,7 +421,7 @@ export class VectorIndexScope extends VectorDataApi {
450
421
  *
451
422
  * @example
452
423
  * ```typescript
453
- * const index = client.bucket('embeddings-prod').index('documents-openai')
424
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
454
425
  * const { data } = await index.listVectors({
455
426
  * maxResults: 500,
456
427
  * returnMetadata: true
@@ -482,7 +453,7 @@ export class VectorIndexScope extends VectorDataApi {
482
453
  *
483
454
  * @example
484
455
  * ```typescript
485
- * const index = client.bucket('embeddings-prod').index('documents-openai')
456
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
486
457
  * const { data } = await index.queryVectors({
487
458
  * queryVector: { float32: [0.1, 0.2, ...] },
488
459
  * topK: 5,
@@ -517,7 +488,7 @@ export class VectorIndexScope extends VectorDataApi {
517
488
  *
518
489
  * @example
519
490
  * ```typescript
520
- * const index = client.bucket('embeddings-prod').index('documents-openai')
491
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
521
492
  * await index.deleteVectors({
522
493
  * keys: ['doc-1', 'doc-2', 'doc-3']
523
494
  * })
@@ -10,13 +10,9 @@ import {
10
10
  } from './types'
11
11
 
12
12
  /**
13
- *
14
- * @alpha
15
- *
16
- * API class for managing Vector Buckets
17
- * Provides methods for creating, reading, listing, and deleting vector buckets
18
- *
19
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
13
+ * @hidden
14
+ * Base implementation for vector bucket operations.
15
+ * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.
20
16
  */
21
17
  export default class VectorBucketApi {
22
18
  protected url: string
@@ -24,79 +20,20 @@ export default class VectorBucketApi {
24
20
  protected fetch: Fetch
25
21
  protected shouldThrowOnError = false
26
22
 
27
- /**
28
- *
29
- * @alpha
30
- *
31
- * Creates a new VectorBucketApi instance
32
- *
33
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
34
- *
35
- * @category Vector Buckets
36
- * @param url - The base URL for the storage vectors API
37
- * @param headers - HTTP headers to include in requests
38
- * @param fetch - Optional custom fetch implementation
39
- *
40
- * @example
41
- * ```typescript
42
- * const client = new VectorBucketApi(url, headers)
43
- * ```
44
- */
23
+ /** Creates a new VectorBucketApi instance */
45
24
  constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {
46
25
  this.url = url.replace(/\/$/, '')
47
26
  this.headers = { ...DEFAULT_HEADERS, ...headers }
48
27
  this.fetch = resolveFetch(fetch)
49
28
  }
50
29
 
51
- /**
52
- *
53
- * @alpha
54
- *
55
- * Enable throwing errors instead of returning them in the response
56
- * When enabled, failed operations will throw instead of returning { data: null, error }
57
- *
58
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
59
- *
60
- * @category Vector Buckets
61
- * @returns This instance for method chaining
62
- * @example
63
- * ```typescript
64
- * const client = new VectorBucketApi(url, headers)
65
- * client.throwOnError()
66
- * const { data } = await client.createBucket('my-bucket') // throws on error
67
- * ```
68
- */
30
+ /** Enable throwing errors instead of returning them in the response */
69
31
  public throwOnError(): this {
70
32
  this.shouldThrowOnError = true
71
33
  return this
72
34
  }
73
35
 
74
- /**
75
- *
76
- * @alpha
77
- *
78
- * Creates a new vector bucket
79
- * Vector buckets are containers for vector indexes and their data
80
- *
81
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
82
- *
83
- * @category Vector Buckets
84
- * @param vectorBucketName - Unique name for the vector bucket
85
- * @returns Promise with empty response on success or error
86
- *
87
- * @throws {StorageVectorsApiError} With code:
88
- * - `S3VectorConflictException` if bucket already exists (HTTP 409)
89
- * - `S3VectorMaxBucketsExceeded` if quota exceeded (HTTP 400)
90
- * - `InternalError` for server errors (HTTP 500)
91
- *
92
- * @example
93
- * ```typescript
94
- * const { data, error } = await client.createBucket('embeddings-prod')
95
- * if (error) {
96
- * console.error('Failed to create bucket:', error.message)
97
- * }
98
- * ```
99
- */
36
+ /** Creates a new vector bucket */
100
37
  async createBucket(vectorBucketName: string): Promise<ApiResponse<undefined>> {
101
38
  try {
102
39
  const data = await post(
@@ -117,31 +54,7 @@ export default class VectorBucketApi {
117
54
  }
118
55
  }
119
56
 
120
- /**
121
- *
122
- * @alpha
123
- *
124
- * Retrieves metadata for a specific vector bucket
125
- * Returns bucket configuration including encryption settings and creation time
126
- *
127
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
128
- *
129
- * @category Vector Buckets
130
- * @param vectorBucketName - Name of the vector bucket to retrieve
131
- * @returns Promise with bucket metadata or error
132
- *
133
- * @throws {StorageVectorsApiError} With code:
134
- * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
135
- * - `InternalError` for server errors (HTTP 500)
136
- *
137
- * @example
138
- * ```typescript
139
- * const { data, error } = await client.getBucket('embeddings-prod')
140
- * if (data) {
141
- * console.log('Bucket created at:', new Date(data.vectorBucket.creationTime! * 1000))
142
- * }
143
- * ```
144
- */
57
+ /** Retrieves metadata for a specific vector bucket */
145
58
  async getBucket(vectorBucketName: string): Promise<ApiResponse<{ vectorBucket: VectorBucket }>> {
146
59
  try {
147
60
  const data = await post(
@@ -162,38 +75,7 @@ export default class VectorBucketApi {
162
75
  }
163
76
  }
164
77
 
165
- /**
166
- *
167
- * @alpha
168
- *
169
- * Lists vector buckets with optional filtering and pagination
170
- * Supports prefix-based filtering and paginated results
171
- *
172
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
173
- *
174
- * @category Vector Buckets
175
- * @param options - Listing options
176
- * @param options.prefix - Filter buckets by name prefix
177
- * @param options.maxResults - Maximum results per page (default: 100)
178
- * @param options.nextToken - Pagination token from previous response
179
- * @returns Promise with list of buckets and pagination token
180
- *
181
- * @throws {StorageVectorsApiError} With code:
182
- * - `InternalError` for server errors (HTTP 500)
183
- *
184
- * @example
185
- * ```typescript
186
- * // List all buckets with prefix 'prod-'
187
- * const { data, error } = await client.listBuckets({ prefix: 'prod-' })
188
- * if (data) {
189
- * console.log('Found buckets:', data.buckets.length)
190
- * // Fetch next page if available
191
- * if (data.nextToken) {
192
- * const next = await client.listBuckets({ nextToken: data.nextToken })
193
- * }
194
- * }
195
- * ```
196
- */
78
+ /** Lists vector buckets with optional filtering and pagination */
197
79
  async listBuckets(
198
80
  options: ListVectorBucketsOptions = {}
199
81
  ): Promise<ApiResponse<ListVectorBucketsResponse>> {
@@ -213,33 +95,7 @@ export default class VectorBucketApi {
213
95
  }
214
96
  }
215
97
 
216
- /**
217
- *
218
- * @alpha
219
- *
220
- * Deletes a vector bucket
221
- * Bucket must be empty before deletion (all indexes must be removed first)
222
- *
223
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
224
- *
225
- * @category Vector Buckets
226
- * @param vectorBucketName - Name of the vector bucket to delete
227
- * @returns Promise with empty response on success or error
228
- *
229
- * @throws {StorageVectorsApiError} With code:
230
- * - `S3VectorBucketNotEmpty` if bucket contains indexes (HTTP 400)
231
- * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
232
- * - `InternalError` for server errors (HTTP 500)
233
- *
234
- * @example
235
- * ```typescript
236
- * // Delete all indexes first, then delete bucket
237
- * const { error } = await client.deleteBucket('old-bucket')
238
- * if (error?.statusCode === 'S3VectorBucketNotEmpty') {
239
- * console.error('Must delete all indexes first')
240
- * }
241
- * ```
242
- */
98
+ /** Deletes a vector bucket (must be empty first) */
243
99
  async deleteBucket(vectorBucketName: string): Promise<ApiResponse<undefined>> {
244
100
  try {
245
101
  const data = await post(