@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.cjs
CHANGED
|
@@ -6792,7 +6792,8 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6792
6792
|
});
|
|
6793
6793
|
xhr.addEventListener("error", () => reject(new Error("Presigned PUT network error")));
|
|
6794
6794
|
xhr.addEventListener("abort", () => reject(new Error("Presigned PUT aborted")));
|
|
6795
|
-
|
|
6795
|
+
const BlobGlobal = globalThis.Blob;
|
|
6796
|
+
xhr.send(BlobGlobal ? new BlobGlobal([body]) : body);
|
|
6796
6797
|
});
|
|
6797
6798
|
return;
|
|
6798
6799
|
}
|
|
@@ -6806,19 +6807,24 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6806
6807
|
throw new Error(`Presigned PUT failed: ${putRes.status} ${snippet.slice(0, 200)}`);
|
|
6807
6808
|
}
|
|
6808
6809
|
}
|
|
6810
|
+
var yieldToEventLoop = () => new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
6809
6811
|
async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
|
|
6810
6812
|
if (!options?.workspaceExtId) {
|
|
6811
6813
|
throw new ArbiError("uploadDocumentsDirect needs options.workspaceExtId (the key's workspace)");
|
|
6812
6814
|
}
|
|
6813
6815
|
if (files.length === 0) return { doc_ext_ids: [], skipped: [] };
|
|
6814
6816
|
const SECRETBOX_ENVELOPE_OVERHEAD = 40;
|
|
6815
|
-
const declared =
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6817
|
+
const declared = [];
|
|
6818
|
+
for (const f2 of files) {
|
|
6819
|
+
declared.push({
|
|
6820
|
+
file_name: f2.name,
|
|
6821
|
+
file_size: f2.data.length,
|
|
6822
|
+
encrypted_file_size: f2.data.length + SECRETBOX_ENVELOPE_OVERHEAD,
|
|
6823
|
+
content_hash: client.createContentHash(f2.data, workspaceKey),
|
|
6824
|
+
content_type: f2.contentType ?? null
|
|
6825
|
+
});
|
|
6826
|
+
await yieldToEventLoop();
|
|
6827
|
+
}
|
|
6822
6828
|
const initBody = {
|
|
6823
6829
|
files: declared,
|
|
6824
6830
|
shared: options.shared !== false,
|