@supabase/storage-js 2.116.0-canary.1 → 2.116.0-canary.3

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 CHANGED
@@ -777,7 +777,7 @@ const { data, error } = await index.queryVectors({
777
777
  })
778
778
 
779
779
  if (data) {
780
- data.matches.forEach((match) => {
780
+ data.vectors.forEach((match) => {
781
781
  console.log(`${match.key}: distance=${match.distance}`)
782
782
  console.log('Metadata:', match.metadata)
783
783
  })
@@ -996,11 +996,36 @@ const { data, error } = await index.queryVectors({
996
996
  })
997
997
 
998
998
  // Results ordered by similarity
999
- data?.matches.forEach((match) => {
999
+ data?.vectors.forEach((match) => {
1000
1000
  console.log(`${match.key}: distance=${match.distance}`)
1001
1001
  })
1002
1002
  ```
1003
1003
 
1004
+ S3 vector buckets support deep queries with `topK` up to 10,000, returning at most 100 vectors per response. Pass the response's `nextToken` with the same query to retrieve the next page:
1005
+
1006
+ ```typescript
1007
+ const query = {
1008
+ queryVector: { float32: embedding },
1009
+ topK: 1000,
1010
+ returnDistance: true,
1011
+ }
1012
+
1013
+ let nextToken: string | undefined
1014
+
1015
+ do {
1016
+ const { data, error } = await index.queryVectors({ ...query, nextToken })
1017
+ if (error) throw error
1018
+
1019
+ for (const vector of data.vectors) {
1020
+ console.log(`${vector.key}: distance=${vector.distance}`)
1021
+ }
1022
+
1023
+ nextToken = data.nextToken
1024
+ } while (nextToken)
1025
+ ```
1026
+
1027
+ The pgvector backend supports `topK` up to 100 and does not support `nextToken` pagination.
1028
+
1004
1029
  **Filter Syntax:**
1005
1030
  The `filter` parameter accepts arbitrary JSON for metadata filtering. Non-filterable keys (configured at index creation) cannot be used in filters but can still be returned.
1006
1031
 
package/dist/index.cjs CHANGED
@@ -1004,6 +1004,7 @@ var StorageFileApi = class extends BaseApiClient {
1004
1004
  * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
1005
1005
  * @param options.transform Transform the asset before serving it to the client.
1006
1006
  * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
1007
+ * @param options.versionId Create a signed URL for a specific object version rather than the current one.
1007
1008
  * @returns Promise with response containing signed URL or error
1008
1009
  *
1009
1010
  * @example Create Signed URL
@@ -1058,7 +1059,7 @@ var StorageFileApi = class extends BaseApiClient {
1058
1059
  return _this8.handleOperation(async () => {
1059
1060
  let _path = _this8._getFinalPath(path);
1060
1061
  const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
1061
- let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers });
1062
+ let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2(_objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), (options === null || options === void 0 ? void 0 : options.versionId) != null ? { versionId: options.versionId } : {}), { headers: _this8.headers });
1062
1063
  const query = new URLSearchParams();
1063
1064
  if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
1064
1065
  if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
@@ -1288,6 +1289,7 @@ var StorageFileApi = class extends BaseApiClient {
1288
1289
  * @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
1289
1290
  * @param options.transform Transform the asset before serving it to the client.
1290
1291
  * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
1292
+ * @param options.versionId Return the URL for a specific object version rather than the current one.
1291
1293
  * @returns Object with public URL
1292
1294
  *
1293
1295
  * @example Returns the URL for an asset in a public bucket
@@ -1343,6 +1345,7 @@ var StorageFileApi = class extends BaseApiClient {
1343
1345
  if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
1344
1346
  if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
1345
1347
  if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1348
+ if ((options === null || options === void 0 ? void 0 : options.versionId) != null) query.set("versionId", String(options.versionId));
1346
1349
  const queryString = query.toString();
1347
1350
  const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image" : "object";
1348
1351
  return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
@@ -1629,7 +1632,7 @@ var StorageFileApi = class extends BaseApiClient {
1629
1632
 
1630
1633
  //#endregion
1631
1634
  //#region src/lib/version.ts
1632
- const version = "2.116.0-canary.1";
1635
+ const version = "2.116.0-canary.3";
1633
1636
 
1634
1637
  //#endregion
1635
1638
  //#region src/lib/constants.ts
@@ -1992,8 +1995,8 @@ var StorageBucketApi = class extends BaseApiClient {
1992
1995
  * is overwritten. Send at least one rule. Call {@link deleteBucketLifecycle}
1993
1996
  * to remove the policy.
1994
1997
  *
1995
- * Each rule currently supports only `noncurrentVersionExpiration`. Set
1996
- * `filter` to `{}`. Prefix filters, tag filters, and current-object
1998
+ * Each rule currently supports only `noncurrentVersionExpiration`. `filter`
1999
+ * is required and must be `{}`. Prefix filters, tag filters, and current-object
1997
2000
  * expiration are rejected. Rule IDs must be unique. Omit `id` and the
1998
2001
  * server generates one.
1999
2002
  *
@@ -3154,7 +3157,7 @@ var VectorIndexScope = class extends VectorDataApi {
3154
3157
  * @category Storage
3155
3158
  * @subcategory Vector Buckets
3156
3159
  * @param options - Query options (bucket and index names automatically set)
3157
- * @returns Promise with response containing matches array of similar vectors ordered by distance or error
3160
+ * @returns Promise with response containing vectors ordered by distance, an optional pagination token, or an error
3158
3161
  *
3159
3162
  * @example Query similar vectors
3160
3163
  * ```typescript