@supabase/storage-js 2.84.0 → 2.84.1-canary.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/dist/main/StorageClient.d.ts +1 -15
- package/dist/main/StorageClient.d.ts.map +1 -1
- package/dist/main/StorageClient.js +1 -15
- package/dist/main/StorageClient.js.map +1 -1
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts +18 -47
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
- package/dist/main/lib/vectors/StorageVectorsClient.js +18 -47
- package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -1
- package/dist/main/lib/vectors/VectorBucketApi.d.ts +9 -153
- package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +1 -1
- package/dist/main/lib/vectors/VectorBucketApi.js +9 -153
- package/dist/main/lib/vectors/VectorBucketApi.js.map +1 -1
- package/dist/main/lib/vectors/VectorDataApi.d.ts +10 -258
- package/dist/main/lib/vectors/VectorDataApi.d.ts.map +1 -1
- package/dist/main/lib/vectors/VectorDataApi.js +10 -258
- package/dist/main/lib/vectors/VectorDataApi.js.map +1 -1
- package/dist/main/lib/vectors/VectorIndexApi.d.ts +9 -177
- package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +1 -1
- package/dist/main/lib/vectors/VectorIndexApi.js +9 -176
- package/dist/main/lib/vectors/VectorIndexApi.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 +6 -2
- package/dist/main/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/main/packages/StorageAnalyticsClient.js +6 -2
- package/dist/main/packages/StorageAnalyticsClient.js.map +1 -1
- package/dist/module/StorageClient.d.ts +1 -15
- package/dist/module/StorageClient.d.ts.map +1 -1
- package/dist/module/StorageClient.js +1 -15
- package/dist/module/StorageClient.js.map +1 -1
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts +18 -47
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
- package/dist/module/lib/vectors/StorageVectorsClient.js +18 -47
- package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -1
- package/dist/module/lib/vectors/VectorBucketApi.d.ts +9 -153
- package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +1 -1
- package/dist/module/lib/vectors/VectorBucketApi.js +9 -153
- package/dist/module/lib/vectors/VectorBucketApi.js.map +1 -1
- package/dist/module/lib/vectors/VectorDataApi.d.ts +10 -258
- package/dist/module/lib/vectors/VectorDataApi.d.ts.map +1 -1
- package/dist/module/lib/vectors/VectorDataApi.js +10 -258
- package/dist/module/lib/vectors/VectorDataApi.js.map +1 -1
- package/dist/module/lib/vectors/VectorIndexApi.d.ts +9 -177
- package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +1 -1
- package/dist/module/lib/vectors/VectorIndexApi.js +9 -176
- package/dist/module/lib/vectors/VectorIndexApi.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 +6 -2
- package/dist/module/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/module/packages/StorageAnalyticsClient.js +6 -2
- package/dist/module/packages/StorageAnalyticsClient.js.map +1 -1
- 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/StorageClient.ts +1 -15
- package/src/lib/vectors/StorageVectorsClient.ts +18 -47
- package/src/lib/vectors/VectorBucketApi.ts +9 -153
- package/src/lib/vectors/VectorDataApi.ts +10 -258
- package/src/lib/vectors/VectorIndexApi.ts +9 -177
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageAnalyticsClient.ts +6 -2
|
@@ -6,102 +6,24 @@ const errors_1 = require("./errors");
|
|
|
6
6
|
const fetch_1 = require("./fetch");
|
|
7
7
|
const helpers_1 = require("./helpers");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* API class for managing Vector Data within Vector Indexes
|
|
13
|
-
* Provides methods for inserting, querying, listing, and deleting vector embeddings
|
|
14
|
-
*
|
|
15
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
9
|
+
* @hidden
|
|
10
|
+
* Base implementation for vector data operations.
|
|
11
|
+
* Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
|
|
16
12
|
*/
|
|
17
13
|
class VectorDataApi {
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @alpha
|
|
21
|
-
*
|
|
22
|
-
* Creates a VectorDataApi bound to a Storage Vectors deployment.
|
|
23
|
-
*
|
|
24
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
25
|
-
*
|
|
26
|
-
* @category Vector Buckets
|
|
27
|
-
* @param url - Base URL for the Storage Vectors API.
|
|
28
|
-
* @param headers - Default headers (for example authentication tokens).
|
|
29
|
-
* @param fetch - Optional custom `fetch` implementation for non-browser runtimes.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const client = new VectorDataApi(url, headers)
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
14
|
+
/** Creates a new VectorDataApi instance */
|
|
36
15
|
constructor(url, headers = {}, fetch) {
|
|
37
16
|
this.shouldThrowOnError = false;
|
|
38
17
|
this.url = url.replace(/\/$/, '');
|
|
39
18
|
this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
|
|
40
19
|
this.fetch = (0, helpers_1.resolveFetch)(fetch);
|
|
41
20
|
}
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @alpha
|
|
45
|
-
*
|
|
46
|
-
* Enable throwing errors instead of returning them in the response
|
|
47
|
-
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
48
|
-
*
|
|
49
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
50
|
-
*
|
|
51
|
-
* @category Vector Buckets
|
|
52
|
-
* @returns This instance for method chaining
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const client = new VectorDataApi(url, headers)
|
|
56
|
-
* client.throwOnError()
|
|
57
|
-
* const { data } = await client.putVectors(options) // throws on error
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
21
|
+
/** Enable throwing errors instead of returning them in the response */
|
|
60
22
|
throwOnError() {
|
|
61
23
|
this.shouldThrowOnError = true;
|
|
62
24
|
return this;
|
|
63
25
|
}
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @alpha
|
|
67
|
-
*
|
|
68
|
-
* Inserts or updates vectors in batch (upsert operation)
|
|
69
|
-
* Accepts 1-500 vectors per request. Larger batches should be split
|
|
70
|
-
*
|
|
71
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
72
|
-
*
|
|
73
|
-
* @category Vector Buckets
|
|
74
|
-
* @param options - Vector insertion options
|
|
75
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
76
|
-
* @param options.indexName - Name of the target index
|
|
77
|
-
* @param options.vectors - Array of vectors to insert/update (1-500 items)
|
|
78
|
-
* @returns Promise with empty response on success or error
|
|
79
|
-
*
|
|
80
|
-
* @throws {StorageVectorsApiError} With code:
|
|
81
|
-
* - `S3VectorConflictException` if duplicate key conflict occurs (HTTP 409)
|
|
82
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
83
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* const { data, error } = await client.putVectors({
|
|
88
|
-
* vectorBucketName: 'embeddings-prod',
|
|
89
|
-
* indexName: 'documents-openai-small',
|
|
90
|
-
* vectors: [
|
|
91
|
-
* {
|
|
92
|
-
* key: 'doc-1',
|
|
93
|
-
* data: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
94
|
-
* metadata: { title: 'Introduction', page: 1 }
|
|
95
|
-
* },
|
|
96
|
-
* {
|
|
97
|
-
* key: 'doc-2',
|
|
98
|
-
* data: { float32: [0.4, 0.5, 0.6, ...] },
|
|
99
|
-
* metadata: { title: 'Conclusion', page: 42 }
|
|
100
|
-
* }
|
|
101
|
-
* ]
|
|
102
|
-
* })
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
26
|
+
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
105
27
|
putVectors(options) {
|
|
106
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
29
|
try {
|
|
@@ -125,43 +47,7 @@ class VectorDataApi {
|
|
|
125
47
|
}
|
|
126
48
|
});
|
|
127
49
|
}
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
* @alpha
|
|
131
|
-
*
|
|
132
|
-
* Retrieves vectors by their keys in batch
|
|
133
|
-
* Optionally includes vector data and/or metadata in response
|
|
134
|
-
* Additional permissions required when returning data or metadata
|
|
135
|
-
*
|
|
136
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
137
|
-
*
|
|
138
|
-
* @category Vector Buckets
|
|
139
|
-
* @param options - Vector retrieval options
|
|
140
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
141
|
-
* @param options.indexName - Name of the index
|
|
142
|
-
* @param options.keys - Array of vector keys to retrieve
|
|
143
|
-
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
144
|
-
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
145
|
-
* @returns Promise with array of vectors or error
|
|
146
|
-
*
|
|
147
|
-
* @throws {StorageVectorsApiError} With code:
|
|
148
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
149
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```typescript
|
|
153
|
-
* const { data, error } = await client.getVectors({
|
|
154
|
-
* vectorBucketName: 'embeddings-prod',
|
|
155
|
-
* indexName: 'documents-openai-small',
|
|
156
|
-
* keys: ['doc-1', 'doc-2', 'doc-3'],
|
|
157
|
-
* returnData: false, // Don't return embeddings
|
|
158
|
-
* returnMetadata: true // Return metadata only
|
|
159
|
-
* })
|
|
160
|
-
* if (data) {
|
|
161
|
-
* data.vectors.forEach(v => console.log(v.key, v.metadata))
|
|
162
|
-
* }
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
50
|
+
/** Retrieves vectors by their keys in batch */
|
|
165
51
|
getVectors(options) {
|
|
166
52
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
167
53
|
try {
|
|
@@ -181,63 +67,7 @@ class VectorDataApi {
|
|
|
181
67
|
}
|
|
182
68
|
});
|
|
183
69
|
}
|
|
184
|
-
/**
|
|
185
|
-
*
|
|
186
|
-
* @alpha
|
|
187
|
-
*
|
|
188
|
-
* Lists/scans vectors in an index with pagination
|
|
189
|
-
* Supports parallel scanning via segment configuration for high-throughput scenarios
|
|
190
|
-
* Additional permissions required when returning data or metadata
|
|
191
|
-
*
|
|
192
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
193
|
-
*
|
|
194
|
-
* @category Vector Buckets
|
|
195
|
-
* @param options - Vector listing options
|
|
196
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
197
|
-
* @param options.indexName - Name of the index
|
|
198
|
-
* @param options.maxResults - Maximum results per page (default: 500, max: 1000)
|
|
199
|
-
* @param options.nextToken - Pagination token from previous response
|
|
200
|
-
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
201
|
-
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
202
|
-
* @param options.segmentCount - Total parallel segments (1-16) for distributed scanning
|
|
203
|
-
* @param options.segmentIndex - Zero-based segment index (0 to segmentCount-1)
|
|
204
|
-
* @returns Promise with array of vectors, pagination token, or error
|
|
205
|
-
*
|
|
206
|
-
* @throws {StorageVectorsApiError} With code:
|
|
207
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
208
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* ```typescript
|
|
212
|
-
* // Simple pagination
|
|
213
|
-
* let nextToken: string | undefined
|
|
214
|
-
* do {
|
|
215
|
-
* const { data, error } = await client.listVectors({
|
|
216
|
-
* vectorBucketName: 'embeddings-prod',
|
|
217
|
-
* indexName: 'documents-openai-small',
|
|
218
|
-
* maxResults: 500,
|
|
219
|
-
* nextToken,
|
|
220
|
-
* returnMetadata: true
|
|
221
|
-
* })
|
|
222
|
-
* if (error) break
|
|
223
|
-
* console.log('Batch:', data.vectors.length)
|
|
224
|
-
* nextToken = data.nextToken
|
|
225
|
-
* } while (nextToken)
|
|
226
|
-
*
|
|
227
|
-
* // Parallel scanning (4 concurrent workers)
|
|
228
|
-
* const workers = [0, 1, 2, 3].map(async (segmentIndex) => {
|
|
229
|
-
* const { data } = await client.listVectors({
|
|
230
|
-
* vectorBucketName: 'embeddings-prod',
|
|
231
|
-
* indexName: 'documents-openai-small',
|
|
232
|
-
* segmentCount: 4,
|
|
233
|
-
* segmentIndex,
|
|
234
|
-
* returnMetadata: true
|
|
235
|
-
* })
|
|
236
|
-
* return data?.vectors || []
|
|
237
|
-
* })
|
|
238
|
-
* const results = await Promise.all(workers)
|
|
239
|
-
* ```
|
|
240
|
-
*/
|
|
70
|
+
/** Lists vectors in an index with pagination */
|
|
241
71
|
listVectors(options) {
|
|
242
72
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
243
73
|
try {
|
|
@@ -268,54 +98,7 @@ class VectorDataApi {
|
|
|
268
98
|
}
|
|
269
99
|
});
|
|
270
100
|
}
|
|
271
|
-
/**
|
|
272
|
-
*
|
|
273
|
-
* @alpha
|
|
274
|
-
*
|
|
275
|
-
* Queries for similar vectors using approximate nearest neighbor (ANN) search
|
|
276
|
-
* Returns top-K most similar vectors based on the configured distance metric
|
|
277
|
-
* Supports optional metadata filtering (requires GetVectors permission)
|
|
278
|
-
*
|
|
279
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
280
|
-
*
|
|
281
|
-
* @category Vector Buckets
|
|
282
|
-
* @param options - Query options
|
|
283
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
284
|
-
* @param options.indexName - Name of the index
|
|
285
|
-
* @param options.queryVector - Query embedding to find similar vectors
|
|
286
|
-
* @param options.topK - Number of nearest neighbors to return (default: 10)
|
|
287
|
-
* @param options.filter - Optional JSON filter for metadata (requires GetVectors permission)
|
|
288
|
-
* @param options.returnDistance - Whether to include similarity distances
|
|
289
|
-
* @param options.returnMetadata - Whether to include metadata (requires GetVectors permission)
|
|
290
|
-
* @returns Promise with array of similar vectors ordered by distance
|
|
291
|
-
*
|
|
292
|
-
* @throws {StorageVectorsApiError} With code:
|
|
293
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
294
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
* ```typescript
|
|
298
|
-
* // Semantic search with filtering
|
|
299
|
-
* const { data, error } = await client.queryVectors({
|
|
300
|
-
* vectorBucketName: 'embeddings-prod',
|
|
301
|
-
* indexName: 'documents-openai-small',
|
|
302
|
-
* queryVector: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
303
|
-
* topK: 5,
|
|
304
|
-
* filter: {
|
|
305
|
-
* category: 'technical',
|
|
306
|
-
* published: true
|
|
307
|
-
* },
|
|
308
|
-
* returnDistance: true,
|
|
309
|
-
* returnMetadata: true
|
|
310
|
-
* })
|
|
311
|
-
* if (data) {
|
|
312
|
-
* data.matches.forEach(match => {
|
|
313
|
-
* console.log(`${match.key}: distance=${match.distance}`)
|
|
314
|
-
* console.log('Metadata:', match.metadata)
|
|
315
|
-
* })
|
|
316
|
-
* }
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
101
|
+
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
319
102
|
queryVectors(options) {
|
|
320
103
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
321
104
|
try {
|
|
@@ -335,38 +118,7 @@ class VectorDataApi {
|
|
|
335
118
|
}
|
|
336
119
|
});
|
|
337
120
|
}
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
* @alpha
|
|
341
|
-
*
|
|
342
|
-
* Deletes vectors by their keys in batch
|
|
343
|
-
* Accepts 1-500 keys per request
|
|
344
|
-
*
|
|
345
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
346
|
-
*
|
|
347
|
-
* @category Vector Buckets
|
|
348
|
-
* @param options - Vector deletion options
|
|
349
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
350
|
-
* @param options.indexName - Name of the index
|
|
351
|
-
* @param options.keys - Array of vector keys to delete (1-500 items)
|
|
352
|
-
* @returns Promise with empty response on success or error
|
|
353
|
-
*
|
|
354
|
-
* @throws {StorageVectorsApiError} With code:
|
|
355
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
356
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* ```typescript
|
|
360
|
-
* const { error } = await client.deleteVectors({
|
|
361
|
-
* vectorBucketName: 'embeddings-prod',
|
|
362
|
-
* indexName: 'documents-openai-small',
|
|
363
|
-
* keys: ['doc-1', 'doc-2', 'doc-3']
|
|
364
|
-
* })
|
|
365
|
-
* if (!error) {
|
|
366
|
-
* console.log('Vectors deleted successfully')
|
|
367
|
-
* }
|
|
368
|
-
* ```
|
|
369
|
-
*/
|
|
121
|
+
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
370
122
|
deleteVectors(options) {
|
|
371
123
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
372
124
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorDataApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAaxC
|
|
1
|
+
{"version":3,"file":"VectorDataApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAaxC;;;;GAIG;AACH,MAAqB,aAAa;IAMhC,2CAA2C;IAC3C,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAHrE,uBAAkB,GAAG,KAAK,CAAA;QAIlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,uEAAuE;IAChE,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8DAA8D;IACxD,UAAU,CAAC,OAA0B;;YACzC,IAAI,CAAC;gBACH,sBAAsB;gBACtB,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;oBAC/D,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;gBACtE,CAAC;gBAED,MAA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ACb,CAAC;QACH,CAAC;KAAA;CACF;AAlID,gCAkIC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fetch } from './fetch';
|
|
2
2
|
import { ApiResponse, VectorIndex, ListIndexesOptions, ListIndexesResponse, VectorDataType, DistanceMetric, MetadataConfiguration } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
4
|
* @alpha
|
|
6
5
|
*
|
|
7
6
|
* Options for creating a vector index
|
|
@@ -17,13 +16,9 @@ export interface CreateIndexOptions {
|
|
|
17
16
|
metadataConfiguration?: MetadataConfiguration;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* API class for managing Vector Indexes within Vector Buckets
|
|
24
|
-
* Provides methods for creating, reading, listing, and deleting vector indexes
|
|
25
|
-
*
|
|
26
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
19
|
+
* @hidden
|
|
20
|
+
* Base implementation for vector index operations.
|
|
21
|
+
* Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.
|
|
27
22
|
*/
|
|
28
23
|
export default class VectorIndexApi {
|
|
29
24
|
protected url: string;
|
|
@@ -32,184 +27,21 @@ export default class VectorIndexApi {
|
|
|
32
27
|
};
|
|
33
28
|
protected fetch: Fetch;
|
|
34
29
|
protected shouldThrowOnError: boolean;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @alpha
|
|
38
|
-
*
|
|
39
|
-
* Creates an API client for managing vector indexes.
|
|
40
|
-
*
|
|
41
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
42
|
-
*
|
|
43
|
-
* @category Vector Buckets
|
|
44
|
-
* @param url - Base URL for the Storage Vectors API.
|
|
45
|
-
* @param headers - Default headers sent with each request.
|
|
46
|
-
* @param fetch - Optional custom `fetch` implementation for non-browser runtimes.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* const client = new VectorIndexApi(url, headers)
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
30
|
+
/** Creates a new VectorIndexApi instance */
|
|
53
31
|
constructor(url: string, headers?: {
|
|
54
32
|
[key: string]: string;
|
|
55
33
|
}, fetch?: Fetch);
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @alpha
|
|
59
|
-
*
|
|
60
|
-
* Enable throwing errors instead of returning them in the response
|
|
61
|
-
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
62
|
-
*
|
|
63
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
64
|
-
*
|
|
65
|
-
* @category Vector Buckets
|
|
66
|
-
* @returns This instance for method chaining
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const client = new VectorIndexApi(url, headers)
|
|
70
|
-
* client.throwOnError()
|
|
71
|
-
* const { data } = await client.createIndex(options) // throws on error
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
34
|
+
/** Enable throwing errors instead of returning them in the response */
|
|
74
35
|
throwOnError(): this;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @alpha
|
|
78
|
-
*
|
|
79
|
-
* Creates a new vector index within a bucket
|
|
80
|
-
* Defines the schema for vectors including dimensionality, distance metric, and metadata config
|
|
81
|
-
*
|
|
82
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
83
|
-
*
|
|
84
|
-
* @category Vector Buckets
|
|
85
|
-
* @param options - Index configuration
|
|
86
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
87
|
-
* @param options.indexName - Unique name for the index within the bucket
|
|
88
|
-
* @param options.dataType - Data type for vector components (currently only 'float32')
|
|
89
|
-
* @param options.dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
|
|
90
|
-
* @param options.distanceMetric - Similarity metric ('cosine', 'euclidean', 'dotproduct')
|
|
91
|
-
* @param options.metadataConfiguration - Optional config for non-filterable metadata keys
|
|
92
|
-
* @returns Promise with empty response on success or error
|
|
93
|
-
*
|
|
94
|
-
* @throws {StorageVectorsApiError} With code:
|
|
95
|
-
* - `S3VectorConflictException` if index already exists (HTTP 409)
|
|
96
|
-
* - `S3VectorMaxIndexesExceeded` if quota exceeded (HTTP 400)
|
|
97
|
-
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
98
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```typescript
|
|
102
|
-
* const { data, error } = await client.createIndex({
|
|
103
|
-
* vectorBucketName: 'embeddings-prod',
|
|
104
|
-
* indexName: 'documents-openai-small',
|
|
105
|
-
* dataType: 'float32',
|
|
106
|
-
* dimension: 1536,
|
|
107
|
-
* distanceMetric: 'cosine',
|
|
108
|
-
* metadataConfiguration: {
|
|
109
|
-
* nonFilterableMetadataKeys: ['raw_text', 'internal_id']
|
|
110
|
-
* }
|
|
111
|
-
* })
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
36
|
+
/** Creates a new vector index within a bucket */
|
|
114
37
|
createIndex(options: CreateIndexOptions): Promise<ApiResponse<undefined>>;
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
* @alpha
|
|
118
|
-
*
|
|
119
|
-
* Retrieves metadata for a specific vector index
|
|
120
|
-
* Returns index configuration including dimension, distance metric, and metadata settings
|
|
121
|
-
*
|
|
122
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
123
|
-
*
|
|
124
|
-
* @category Vector Buckets
|
|
125
|
-
* @param vectorBucketName - Name of the parent vector bucket
|
|
126
|
-
* @param indexName - Name of the index to retrieve
|
|
127
|
-
* @returns Promise with index metadata or error
|
|
128
|
-
*
|
|
129
|
-
* @throws {StorageVectorsApiError} With code:
|
|
130
|
-
* - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
|
|
131
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```typescript
|
|
135
|
-
* const { data, error } = await client.getIndex('embeddings-prod', 'documents-openai-small')
|
|
136
|
-
* if (data) {
|
|
137
|
-
* console.log('Index dimension:', data.index.dimension)
|
|
138
|
-
* console.log('Distance metric:', data.index.distanceMetric)
|
|
139
|
-
* }
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
38
|
+
/** Retrieves metadata for a specific vector index */
|
|
142
39
|
getIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<{
|
|
143
40
|
index: VectorIndex;
|
|
144
41
|
}>>;
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @alpha
|
|
148
|
-
*
|
|
149
|
-
* Lists vector indexes within a bucket with optional filtering and pagination
|
|
150
|
-
* Supports prefix-based filtering and paginated results
|
|
151
|
-
*
|
|
152
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
153
|
-
*
|
|
154
|
-
* @category Vector Buckets
|
|
155
|
-
* @param options - Listing options
|
|
156
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
157
|
-
* @param options.prefix - Filter indexes by name prefix
|
|
158
|
-
* @param options.maxResults - Maximum results per page (default: 100)
|
|
159
|
-
* @param options.nextToken - Pagination token from previous response
|
|
160
|
-
* @returns Promise with list of indexes and pagination token
|
|
161
|
-
*
|
|
162
|
-
* @throws {StorageVectorsApiError} With code:
|
|
163
|
-
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
164
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```typescript
|
|
168
|
-
* // List all indexes in a bucket
|
|
169
|
-
* const { data, error } = await client.listIndexes({
|
|
170
|
-
* vectorBucketName: 'embeddings-prod',
|
|
171
|
-
* prefix: 'documents-'
|
|
172
|
-
* })
|
|
173
|
-
* if (data) {
|
|
174
|
-
* console.log('Found indexes:', data.indexes.map(i => i.indexName))
|
|
175
|
-
* // Fetch next page if available
|
|
176
|
-
* if (data.nextToken) {
|
|
177
|
-
* const next = await client.listIndexes({
|
|
178
|
-
* vectorBucketName: 'embeddings-prod',
|
|
179
|
-
* nextToken: data.nextToken
|
|
180
|
-
* })
|
|
181
|
-
* }
|
|
182
|
-
* }
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
42
|
+
/** Lists vector indexes within a bucket with optional filtering and pagination */
|
|
185
43
|
listIndexes(options: ListIndexesOptions): Promise<ApiResponse<ListIndexesResponse>>;
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
188
|
-
* @alpha
|
|
189
|
-
*
|
|
190
|
-
* Deletes a vector index and all its data
|
|
191
|
-
* This operation removes the index schema and all vectors stored in the index
|
|
192
|
-
*
|
|
193
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
194
|
-
*
|
|
195
|
-
* @category Vector Buckets
|
|
196
|
-
* @param vectorBucketName - Name of the parent vector bucket
|
|
197
|
-
* @param indexName - Name of the index to delete
|
|
198
|
-
* @returns Promise with empty response on success or error
|
|
199
|
-
*
|
|
200
|
-
* @throws {StorageVectorsApiError} With code:
|
|
201
|
-
* - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
|
|
202
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```typescript
|
|
206
|
-
* // Delete an index and all its vectors
|
|
207
|
-
* const { error } = await client.deleteIndex('embeddings-prod', 'old-index')
|
|
208
|
-
* if (!error) {
|
|
209
|
-
* console.log('Index deleted successfully')
|
|
210
|
-
* }
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
44
|
+
/** Deletes a vector index and all its data */
|
|
213
45
|
deleteIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<undefined>>;
|
|
214
46
|
}
|
|
215
47
|
//# sourceMappingURL=VectorIndexApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorIndexApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorIndexApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB
|
|
1
|
+
{"version":3,"file":"VectorIndexApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorIndexApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,cAAc,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,cAAc,CAAA;IAC9B,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;CAC9C;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,kBAAkB,UAAQ;IAEpC,4CAA4C;gBAChC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAM/E,uEAAuE;IAChE,YAAY,IAAI,IAAI;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