@supabase/storage-js 2.102.2-canary.0 → 2.103.0-canary.1
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 +34 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +11 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +34 -24
- 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 +68 -57
package/dist/index.cjs
CHANGED
|
@@ -902,6 +902,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
902
902
|
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
903
903
|
* @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.
|
|
904
904
|
* @param options.transform Transform the asset before serving it to the client.
|
|
905
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
905
906
|
* @returns Promise with response containing signed URL or error
|
|
906
907
|
*
|
|
907
908
|
* @example Create Signed URL
|
|
@@ -957,9 +958,12 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
957
958
|
let _path = _this8._getFinalPath(path);
|
|
958
959
|
const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
|
|
959
960
|
let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers });
|
|
960
|
-
const
|
|
961
|
+
const query = new URLSearchParams();
|
|
962
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
963
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
964
|
+
const queryString = query.toString();
|
|
961
965
|
const returnedPath = hasTransform && data.signedURL.includes("/object/sign/") ? data.signedURL.replace("/object/sign/", "/render/image/sign/") : data.signedURL;
|
|
962
|
-
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${
|
|
966
|
+
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${queryString ? `&${queryString}` : ""}`) };
|
|
963
967
|
});
|
|
964
968
|
}
|
|
965
969
|
/**
|
|
@@ -969,6 +973,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
969
973
|
* @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
|
|
970
974
|
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
971
975
|
* @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.
|
|
976
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
972
977
|
* @returns Promise with response containing array of objects with signedUrl, path, and error or error
|
|
973
978
|
*
|
|
974
979
|
* @example Create Signed URLs
|
|
@@ -1013,8 +1018,11 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1013
1018
|
expiresIn,
|
|
1014
1019
|
paths
|
|
1015
1020
|
}, { headers: _this9.headers });
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1021
|
+
const query = new URLSearchParams();
|
|
1022
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
1023
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1024
|
+
const queryString = query.toString();
|
|
1025
|
+
return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null }));
|
|
1018
1026
|
});
|
|
1019
1027
|
}
|
|
1020
1028
|
/**
|
|
@@ -1023,6 +1031,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1023
1031
|
* @category File Buckets
|
|
1024
1032
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
1025
1033
|
* @param options.transform Transform the asset before serving it to the client.
|
|
1034
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
1026
1035
|
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
1027
1036
|
* @returns BlobDownloadBuilder instance for downloading the file
|
|
1028
1037
|
*
|
|
@@ -1083,10 +1092,12 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1083
1092
|
*/
|
|
1084
1093
|
download(path, options, parameters) {
|
|
1085
1094
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1095
|
+
const query = new URLSearchParams();
|
|
1096
|
+
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
1097
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1098
|
+
const queryString = query.toString();
|
|
1088
1099
|
const _path = this._getFinalPath(path);
|
|
1089
|
-
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
|
|
1100
|
+
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
|
|
1090
1101
|
headers: this.headers,
|
|
1091
1102
|
noResolveJson: true
|
|
1092
1103
|
}, parameters);
|
|
@@ -1167,6 +1178,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1167
1178
|
* @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
|
|
1168
1179
|
* @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.
|
|
1169
1180
|
* @param options.transform Transform the asset before serving it to the client.
|
|
1181
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
1170
1182
|
* @returns Object with public URL
|
|
1171
1183
|
*
|
|
1172
1184
|
* @example Returns the URL for an asset in a public bucket
|
|
@@ -1218,15 +1230,13 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1218
1230
|
*/
|
|
1219
1231
|
getPublicUrl(path, options) {
|
|
1220
1232
|
const _path = this._getFinalPath(path);
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
if (
|
|
1233
|
+
const query = new URLSearchParams();
|
|
1234
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
1235
|
+
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
1236
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1237
|
+
const queryString = query.toString();
|
|
1224
1238
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image" : "object";
|
|
1225
|
-
|
|
1226
|
-
if (transformationQuery !== "") _queryString.push(transformationQuery);
|
|
1227
|
-
let queryString = _queryString.join("&");
|
|
1228
|
-
if (queryString !== "") queryString = `?${queryString}`;
|
|
1229
|
-
return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}${queryString}`) } };
|
|
1239
|
+
return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
|
|
1230
1240
|
}
|
|
1231
1241
|
/**
|
|
1232
1242
|
* Deletes files within the same bucket
|
|
@@ -1429,20 +1439,20 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1429
1439
|
_removeEmptyFolders(path) {
|
|
1430
1440
|
return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/");
|
|
1431
1441
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
if (transform.width)
|
|
1435
|
-
if (transform.height)
|
|
1436
|
-
if (transform.resize)
|
|
1437
|
-
if (transform.format)
|
|
1438
|
-
if (transform.quality)
|
|
1439
|
-
return
|
|
1442
|
+
/** Modifies the `query`, appending values the from `transform` */
|
|
1443
|
+
applyTransformOptsToQuery(query, transform) {
|
|
1444
|
+
if (transform.width) query.set("width", transform.width.toString());
|
|
1445
|
+
if (transform.height) query.set("height", transform.height.toString());
|
|
1446
|
+
if (transform.resize) query.set("resize", transform.resize);
|
|
1447
|
+
if (transform.format) query.set("format", transform.format);
|
|
1448
|
+
if (transform.quality) query.set("quality", transform.quality.toString());
|
|
1449
|
+
return query;
|
|
1440
1450
|
}
|
|
1441
1451
|
};
|
|
1442
1452
|
|
|
1443
1453
|
//#endregion
|
|
1444
1454
|
//#region src/lib/version.ts
|
|
1445
|
-
const version = "2.
|
|
1455
|
+
const version = "2.103.0-canary.1";
|
|
1446
1456
|
|
|
1447
1457
|
//#endregion
|
|
1448
1458
|
//#region src/lib/constants.ts
|