@meistrari/vault-sdk 1.6.3 → 1.7.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
@@ -221,7 +221,7 @@ async function detectFileMimeType(blob) {
221
221
  }
222
222
 
223
223
  const name = "@meistrari/vault-sdk";
224
- const version = "1.6.3";
224
+ const version = "1.7.0";
225
225
  const license = "UNLICENSED";
226
226
  const repository = {
227
227
  type: "git",
@@ -846,9 +846,29 @@ class VaultFile {
846
846
  const headers = new Headers();
847
847
  headers.set("Content-Type", mimeType);
848
848
  headers.set("Content-Length", contentLength.toString());
849
+ let content = stream;
850
+ if (stream instanceof ReadableStream && typeof Bun !== "undefined") {
851
+ console.warn(
852
+ "[Vault SDK - WARNING] Buffering file upload due to Bun fetch implementation. Large files may cause memory issues. Consider using Node.js for streaming uploads.",
853
+ { fileName: this.name, fileSize: contentLength }
854
+ );
855
+ const chunks = [];
856
+ const reader = stream.getReader();
857
+ try {
858
+ while (true) {
859
+ const { done, value } = await reader.read();
860
+ if (done)
861
+ break;
862
+ chunks.push(value);
863
+ }
864
+ } finally {
865
+ reader.releaseLock();
866
+ }
867
+ content = new Blob(chunks, { type: mimeType });
868
+ }
849
869
  await wrappedFetch(uploadUrl, {
850
870
  method: "PUT",
851
- body: stream,
871
+ body: content,
852
872
  headers,
853
873
  signal
854
874
  });
package/dist/index.mjs CHANGED
@@ -219,7 +219,7 @@ async function detectFileMimeType(blob) {
219
219
  }
220
220
 
221
221
  const name = "@meistrari/vault-sdk";
222
- const version = "1.6.3";
222
+ const version = "1.7.0";
223
223
  const license = "UNLICENSED";
224
224
  const repository = {
225
225
  type: "git",
@@ -844,9 +844,29 @@ class VaultFile {
844
844
  const headers = new Headers();
845
845
  headers.set("Content-Type", mimeType);
846
846
  headers.set("Content-Length", contentLength.toString());
847
+ let content = stream;
848
+ if (stream instanceof ReadableStream && typeof Bun !== "undefined") {
849
+ console.warn(
850
+ "[Vault SDK - WARNING] Buffering file upload due to Bun fetch implementation. Large files may cause memory issues. Consider using Node.js for streaming uploads.",
851
+ { fileName: this.name, fileSize: contentLength }
852
+ );
853
+ const chunks = [];
854
+ const reader = stream.getReader();
855
+ try {
856
+ while (true) {
857
+ const { done, value } = await reader.read();
858
+ if (done)
859
+ break;
860
+ chunks.push(value);
861
+ }
862
+ } finally {
863
+ reader.releaseLock();
864
+ }
865
+ content = new Blob(chunks, { type: mimeType });
866
+ }
847
867
  await wrappedFetch(uploadUrl, {
848
868
  method: "PUT",
849
- body: stream,
869
+ body: content,
850
870
  headers,
851
871
  signal
852
872
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/vault-sdk",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",