@supabase/storage-js 2.79.1-canary.1 → 2.80.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 +920 -12
- package/dist/main/StorageClient.d.ts +28 -0
- package/dist/main/StorageClient.d.ts.map +1 -1
- package/dist/main/StorageClient.js +38 -5
- package/dist/main/StorageClient.js.map +1 -1
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +7 -17
- package/dist/main/index.js.map +1 -1
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +3 -1
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +16 -17
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +1 -1
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +4 -57
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/index.d.ts +1 -0
- package/dist/main/lib/index.d.ts.map +1 -1
- package/dist/main/lib/index.js +6 -18
- package/dist/main/lib/index.js.map +1 -1
- package/dist/main/lib/types.d.ts +74 -4
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts +310 -0
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -0
- package/dist/main/lib/vectors/StorageVectorsClient.js +366 -0
- package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -0
- package/dist/main/lib/vectors/VectorBucketApi.d.ts +129 -0
- package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +1 -0
- package/dist/main/lib/vectors/VectorBucketApi.js +199 -0
- package/dist/main/lib/vectors/VectorBucketApi.js.map +1 -0
- package/dist/main/lib/vectors/VectorDataApi.d.ts +221 -0
- package/dist/main/lib/vectors/VectorDataApi.d.ts.map +1 -0
- package/dist/main/lib/vectors/VectorDataApi.js +336 -0
- package/dist/main/lib/vectors/VectorDataApi.js.map +1 -0
- package/dist/main/lib/vectors/VectorIndexApi.d.ts +157 -0
- package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +1 -0
- package/dist/main/lib/vectors/VectorIndexApi.js +218 -0
- package/dist/main/lib/vectors/VectorIndexApi.js.map +1 -0
- package/dist/main/lib/vectors/constants.d.ts +5 -0
- package/dist/main/lib/vectors/constants.d.ts.map +1 -0
- package/dist/main/lib/vectors/constants.js +9 -0
- package/dist/main/lib/vectors/constants.js.map +1 -0
- package/dist/main/lib/vectors/errors.d.ts +55 -0
- package/dist/main/lib/vectors/errors.d.ts.map +1 -0
- package/dist/main/lib/vectors/errors.js +76 -0
- package/dist/main/lib/vectors/errors.js.map +1 -0
- package/dist/main/lib/vectors/fetch.d.ts +57 -0
- package/dist/main/lib/vectors/fetch.d.ts.map +1 -0
- package/dist/main/lib/vectors/fetch.js +167 -0
- package/dist/main/lib/vectors/fetch.js.map +1 -0
- package/dist/main/lib/vectors/helpers.d.ts +46 -0
- package/dist/main/lib/vectors/helpers.d.ts.map +1 -0
- package/dist/main/lib/vectors/helpers.js +74 -0
- package/dist/main/lib/vectors/helpers.js.map +1 -0
- package/dist/main/lib/vectors/index.d.ts +11 -0
- package/dist/main/lib/vectors/index.d.ts.map +1 -0
- package/dist/main/lib/vectors/index.js +31 -0
- package/dist/main/lib/vectors/index.js.map +1 -0
- package/dist/main/lib/vectors/types.d.ts +277 -0
- package/dist/main/lib/vectors/types.d.ts.map +1 -0
- package/dist/main/lib/vectors/types.js +3 -0
- package/dist/main/lib/vectors/types.js.map +1 -0
- 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/BlobDownloadBuilder.d.ts +6 -1
- package/dist/main/packages/BlobDownloadBuilder.d.ts.map +1 -1
- package/dist/main/packages/BlobDownloadBuilder.js +20 -15
- package/dist/main/packages/BlobDownloadBuilder.js.map +1 -1
- package/dist/main/packages/StorageAnalyticsApi.d.ts +123 -0
- package/dist/main/packages/StorageAnalyticsApi.d.ts.map +1 -0
- package/dist/main/packages/StorageAnalyticsApi.js +164 -0
- package/dist/main/packages/StorageAnalyticsApi.js.map +1 -0
- package/dist/main/packages/StorageBucketApi.d.ts +3 -2
- package/dist/main/packages/StorageBucketApi.d.ts.map +1 -1
- package/dist/main/packages/StorageBucketApi.js +34 -18
- package/dist/main/packages/StorageBucketApi.js.map +1 -1
- package/dist/main/packages/StorageFileApi.d.ts.map +1 -1
- package/dist/main/packages/StorageFileApi.js +28 -29
- package/dist/main/packages/StorageFileApi.js.map +1 -1
- package/dist/main/packages/StreamDownloadBuilder.js +2 -10
- package/dist/main/packages/StreamDownloadBuilder.js.map +1 -1
- package/dist/module/StorageClient.d.ts +28 -0
- package/dist/module/StorageClient.d.ts.map +1 -1
- package/dist/module/StorageClient.js +35 -0
- package/dist/module/StorageClient.js.map +1 -1
- package/dist/module/index.d.ts +2 -0
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +3 -1
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +9 -10
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +1 -1
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +4 -24
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/index.d.ts +1 -0
- package/dist/module/lib/index.d.ts.map +1 -1
- package/dist/module/lib/index.js +1 -0
- package/dist/module/lib/index.js.map +1 -1
- package/dist/module/lib/types.d.ts +74 -4
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts +310 -0
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -0
- package/dist/module/lib/vectors/StorageVectorsClient.js +360 -0
- package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -0
- package/dist/module/lib/vectors/VectorBucketApi.d.ts +129 -0
- package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +1 -0
- package/dist/module/lib/vectors/VectorBucketApi.js +196 -0
- package/dist/module/lib/vectors/VectorBucketApi.js.map +1 -0
- package/dist/module/lib/vectors/VectorDataApi.d.ts +221 -0
- package/dist/module/lib/vectors/VectorDataApi.d.ts.map +1 -0
- package/dist/module/lib/vectors/VectorDataApi.js +333 -0
- package/dist/module/lib/vectors/VectorDataApi.js.map +1 -0
- package/dist/module/lib/vectors/VectorIndexApi.d.ts +157 -0
- package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +1 -0
- package/dist/module/lib/vectors/VectorIndexApi.js +215 -0
- package/dist/module/lib/vectors/VectorIndexApi.js.map +1 -0
- package/dist/module/lib/vectors/constants.d.ts +5 -0
- package/dist/module/lib/vectors/constants.d.ts.map +1 -0
- package/dist/module/lib/vectors/constants.js +6 -0
- package/dist/module/lib/vectors/constants.js.map +1 -0
- package/dist/module/lib/vectors/errors.d.ts +55 -0
- package/dist/module/lib/vectors/errors.d.ts.map +1 -0
- package/dist/module/lib/vectors/errors.js +69 -0
- package/dist/module/lib/vectors/errors.js.map +1 -0
- package/dist/module/lib/vectors/fetch.d.ts +57 -0
- package/dist/module/lib/vectors/fetch.d.ts.map +1 -0
- package/dist/module/lib/vectors/fetch.js +161 -0
- package/dist/module/lib/vectors/fetch.js.map +1 -0
- package/dist/module/lib/vectors/helpers.d.ts +46 -0
- package/dist/module/lib/vectors/helpers.d.ts.map +1 -0
- package/dist/module/lib/vectors/helpers.js +66 -0
- package/dist/module/lib/vectors/helpers.js.map +1 -0
- package/dist/module/lib/vectors/index.d.ts +11 -0
- package/dist/module/lib/vectors/index.d.ts.map +1 -0
- package/dist/module/lib/vectors/index.js +11 -0
- package/dist/module/lib/vectors/index.js.map +1 -0
- package/dist/module/lib/vectors/types.d.ts +277 -0
- package/dist/module/lib/vectors/types.d.ts.map +1 -0
- package/dist/module/lib/vectors/types.js +2 -0
- package/dist/module/lib/vectors/types.js.map +1 -0
- 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/BlobDownloadBuilder.d.ts +6 -1
- package/dist/module/packages/BlobDownloadBuilder.d.ts.map +1 -1
- package/dist/module/packages/BlobDownloadBuilder.js +20 -11
- package/dist/module/packages/BlobDownloadBuilder.js.map +1 -1
- package/dist/module/packages/StorageAnalyticsApi.d.ts +123 -0
- package/dist/module/packages/StorageAnalyticsApi.d.ts.map +1 -0
- package/dist/module/packages/StorageAnalyticsApi.js +161 -0
- package/dist/module/packages/StorageAnalyticsApi.js.map +1 -0
- package/dist/module/packages/StorageBucketApi.d.ts +3 -2
- package/dist/module/packages/StorageBucketApi.d.ts.map +1 -1
- package/dist/module/packages/StorageBucketApi.js +28 -12
- package/dist/module/packages/StorageBucketApi.js.map +1 -1
- package/dist/module/packages/StorageFileApi.d.ts.map +1 -1
- package/dist/module/packages/StorageFileApi.js +13 -11
- package/dist/module/packages/StorageFileApi.js.map +1 -1
- package/dist/module/packages/StreamDownloadBuilder.js +1 -9
- package/dist/module/packages/StreamDownloadBuilder.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/umd/supabase.js +1 -1
- package/package.json +6 -13
- package/src/StorageClient.ts +37 -0
- package/src/index.ts +2 -0
- package/src/lib/constants.ts +3 -1
- package/src/lib/fetch.ts +5 -1
- package/src/lib/helpers.ts +3 -14
- package/src/lib/index.ts +1 -0
- package/src/lib/types.ts +83 -2
- package/src/lib/vectors/StorageVectorsClient.ts +405 -0
- package/src/lib/vectors/VectorBucketApi.ts +217 -0
- package/src/lib/vectors/VectorDataApi.ts +341 -0
- package/src/lib/vectors/VectorIndexApi.ts +245 -0
- package/src/lib/vectors/constants.ts +5 -0
- package/src/lib/vectors/errors.ts +78 -0
- package/src/lib/vectors/fetch.ts +218 -0
- package/src/lib/vectors/helpers.ts +79 -0
- package/src/lib/vectors/index.ts +66 -0
- package/src/lib/vectors/types.ts +299 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/BlobDownloadBuilder.ts +22 -2
- package/src/packages/StorageAnalyticsApi.ts +199 -0
- package/src/packages/StorageBucketApi.ts +29 -4
- package/src/packages/StorageFileApi.ts +15 -2
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const fetch_1 = require("./fetch");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
8
|
+
/**
|
|
9
|
+
* API class for managing Vector Data within Vector Indexes
|
|
10
|
+
* Provides methods for inserting, querying, listing, and deleting vector embeddings
|
|
11
|
+
*/
|
|
12
|
+
class VectorDataApi {
|
|
13
|
+
constructor(url, headers = {}, fetch) {
|
|
14
|
+
this.shouldThrowOnError = false;
|
|
15
|
+
this.url = url.replace(/\/$/, '');
|
|
16
|
+
this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
|
|
17
|
+
this.fetch = (0, helpers_1.resolveFetch)(fetch);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Enable throwing errors instead of returning them in the response
|
|
21
|
+
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
22
|
+
*
|
|
23
|
+
* @returns This instance for method chaining
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const client = new VectorDataApi(url, headers)
|
|
27
|
+
* client.throwOnError()
|
|
28
|
+
* const { data } = await client.putVectors(options) // throws on error
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
throwOnError() {
|
|
32
|
+
this.shouldThrowOnError = true;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Inserts or updates vectors in batch (upsert operation)
|
|
37
|
+
* Accepts 1-500 vectors per request. Larger batches should be split
|
|
38
|
+
*
|
|
39
|
+
* @param options - Vector insertion options
|
|
40
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
41
|
+
* @param options.indexName - Name of the target index
|
|
42
|
+
* @param options.vectors - Array of vectors to insert/update (1-500 items)
|
|
43
|
+
* @returns Promise with empty response on success or error
|
|
44
|
+
*
|
|
45
|
+
* @throws {StorageVectorsApiError} With code:
|
|
46
|
+
* - `S3VectorConflictException` if duplicate key conflict occurs (HTTP 409)
|
|
47
|
+
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
48
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const { data, error } = await client.putVectors({
|
|
53
|
+
* vectorBucketName: 'embeddings-prod',
|
|
54
|
+
* indexName: 'documents-openai-small',
|
|
55
|
+
* vectors: [
|
|
56
|
+
* {
|
|
57
|
+
* key: 'doc-1',
|
|
58
|
+
* data: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
59
|
+
* metadata: { title: 'Introduction', page: 1 }
|
|
60
|
+
* },
|
|
61
|
+
* {
|
|
62
|
+
* key: 'doc-2',
|
|
63
|
+
* data: { float32: [0.4, 0.5, 0.6, ...] },
|
|
64
|
+
* metadata: { title: 'Conclusion', page: 42 }
|
|
65
|
+
* }
|
|
66
|
+
* ]
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
putVectors(options) {
|
|
71
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
try {
|
|
73
|
+
// Validate batch size
|
|
74
|
+
if (options.vectors.length < 1 || options.vectors.length > 500) {
|
|
75
|
+
throw new Error('Vector batch size must be between 1 and 500 items');
|
|
76
|
+
}
|
|
77
|
+
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/PutVectors`, options, {
|
|
78
|
+
headers: this.headers,
|
|
79
|
+
});
|
|
80
|
+
return { data: data || {}, error: null };
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (this.shouldThrowOnError) {
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
if ((0, errors_1.isStorageVectorsError)(error)) {
|
|
87
|
+
return { data: null, error };
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves vectors by their keys in batch
|
|
95
|
+
* Optionally includes vector data and/or metadata in response
|
|
96
|
+
* Additional permissions required when returning data or metadata
|
|
97
|
+
*
|
|
98
|
+
* @param options - Vector retrieval options
|
|
99
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
100
|
+
* @param options.indexName - Name of the index
|
|
101
|
+
* @param options.keys - Array of vector keys to retrieve
|
|
102
|
+
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
103
|
+
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
104
|
+
* @returns Promise with array of vectors or error
|
|
105
|
+
*
|
|
106
|
+
* @throws {StorageVectorsApiError} With code:
|
|
107
|
+
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
108
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const { data, error } = await client.getVectors({
|
|
113
|
+
* vectorBucketName: 'embeddings-prod',
|
|
114
|
+
* indexName: 'documents-openai-small',
|
|
115
|
+
* keys: ['doc-1', 'doc-2', 'doc-3'],
|
|
116
|
+
* returnData: false, // Don't return embeddings
|
|
117
|
+
* returnMetadata: true // Return metadata only
|
|
118
|
+
* })
|
|
119
|
+
* if (data) {
|
|
120
|
+
* data.vectors.forEach(v => console.log(v.key, v.metadata))
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
getVectors(options) {
|
|
125
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
try {
|
|
127
|
+
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/GetVectors`, options, {
|
|
128
|
+
headers: this.headers,
|
|
129
|
+
});
|
|
130
|
+
return { data, error: null };
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (this.shouldThrowOnError) {
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
if ((0, errors_1.isStorageVectorsError)(error)) {
|
|
137
|
+
return { data: null, error };
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Lists/scans vectors in an index with pagination
|
|
145
|
+
* Supports parallel scanning via segment configuration for high-throughput scenarios
|
|
146
|
+
* Additional permissions required when returning data or metadata
|
|
147
|
+
*
|
|
148
|
+
* @param options - Vector listing options
|
|
149
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
150
|
+
* @param options.indexName - Name of the index
|
|
151
|
+
* @param options.maxResults - Maximum results per page (default: 500, max: 1000)
|
|
152
|
+
* @param options.nextToken - Pagination token from previous response
|
|
153
|
+
* @param options.returnData - Whether to include vector embeddings (requires permission)
|
|
154
|
+
* @param options.returnMetadata - Whether to include metadata (requires permission)
|
|
155
|
+
* @param options.segmentCount - Total parallel segments (1-16) for distributed scanning
|
|
156
|
+
* @param options.segmentIndex - Zero-based segment index (0 to segmentCount-1)
|
|
157
|
+
* @returns Promise with array of vectors, pagination token, or error
|
|
158
|
+
*
|
|
159
|
+
* @throws {StorageVectorsApiError} With code:
|
|
160
|
+
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
161
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* // Simple pagination
|
|
166
|
+
* let nextToken: string | undefined
|
|
167
|
+
* do {
|
|
168
|
+
* const { data, error } = await client.listVectors({
|
|
169
|
+
* vectorBucketName: 'embeddings-prod',
|
|
170
|
+
* indexName: 'documents-openai-small',
|
|
171
|
+
* maxResults: 500,
|
|
172
|
+
* nextToken,
|
|
173
|
+
* returnMetadata: true
|
|
174
|
+
* })
|
|
175
|
+
* if (error) break
|
|
176
|
+
* console.log('Batch:', data.vectors.length)
|
|
177
|
+
* nextToken = data.nextToken
|
|
178
|
+
* } while (nextToken)
|
|
179
|
+
*
|
|
180
|
+
* // Parallel scanning (4 concurrent workers)
|
|
181
|
+
* const workers = [0, 1, 2, 3].map(async (segmentIndex) => {
|
|
182
|
+
* const { data } = await client.listVectors({
|
|
183
|
+
* vectorBucketName: 'embeddings-prod',
|
|
184
|
+
* indexName: 'documents-openai-small',
|
|
185
|
+
* segmentCount: 4,
|
|
186
|
+
* segmentIndex,
|
|
187
|
+
* returnMetadata: true
|
|
188
|
+
* })
|
|
189
|
+
* return data?.vectors || []
|
|
190
|
+
* })
|
|
191
|
+
* const results = await Promise.all(workers)
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
listVectors(options) {
|
|
195
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
try {
|
|
197
|
+
// Validate segment configuration
|
|
198
|
+
if (options.segmentCount !== undefined) {
|
|
199
|
+
if (options.segmentCount < 1 || options.segmentCount > 16) {
|
|
200
|
+
throw new Error('segmentCount must be between 1 and 16');
|
|
201
|
+
}
|
|
202
|
+
if (options.segmentIndex !== undefined) {
|
|
203
|
+
if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) {
|
|
204
|
+
throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/ListVectors`, options, {
|
|
209
|
+
headers: this.headers,
|
|
210
|
+
});
|
|
211
|
+
return { data, error: null };
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
if (this.shouldThrowOnError) {
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
if ((0, errors_1.isStorageVectorsError)(error)) {
|
|
218
|
+
return { data: null, error };
|
|
219
|
+
}
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Queries for similar vectors using approximate nearest neighbor (ANN) search
|
|
226
|
+
* Returns top-K most similar vectors based on the configured distance metric
|
|
227
|
+
* Supports optional metadata filtering (requires GetVectors permission)
|
|
228
|
+
*
|
|
229
|
+
* @param options - Query options
|
|
230
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
231
|
+
* @param options.indexName - Name of the index
|
|
232
|
+
* @param options.queryVector - Query embedding to find similar vectors
|
|
233
|
+
* @param options.topK - Number of nearest neighbors to return (default: 10)
|
|
234
|
+
* @param options.filter - Optional JSON filter for metadata (requires GetVectors permission)
|
|
235
|
+
* @param options.returnDistance - Whether to include similarity distances
|
|
236
|
+
* @param options.returnMetadata - Whether to include metadata (requires GetVectors permission)
|
|
237
|
+
* @returns Promise with array of similar vectors ordered by distance
|
|
238
|
+
*
|
|
239
|
+
* @throws {StorageVectorsApiError} With code:
|
|
240
|
+
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
241
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* // Semantic search with filtering
|
|
246
|
+
* const { data, error } = await client.queryVectors({
|
|
247
|
+
* vectorBucketName: 'embeddings-prod',
|
|
248
|
+
* indexName: 'documents-openai-small',
|
|
249
|
+
* queryVector: { float32: [0.1, 0.2, 0.3, ...] }, // 1536 dimensions
|
|
250
|
+
* topK: 5,
|
|
251
|
+
* filter: {
|
|
252
|
+
* category: 'technical',
|
|
253
|
+
* published: true
|
|
254
|
+
* },
|
|
255
|
+
* returnDistance: true,
|
|
256
|
+
* returnMetadata: true
|
|
257
|
+
* })
|
|
258
|
+
* if (data) {
|
|
259
|
+
* data.matches.forEach(match => {
|
|
260
|
+
* console.log(`${match.key}: distance=${match.distance}`)
|
|
261
|
+
* console.log('Metadata:', match.metadata)
|
|
262
|
+
* })
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
queryVectors(options) {
|
|
267
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
try {
|
|
269
|
+
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/QueryVectors`, options, {
|
|
270
|
+
headers: this.headers,
|
|
271
|
+
});
|
|
272
|
+
return { data, error: null };
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
if (this.shouldThrowOnError) {
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
if ((0, errors_1.isStorageVectorsError)(error)) {
|
|
279
|
+
return { data: null, error };
|
|
280
|
+
}
|
|
281
|
+
throw error;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Deletes vectors by their keys in batch
|
|
287
|
+
* Accepts 1-500 keys per request
|
|
288
|
+
*
|
|
289
|
+
* @param options - Vector deletion options
|
|
290
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
291
|
+
* @param options.indexName - Name of the index
|
|
292
|
+
* @param options.keys - Array of vector keys to delete (1-500 items)
|
|
293
|
+
* @returns Promise with empty response on success or error
|
|
294
|
+
*
|
|
295
|
+
* @throws {StorageVectorsApiError} With code:
|
|
296
|
+
* - `S3VectorNotFoundException` if bucket or index doesn't exist (HTTP 404)
|
|
297
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const { error } = await client.deleteVectors({
|
|
302
|
+
* vectorBucketName: 'embeddings-prod',
|
|
303
|
+
* indexName: 'documents-openai-small',
|
|
304
|
+
* keys: ['doc-1', 'doc-2', 'doc-3']
|
|
305
|
+
* })
|
|
306
|
+
* if (!error) {
|
|
307
|
+
* console.log('Vectors deleted successfully')
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
deleteVectors(options) {
|
|
312
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
313
|
+
try {
|
|
314
|
+
// Validate batch size
|
|
315
|
+
if (options.keys.length < 1 || options.keys.length > 500) {
|
|
316
|
+
throw new Error('Keys batch size must be between 1 and 500 items');
|
|
317
|
+
}
|
|
318
|
+
const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/DeleteVectors`, options, {
|
|
319
|
+
headers: this.headers,
|
|
320
|
+
});
|
|
321
|
+
return { data: data || {}, error: null };
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
if (this.shouldThrowOnError) {
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
if ((0, errors_1.isStorageVectorsError)(error)) {
|
|
328
|
+
return { data: null, error };
|
|
329
|
+
}
|
|
330
|
+
throw error;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
exports.default = VectorDataApi;
|
|
336
|
+
//# sourceMappingURL=VectorDataApi.js.map
|
|
@@ -0,0 +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;;;GAGG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EAAE,CAAA;gBAC9B,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,aAAa,CAAC,OAA6B;;YAC/C,IAAI,CAAC;gBACH,sBAAsB;gBACtB,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;oBACzD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;gBACpE,CAAC;gBAED,MAAM,IAAI,GAAG,MAAM,IAAA,YAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,gBAAgB,EAAE,OAAO,EAAE;oBACxE,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CAAA;gBACF,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;YAC1C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC5B,MAAM,KAAK,CAAA;gBACb,CAAC;gBACD,IAAI,IAAA,8BAAqB,EAAC,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;AAhUD,gCAgUC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Fetch } from './fetch';
|
|
2
|
+
import { ApiResponse, VectorIndex, ListIndexesOptions, ListIndexesResponse, VectorDataType, DistanceMetric, MetadataConfiguration } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating a vector index
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateIndexOptions {
|
|
7
|
+
vectorBucketName: string;
|
|
8
|
+
indexName: string;
|
|
9
|
+
dataType: VectorDataType;
|
|
10
|
+
dimension: number;
|
|
11
|
+
distanceMetric: DistanceMetric;
|
|
12
|
+
metadataConfiguration?: MetadataConfiguration;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* API class for managing Vector Indexes within Vector Buckets
|
|
16
|
+
* Provides methods for creating, reading, listing, and deleting vector indexes
|
|
17
|
+
*/
|
|
18
|
+
export default class VectorIndexApi {
|
|
19
|
+
protected url: string;
|
|
20
|
+
protected headers: {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
protected fetch: Fetch;
|
|
24
|
+
protected shouldThrowOnError: boolean;
|
|
25
|
+
constructor(url: string, headers?: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
}, fetch?: Fetch);
|
|
28
|
+
/**
|
|
29
|
+
* Enable throwing errors instead of returning them in the response
|
|
30
|
+
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
31
|
+
*
|
|
32
|
+
* @returns This instance for method chaining
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const client = new VectorIndexApi(url, headers)
|
|
36
|
+
* client.throwOnError()
|
|
37
|
+
* const { data } = await client.createIndex(options) // throws on error
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
throwOnError(): this;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new vector index within a bucket
|
|
43
|
+
* Defines the schema for vectors including dimensionality, distance metric, and metadata config
|
|
44
|
+
*
|
|
45
|
+
* @param options - Index configuration
|
|
46
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
47
|
+
* @param options.indexName - Unique name for the index within the bucket
|
|
48
|
+
* @param options.dataType - Data type for vector components (currently only 'float32')
|
|
49
|
+
* @param options.dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
|
|
50
|
+
* @param options.distanceMetric - Similarity metric ('cosine', 'euclidean', 'dotproduct')
|
|
51
|
+
* @param options.metadataConfiguration - Optional config for non-filterable metadata keys
|
|
52
|
+
* @returns Promise with empty response on success or error
|
|
53
|
+
*
|
|
54
|
+
* @throws {StorageVectorsApiError} With code:
|
|
55
|
+
* - `S3VectorConflictException` if index already exists (HTTP 409)
|
|
56
|
+
* - `S3VectorMaxIndexesExceeded` if quota exceeded (HTTP 400)
|
|
57
|
+
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
58
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const { data, error } = await client.createIndex({
|
|
63
|
+
* vectorBucketName: 'embeddings-prod',
|
|
64
|
+
* indexName: 'documents-openai-small',
|
|
65
|
+
* dataType: 'float32',
|
|
66
|
+
* dimension: 1536,
|
|
67
|
+
* distanceMetric: 'cosine',
|
|
68
|
+
* metadataConfiguration: {
|
|
69
|
+
* nonFilterableMetadataKeys: ['raw_text', 'internal_id']
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
createIndex(options: CreateIndexOptions): Promise<ApiResponse<undefined>>;
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves metadata for a specific vector index
|
|
77
|
+
* Returns index configuration including dimension, distance metric, and metadata settings
|
|
78
|
+
*
|
|
79
|
+
* @param vectorBucketName - Name of the parent vector bucket
|
|
80
|
+
* @param indexName - Name of the index to retrieve
|
|
81
|
+
* @returns Promise with index metadata or error
|
|
82
|
+
*
|
|
83
|
+
* @throws {StorageVectorsApiError} With code:
|
|
84
|
+
* - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
|
|
85
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const { data, error } = await client.getIndex('embeddings-prod', 'documents-openai-small')
|
|
90
|
+
* if (data) {
|
|
91
|
+
* console.log('Index dimension:', data.index.dimension)
|
|
92
|
+
* console.log('Distance metric:', data.index.distanceMetric)
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
getIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<{
|
|
97
|
+
index: VectorIndex;
|
|
98
|
+
}>>;
|
|
99
|
+
/**
|
|
100
|
+
* Lists vector indexes within a bucket with optional filtering and pagination
|
|
101
|
+
* Supports prefix-based filtering and paginated results
|
|
102
|
+
*
|
|
103
|
+
* @param options - Listing options
|
|
104
|
+
* @param options.vectorBucketName - Name of the parent vector bucket
|
|
105
|
+
* @param options.prefix - Filter indexes by name prefix
|
|
106
|
+
* @param options.maxResults - Maximum results per page (default: 100)
|
|
107
|
+
* @param options.nextToken - Pagination token from previous response
|
|
108
|
+
* @returns Promise with list of indexes and pagination token
|
|
109
|
+
*
|
|
110
|
+
* @throws {StorageVectorsApiError} With code:
|
|
111
|
+
* - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
|
|
112
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // List all indexes in a bucket
|
|
117
|
+
* const { data, error } = await client.listIndexes({
|
|
118
|
+
* vectorBucketName: 'embeddings-prod',
|
|
119
|
+
* prefix: 'documents-'
|
|
120
|
+
* })
|
|
121
|
+
* if (data) {
|
|
122
|
+
* console.log('Found indexes:', data.indexes.map(i => i.indexName))
|
|
123
|
+
* // Fetch next page if available
|
|
124
|
+
* if (data.nextToken) {
|
|
125
|
+
* const next = await client.listIndexes({
|
|
126
|
+
* vectorBucketName: 'embeddings-prod',
|
|
127
|
+
* nextToken: data.nextToken
|
|
128
|
+
* })
|
|
129
|
+
* }
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
listIndexes(options: ListIndexesOptions): Promise<ApiResponse<ListIndexesResponse>>;
|
|
134
|
+
/**
|
|
135
|
+
* Deletes a vector index and all its data
|
|
136
|
+
* This operation removes the index schema and all vectors stored in the index
|
|
137
|
+
*
|
|
138
|
+
* @param vectorBucketName - Name of the parent vector bucket
|
|
139
|
+
* @param indexName - Name of the index to delete
|
|
140
|
+
* @returns Promise with empty response on success or error
|
|
141
|
+
*
|
|
142
|
+
* @throws {StorageVectorsApiError} With code:
|
|
143
|
+
* - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
|
|
144
|
+
* - `InternalError` for server errors (HTTP 500)
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* // Delete an index and all its vectors
|
|
149
|
+
* const { error } = await client.deleteIndex('embeddings-prod', 'old-index')
|
|
150
|
+
* if (!error) {
|
|
151
|
+
* console.log('Index deleted successfully')
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
deleteIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<undefined>>;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=VectorIndexApi.d.ts.map
|
|
@@ -0,0 +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;;GAEG;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;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,SAAS,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