@supabase/storage-js 2.119.0-canary.0 → 2.119.0-canary.2
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 +19 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -21
- package/dist/index.mjs.map +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +1 -1
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageFileApi.ts +22 -31
package/dist/index.cjs
CHANGED
|
@@ -1247,6 +1247,14 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1247
1247
|
/**
|
|
1248
1248
|
* Checks the existence of a file.
|
|
1249
1249
|
*
|
|
1250
|
+
* This reads the object's metadata, so the result is `false` only when Storage reports that the
|
|
1251
|
+
* key does not exist: an error with code `NoSuchKey`, or an HTTP 404 with no error code. In that
|
|
1252
|
+
* case `data` is `false` and `error` holds the original error.
|
|
1253
|
+
*
|
|
1254
|
+
* Every other failure throws instead of returning `false`, including an invalid or expired JWT
|
|
1255
|
+
* (`InvalidJWT`), a missing bucket (`NoSuchBucket`) and network errors. With `throwOnError()`,
|
|
1256
|
+
* a missing key throws as well.
|
|
1257
|
+
*
|
|
1250
1258
|
* @category Storage
|
|
1251
1259
|
* @subcategory File Buckets
|
|
1252
1260
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
@@ -1261,26 +1269,16 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1261
1269
|
* ```
|
|
1262
1270
|
*/
|
|
1263
1271
|
async exists(path) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
if (isStorageError(error)) {
|
|
1275
|
-
var _error$originalError;
|
|
1276
|
-
const status = error instanceof StorageApiError ? error.status : error instanceof StorageUnknownError ? (_error$originalError = error.originalError) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status : void 0;
|
|
1277
|
-
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
1278
|
-
data: false,
|
|
1279
|
-
error
|
|
1280
|
-
};
|
|
1281
|
-
}
|
|
1282
|
-
throw error;
|
|
1283
|
-
}
|
|
1272
|
+
const { error } = await this.info(path);
|
|
1273
|
+
if (!error) return {
|
|
1274
|
+
data: true,
|
|
1275
|
+
error: null
|
|
1276
|
+
};
|
|
1277
|
+
if (error instanceof StorageApiError && (error.code === "NoSuchKey" || error.status === 404 && error.code === void 0)) return {
|
|
1278
|
+
data: false,
|
|
1279
|
+
error
|
|
1280
|
+
};
|
|
1281
|
+
throw error;
|
|
1284
1282
|
}
|
|
1285
1283
|
/**
|
|
1286
1284
|
* A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
|
|
@@ -1649,7 +1647,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1649
1647
|
|
|
1650
1648
|
//#endregion
|
|
1651
1649
|
//#region src/lib/version.ts
|
|
1652
|
-
const version = "2.119.0-canary.
|
|
1650
|
+
const version = "2.119.0-canary.2";
|
|
1653
1651
|
|
|
1654
1652
|
//#endregion
|
|
1655
1653
|
//#region src/lib/constants.ts
|