@supabase/storage-js 3.0.0-next.6 → 3.0.0-next.7
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 +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -3
- 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 +21 -2
package/dist/index.cjs
CHANGED
|
@@ -710,19 +710,24 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
710
710
|
return _this3.handleOperation(async () => {
|
|
711
711
|
let body;
|
|
712
712
|
const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
713
|
-
|
|
713
|
+
let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
714
|
+
const metadata = options.metadata;
|
|
714
715
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
715
716
|
body = new FormData();
|
|
716
717
|
body.append("cacheControl", options.cacheControl);
|
|
718
|
+
if (metadata) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
717
719
|
body.append("", fileBody);
|
|
718
720
|
} else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
|
|
719
721
|
body = fileBody;
|
|
720
|
-
body.append("cacheControl", options.cacheControl);
|
|
722
|
+
if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
|
|
723
|
+
if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
721
724
|
} else {
|
|
722
725
|
body = fileBody;
|
|
723
726
|
headers["cache-control"] = `max-age=${options.cacheControl}`;
|
|
724
727
|
headers["content-type"] = options.contentType;
|
|
728
|
+
if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata));
|
|
725
729
|
}
|
|
730
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
726
731
|
return {
|
|
727
732
|
path: cleanPath,
|
|
728
733
|
fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
|
|
@@ -1481,7 +1486,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1481
1486
|
|
|
1482
1487
|
//#endregion
|
|
1483
1488
|
//#region src/lib/version.ts
|
|
1484
|
-
const version = "3.0.0-next.
|
|
1489
|
+
const version = "3.0.0-next.7";
|
|
1485
1490
|
|
|
1486
1491
|
//#endregion
|
|
1487
1492
|
//#region src/lib/constants.ts
|