@arbidocs/sdk 0.5.138 → 0.5.139
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/browser.cjs +14 -8
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +14 -8
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/examples/human-review/package.json +1 -1
- package/examples/react-chat/package.json +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6783,7 +6783,8 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6783
6783
|
});
|
|
6784
6784
|
xhr.addEventListener("error", () => reject(new Error("Presigned PUT network error")));
|
|
6785
6785
|
xhr.addEventListener("abort", () => reject(new Error("Presigned PUT aborted")));
|
|
6786
|
-
|
|
6786
|
+
const BlobGlobal = globalThis.Blob;
|
|
6787
|
+
xhr.send(BlobGlobal ? new BlobGlobal([body]) : body);
|
|
6787
6788
|
});
|
|
6788
6789
|
return;
|
|
6789
6790
|
}
|
|
@@ -6797,19 +6798,24 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6797
6798
|
throw new Error(`Presigned PUT failed: ${putRes.status} ${snippet.slice(0, 200)}`);
|
|
6798
6799
|
}
|
|
6799
6800
|
}
|
|
6801
|
+
var yieldToEventLoop = () => new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
6800
6802
|
async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
|
|
6801
6803
|
if (!options?.workspaceExtId) {
|
|
6802
6804
|
throw new ArbiError("uploadDocumentsDirect needs options.workspaceExtId (the key's workspace)");
|
|
6803
6805
|
}
|
|
6804
6806
|
if (files.length === 0) return { doc_ext_ids: [], skipped: [] };
|
|
6805
6807
|
const SECRETBOX_ENVELOPE_OVERHEAD = 40;
|
|
6806
|
-
const declared =
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6808
|
+
const declared = [];
|
|
6809
|
+
for (const f2 of files) {
|
|
6810
|
+
declared.push({
|
|
6811
|
+
file_name: f2.name,
|
|
6812
|
+
file_size: f2.data.length,
|
|
6813
|
+
encrypted_file_size: f2.data.length + SECRETBOX_ENVELOPE_OVERHEAD,
|
|
6814
|
+
content_hash: createContentHash(f2.data, workspaceKey),
|
|
6815
|
+
content_type: f2.contentType ?? null
|
|
6816
|
+
});
|
|
6817
|
+
await yieldToEventLoop();
|
|
6818
|
+
}
|
|
6813
6819
|
const initBody = {
|
|
6814
6820
|
files: declared,
|
|
6815
6821
|
shared: options.shared !== false,
|