@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.
- 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,87 +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 Buckets
|
|
13
|
-
* Provides methods for creating, reading, listing, and deleting vector buckets
|
|
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 bucket operations.
|
|
11
|
+
* Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.
|
|
16
12
|
*/
|
|
17
13
|
class VectorBucketApi {
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @alpha
|
|
21
|
-
*
|
|
22
|
-
* Creates a new VectorBucketApi instance
|
|
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 - The base URL for the storage vectors API
|
|
28
|
-
* @param headers - HTTP headers to include in requests
|
|
29
|
-
* @param fetch - Optional custom fetch implementation
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const client = new VectorBucketApi(url, headers)
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
14
|
+
/** Creates a new VectorBucketApi 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 VectorBucketApi(url, headers)
|
|
56
|
-
* client.throwOnError()
|
|
57
|
-
* const { data } = await client.createBucket('my-bucket') // 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
|
-
* Creates a new vector bucket
|
|
69
|
-
* Vector buckets are containers for vector indexes and their data
|
|
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 vectorBucketName - Unique name for the vector bucket
|
|
75
|
-
* @returns Promise with empty response on success or error
|
|
76
|
-
*
|
|
77
|
-
* @throws {StorageVectorsApiError} With code:
|
|
78
|
-
* - `S3VectorConflictException` if bucket already exists (HTTP 409)
|
|
79
|
-
* - `S3VectorMaxBucketsExceeded` if quota exceeded (HTTP 400)
|
|
80
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* const { data, error } = await client.createBucket('embeddings-prod')
|
|
85
|
-
* if (error) {
|
|
86
|
-
* console.error('Failed to create bucket:', error.message)
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
26
|
+
/** Creates a new vector bucket */
|
|
90
27
|
createBucket(vectorBucketName) {
|
|
91
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
29
|
try {
|
|
@@ -104,31 +41,7 @@ class VectorBucketApi {
|
|
|
104
41
|
}
|
|
105
42
|
});
|
|
106
43
|
}
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
* @alpha
|
|
110
|
-
*
|
|
111
|
-
* Retrieves metadata for a specific vector bucket
|
|
112
|
-
* Returns bucket configuration including encryption settings and creation time
|
|
113
|
-
*
|
|
114
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
115
|
-
*
|
|
116
|
-
* @category Vector Buckets
|
|
117
|
-
* @param vectorBucketName - Name of the vector bucket to retrieve
|
|
118
|
-
* @returns Promise with bucket metadata or error
|
|
119
|
-
*
|
|
120
|
-
* @throws {StorageVectorsApiError} With code:
|
|
121
|
-
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
122
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const { data, error } = await client.getBucket('embeddings-prod')
|
|
127
|
-
* if (data) {
|
|
128
|
-
* console.log('Bucket created at:', new Date(data.vectorBucket.creationTime! * 1000))
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
44
|
+
/** Retrieves metadata for a specific vector bucket */
|
|
132
45
|
getBucket(vectorBucketName) {
|
|
133
46
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
134
47
|
try {
|
|
@@ -146,38 +59,7 @@ class VectorBucketApi {
|
|
|
146
59
|
}
|
|
147
60
|
});
|
|
148
61
|
}
|
|
149
|
-
/**
|
|
150
|
-
*
|
|
151
|
-
* @alpha
|
|
152
|
-
*
|
|
153
|
-
* Lists vector buckets with optional filtering and pagination
|
|
154
|
-
* Supports prefix-based filtering and paginated results
|
|
155
|
-
*
|
|
156
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
157
|
-
*
|
|
158
|
-
* @category Vector Buckets
|
|
159
|
-
* @param options - Listing options
|
|
160
|
-
* @param options.prefix - Filter buckets by name prefix
|
|
161
|
-
* @param options.maxResults - Maximum results per page (default: 100)
|
|
162
|
-
* @param options.nextToken - Pagination token from previous response
|
|
163
|
-
* @returns Promise with list of buckets and pagination token
|
|
164
|
-
*
|
|
165
|
-
* @throws {StorageVectorsApiError} With code:
|
|
166
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* // List all buckets with prefix 'prod-'
|
|
171
|
-
* const { data, error } = await client.listBuckets({ prefix: 'prod-' })
|
|
172
|
-
* if (data) {
|
|
173
|
-
* console.log('Found buckets:', data.buckets.length)
|
|
174
|
-
* // Fetch next page if available
|
|
175
|
-
* if (data.nextToken) {
|
|
176
|
-
* const next = await client.listBuckets({ nextToken: data.nextToken })
|
|
177
|
-
* }
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
62
|
+
/** Lists vector buckets with optional filtering and pagination */
|
|
181
63
|
listBuckets() {
|
|
182
64
|
return tslib_1.__awaiter(this, arguments, void 0, function* (options = {}) {
|
|
183
65
|
try {
|
|
@@ -197,33 +79,7 @@ class VectorBucketApi {
|
|
|
197
79
|
}
|
|
198
80
|
});
|
|
199
81
|
}
|
|
200
|
-
/**
|
|
201
|
-
*
|
|
202
|
-
* @alpha
|
|
203
|
-
*
|
|
204
|
-
* Deletes a vector bucket
|
|
205
|
-
* Bucket must be empty before deletion (all indexes must be removed first)
|
|
206
|
-
*
|
|
207
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
208
|
-
*
|
|
209
|
-
* @category Vector Buckets
|
|
210
|
-
* @param vectorBucketName - Name of the vector bucket to delete
|
|
211
|
-
* @returns Promise with empty response on success or error
|
|
212
|
-
*
|
|
213
|
-
* @throws {StorageVectorsApiError} With code:
|
|
214
|
-
* - `S3VectorBucketNotEmpty` if bucket contains indexes (HTTP 400)
|
|
215
|
-
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
216
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* ```typescript
|
|
220
|
-
* // Delete all indexes first, then delete bucket
|
|
221
|
-
* const { error } = await client.deleteBucket('old-bucket')
|
|
222
|
-
* if (error?.statusCode === 'S3VectorBucketNotEmpty') {
|
|
223
|
-
* console.error('Must delete all indexes first')
|
|
224
|
-
* }
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
82
|
+
/** Deletes a vector bucket (must be empty first) */
|
|
227
83
|
deleteBucket(vectorBucketName) {
|
|
228
84
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
229
85
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorBucketApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorBucketApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAQxC
|
|
1
|
+
{"version":3,"file":"VectorBucketApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorBucketApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAQxC;;;;GAIG;AACH,MAAqB,eAAe;IAMlC,6CAA6C;IAC7C,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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C,KAAK,CAAC,EAAE,CAAC;oBACjC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;gBAC9B,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;CACF;AArGD,kCAqGC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { Fetch } from './fetch';
|
|
2
2
|
import { ApiResponse, PutVectorsOptions, GetVectorsOptions, GetVectorsResponse, DeleteVectorsOptions, ListVectorsOptions, ListVectorsResponse, QueryVectorsOptions, QueryVectorsResponse } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* API class for managing Vector Data within Vector Indexes
|
|
8
|
-
* Provides methods for inserting, querying, listing, and deleting vector embeddings
|
|
9
|
-
*
|
|
10
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
4
|
+
* @hidden
|
|
5
|
+
* Base implementation for vector data operations.
|
|
6
|
+
* Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
|
|
11
7
|
*/
|
|
12
8
|
export default class VectorDataApi {
|
|
13
9
|
protected url: string;
|
|
@@ -16,265 +12,21 @@ export default class VectorDataApi {
|
|
|
16
12
|
};
|
|
17
13
|
protected fetch: Fetch;
|
|
18
14
|
protected shouldThrowOnError: boolean;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @alpha
|
|
22
|
-
*
|
|
23
|
-
* Creates a VectorDataApi bound to a Storage Vectors deployment.
|
|
24
|
-
*
|
|
25
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
26
|
-
*
|
|
27
|
-
* @category Vector Buckets
|
|
28
|
-
* @param url - Base URL for the Storage Vectors API.
|
|
29
|
-
* @param headers - Default headers (for example authentication tokens).
|
|
30
|
-
* @param fetch - Optional custom `fetch` implementation for non-browser runtimes.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const client = new VectorDataApi(url, headers)
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
15
|
+
/** Creates a new VectorDataApi instance */
|
|
37
16
|
constructor(url: string, headers?: {
|
|
38
17
|
[key: string]: string;
|
|
39
18
|
}, fetch?: Fetch);
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @alpha
|
|
43
|
-
*
|
|
44
|
-
* Enable throwing errors instead of returning them in the response
|
|
45
|
-
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
46
|
-
*
|
|
47
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
48
|
-
*
|
|
49
|
-
* @category Vector Buckets
|
|
50
|
-
* @returns This instance for method chaining
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const client = new VectorDataApi(url, headers)
|
|
54
|
-
* client.throwOnError()
|
|
55
|
-
* const { data } = await client.putVectors(options) // throws on error
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
19
|
+
/** Enable throwing errors instead of returning them in the response */
|
|
58
20
|
throwOnError(): this;
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @alpha
|
|
62
|
-
*
|
|
63
|
-
* Inserts or updates vectors in batch (upsert operation)
|
|
64
|
-
* Accepts 1-500 vectors per request. Larger batches should be split
|
|
65
|
-
*
|
|
66
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
67
|
-
*
|
|
68
|
-
* @category Vector Buckets
|
|
69
|
-
* @param options - Vector insertion options
|
|
70
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
71
|
-
* @param options.indexName - Name of the target index
|
|
72
|
-
* @param options.vectors - Array of vectors to insert/update (1-500 items)
|
|
73
|
-
* @returns Promise with empty response on success or error
|
|
74
|
-
*
|
|
75
|
-
* @throws {StorageVectorsApiError} With code:
|
|
76
|
-
* - `S3VectorConflictException` if duplicate key conflict occurs (HTTP 409)
|
|
77
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
78
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* const { data, error } = await client.putVectors({
|
|
83
|
-
* vectorBucketName: 'embeddings-prod',
|
|
84
|
-
* indexName: 'documents-openai-small',
|
|
85
|
-
* vectors: [
|
|
86
|
-
* {
|
|
87
|
-
* key: 'doc-1',
|
|
88
|
-
* data: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
89
|
-
* metadata: { title: 'Introduction', page: 1 }
|
|
90
|
-
* },
|
|
91
|
-
* {
|
|
92
|
-
* key: 'doc-2',
|
|
93
|
-
* data: { float32: [0.4, 0.5, 0.6, ...] },
|
|
94
|
-
* metadata: { title: 'Conclusion', page: 42 }
|
|
95
|
-
* }
|
|
96
|
-
* ]
|
|
97
|
-
* })
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
21
|
+
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
100
22
|
putVectors(options: PutVectorsOptions): Promise<ApiResponse<undefined>>;
|
|
101
|
-
/**
|
|
102
|
-
*
|
|
103
|
-
* @alpha
|
|
104
|
-
*
|
|
105
|
-
* Retrieves vectors by their keys in batch
|
|
106
|
-
* Optionally includes vector data and/or metadata in response
|
|
107
|
-
* Additional permissions required when returning data or metadata
|
|
108
|
-
*
|
|
109
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
110
|
-
*
|
|
111
|
-
* @category Vector Buckets
|
|
112
|
-
* @param options - Vector retrieval options
|
|
113
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
114
|
-
* @param options.indexName - Name of the index
|
|
115
|
-
* @param options.keys - Array of vector keys to retrieve
|
|
116
|
-
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
117
|
-
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
118
|
-
* @returns Promise with array of vectors or error
|
|
119
|
-
*
|
|
120
|
-
* @throws {StorageVectorsApiError} With code:
|
|
121
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
122
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const { data, error } = await client.getVectors({
|
|
127
|
-
* vectorBucketName: 'embeddings-prod',
|
|
128
|
-
* indexName: 'documents-openai-small',
|
|
129
|
-
* keys: ['doc-1', 'doc-2', 'doc-3'],
|
|
130
|
-
* returnData: false, // Don't return embeddings
|
|
131
|
-
* returnMetadata: true // Return metadata only
|
|
132
|
-
* })
|
|
133
|
-
* if (data) {
|
|
134
|
-
* data.vectors.forEach(v => console.log(v.key, v.metadata))
|
|
135
|
-
* }
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
23
|
+
/** Retrieves vectors by their keys in batch */
|
|
138
24
|
getVectors(options: GetVectorsOptions): Promise<ApiResponse<GetVectorsResponse>>;
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* @alpha
|
|
142
|
-
*
|
|
143
|
-
* Lists/scans vectors in an index with pagination
|
|
144
|
-
* Supports parallel scanning via segment configuration for high-throughput scenarios
|
|
145
|
-
* Additional permissions required when returning data or metadata
|
|
146
|
-
*
|
|
147
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
148
|
-
*
|
|
149
|
-
* @category Vector Buckets
|
|
150
|
-
* @param options - Vector listing options
|
|
151
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
152
|
-
* @param options.indexName - Name of the index
|
|
153
|
-
* @param options.maxResults - Maximum results per page (default: 500, max: 1000)
|
|
154
|
-
* @param options.nextToken - Pagination token from previous response
|
|
155
|
-
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
156
|
-
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
157
|
-
* @param options.segmentCount - Total parallel segments (1-16) for distributed scanning
|
|
158
|
-
* @param options.segmentIndex - Zero-based segment index (0 to segmentCount-1)
|
|
159
|
-
* @returns Promise with array of vectors, pagination token, or error
|
|
160
|
-
*
|
|
161
|
-
* @throws {StorageVectorsApiError} With code:
|
|
162
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
163
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* // Simple pagination
|
|
168
|
-
* let nextToken: string | undefined
|
|
169
|
-
* do {
|
|
170
|
-
* const { data, error } = await client.listVectors({
|
|
171
|
-
* vectorBucketName: 'embeddings-prod',
|
|
172
|
-
* indexName: 'documents-openai-small',
|
|
173
|
-
* maxResults: 500,
|
|
174
|
-
* nextToken,
|
|
175
|
-
* returnMetadata: true
|
|
176
|
-
* })
|
|
177
|
-
* if (error) break
|
|
178
|
-
* console.log('Batch:', data.vectors.length)
|
|
179
|
-
* nextToken = data.nextToken
|
|
180
|
-
* } while (nextToken)
|
|
181
|
-
*
|
|
182
|
-
* // Parallel scanning (4 concurrent workers)
|
|
183
|
-
* const workers = [0, 1, 2, 3].map(async (segmentIndex) => {
|
|
184
|
-
* const { data } = await client.listVectors({
|
|
185
|
-
* vectorBucketName: 'embeddings-prod',
|
|
186
|
-
* indexName: 'documents-openai-small',
|
|
187
|
-
* segmentCount: 4,
|
|
188
|
-
* segmentIndex,
|
|
189
|
-
* returnMetadata: true
|
|
190
|
-
* })
|
|
191
|
-
* return data?.vectors || []
|
|
192
|
-
* })
|
|
193
|
-
* const results = await Promise.all(workers)
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
25
|
+
/** Lists vectors in an index with pagination */
|
|
196
26
|
listVectors(options: ListVectorsOptions): Promise<ApiResponse<ListVectorsResponse>>;
|
|
197
|
-
/**
|
|
198
|
-
*
|
|
199
|
-
* @alpha
|
|
200
|
-
*
|
|
201
|
-
* Queries for similar vectors using approximate nearest neighbor (ANN) search
|
|
202
|
-
* Returns top-K most similar vectors based on the configured distance metric
|
|
203
|
-
* Supports optional metadata filtering (requires GetVectors permission)
|
|
204
|
-
*
|
|
205
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
206
|
-
*
|
|
207
|
-
* @category Vector Buckets
|
|
208
|
-
* @param options - Query options
|
|
209
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
210
|
-
* @param options.indexName - Name of the index
|
|
211
|
-
* @param options.queryVector - Query embedding to find similar vectors
|
|
212
|
-
* @param options.topK - Number of nearest neighbors to return (default: 10)
|
|
213
|
-
* @param options.filter - Optional JSON filter for metadata (requires GetVectors permission)
|
|
214
|
-
* @param options.returnDistance - Whether to include similarity distances
|
|
215
|
-
* @param options.returnMetadata - Whether to include metadata (requires GetVectors permission)
|
|
216
|
-
* @returns Promise with array of similar vectors ordered by distance
|
|
217
|
-
*
|
|
218
|
-
* @throws {StorageVectorsApiError} With code:
|
|
219
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
220
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* ```typescript
|
|
224
|
-
* // Semantic search with filtering
|
|
225
|
-
* const { data, error } = await client.queryVectors({
|
|
226
|
-
* vectorBucketName: 'embeddings-prod',
|
|
227
|
-
* indexName: 'documents-openai-small',
|
|
228
|
-
* queryVector: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
229
|
-
* topK: 5,
|
|
230
|
-
* filter: {
|
|
231
|
-
* category: 'technical',
|
|
232
|
-
* published: true
|
|
233
|
-
* },
|
|
234
|
-
* returnDistance: true,
|
|
235
|
-
* returnMetadata: true
|
|
236
|
-
* })
|
|
237
|
-
* if (data) {
|
|
238
|
-
* data.matches.forEach(match => {
|
|
239
|
-
* console.log(`${match.key}: distance=${match.distance}`)
|
|
240
|
-
* console.log('Metadata:', match.metadata)
|
|
241
|
-
* })
|
|
242
|
-
* }
|
|
243
|
-
* ```
|
|
244
|
-
*/
|
|
27
|
+
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
245
28
|
queryVectors(options: QueryVectorsOptions): Promise<ApiResponse<QueryVectorsResponse>>;
|
|
246
|
-
/**
|
|
247
|
-
*
|
|
248
|
-
* @alpha
|
|
249
|
-
*
|
|
250
|
-
* Deletes vectors by their keys in batch
|
|
251
|
-
* Accepts 1-500 keys per request
|
|
252
|
-
*
|
|
253
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
254
|
-
*
|
|
255
|
-
* @category Vector Buckets
|
|
256
|
-
* @param options - Vector deletion options
|
|
257
|
-
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
258
|
-
* @param options.indexName - Name of the index
|
|
259
|
-
* @param options.keys - Array of vector keys to delete (1-500 items)
|
|
260
|
-
* @returns Promise with empty response on success or error
|
|
261
|
-
*
|
|
262
|
-
* @throws {StorageVectorsApiError} With code:
|
|
263
|
-
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
264
|
-
* - `InternalError` for server errors (HTTP 500)
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```typescript
|
|
268
|
-
* const { error } = await client.deleteVectors({
|
|
269
|
-
* vectorBucketName: 'embeddings-prod',
|
|
270
|
-
* indexName: 'documents-openai-small',
|
|
271
|
-
* keys: ['doc-1', 'doc-2', 'doc-3']
|
|
272
|
-
* })
|
|
273
|
-
* if (!error) {
|
|
274
|
-
* console.log('Vectors deleted successfully')
|
|
275
|
-
* }
|
|
276
|
-
* ```
|
|
277
|
-
*/
|
|
29
|
+
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
278
30
|
deleteVectors(options: DeleteVectorsOptions): Promise<ApiResponse<undefined>>;
|
|
279
31
|
}
|
|
280
32
|
//# sourceMappingURL=VectorDataApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorDataApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB
|
|
1
|
+
{"version":3,"file":"VectorDataApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,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,2CAA2C;gBAC/B,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;IAK3B,8DAA8D;IACxD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAsB7E,+CAA+C;IACzC,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAA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