@supabase/storage-js 2.87.4-canary.2 → 2.87.4-canary.4
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 +2 -106
- package/dist/index.cjs +3019 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2601 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2601 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2998 -0
- package/dist/index.mjs.map +1 -0
- package/dist/umd/supabase.js +1 -1
- package/package.json +21 -12
- package/src/lib/version.ts +1 -1
- package/dist/main/StorageClient.d.ts +0 -64
- package/dist/main/StorageClient.d.ts.map +0 -1
- package/dist/main/StorageClient.js +0 -74
- package/dist/main/StorageClient.js.map +0 -1
- package/dist/main/index.d.ts +0 -7
- package/dist/main/index.d.ts.map +0 -1
- package/dist/main/index.js +0 -12
- package/dist/main/index.js.map +0 -1
- package/dist/main/lib/constants.d.ts +0 -4
- package/dist/main/lib/constants.d.ts.map +0 -1
- package/dist/main/lib/constants.js +0 -8
- package/dist/main/lib/constants.js.map +0 -1
- package/dist/main/lib/errors.d.ts +0 -21
- package/dist/main/lib/errors.d.ts.map +0 -1
- package/dist/main/lib/errors.js +0 -41
- package/dist/main/lib/errors.js.map +0 -1
- package/dist/main/lib/fetch.d.ts +0 -16
- package/dist/main/lib/fetch.d.ts.map +0 -1
- package/dist/main/lib/fetch.js +0 -95
- package/dist/main/lib/fetch.js.map +0 -1
- package/dist/main/lib/helpers.d.ts +0 -28
- package/dist/main/lib/helpers.d.ts.map +0 -1
- package/dist/main/lib/helpers.js +0 -87
- package/dist/main/lib/helpers.js.map +0 -1
- package/dist/main/lib/index.d.ts +0 -6
- package/dist/main/lib/index.d.ts.map +0 -1
- package/dist/main/lib/index.js +0 -9
- package/dist/main/lib/index.js.map +0 -1
- package/dist/main/lib/types.d.ts +0 -226
- package/dist/main/lib/types.d.ts.map +0 -1
- package/dist/main/lib/types.js +0 -3
- package/dist/main/lib/types.js.map +0 -1
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts +0 -505
- package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
- package/dist/main/lib/vectors/StorageVectorsClient.js +0 -582
- package/dist/main/lib/vectors/StorageVectorsClient.js.map +0 -1
- package/dist/main/lib/vectors/VectorBucketApi.d.ts +0 -32
- package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorBucketApi.js +0 -102
- package/dist/main/lib/vectors/VectorBucketApi.js.map +0 -1
- package/dist/main/lib/vectors/VectorDataApi.d.ts +0 -32
- package/dist/main/lib/vectors/VectorDataApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorDataApi.js +0 -147
- package/dist/main/lib/vectors/VectorDataApi.js.map +0 -1
- package/dist/main/lib/vectors/VectorIndexApi.d.ts +0 -47
- package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +0 -1
- package/dist/main/lib/vectors/VectorIndexApi.js +0 -104
- package/dist/main/lib/vectors/VectorIndexApi.js.map +0 -1
- package/dist/main/lib/vectors/constants.d.ts +0 -5
- package/dist/main/lib/vectors/constants.d.ts.map +0 -1
- package/dist/main/lib/vectors/constants.js +0 -9
- package/dist/main/lib/vectors/constants.js.map +0 -1
- package/dist/main/lib/vectors/errors.d.ts +0 -55
- package/dist/main/lib/vectors/errors.d.ts.map +0 -1
- package/dist/main/lib/vectors/errors.js +0 -76
- package/dist/main/lib/vectors/errors.js.map +0 -1
- package/dist/main/lib/vectors/fetch.d.ts +0 -57
- package/dist/main/lib/vectors/fetch.d.ts.map +0 -1
- package/dist/main/lib/vectors/fetch.js +0 -167
- package/dist/main/lib/vectors/fetch.js.map +0 -1
- package/dist/main/lib/vectors/helpers.d.ts +0 -46
- package/dist/main/lib/vectors/helpers.d.ts.map +0 -1
- package/dist/main/lib/vectors/helpers.js +0 -74
- package/dist/main/lib/vectors/helpers.js.map +0 -1
- package/dist/main/lib/vectors/index.d.ts +0 -11
- package/dist/main/lib/vectors/index.d.ts.map +0 -1
- package/dist/main/lib/vectors/index.js +0 -31
- package/dist/main/lib/vectors/index.js.map +0 -1
- package/dist/main/lib/vectors/types.d.ts +0 -279
- package/dist/main/lib/vectors/types.d.ts.map +0 -1
- package/dist/main/lib/vectors/types.js +0 -3
- package/dist/main/lib/vectors/types.js.map +0 -1
- package/dist/main/lib/version.d.ts +0 -2
- package/dist/main/lib/version.d.ts.map +0 -1
- package/dist/main/lib/version.js +0 -11
- package/dist/main/lib/version.js.map +0 -1
- package/dist/main/packages/BlobDownloadBuilder.d.ts +0 -16
- package/dist/main/packages/BlobDownloadBuilder.d.ts.map +0 -1
- package/dist/main/packages/BlobDownloadBuilder.js +0 -55
- package/dist/main/packages/BlobDownloadBuilder.js.map +0 -1
- package/dist/main/packages/StorageAnalyticsClient.d.ts +0 -324
- package/dist/main/packages/StorageAnalyticsClient.d.ts.map +0 -1
- package/dist/main/packages/StorageAnalyticsClient.js +0 -395
- package/dist/main/packages/StorageAnalyticsClient.js.map +0 -1
- package/dist/main/packages/StorageBucketApi.d.ts +0 -266
- package/dist/main/packages/StorageBucketApi.d.ts.map +0 -1
- package/dist/main/packages/StorageBucketApi.js +0 -362
- package/dist/main/packages/StorageBucketApi.js.map +0 -1
- package/dist/main/packages/StorageFileApi.d.ts +0 -680
- package/dist/main/packages/StorageFileApi.d.ts.map +0 -1
- package/dist/main/packages/StorageFileApi.js +0 -1002
- package/dist/main/packages/StorageFileApi.js.map +0 -1
- package/dist/main/packages/StreamDownloadBuilder.d.ts +0 -9
- package/dist/main/packages/StreamDownloadBuilder.d.ts.map +0 -1
- package/dist/main/packages/StreamDownloadBuilder.js +0 -35
- package/dist/main/packages/StreamDownloadBuilder.js.map +0 -1
- package/dist/module/StorageClient.d.ts +0 -64
- package/dist/module/StorageClient.d.ts.map +0 -1
- package/dist/module/StorageClient.js +0 -69
- package/dist/module/StorageClient.js.map +0 -1
- package/dist/module/index.d.ts +0 -7
- package/dist/module/index.d.ts.map +0 -1
- package/dist/module/index.js +0 -6
- package/dist/module/index.js.map +0 -1
- package/dist/module/lib/constants.d.ts +0 -4
- package/dist/module/lib/constants.d.ts.map +0 -1
- package/dist/module/lib/constants.js +0 -5
- package/dist/module/lib/constants.js.map +0 -1
- package/dist/module/lib/errors.d.ts +0 -21
- package/dist/module/lib/errors.d.ts.map +0 -1
- package/dist/module/lib/errors.js +0 -34
- package/dist/module/lib/errors.js.map +0 -1
- package/dist/module/lib/fetch.d.ts +0 -16
- package/dist/module/lib/fetch.d.ts.map +0 -1
- package/dist/module/lib/fetch.js +0 -88
- package/dist/module/lib/fetch.js.map +0 -1
- package/dist/module/lib/helpers.d.ts +0 -28
- package/dist/module/lib/helpers.d.ts.map +0 -1
- package/dist/module/lib/helpers.js +0 -79
- package/dist/module/lib/helpers.js.map +0 -1
- package/dist/module/lib/index.d.ts +0 -6
- package/dist/module/lib/index.d.ts.map +0 -1
- package/dist/module/lib/index.js +0 -6
- package/dist/module/lib/index.js.map +0 -1
- package/dist/module/lib/types.d.ts +0 -226
- package/dist/module/lib/types.d.ts.map +0 -1
- package/dist/module/lib/types.js +0 -2
- package/dist/module/lib/types.js.map +0 -1
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts +0 -505
- package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
- package/dist/module/lib/vectors/StorageVectorsClient.js +0 -576
- package/dist/module/lib/vectors/StorageVectorsClient.js.map +0 -1
- package/dist/module/lib/vectors/VectorBucketApi.d.ts +0 -32
- package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorBucketApi.js +0 -99
- package/dist/module/lib/vectors/VectorBucketApi.js.map +0 -1
- package/dist/module/lib/vectors/VectorDataApi.d.ts +0 -32
- package/dist/module/lib/vectors/VectorDataApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorDataApi.js +0 -144
- package/dist/module/lib/vectors/VectorDataApi.js.map +0 -1
- package/dist/module/lib/vectors/VectorIndexApi.d.ts +0 -47
- package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +0 -1
- package/dist/module/lib/vectors/VectorIndexApi.js +0 -101
- package/dist/module/lib/vectors/VectorIndexApi.js.map +0 -1
- package/dist/module/lib/vectors/constants.d.ts +0 -5
- package/dist/module/lib/vectors/constants.d.ts.map +0 -1
- package/dist/module/lib/vectors/constants.js +0 -6
- package/dist/module/lib/vectors/constants.js.map +0 -1
- package/dist/module/lib/vectors/errors.d.ts +0 -55
- package/dist/module/lib/vectors/errors.d.ts.map +0 -1
- package/dist/module/lib/vectors/errors.js +0 -69
- package/dist/module/lib/vectors/errors.js.map +0 -1
- package/dist/module/lib/vectors/fetch.d.ts +0 -57
- package/dist/module/lib/vectors/fetch.d.ts.map +0 -1
- package/dist/module/lib/vectors/fetch.js +0 -161
- package/dist/module/lib/vectors/fetch.js.map +0 -1
- package/dist/module/lib/vectors/helpers.d.ts +0 -46
- package/dist/module/lib/vectors/helpers.d.ts.map +0 -1
- package/dist/module/lib/vectors/helpers.js +0 -66
- package/dist/module/lib/vectors/helpers.js.map +0 -1
- package/dist/module/lib/vectors/index.d.ts +0 -11
- package/dist/module/lib/vectors/index.d.ts.map +0 -1
- package/dist/module/lib/vectors/index.js +0 -11
- package/dist/module/lib/vectors/index.js.map +0 -1
- package/dist/module/lib/vectors/types.d.ts +0 -279
- package/dist/module/lib/vectors/types.d.ts.map +0 -1
- package/dist/module/lib/vectors/types.js +0 -2
- package/dist/module/lib/vectors/types.js.map +0 -1
- package/dist/module/lib/version.d.ts +0 -2
- package/dist/module/lib/version.d.ts.map +0 -1
- package/dist/module/lib/version.js +0 -8
- package/dist/module/lib/version.js.map +0 -1
- package/dist/module/packages/BlobDownloadBuilder.d.ts +0 -16
- package/dist/module/packages/BlobDownloadBuilder.d.ts.map +0 -1
- package/dist/module/packages/BlobDownloadBuilder.js +0 -53
- package/dist/module/packages/BlobDownloadBuilder.js.map +0 -1
- package/dist/module/packages/StorageAnalyticsClient.d.ts +0 -324
- package/dist/module/packages/StorageAnalyticsClient.d.ts.map +0 -1
- package/dist/module/packages/StorageAnalyticsClient.js +0 -392
- package/dist/module/packages/StorageAnalyticsClient.js.map +0 -1
- package/dist/module/packages/StorageBucketApi.d.ts +0 -266
- package/dist/module/packages/StorageBucketApi.d.ts.map +0 -1
- package/dist/module/packages/StorageBucketApi.js +0 -359
- package/dist/module/packages/StorageBucketApi.js.map +0 -1
- package/dist/module/packages/StorageFileApi.d.ts +0 -680
- package/dist/module/packages/StorageFileApi.d.ts.map +0 -1
- package/dist/module/packages/StorageFileApi.js +0 -999
- package/dist/module/packages/StorageFileApi.js.map +0 -1
- package/dist/module/packages/StreamDownloadBuilder.d.ts +0 -9
- package/dist/module/packages/StreamDownloadBuilder.d.ts.map +0 -1
- package/dist/module/packages/StreamDownloadBuilder.js +0 -32
- package/dist/module/packages/StreamDownloadBuilder.js.map +0 -1
- package/dist/tsconfig.module.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { VectorFetchParameters } from './types';
|
|
2
|
-
export type Fetch = typeof fetch;
|
|
3
|
-
/**
|
|
4
|
-
* Options for fetch requests
|
|
5
|
-
* @property headers - Custom HTTP headers
|
|
6
|
-
* @property noResolveJson - If true, return raw Response instead of parsing JSON
|
|
7
|
-
*/
|
|
8
|
-
export interface FetchOptions {
|
|
9
|
-
headers?: {
|
|
10
|
-
[key: string]: string;
|
|
11
|
-
};
|
|
12
|
-
noResolveJson?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* HTTP methods supported by the API
|
|
16
|
-
*/
|
|
17
|
-
export type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
18
|
-
/**
|
|
19
|
-
* Performs a GET request
|
|
20
|
-
* @param fetcher - Fetch function to use
|
|
21
|
-
* @param url - Request URL
|
|
22
|
-
* @param options - Custom fetch options
|
|
23
|
-
* @param parameters - Additional fetch parameters
|
|
24
|
-
* @returns Promise with parsed response
|
|
25
|
-
*/
|
|
26
|
-
export declare function get(fetcher: Fetch, url: string, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
|
|
27
|
-
/**
|
|
28
|
-
* Performs a POST request
|
|
29
|
-
* @param fetcher - Fetch function to use
|
|
30
|
-
* @param url - Request URL
|
|
31
|
-
* @param body - Request body to be JSON stringified
|
|
32
|
-
* @param options - Custom fetch options
|
|
33
|
-
* @param parameters - Additional fetch parameters
|
|
34
|
-
* @returns Promise with parsed response
|
|
35
|
-
*/
|
|
36
|
-
export declare function post(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
|
|
37
|
-
/**
|
|
38
|
-
* Performs a PUT request
|
|
39
|
-
* @param fetcher - Fetch function to use
|
|
40
|
-
* @param url - Request URL
|
|
41
|
-
* @param body - Request body to be JSON stringified
|
|
42
|
-
* @param options - Custom fetch options
|
|
43
|
-
* @param parameters - Additional fetch parameters
|
|
44
|
-
* @returns Promise with parsed response
|
|
45
|
-
*/
|
|
46
|
-
export declare function put(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
|
|
47
|
-
/**
|
|
48
|
-
* Performs a DELETE request
|
|
49
|
-
* @param fetcher - Fetch function to use
|
|
50
|
-
* @param url - Request URL
|
|
51
|
-
* @param body - Request body to be JSON stringified
|
|
52
|
-
* @param options - Custom fetch options
|
|
53
|
-
* @param parameters - Additional fetch parameters
|
|
54
|
-
* @returns Promise with parsed response
|
|
55
|
-
*/
|
|
56
|
-
export declare function remove(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
|
|
57
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/fetch.ts"],"names":[],"m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
2
|
-
import { StorageVectorsApiError, StorageVectorsUnknownError } from './errors';
|
|
3
|
-
import { isPlainObject } from './helpers';
|
|
4
|
-
/**
|
|
5
|
-
* Extracts error message from various error response formats
|
|
6
|
-
* @param err - Error object from API
|
|
7
|
-
* @returns Human-readable error message
|
|
8
|
-
*/
|
|
9
|
-
const _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
|
|
10
|
-
/**
|
|
11
|
-
* Handles fetch errors and converts them to StorageVectors error types
|
|
12
|
-
* @param error - The error caught from fetch
|
|
13
|
-
* @param reject - Promise rejection function
|
|
14
|
-
* @param options - Fetch options that may affect error handling
|
|
15
|
-
*/
|
|
16
|
-
const handleError = (error, reject, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
// Check if error is a Response-like object (has status and ok properties)
|
|
18
|
-
// This is more reliable than instanceof which can fail across realms
|
|
19
|
-
const isResponseLike = error &&
|
|
20
|
-
typeof error === 'object' &&
|
|
21
|
-
'status' in error &&
|
|
22
|
-
'ok' in error &&
|
|
23
|
-
typeof error.status === 'number';
|
|
24
|
-
if (isResponseLike && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
|
|
25
|
-
const status = error.status || 500;
|
|
26
|
-
const responseError = error;
|
|
27
|
-
// Try to parse JSON body if available
|
|
28
|
-
if (typeof responseError.json === 'function') {
|
|
29
|
-
responseError
|
|
30
|
-
.json()
|
|
31
|
-
.then((err) => {
|
|
32
|
-
const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + '';
|
|
33
|
-
reject(new StorageVectorsApiError(_getErrorMessage(err), status, statusCode));
|
|
34
|
-
})
|
|
35
|
-
.catch(() => {
|
|
36
|
-
// If JSON parsing fails, create an ApiError with the HTTP status code
|
|
37
|
-
const statusCode = status + '';
|
|
38
|
-
const message = responseError.statusText || `HTTP ${status} error`;
|
|
39
|
-
reject(new StorageVectorsApiError(message, status, statusCode));
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
// No json() method available, create error from status
|
|
44
|
-
const statusCode = status + '';
|
|
45
|
-
const message = responseError.statusText || `HTTP ${status} error`;
|
|
46
|
-
reject(new StorageVectorsApiError(message, status, statusCode));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
reject(new StorageVectorsUnknownError(_getErrorMessage(error), error));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Builds request parameters for fetch calls
|
|
55
|
-
* @param method - HTTP method
|
|
56
|
-
* @param options - Custom fetch options
|
|
57
|
-
* @param parameters - Additional fetch parameters like AbortSignal
|
|
58
|
-
* @param body - Request body (will be JSON stringified if plain object)
|
|
59
|
-
* @returns Complete fetch request parameters
|
|
60
|
-
*/
|
|
61
|
-
const _getRequestParams = (method, options, parameters, body) => {
|
|
62
|
-
const params = { method, headers: (options === null || options === void 0 ? void 0 : options.headers) || {} };
|
|
63
|
-
if (method === 'GET' || !body) {
|
|
64
|
-
return params;
|
|
65
|
-
}
|
|
66
|
-
if (isPlainObject(body)) {
|
|
67
|
-
params.headers = Object.assign({ 'Content-Type': 'application/json' }, options === null || options === void 0 ? void 0 : options.headers);
|
|
68
|
-
params.body = JSON.stringify(body);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
params.body = body;
|
|
72
|
-
}
|
|
73
|
-
return Object.assign(Object.assign({}, params), parameters);
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Internal request handler that wraps fetch with error handling
|
|
77
|
-
* @param fetcher - Fetch function to use
|
|
78
|
-
* @param method - HTTP method
|
|
79
|
-
* @param url - Request URL
|
|
80
|
-
* @param options - Custom fetch options
|
|
81
|
-
* @param parameters - Additional fetch parameters
|
|
82
|
-
* @param body - Request body
|
|
83
|
-
* @returns Promise with parsed response or error
|
|
84
|
-
*/
|
|
85
|
-
function _handleRequest(fetcher, method, url, options, parameters, body) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
return new Promise((resolve, reject) => {
|
|
88
|
-
fetcher(url, _getRequestParams(method, options, parameters, body))
|
|
89
|
-
.then((result) => {
|
|
90
|
-
if (!result.ok)
|
|
91
|
-
throw result;
|
|
92
|
-
if (options === null || options === void 0 ? void 0 : options.noResolveJson)
|
|
93
|
-
return result;
|
|
94
|
-
// Handle empty responses (204, empty body)
|
|
95
|
-
const contentType = result.headers.get('content-type');
|
|
96
|
-
if (!contentType || !contentType.includes('application/json')) {
|
|
97
|
-
return {};
|
|
98
|
-
}
|
|
99
|
-
return result.json();
|
|
100
|
-
})
|
|
101
|
-
.then((data) => resolve(data))
|
|
102
|
-
.catch((error) => handleError(error, reject, options));
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Performs a GET request
|
|
108
|
-
* @param fetcher - Fetch function to use
|
|
109
|
-
* @param url - Request URL
|
|
110
|
-
* @param options - Custom fetch options
|
|
111
|
-
* @param parameters - Additional fetch parameters
|
|
112
|
-
* @returns Promise with parsed response
|
|
113
|
-
*/
|
|
114
|
-
export function get(fetcher, url, options, parameters) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
return _handleRequest(fetcher, 'GET', url, options, parameters);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Performs a POST request
|
|
121
|
-
* @param fetcher - Fetch function to use
|
|
122
|
-
* @param url - Request URL
|
|
123
|
-
* @param body - Request body to be JSON stringified
|
|
124
|
-
* @param options - Custom fetch options
|
|
125
|
-
* @param parameters - Additional fetch parameters
|
|
126
|
-
* @returns Promise with parsed response
|
|
127
|
-
*/
|
|
128
|
-
export function post(fetcher, url, body, options, parameters) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
return _handleRequest(fetcher, 'POST', url, options, parameters, body);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Performs a PUT request
|
|
135
|
-
* @param fetcher - Fetch function to use
|
|
136
|
-
* @param url - Request URL
|
|
137
|
-
* @param body - Request body to be JSON stringified
|
|
138
|
-
* @param options - Custom fetch options
|
|
139
|
-
* @param parameters - Additional fetch parameters
|
|
140
|
-
* @returns Promise with parsed response
|
|
141
|
-
*/
|
|
142
|
-
export function put(fetcher, url, body, options, parameters) {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
return _handleRequest(fetcher, 'PUT', url, options, parameters, body);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Performs a DELETE request
|
|
149
|
-
* @param fetcher - Fetch function to use
|
|
150
|
-
* @param url - Request URL
|
|
151
|
-
* @param body - Request body to be JSON stringified
|
|
152
|
-
* @param options - Custom fetch options
|
|
153
|
-
* @param parameters - Additional fetch parameters
|
|
154
|
-
* @returns Promise with parsed response
|
|
155
|
-
*/
|
|
156
|
-
export function remove(fetcher, url, body, options, parameters) {
|
|
157
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
return _handleRequest(fetcher, 'DELETE', url, options, parameters, body);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../src/lib/vectors/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAmB,MAAM,WAAW,CAAA;AAsB1D;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAU,EAAE,CAC5C,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,iBAAiB,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,G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AAC,CAAA;IACxE,CAAC;CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,UAAgB,GAAG,CACvB,OAAc,EACd,GAAW,EACX,IAAY,EACZ,OAAsB,EACtB,UAAkC;;QAElC,OAAO,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACvE,CAAC;CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,UAAgB,MAAM,CAC1B,OAAc,EACd,GAAW,EACX,IAAY,EACZ,OAAsB,EACtB,UAAkC;;QAElC,OAAO,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1E,CAAC;CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
type Fetch = typeof fetch;
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the fetch implementation to use
|
|
4
|
-
* Uses custom fetch if provided, otherwise uses native fetch
|
|
5
|
-
*
|
|
6
|
-
* @param customFetch - Optional custom fetch implementation
|
|
7
|
-
* @returns Resolved fetch function
|
|
8
|
-
*/
|
|
9
|
-
export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves the Response constructor to use
|
|
12
|
-
* Returns native Response constructor
|
|
13
|
-
*
|
|
14
|
-
* @returns Response constructor
|
|
15
|
-
*/
|
|
16
|
-
export declare const resolveResponse: () => typeof Response;
|
|
17
|
-
/**
|
|
18
|
-
* Determine if input is a plain object
|
|
19
|
-
* An object is plain if it's created by either {}, new Object(), or Object.create(null)
|
|
20
|
-
*
|
|
21
|
-
* @param value - Value to check
|
|
22
|
-
* @returns True if value is a plain object
|
|
23
|
-
* @source https://github.com/sindresorhus/is-plain-obj
|
|
24
|
-
*/
|
|
25
|
-
export declare const isPlainObject: (value: object) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Normalizes a number array to float32 format
|
|
28
|
-
* Ensures all vector values are valid 32-bit floats
|
|
29
|
-
*
|
|
30
|
-
* @param values - Array of numbers to normalize
|
|
31
|
-
* @returns Normalized float32 array
|
|
32
|
-
*/
|
|
33
|
-
export declare const normalizeToFloat32: (values: number[]) => number[];
|
|
34
|
-
/**
|
|
35
|
-
* Validates vector dimensions match expected dimension
|
|
36
|
-
* Throws error if dimensions don't match
|
|
37
|
-
*
|
|
38
|
-
* @param vector - Vector data to validate
|
|
39
|
-
* @param expectedDimension - Expected vector dimension
|
|
40
|
-
* @throws Error if dimensions don't match
|
|
41
|
-
*/
|
|
42
|
-
export declare const validateVectorDimension: (vector: {
|
|
43
|
-
float32: number[];
|
|
44
|
-
}, expectedDimension?: number) => void;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/helpers.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,OAAO,KAAK,CAAA;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAKlD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAO,OAAO,QAEzC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OAa7C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,KAAG,MAAM,EAG3D,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EAC7B,oBAAoB,MAAM,KACzB,IAMF,CAAA"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves the fetch implementation to use
|
|
3
|
-
* Uses custom fetch if provided, otherwise uses native fetch
|
|
4
|
-
*
|
|
5
|
-
* @param customFetch - Optional custom fetch implementation
|
|
6
|
-
* @returns Resolved fetch function
|
|
7
|
-
*/
|
|
8
|
-
export const resolveFetch = (customFetch) => {
|
|
9
|
-
if (customFetch) {
|
|
10
|
-
return (...args) => customFetch(...args);
|
|
11
|
-
}
|
|
12
|
-
return (...args) => fetch(...args);
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Resolves the Response constructor to use
|
|
16
|
-
* Returns native Response constructor
|
|
17
|
-
*
|
|
18
|
-
* @returns Response constructor
|
|
19
|
-
*/
|
|
20
|
-
export const resolveResponse = () => {
|
|
21
|
-
return Response;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Determine if input is a plain object
|
|
25
|
-
* An object is plain if it's created by either {}, new Object(), or Object.create(null)
|
|
26
|
-
*
|
|
27
|
-
* @param value - Value to check
|
|
28
|
-
* @returns True if value is a plain object
|
|
29
|
-
* @source https://github.com/sindresorhus/is-plain-obj
|
|
30
|
-
*/
|
|
31
|
-
export const isPlainObject = (value) => {
|
|
32
|
-
if (typeof value !== 'object' || value === null) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
const prototype = Object.getPrototypeOf(value);
|
|
36
|
-
return ((prototype === null ||
|
|
37
|
-
prototype === Object.prototype ||
|
|
38
|
-
Object.getPrototypeOf(prototype) === null) &&
|
|
39
|
-
!(Symbol.toStringTag in value) &&
|
|
40
|
-
!(Symbol.iterator in value));
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Normalizes a number array to float32 format
|
|
44
|
-
* Ensures all vector values are valid 32-bit floats
|
|
45
|
-
*
|
|
46
|
-
* @param values - Array of numbers to normalize
|
|
47
|
-
* @returns Normalized float32 array
|
|
48
|
-
*/
|
|
49
|
-
export const normalizeToFloat32 = (values) => {
|
|
50
|
-
// Use Float32Array to ensure proper precision
|
|
51
|
-
return Array.from(new Float32Array(values));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Validates vector dimensions match expected dimension
|
|
55
|
-
* Throws error if dimensions don't match
|
|
56
|
-
*
|
|
57
|
-
* @param vector - Vector data to validate
|
|
58
|
-
* @param expectedDimension - Expected vector dimension
|
|
59
|
-
* @throws Error if dimensions don't match
|
|
60
|
-
*/
|
|
61
|
-
export const validateVectorDimension = (vector, expectedDimension) => {
|
|
62
|
-
if (expectedDimension !== undefined && vector.float32.length !== expectedDimension) {
|
|
63
|
-
throw new Error(`Vector dimension mismatch: expected ${expectedDimension}, got ${vector.float32.length}`);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/lib/vectors/helpers.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA;AACpC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAoB,EAAE;IACnD,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAW,EAAE;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;IAC9C,OAAO,CACL,CAAC,SAAS,KAAK,IAAI;QACjB,SAAS,KAAK,MAAM,CAAC,SAAS;QAC9B,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;QAC5C,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;QAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAC5B,CAAA;AACH,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAgB,EAAY,EAAE;IAC/D,8CAA8C;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7C,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAA6B,EAC7B,iBAA0B,EACpB,EAAE;IACR,IAAI,iBAAiB,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CACb,uCAAuC,iBAAiB,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CACzF,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { StorageVectorsClient, VectorBucketScope, VectorIndexScope } from './StorageVectorsClient';
|
|
2
|
-
export type { StorageVectorsClientOptions } from './StorageVectorsClient';
|
|
3
|
-
export { default as VectorBucketApi } from './VectorBucketApi';
|
|
4
|
-
export { default as VectorIndexApi } from './VectorIndexApi';
|
|
5
|
-
export { default as VectorDataApi } from './VectorDataApi';
|
|
6
|
-
export type { CreateIndexOptions } from './VectorIndexApi';
|
|
7
|
-
export type { VectorBucket, VectorIndex, VectorData, VectorMetadata, VectorObject, VectorMatch, EncryptionConfiguration, MetadataConfiguration, VectorDataType, DistanceMetric, VectorFilter, ListVectorBucketsOptions, ListVectorBucketsResponse, ListIndexesOptions, ListIndexesResponse, PutVectorsOptions, GetVectorsOptions, GetVectorsResponse, DeleteVectorsOptions, ListVectorsOptions, ListVectorsResponse, QueryVectorsOptions, QueryVectorsResponse, ApiResponse, SuccessResponse, ErrorResponse, VectorFetchParameters, } from './types';
|
|
8
|
-
export { StorageVectorsError, StorageVectorsApiError, StorageVectorsUnknownError, StorageVectorsErrorCode, isStorageVectorsError, } from './errors';
|
|
9
|
-
export type { Fetch, FetchOptions, RequestMethodType } from './fetch';
|
|
10
|
-
export { resolveFetch, resolveResponse, isPlainObject, normalizeToFloat32, validateVectorDimension, } from './helpers';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAClG,YAAY,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAGzE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,YAAY,EAEV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EAGZ,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EAGpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,qBAAqB,GACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,UAAU,CAAA;AAGjB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGrE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,WAAW,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Main client
|
|
2
|
-
export { StorageVectorsClient, VectorBucketScope, VectorIndexScope } from './StorageVectorsClient';
|
|
3
|
-
// API classes (for advanced usage)
|
|
4
|
-
export { default as VectorBucketApi } from './VectorBucketApi';
|
|
5
|
-
export { default as VectorIndexApi } from './VectorIndexApi';
|
|
6
|
-
export { default as VectorDataApi } from './VectorDataApi';
|
|
7
|
-
// Errors
|
|
8
|
-
export { StorageVectorsError, StorageVectorsApiError, StorageVectorsUnknownError, StorageVectorsErrorCode, isStorageVectorsError, } from './errors';
|
|
9
|
-
// Helper utilities
|
|
10
|
-
export { resolveFetch, resolveResponse, isPlainObject, normalizeToFloat32, validateVectorDimension, } from './helpers';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/vectors/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGlG,mCAAmC;AACnC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAuC1D,SAAS;AACT,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,UAAU,CAAA;AAKjB,mBAAmB;AACnB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,WAAW,CAAA"}
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { StorageVectorsError } from './errors';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for encryption at rest
|
|
4
|
-
* @property kmsKeyArn - ARN of the KMS key used for encryption
|
|
5
|
-
* @property sseType - Server-side encryption type (e.g., 'KMS')
|
|
6
|
-
*/
|
|
7
|
-
export interface EncryptionConfiguration {
|
|
8
|
-
kmsKeyArn?: string;
|
|
9
|
-
sseType?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Vector bucket metadata
|
|
13
|
-
* @property vectorBucketName - Unique name of the vector bucket
|
|
14
|
-
* @property creationTime - Unix timestamp of when the bucket was created
|
|
15
|
-
* @property encryptionConfiguration - Optional encryption settings
|
|
16
|
-
*/
|
|
17
|
-
export interface VectorBucket {
|
|
18
|
-
vectorBucketName: string;
|
|
19
|
-
creationTime?: number;
|
|
20
|
-
encryptionConfiguration?: EncryptionConfiguration;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Metadata configuration for vector index
|
|
24
|
-
* Defines which metadata keys should not be indexed for filtering
|
|
25
|
-
* @property nonFilterableMetadataKeys - Array of metadata keys that cannot be used in filters
|
|
26
|
-
*/
|
|
27
|
-
export interface MetadataConfiguration {
|
|
28
|
-
nonFilterableMetadataKeys?: string[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Supported data types for vectors
|
|
32
|
-
* Currently only float32 is supported
|
|
33
|
-
*/
|
|
34
|
-
export type VectorDataType = 'float32';
|
|
35
|
-
/**
|
|
36
|
-
* Distance metrics for vector similarity search
|
|
37
|
-
*/
|
|
38
|
-
export type DistanceMetric = 'cosine' | 'euclidean' | 'dotproduct';
|
|
39
|
-
/**
|
|
40
|
-
* Vector index configuration and metadata
|
|
41
|
-
* @property indexName - Unique name of the index within the bucket
|
|
42
|
-
* @property vectorBucketName - Name of the parent vector bucket
|
|
43
|
-
* @property dataType - Data type of vector components (currently only 'float32')
|
|
44
|
-
* @property dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
|
|
45
|
-
* @property distanceMetric - Similarity metric used for queries
|
|
46
|
-
* @property metadataConfiguration - Configuration for metadata filtering
|
|
47
|
-
* @property creationTime - Unix timestamp of when the index was created
|
|
48
|
-
*/
|
|
49
|
-
export interface VectorIndex {
|
|
50
|
-
indexName: string;
|
|
51
|
-
vectorBucketName: string;
|
|
52
|
-
dataType: VectorDataType;
|
|
53
|
-
dimension: number;
|
|
54
|
-
distanceMetric: DistanceMetric;
|
|
55
|
-
metadataConfiguration?: MetadataConfiguration;
|
|
56
|
-
creationTime?: number;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Vector data representation
|
|
60
|
-
* Vectors must be float32 arrays with dimensions matching the index
|
|
61
|
-
* @property float32 - Array of 32-bit floating point numbers
|
|
62
|
-
*/
|
|
63
|
-
export interface VectorData {
|
|
64
|
-
float32: number[];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Arbitrary JSON metadata attached to vectors
|
|
68
|
-
* Keys configured as non-filterable in the index can be stored but not queried
|
|
69
|
-
*/
|
|
70
|
-
export type VectorMetadata = Record<string, any>;
|
|
71
|
-
/**
|
|
72
|
-
* Single vector object for insertion/update
|
|
73
|
-
* @property key - Unique identifier for the vector
|
|
74
|
-
* @property data - Vector embedding data
|
|
75
|
-
* @property metadata - Optional arbitrary metadata
|
|
76
|
-
*/
|
|
77
|
-
export interface VectorObject {
|
|
78
|
-
key: string;
|
|
79
|
-
data: VectorData;
|
|
80
|
-
metadata?: VectorMetadata;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Vector object returned from queries with optional distance
|
|
84
|
-
* @property key - Unique identifier for the vector
|
|
85
|
-
* @property data - Vector embedding data (if requested)
|
|
86
|
-
* @property metadata - Arbitrary metadata (if requested)
|
|
87
|
-
* @property distance - Similarity distance from query vector (if requested)
|
|
88
|
-
*/
|
|
89
|
-
export interface VectorMatch {
|
|
90
|
-
key: string;
|
|
91
|
-
data?: VectorData;
|
|
92
|
-
metadata?: VectorMetadata;
|
|
93
|
-
distance?: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Options for fetching vector buckets
|
|
97
|
-
* @property prefix - Filter buckets by name prefix
|
|
98
|
-
* @property maxResults - Maximum number of results to return (default: 100)
|
|
99
|
-
* @property nextToken - Token for pagination from previous response
|
|
100
|
-
*/
|
|
101
|
-
export interface ListVectorBucketsOptions {
|
|
102
|
-
prefix?: string;
|
|
103
|
-
maxResults?: number;
|
|
104
|
-
nextToken?: string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Response from listing vector buckets
|
|
108
|
-
* @property vectorBuckets - Array of bucket names
|
|
109
|
-
* @property nextToken - Token for fetching next page (if more results exist)
|
|
110
|
-
*/
|
|
111
|
-
export interface ListVectorBucketsResponse {
|
|
112
|
-
vectorBuckets: {
|
|
113
|
-
vectorBucketName: string;
|
|
114
|
-
}[];
|
|
115
|
-
nextToken?: string;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Options for listing indexes within a bucket
|
|
119
|
-
* @property vectorBucketName - Name of the parent vector bucket
|
|
120
|
-
* @property prefix - Filter indexes by name prefix
|
|
121
|
-
* @property maxResults - Maximum number of results to return (default: 100)
|
|
122
|
-
* @property nextToken - Token for pagination from previous response
|
|
123
|
-
*/
|
|
124
|
-
export interface ListIndexesOptions {
|
|
125
|
-
vectorBucketName: string;
|
|
126
|
-
prefix?: string;
|
|
127
|
-
maxResults?: number;
|
|
128
|
-
nextToken?: string;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Response from listing indexes
|
|
132
|
-
* @property indexes - Array of index names
|
|
133
|
-
* @property nextToken - Token for fetching next page (if more results exist)
|
|
134
|
-
*/
|
|
135
|
-
export interface ListIndexesResponse {
|
|
136
|
-
indexes: {
|
|
137
|
-
indexName: string;
|
|
138
|
-
}[];
|
|
139
|
-
nextToken?: string;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Options for batch reading vectors
|
|
143
|
-
* @property vectorBucketName - Name of the vector bucket
|
|
144
|
-
* @property indexName - Name of the index
|
|
145
|
-
* @property keys - Array of vector keys to retrieve
|
|
146
|
-
* @property returnData - Whether to include vector data in response
|
|
147
|
-
* @property returnMetadata - Whether to include metadata in response
|
|
148
|
-
*/
|
|
149
|
-
export interface GetVectorsOptions {
|
|
150
|
-
vectorBucketName: string;
|
|
151
|
-
indexName: string;
|
|
152
|
-
keys: string[];
|
|
153
|
-
returnData?: boolean;
|
|
154
|
-
returnMetadata?: boolean;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Response from getting vectors
|
|
158
|
-
* @property vectors - Array of retrieved vector objects
|
|
159
|
-
*/
|
|
160
|
-
export interface GetVectorsResponse {
|
|
161
|
-
vectors: VectorMatch[];
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Options for batch inserting/updating vectors
|
|
165
|
-
* @property vectorBucketName - Name of the vector bucket
|
|
166
|
-
* @property indexName - Name of the index
|
|
167
|
-
* @property vectors - Array of vectors to insert/upsert (1-500 items)
|
|
168
|
-
*/
|
|
169
|
-
export interface PutVectorsOptions {
|
|
170
|
-
vectorBucketName: string;
|
|
171
|
-
indexName: string;
|
|
172
|
-
vectors: VectorObject[];
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Options for batch deleting vectors
|
|
176
|
-
* @property vectorBucketName - Name of the vector bucket
|
|
177
|
-
* @property indexName - Name of the index
|
|
178
|
-
* @property keys - Array of vector keys to delete (1-500 items)
|
|
179
|
-
*/
|
|
180
|
-
export interface DeleteVectorsOptions {
|
|
181
|
-
vectorBucketName: string;
|
|
182
|
-
indexName: string;
|
|
183
|
-
keys: string[];
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Options for listing/scanning vectors in an index
|
|
187
|
-
* Supports parallel scanning via segment configuration
|
|
188
|
-
* @property vectorBucketName - Name of the vector bucket
|
|
189
|
-
* @property indexName - Name of the index
|
|
190
|
-
* @property maxResults - Maximum number of results to return (default: 500, max: 1000)
|
|
191
|
-
* @property nextToken - Token for pagination from previous response
|
|
192
|
-
* @property returnData - Whether to include vector data in response
|
|
193
|
-
* @property returnMetadata - Whether to include metadata in response
|
|
194
|
-
* @property segmentCount - Total number of parallel segments (1-16)
|
|
195
|
-
* @property segmentIndex - Zero-based index of this segment (0 to segmentCount-1)
|
|
196
|
-
*/
|
|
197
|
-
export interface ListVectorsOptions {
|
|
198
|
-
vectorBucketName: string;
|
|
199
|
-
indexName: string;
|
|
200
|
-
maxResults?: number;
|
|
201
|
-
nextToken?: string;
|
|
202
|
-
returnData?: boolean;
|
|
203
|
-
returnMetadata?: boolean;
|
|
204
|
-
segmentCount?: number;
|
|
205
|
-
segmentIndex?: number;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Response from listing vectors
|
|
209
|
-
* @property vectors - Array of vector objects
|
|
210
|
-
* @property nextToken - Token for fetching next page (if more results exist)
|
|
211
|
-
*/
|
|
212
|
-
export interface ListVectorsResponse {
|
|
213
|
-
vectors: VectorMatch[];
|
|
214
|
-
nextToken?: string;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* JSON filter expression for metadata filtering
|
|
218
|
-
* Format and syntax depend on the S3 Vectors service implementation
|
|
219
|
-
*/
|
|
220
|
-
export type VectorFilter = Record<string, any>;
|
|
221
|
-
/**
|
|
222
|
-
* Options for querying similar vectors (ANN search)
|
|
223
|
-
* @property vectorBucketName - Name of the vector bucket
|
|
224
|
-
* @property indexName - Name of the index
|
|
225
|
-
* @property queryVector - Query vector to find similar vectors
|
|
226
|
-
* @property topK - Number of nearest neighbors to return (default: 10)
|
|
227
|
-
* @property filter - Optional JSON filter for metadata
|
|
228
|
-
* @property returnDistance - Whether to include distance scores
|
|
229
|
-
* @property returnMetadata - Whether to include metadata in results
|
|
230
|
-
*/
|
|
231
|
-
export interface QueryVectorsOptions {
|
|
232
|
-
vectorBucketName: string;
|
|
233
|
-
indexName: string;
|
|
234
|
-
queryVector: VectorData;
|
|
235
|
-
topK?: number;
|
|
236
|
-
filter?: VectorFilter;
|
|
237
|
-
returnDistance?: boolean;
|
|
238
|
-
returnMetadata?: boolean;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Response from vector similarity query
|
|
242
|
-
* @property vectors - Array of similar vectors ordered by distance
|
|
243
|
-
* @property distanceMetric - The distance metric used for the similarity search
|
|
244
|
-
*/
|
|
245
|
-
export interface QueryVectorsResponse {
|
|
246
|
-
vectors: VectorMatch[];
|
|
247
|
-
distanceMetric?: DistanceMetric;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Fetch-specific parameters like abort signals
|
|
251
|
-
* @property signal - AbortSignal for cancelling requests
|
|
252
|
-
*/
|
|
253
|
-
export interface VectorFetchParameters {
|
|
254
|
-
signal?: AbortSignal;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Standard response wrapper for successful operations
|
|
258
|
-
* @property data - Response data of type T
|
|
259
|
-
* @property error - Null on success
|
|
260
|
-
*/
|
|
261
|
-
export interface SuccessResponse<T> {
|
|
262
|
-
data: T;
|
|
263
|
-
error: null;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Standard response wrapper for failed operations
|
|
267
|
-
* @property data - Null on error
|
|
268
|
-
* @property error - StorageVectorsError with details
|
|
269
|
-
*/
|
|
270
|
-
export interface ErrorResponse {
|
|
271
|
-
data: null;
|
|
272
|
-
error: StorageVectorsError;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Union type for all API responses
|
|
276
|
-
* Follows the pattern: { data: T, error: null } | { data: null, error: Error }
|
|
277
|
-
*/
|
|
278
|
-
export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;
|
|
279
|
-
//# sourceMappingURL=types.d.ts.map
|