@supabase/storage-js 2.108.3-canary.2 → 2.110.0-canary.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 CHANGED
@@ -32,13 +32,17 @@
32
32
 
33
33
  ## Requirements
34
34
 
35
- - **Node.js 20 or later** (Node.js 18 support dropped as of October 31, 2025)
35
+ - **Node.js 22 or later** (Node.js 20 support dropped in v2.110.0)
36
36
  - For browser support, all modern browsers are supported
37
37
 
38
38
  > ⚠️ **Node.js 18 Deprecation Notice**
39
39
  >
40
40
  > Node.js 18 reached end-of-life on April 30, 2025. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/37217), support for Node.js 18 was dropped on October 31, 2025.
41
41
 
42
+ > ⚠️ **Node.js 20 Deprecation Notice**
43
+ >
44
+ > Node.js 20 reached end-of-life on April 30, 2026. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/45715), support for Node.js 20 was dropped in v2.110.0.
45
+
42
46
  ## Features
43
47
 
44
48
  - **File Storage**: Upload, download, list, move, and delete files
package/dist/index.cjs CHANGED
@@ -1367,6 +1367,57 @@ var StorageFileApi = class extends BaseApiClient {
1367
1367
  });
1368
1368
  }
1369
1369
  /**
1370
+ * Purges the CDN cache for a single object in this bucket.
1371
+ *
1372
+ * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server
1373
+ * issues a CDN invalidation for the object and returns `{ message: 'success' }`.
1374
+ *
1375
+ * **Requires the `service_role` key.** The underlying endpoint enforces
1376
+ * `service_role` JWT — calls made with the anon key or a user JWT will be
1377
+ * rejected by the server.
1378
+ *
1379
+ * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must
1380
+ * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant
1381
+ * feature enabled, otherwise the server returns an error.
1382
+ *
1383
+ * Operates on a single object path. There is no wildcard or recursion: pass
1384
+ * the exact path of the object you want invalidated.
1385
+ *
1386
+ * @category Storage
1387
+ * @subcategory File Buckets
1388
+ * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`.
1389
+ * @param options Optional purge cache options.
1390
+ * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact.
1391
+ * @param parameters Optional fetch parameters such as an `AbortController` signal.
1392
+ * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.
1393
+ *
1394
+ * @example Purge a single cached object
1395
+ * ```js
1396
+ * const { data, error } = await supabase
1397
+ * .storage
1398
+ * .from('avatars')
1399
+ * .purgeCache('folder/avatar1.png')
1400
+ * ```
1401
+ *
1402
+ * @example Purge only transformations for a single object
1403
+ * ```js
1404
+ * const { data, error } = await supabase
1405
+ * .storage
1406
+ * .from('avatars')
1407
+ * .purgeCache('folder/avatar1.png', { transformations: true })
1408
+ * ```
1409
+ */
1410
+ async purgeCache(path, options, parameters) {
1411
+ var _this13 = this;
1412
+ return _this13.handleOperation(async () => {
1413
+ const _path = _this13._getFinalPath(path);
1414
+ const query = new URLSearchParams();
1415
+ if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true");
1416
+ const queryString = query.toString();
1417
+ return await remove(_this13.fetch, `${_this13.url}/cdn/${_path}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this13.headers }, parameters);
1418
+ });
1419
+ }
1420
+ /**
1370
1421
  * Get file metadata
1371
1422
  * @param id the file id to retrieve metadata
1372
1423
  */
@@ -1458,14 +1509,14 @@ var StorageFileApi = class extends BaseApiClient {
1458
1509
  * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1459
1510
  */
1460
1511
  async list(path, options, parameters) {
1461
- var _this13 = this;
1462
- return _this13.handleOperation(async () => {
1512
+ var _this14 = this;
1513
+ return _this14.handleOperation(async () => {
1463
1514
  const sortBy = (options === null || options === void 0 ? void 0 : options.sortBy) ? _objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS.sortBy), options.sortBy) : DEFAULT_SEARCH_OPTIONS.sortBy;
1464
1515
  const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, {
1465
1516
  sortBy,
1466
1517
  prefix: path || ""
1467
1518
  });
1468
- return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
1519
+ return await post(_this14.fetch, `${_this14.url}/object/list/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
1469
1520
  });
1470
1521
  }
1471
1522
  /**
@@ -1516,10 +1567,10 @@ var StorageFileApi = class extends BaseApiClient {
1516
1567
  * ```
1517
1568
  */
1518
1569
  async listV2(options, parameters) {
1519
- var _this14 = this;
1520
- return _this14.handleOperation(async () => {
1570
+ var _this15 = this;
1571
+ return _this15.handleOperation(async () => {
1521
1572
  const body = _objectSpread2({}, options);
1522
- return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
1573
+ return await post(_this15.fetch, `${_this15.url}/object/list-v2/${_this15.bucketId}`, body, { headers: _this15.headers }, parameters);
1523
1574
  });
1524
1575
  }
1525
1576
  encodeMetadata(metadata) {
@@ -1548,7 +1599,7 @@ var StorageFileApi = class extends BaseApiClient {
1548
1599
 
1549
1600
  //#endregion
1550
1601
  //#region src/lib/version.ts
1551
- const version = "2.108.3-canary.2";
1602
+ const version = "2.110.0-canary.0";
1552
1603
 
1553
1604
  //#endregion
1554
1605
  //#region src/lib/constants.ts
@@ -1844,6 +1895,51 @@ var StorageBucketApi = class extends BaseApiClient {
1844
1895
  return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
1845
1896
  });
1846
1897
  }
1898
+ /**
1899
+ * Purges the CDN cache for an entire bucket.
1900
+ *
1901
+ * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server
1902
+ * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`.
1903
+ *
1904
+ * **Requires the `service_role` key.** The underlying endpoint enforces
1905
+ * `service_role` JWT — calls made with the anon key or a user JWT will be
1906
+ * rejected by the server.
1907
+ *
1908
+ * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must
1909
+ * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant
1910
+ * feature enabled, otherwise the server returns an error.
1911
+ *
1912
+ * @category Storage
1913
+ * @subcategory File Buckets
1914
+ * @param id The unique identifier of the bucket you would like to purge from cache.
1915
+ * @param options Optional purge cache options.
1916
+ * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact.
1917
+ * @param parameters Optional fetch parameters such as an `AbortController` signal.
1918
+ * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.
1919
+ *
1920
+ * @example Purge cache for an entire bucket
1921
+ * ```js
1922
+ * const { data, error } = await supabase
1923
+ * .storage
1924
+ * .purgeBucketCache('avatars')
1925
+ * ```
1926
+ *
1927
+ * @example Purge only transformations for an entire bucket
1928
+ * ```js
1929
+ * const { data, error } = await supabase
1930
+ * .storage
1931
+ * .purgeBucketCache('avatars', { transformations: true })
1932
+ * ```
1933
+ */
1934
+ async purgeBucketCache(id, options, parameters) {
1935
+ var _this7 = this;
1936
+ return _this7.handleOperation(async () => {
1937
+ const query = new URLSearchParams();
1938
+ if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true");
1939
+ const queryString = query.toString();
1940
+ return await remove(_this7.fetch, `${_this7.url}/cdn/${id}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters);
1941
+ });
1942
+ }
1847
1943
  listBucketOptionsToQueryString(options) {
1848
1944
  const params = {};
1849
1945
  if (options) {