@supabase/storage-js 2.93.2 → 2.93.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/dist/index.cjs CHANGED
@@ -320,6 +320,7 @@ async function _handleRequest(fetcher, method, url, options, parameters, body, n
320
320
  if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
321
321
  if (namespace === "vectors") {
322
322
  const contentType = result.headers.get("content-type");
323
+ if (result.headers.get("content-length") === "0" || result.status === 204) return {};
323
324
  if (!contentType || !contentType.includes("application/json")) return {};
324
325
  }
325
326
  return result.json();
@@ -352,6 +353,7 @@ function createFetchApi(namespace = "storage") {
352
353
  }
353
354
  const defaultApi = createFetchApi("storage");
354
355
  const { get, post, put, head, remove } = defaultApi;
356
+ const vectorsApi = createFetchApi("vectors");
355
357
 
356
358
  //#endregion
357
359
  //#region src/lib/common/BaseApiClient.ts
@@ -1262,7 +1264,7 @@ var StorageFileApi = class extends BaseApiClient {
1262
1264
 
1263
1265
  //#endregion
1264
1266
  //#region src/lib/version.ts
1265
- const version = "2.93.2";
1267
+ const version = "2.93.3";
1266
1268
 
1267
1269
  //#endregion
1268
1270
  //#region src/lib/constants.ts
@@ -1870,14 +1872,14 @@ var VectorIndexApi = class extends BaseApiClient {
1870
1872
  async createIndex(options) {
1871
1873
  var _this = this;
1872
1874
  return _this.handleOperation(async () => {
1873
- return await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
1875
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
1874
1876
  });
1875
1877
  }
1876
1878
  /** Retrieves metadata for a specific vector index */
1877
1879
  async getIndex(vectorBucketName, indexName) {
1878
1880
  var _this2 = this;
1879
1881
  return _this2.handleOperation(async () => {
1880
- return await post(_this2.fetch, `${_this2.url}/GetIndex`, {
1882
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
1881
1883
  vectorBucketName,
1882
1884
  indexName
1883
1885
  }, { headers: _this2.headers });
@@ -1887,14 +1889,14 @@ var VectorIndexApi = class extends BaseApiClient {
1887
1889
  async listIndexes(options) {
1888
1890
  var _this3 = this;
1889
1891
  return _this3.handleOperation(async () => {
1890
- return await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
1892
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
1891
1893
  });
1892
1894
  }
1893
1895
  /** Deletes a vector index and all its data */
1894
1896
  async deleteIndex(vectorBucketName, indexName) {
1895
1897
  var _this4 = this;
1896
1898
  return _this4.handleOperation(async () => {
1897
- return await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
1899
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
1898
1900
  vectorBucketName,
1899
1901
  indexName
1900
1902
  }, { headers: _this4.headers }) || {};
@@ -1921,14 +1923,14 @@ var VectorDataApi = class extends BaseApiClient {
1921
1923
  var _this = this;
1922
1924
  if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
1923
1925
  return _this.handleOperation(async () => {
1924
- return await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
1926
+ return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
1925
1927
  });
1926
1928
  }
1927
1929
  /** Retrieves vectors by their keys in batch */
1928
1930
  async getVectors(options) {
1929
1931
  var _this2 = this;
1930
1932
  return _this2.handleOperation(async () => {
1931
- return await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
1933
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
1932
1934
  });
1933
1935
  }
1934
1936
  /** Lists vectors in an index with pagination */
@@ -1941,14 +1943,14 @@ var VectorDataApi = class extends BaseApiClient {
1941
1943
  }
1942
1944
  }
1943
1945
  return _this3.handleOperation(async () => {
1944
- return await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
1946
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
1945
1947
  });
1946
1948
  }
1947
1949
  /** Queries for similar vectors using approximate nearest neighbor search */
1948
1950
  async queryVectors(options) {
1949
1951
  var _this4 = this;
1950
1952
  return _this4.handleOperation(async () => {
1951
- return await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
1953
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
1952
1954
  });
1953
1955
  }
1954
1956
  /** Deletes vectors by their keys in batch (1-500 per request) */
@@ -1956,7 +1958,7 @@ var VectorDataApi = class extends BaseApiClient {
1956
1958
  var _this5 = this;
1957
1959
  if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
1958
1960
  return _this5.handleOperation(async () => {
1959
- return await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
1961
+ return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
1960
1962
  });
1961
1963
  }
1962
1964
  };
@@ -1979,28 +1981,28 @@ var VectorBucketApi = class extends BaseApiClient {
1979
1981
  async createBucket(vectorBucketName) {
1980
1982
  var _this = this;
1981
1983
  return _this.handleOperation(async () => {
1982
- return await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
1984
+ return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
1983
1985
  });
1984
1986
  }
1985
1987
  /** Retrieves metadata for a specific vector bucket */
1986
1988
  async getBucket(vectorBucketName) {
1987
1989
  var _this2 = this;
1988
1990
  return _this2.handleOperation(async () => {
1989
- return await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
1991
+ return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
1990
1992
  });
1991
1993
  }
1992
1994
  /** Lists vector buckets with optional filtering and pagination */
1993
1995
  async listBuckets(options = {}) {
1994
1996
  var _this3 = this;
1995
1997
  return _this3.handleOperation(async () => {
1996
- return await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
1998
+ return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
1997
1999
  });
1998
2000
  }
1999
2001
  /** Deletes a vector bucket (must be empty first) */
2000
2002
  async deleteBucket(vectorBucketName) {
2001
2003
  var _this4 = this;
2002
2004
  return _this4.handleOperation(async () => {
2003
- return await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
2005
+ return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
2004
2006
  });
2005
2007
  }
2006
2008
  };