@supabase/storage-js 2.84.1-canary.0 → 2.85.0
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/README.md +10 -7
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts +108 -14
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
- package/dist/main/lib/vectors/StorageVectorsClient.js +124 -4
- package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/main/packages/StorageAnalyticsClient.d.ts +5 -5
- package/dist/main/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/main/packages/StorageAnalyticsClient.js +4 -4
- package/dist/main/packages/StorageBucketApi.d.ts +4 -4
- package/dist/main/packages/StorageBucketApi.js +4 -4
- package/dist/main/packages/StorageFileApi.d.ts +12 -12
- package/dist/main/packages/StorageFileApi.js +12 -12
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts +108 -14
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
- package/dist/module/lib/vectors/StorageVectorsClient.js +124 -4
- package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/module/packages/StorageAnalyticsClient.d.ts +5 -5
- package/dist/module/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/module/packages/StorageAnalyticsClient.js +4 -4
- package/dist/module/packages/StorageBucketApi.d.ts +4 -4
- package/dist/module/packages/StorageBucketApi.js +4 -4
- package/dist/module/packages/StorageFileApi.d.ts +12 -12
- package/dist/module/packages/StorageFileApi.js +12 -12
- 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/vectors/StorageVectorsClient.ts +114 -4
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageAnalyticsClient.ts +5 -5
- package/src/packages/StorageBucketApi.ts +4 -4
- package/src/packages/StorageFileApi.ts +12 -12
|
@@ -3,12 +3,16 @@ import VectorDataApi from './VectorDataApi'
|
|
|
3
3
|
import { Fetch } from './fetch'
|
|
4
4
|
import VectorBucketApi from './VectorBucketApi'
|
|
5
5
|
import {
|
|
6
|
+
ApiResponse,
|
|
6
7
|
DeleteVectorsOptions,
|
|
7
8
|
GetVectorsOptions,
|
|
8
9
|
ListIndexesOptions,
|
|
9
10
|
ListVectorsOptions,
|
|
11
|
+
ListVectorBucketsOptions,
|
|
12
|
+
ListVectorBucketsResponse,
|
|
10
13
|
PutVectorsOptions,
|
|
11
14
|
QueryVectorsOptions,
|
|
15
|
+
VectorBucket,
|
|
12
16
|
} from './types'
|
|
13
17
|
|
|
14
18
|
/**
|
|
@@ -116,6 +120,112 @@ export class StorageVectorsClient extends VectorBucketApi {
|
|
|
116
120
|
from(vectorBucketName: string): VectorBucketScope {
|
|
117
121
|
return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch)
|
|
118
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @alpha
|
|
127
|
+
*
|
|
128
|
+
* Creates a new vector bucket
|
|
129
|
+
* Vector buckets are containers for vector indexes and their data
|
|
130
|
+
*
|
|
131
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
132
|
+
*
|
|
133
|
+
* @category Vector Buckets
|
|
134
|
+
* @param vectorBucketName - Unique name for the vector bucket
|
|
135
|
+
* @returns Promise with empty response on success or error
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const { data, error } = await supabase
|
|
140
|
+
* .storage
|
|
141
|
+
* .vectors
|
|
142
|
+
* .createBucket('embeddings-prod')
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
async createBucket(vectorBucketName: string): Promise<ApiResponse<undefined>> {
|
|
146
|
+
return super.createBucket(vectorBucketName)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
*
|
|
151
|
+
* @alpha
|
|
152
|
+
*
|
|
153
|
+
* Retrieves metadata for a specific vector bucket
|
|
154
|
+
*
|
|
155
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
156
|
+
*
|
|
157
|
+
* @category Vector Buckets
|
|
158
|
+
* @param vectorBucketName - Name of the vector bucket
|
|
159
|
+
* @returns Promise with bucket metadata or error
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const { data, error } = await supabase
|
|
164
|
+
* .storage
|
|
165
|
+
* .vectors
|
|
166
|
+
* .getBucket('embeddings-prod')
|
|
167
|
+
*
|
|
168
|
+
* console.log('Bucket created:', data?.vectorBucket.creationTime)
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
async getBucket(vectorBucketName: string): Promise<ApiResponse<{ vectorBucket: VectorBucket }>> {
|
|
172
|
+
return super.getBucket(vectorBucketName)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
*
|
|
177
|
+
* @alpha
|
|
178
|
+
*
|
|
179
|
+
* Lists all vector buckets with optional filtering and pagination
|
|
180
|
+
*
|
|
181
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
182
|
+
*
|
|
183
|
+
* @category Vector Buckets
|
|
184
|
+
* @param options - Optional filters (prefix, maxResults, nextToken)
|
|
185
|
+
* @returns Promise with list of buckets or error
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* const { data, error } = await supabase
|
|
190
|
+
* .storage
|
|
191
|
+
* .vectors
|
|
192
|
+
* .listBuckets({ prefix: 'embeddings-' })
|
|
193
|
+
*
|
|
194
|
+
* data?.vectorBuckets.forEach(bucket => {
|
|
195
|
+
* console.log(bucket.vectorBucketName)
|
|
196
|
+
* })
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
async listBuckets(
|
|
200
|
+
options: ListVectorBucketsOptions = {}
|
|
201
|
+
): Promise<ApiResponse<ListVectorBucketsResponse>> {
|
|
202
|
+
return super.listBuckets(options)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* @alpha
|
|
208
|
+
*
|
|
209
|
+
* Deletes a vector bucket (bucket must be empty)
|
|
210
|
+
* All indexes must be deleted before deleting the bucket
|
|
211
|
+
*
|
|
212
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
213
|
+
*
|
|
214
|
+
* @category Vector Buckets
|
|
215
|
+
* @param vectorBucketName - Name of the vector bucket to delete
|
|
216
|
+
* @returns Promise with empty response on success or error
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const { data, error } = await supabase
|
|
221
|
+
* .storage
|
|
222
|
+
* .vectors
|
|
223
|
+
* .deleteBucket('embeddings-old')
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
async deleteBucket(vectorBucketName: string): Promise<ApiResponse<undefined>> {
|
|
227
|
+
return super.deleteBucket(vectorBucketName)
|
|
228
|
+
}
|
|
119
229
|
}
|
|
120
230
|
|
|
121
231
|
/**
|
|
@@ -198,7 +308,7 @@ export class VectorBucketScope extends VectorIndexApi {
|
|
|
198
308
|
*
|
|
199
309
|
* @category Vector Buckets
|
|
200
310
|
* @param options - Listing options (vectorBucketName is automatically set)
|
|
201
|
-
* @returns Promise with
|
|
311
|
+
* @returns Promise with response containing indexes array and pagination token or error
|
|
202
312
|
*
|
|
203
313
|
* @example
|
|
204
314
|
* ```typescript
|
|
@@ -387,7 +497,7 @@ export class VectorIndexScope extends VectorDataApi {
|
|
|
387
497
|
*
|
|
388
498
|
* @category Vector Buckets
|
|
389
499
|
* @param options - Vector retrieval options (bucket and index names automatically set)
|
|
390
|
-
* @returns Promise with
|
|
500
|
+
* @returns Promise with response containing vectors array or error
|
|
391
501
|
*
|
|
392
502
|
* @example
|
|
393
503
|
* ```typescript
|
|
@@ -417,7 +527,7 @@ export class VectorIndexScope extends VectorDataApi {
|
|
|
417
527
|
*
|
|
418
528
|
* @category Vector Buckets
|
|
419
529
|
* @param options - Listing options (bucket and index names automatically set)
|
|
420
|
-
* @returns Promise with
|
|
530
|
+
* @returns Promise with response containing vectors array and pagination token or error
|
|
421
531
|
*
|
|
422
532
|
* @example
|
|
423
533
|
* ```typescript
|
|
@@ -449,7 +559,7 @@ export class VectorIndexScope extends VectorDataApi {
|
|
|
449
559
|
*
|
|
450
560
|
* @category Vector Buckets
|
|
451
561
|
* @param options - Query options (bucket and index names automatically set)
|
|
452
|
-
* @returns Promise with array of similar vectors ordered by distance
|
|
562
|
+
* @returns Promise with response containing matches array of similar vectors ordered by distance or error
|
|
453
563
|
*
|
|
454
564
|
* @example
|
|
455
565
|
* ```typescript
|
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.
|
|
7
|
+
export const version = '2.85.0'
|
|
@@ -63,7 +63,7 @@ export default class StorageAnalyticsClient {
|
|
|
63
63
|
*
|
|
64
64
|
* @category Analytics Buckets
|
|
65
65
|
* @param name A unique name for the bucket you are creating
|
|
66
|
-
* @returns Promise with newly created bucket
|
|
66
|
+
* @returns Promise with response containing newly created analytics bucket or error
|
|
67
67
|
*
|
|
68
68
|
* @example Create analytics bucket
|
|
69
69
|
* ```js
|
|
@@ -124,10 +124,10 @@ export default class StorageAnalyticsClient {
|
|
|
124
124
|
* @param options Query parameters for listing buckets
|
|
125
125
|
* @param options.limit Maximum number of buckets to return
|
|
126
126
|
* @param options.offset Number of buckets to skip
|
|
127
|
-
* @param options.sortColumn Column to sort by ('
|
|
127
|
+
* @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')
|
|
128
128
|
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
129
129
|
* @param options.search Search term to filter bucket names
|
|
130
|
-
* @returns Promise with
|
|
130
|
+
* @returns Promise with response containing array of analytics buckets or error
|
|
131
131
|
*
|
|
132
132
|
* @example List analytics buckets
|
|
133
133
|
* ```js
|
|
@@ -161,7 +161,7 @@ export default class StorageAnalyticsClient {
|
|
|
161
161
|
async listBuckets(options?: {
|
|
162
162
|
limit?: number
|
|
163
163
|
offset?: number
|
|
164
|
-
sortColumn?: '
|
|
164
|
+
sortColumn?: 'name' | 'created_at' | 'updated_at'
|
|
165
165
|
sortOrder?: 'asc' | 'desc'
|
|
166
166
|
search?: string
|
|
167
167
|
}): Promise<
|
|
@@ -212,7 +212,7 @@ export default class StorageAnalyticsClient {
|
|
|
212
212
|
*
|
|
213
213
|
* @category Analytics Buckets
|
|
214
214
|
* @param bucketName The unique identifier of the bucket you would like to delete
|
|
215
|
-
* @returns Promise with success message or error
|
|
215
|
+
* @returns Promise with response containing success message or error
|
|
216
216
|
*
|
|
217
217
|
* @example Delete analytics bucket
|
|
218
218
|
* ```js
|
|
@@ -53,7 +53,7 @@ export default class StorageBucketApi {
|
|
|
53
53
|
* @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
|
|
54
54
|
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
55
55
|
* @param options.search Search term to filter bucket names
|
|
56
|
-
* @returns Promise with
|
|
56
|
+
* @returns Promise with response containing array of buckets or error
|
|
57
57
|
*
|
|
58
58
|
* @example List buckets
|
|
59
59
|
* ```js
|
|
@@ -108,7 +108,7 @@ export default class StorageBucketApi {
|
|
|
108
108
|
*
|
|
109
109
|
* @category File Buckets
|
|
110
110
|
* @param id The unique identifier of the bucket you would like to retrieve.
|
|
111
|
-
* @returns Promise with bucket details or error
|
|
111
|
+
* @returns Promise with response containing bucket details or error
|
|
112
112
|
*
|
|
113
113
|
* @example Get bucket
|
|
114
114
|
* ```js
|
|
@@ -175,7 +175,7 @@ export default class StorageBucketApi {
|
|
|
175
175
|
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
176
176
|
* @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
|
|
177
177
|
* - default bucket type is `STANDARD`
|
|
178
|
-
* @returns Promise with newly created bucket
|
|
178
|
+
* @returns Promise with response containing newly created bucket name or error
|
|
179
179
|
*
|
|
180
180
|
* @example Create bucket
|
|
181
181
|
* ```js
|
|
@@ -257,7 +257,7 @@ export default class StorageBucketApi {
|
|
|
257
257
|
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
|
|
258
258
|
* The default value is null, which allows files with all mime types to be uploaded.
|
|
259
259
|
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
260
|
-
* @returns Promise with success message or error
|
|
260
|
+
* @returns Promise with response containing success message or error
|
|
261
261
|
*
|
|
262
262
|
* @example Update bucket
|
|
263
263
|
* ```js
|
|
@@ -175,7 +175,7 @@ export default class StorageFileApi {
|
|
|
175
175
|
* @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
176
176
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
177
177
|
* @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
|
|
178
|
-
* @returns Promise with file path and
|
|
178
|
+
* @returns Promise with response containing file path, id, and fullPath or error
|
|
179
179
|
*
|
|
180
180
|
* @example Upload file
|
|
181
181
|
* ```js
|
|
@@ -237,7 +237,7 @@ export default class StorageFileApi {
|
|
|
237
237
|
* @param token The token generated from `createSignedUploadUrl`
|
|
238
238
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
239
239
|
* @param fileOptions Optional file upload options including cacheControl and contentType.
|
|
240
|
-
* @returns Promise with file path and
|
|
240
|
+
* @returns Promise with response containing file path and fullPath or error
|
|
241
241
|
*
|
|
242
242
|
* @example Upload to a signed URL
|
|
243
243
|
* ```js
|
|
@@ -317,7 +317,7 @@ export default class StorageFileApi {
|
|
|
317
317
|
* @category File Buckets
|
|
318
318
|
* @param path The file path, including the current file name. For example `folder/image.png`.
|
|
319
319
|
* @param options.upsert If set to true, allows the file to be overwritten if it already exists.
|
|
320
|
-
* @returns Promise with signed upload URL, token, and path or error
|
|
320
|
+
* @returns Promise with response containing signed upload URL, token, and path or error
|
|
321
321
|
*
|
|
322
322
|
* @example Create Signed Upload URL
|
|
323
323
|
* ```js
|
|
@@ -396,7 +396,7 @@ export default class StorageFileApi {
|
|
|
396
396
|
* @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
|
|
397
397
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
398
398
|
* @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
|
|
399
|
-
* @returns Promise with file path and
|
|
399
|
+
* @returns Promise with response containing file path, id, and fullPath or error
|
|
400
400
|
*
|
|
401
401
|
* @example Update file
|
|
402
402
|
* ```js
|
|
@@ -467,7 +467,7 @@ export default class StorageFileApi {
|
|
|
467
467
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
468
468
|
* @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
|
|
469
469
|
* @param options The destination options.
|
|
470
|
-
* @returns Promise with success message or error
|
|
470
|
+
* @returns Promise with response containing success message or error
|
|
471
471
|
*
|
|
472
472
|
* @example Move file
|
|
473
473
|
* ```js
|
|
@@ -533,7 +533,7 @@ export default class StorageFileApi {
|
|
|
533
533
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
534
534
|
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
|
|
535
535
|
* @param options The destination options.
|
|
536
|
-
* @returns Promise with copied file path or error
|
|
536
|
+
* @returns Promise with response containing copied file path or error
|
|
537
537
|
*
|
|
538
538
|
* @example Copy file
|
|
539
539
|
* ```js
|
|
@@ -600,7 +600,7 @@ export default class StorageFileApi {
|
|
|
600
600
|
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
601
601
|
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
602
602
|
* @param options.transform Transform the asset before serving it to the client.
|
|
603
|
-
* @returns Promise with signed URL or error
|
|
603
|
+
* @returns Promise with response containing signed URL or error
|
|
604
604
|
*
|
|
605
605
|
* @example Create Signed URL
|
|
606
606
|
* ```js
|
|
@@ -691,7 +691,7 @@ export default class StorageFileApi {
|
|
|
691
691
|
* @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
|
|
692
692
|
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
693
693
|
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
694
|
-
* @returns Promise with array of
|
|
694
|
+
* @returns Promise with response containing array of objects with signedUrl, path, and error or error
|
|
695
695
|
*
|
|
696
696
|
* @example Create Signed URLs
|
|
697
697
|
* ```js
|
|
@@ -828,7 +828,7 @@ export default class StorageFileApi {
|
|
|
828
828
|
*
|
|
829
829
|
* @category File Buckets
|
|
830
830
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
831
|
-
* @returns Promise with file metadata or error
|
|
831
|
+
* @returns Promise with response containing file metadata or error
|
|
832
832
|
*
|
|
833
833
|
* @example Get file info
|
|
834
834
|
* ```js
|
|
@@ -873,7 +873,7 @@ export default class StorageFileApi {
|
|
|
873
873
|
*
|
|
874
874
|
* @category File Buckets
|
|
875
875
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
876
|
-
* @returns Promise with boolean indicating file existence or error
|
|
876
|
+
* @returns Promise with response containing boolean indicating file existence or error
|
|
877
877
|
*
|
|
878
878
|
* @example Check file existence
|
|
879
879
|
* ```js
|
|
@@ -1005,7 +1005,7 @@ export default class StorageFileApi {
|
|
|
1005
1005
|
*
|
|
1006
1006
|
* @category File Buckets
|
|
1007
1007
|
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
1008
|
-
* @returns Promise with
|
|
1008
|
+
* @returns Promise with response containing array of deleted file objects or error
|
|
1009
1009
|
*
|
|
1010
1010
|
* @example Delete file
|
|
1011
1011
|
* ```js
|
|
@@ -1123,7 +1123,7 @@ export default class StorageFileApi {
|
|
|
1123
1123
|
* @param path The folder path.
|
|
1124
1124
|
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
1125
1125
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
1126
|
-
* @returns Promise with
|
|
1126
|
+
* @returns Promise with response containing array of files or error
|
|
1127
1127
|
*
|
|
1128
1128
|
* @example List files in a bucket
|
|
1129
1129
|
* ```js
|