@supabase/storage-js 2.113.0 → 2.114.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/dist/index.cjs CHANGED
@@ -908,6 +908,7 @@ var StorageFileApi = class extends BaseApiClient {
908
908
  * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
909
909
  * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
910
910
  * @param options The destination options.
911
+ * @param options.sourceVersionId The version id of the source object to move.
911
912
  * @returns Promise with response containing success message or error
912
913
  *
913
914
  * @example Move file
@@ -941,7 +942,8 @@ var StorageFileApi = class extends BaseApiClient {
941
942
  bucketId: _this6.bucketId,
942
943
  sourceKey: fromPath,
943
944
  destinationKey: toPath,
944
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
945
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket,
946
+ sourceVersionId: options === null || options === void 0 ? void 0 : options.sourceVersionId
945
947
  }, { headers: _this6.headers });
946
948
  });
947
949
  }
@@ -953,6 +955,7 @@ var StorageFileApi = class extends BaseApiClient {
953
955
  * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
954
956
  * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
955
957
  * @param options The destination options.
958
+ * @param options.sourceVersionId The version id of the source object to copy.
956
959
  * @returns Promise with response containing copied file path or error
957
960
  *
958
961
  * @example Copy file
@@ -986,7 +989,8 @@ var StorageFileApi = class extends BaseApiClient {
986
989
  bucketId: _this7.bucketId,
987
990
  sourceKey: fromPath,
988
991
  destinationKey: toPath,
989
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
992
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket,
993
+ sourceVersionId: options === null || options === void 0 ? void 0 : options.sourceVersionId
990
994
  }, { headers: _this7.headers })).Key };
991
995
  });
992
996
  }
@@ -1128,7 +1132,7 @@ var StorageFileApi = class extends BaseApiClient {
1128
1132
  * @category Storage
1129
1133
  * @subcategory File Buckets
1130
1134
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
1131
- * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache.
1135
+ * @param options Optional settings: `transform` to transform the asset before serving it to the client, `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache, and `versionId` to download a specific object version.
1132
1136
  * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
1133
1137
  * @returns BlobDownloadBuilder instance for downloading the file
1134
1138
  *
@@ -1192,6 +1196,7 @@ var StorageFileApi = class extends BaseApiClient {
1192
1196
  const query = new URLSearchParams();
1193
1197
  if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
1194
1198
  if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1199
+ if ((options === null || options === void 0 ? void 0 : options.versionId) != null) query.set("versionId", String(options.versionId));
1195
1200
  const queryString = query.toString();
1196
1201
  const _path = this._getFinalPath(path);
1197
1202
  const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
@@ -1209,6 +1214,7 @@ var StorageFileApi = class extends BaseApiClient {
1209
1214
  * @category Storage
1210
1215
  * @subcategory File Buckets
1211
1216
  * @param path The file path, including the file name. For example `folder/image.png`.
1217
+ * @param options Optional settings, including `versionId` to retrieve a specific object version.
1212
1218
  * @returns Promise with response containing file metadata or error
1213
1219
  *
1214
1220
  * @example Get file info
@@ -1224,11 +1230,14 @@ var StorageFileApi = class extends BaseApiClient {
1224
1230
  * }
1225
1231
  * ```
1226
1232
  */
1227
- async info(path) {
1233
+ async info(path, options) {
1228
1234
  var _this10 = this;
1229
1235
  const _path = _this10._getFinalPath(path);
1236
+ const query = new URLSearchParams();
1237
+ if ((options === null || options === void 0 ? void 0 : options.versionId) != null) query.set("versionId", String(options.versionId));
1238
+ const queryString = query.toString();
1230
1239
  return _this10.handleOperation(async () => {
1231
- return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
1240
+ return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}${queryString ? `?${queryString}` : ""}`, { headers: _this10.headers }));
1232
1241
  });
1233
1242
  }
1234
1243
  /**
@@ -1346,7 +1355,9 @@ var StorageFileApi = class extends BaseApiClient {
1346
1355
  *
1347
1356
  * @category Storage
1348
1357
  * @subcategory File Buckets
1349
- * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
1358
+ * @param paths An array of files to delete. Each entry is either a path (deletes whichever
1359
+ * version is currently at that path, e.g. `'folder/image.png'`), or `{ path, versionId }` to
1360
+ * delete an exact version current or archived (e.g. `{ path: 'folder/image.png', versionId: '...' }`).
1350
1361
  * @returns Promise with response containing array of deleted file objects or error
1351
1362
  *
1352
1363
  * @example Delete file
@@ -1365,6 +1376,14 @@ var StorageFileApi = class extends BaseApiClient {
1365
1376
  * }
1366
1377
  * ```
1367
1378
  *
1379
+ * @example Delete a specific object version
1380
+ * ```js
1381
+ * const { data, error } = await supabase
1382
+ * .storage
1383
+ * .from('avatars')
1384
+ * .remove([{ path: 'folder/avatar1.png', versionId: 'noncurrent-version-id' }])
1385
+ * ```
1386
+ *
1368
1387
  * @remarks
1369
1388
  * - RLS policy permissions required:
1370
1389
  * - `buckets` table permissions: none
@@ -1610,7 +1629,7 @@ var StorageFileApi = class extends BaseApiClient {
1610
1629
 
1611
1630
  //#endregion
1612
1631
  //#region src/lib/version.ts
1613
- const version = "2.113.0";
1632
+ const version = "2.114.0-canary.0";
1614
1633
 
1615
1634
  //#endregion
1616
1635
  //#region src/lib/constants.ts
@@ -1735,6 +1754,8 @@ var StorageBucketApi = class extends BaseApiClient {
1735
1754
  * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1736
1755
  * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
1737
1756
  * - default bucket type is `STANDARD`
1757
+ * @param options.versioningStatus the bucket's initial object versioning status.
1758
+ * The default value is `DISABLED`
1738
1759
  * @returns Promise with response containing newly created bucket name or error
1739
1760
  *
1740
1761
  * @example Create bucket
@@ -1773,7 +1794,8 @@ var StorageBucketApi = class extends BaseApiClient {
1773
1794
  type: options.type,
1774
1795
  public: options.public,
1775
1796
  file_size_limit: options.fileSizeLimit,
1776
- allowed_mime_types: options.allowedMimeTypes
1797
+ allowed_mime_types: options.allowedMimeTypes,
1798
+ versioning_status: options.versioningStatus
1777
1799
  }, { headers: _this3.headers });
1778
1800
  });
1779
1801
  }
@@ -1790,6 +1812,8 @@ var StorageBucketApi = class extends BaseApiClient {
1790
1812
  * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
1791
1813
  * The default value is null, which allows files with all mime types to be uploaded.
1792
1814
  * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1815
+ * @param options.versioningStatus the bucket's new object versioning status. `DISABLED` is not
1816
+ * valid here, there's no transition back to it once versioning has been touched.
1793
1817
  * @returns Promise with response containing success message or error
1794
1818
  *
1795
1819
  * @example Update bucket
@@ -1827,7 +1851,8 @@ var StorageBucketApi = class extends BaseApiClient {
1827
1851
  name: id,
1828
1852
  public: options.public,
1829
1853
  file_size_limit: options.fileSizeLimit,
1830
- allowed_mime_types: options.allowedMimeTypes
1854
+ allowed_mime_types: options.allowedMimeTypes,
1855
+ versioning_status: options.versioningStatus
1831
1856
  }, { headers: _this4.headers });
1832
1857
  });
1833
1858
  }