@arbidocs/sdk 0.5.138 → 0.5.140
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/browser.cjs
CHANGED
|
@@ -6235,7 +6235,8 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6235
6235
|
});
|
|
6236
6236
|
xhr.addEventListener("error", () => reject(new Error("Presigned PUT network error")));
|
|
6237
6237
|
xhr.addEventListener("abort", () => reject(new Error("Presigned PUT aborted")));
|
|
6238
|
-
|
|
6238
|
+
const BlobGlobal = globalThis.Blob;
|
|
6239
|
+
xhr.send(BlobGlobal ? new BlobGlobal([body]) : body);
|
|
6239
6240
|
});
|
|
6240
6241
|
return;
|
|
6241
6242
|
}
|
|
@@ -6249,19 +6250,24 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
6249
6250
|
throw new Error(`Presigned PUT failed: ${putRes.status} ${snippet.slice(0, 200)}`);
|
|
6250
6251
|
}
|
|
6251
6252
|
}
|
|
6253
|
+
var yieldToEventLoop = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
6252
6254
|
async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
|
|
6253
6255
|
if (!options?.workspaceExtId) {
|
|
6254
6256
|
throw new ArbiError("uploadDocumentsDirect needs options.workspaceExtId (the key's workspace)");
|
|
6255
6257
|
}
|
|
6256
6258
|
if (files.length === 0) return { doc_ext_ids: [], skipped: [] };
|
|
6257
6259
|
const SECRETBOX_ENVELOPE_OVERHEAD = 40;
|
|
6258
|
-
const declared =
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6260
|
+
const declared = [];
|
|
6261
|
+
for (const f2 of files) {
|
|
6262
|
+
declared.push({
|
|
6263
|
+
file_name: f2.name,
|
|
6264
|
+
file_size: f2.data.length,
|
|
6265
|
+
encrypted_file_size: f2.data.length + SECRETBOX_ENVELOPE_OVERHEAD,
|
|
6266
|
+
content_hash: client.createContentHash(f2.data, workspaceKey),
|
|
6267
|
+
content_type: f2.contentType ?? null
|
|
6268
|
+
});
|
|
6269
|
+
await yieldToEventLoop();
|
|
6270
|
+
}
|
|
6265
6271
|
const initBody = {
|
|
6266
6272
|
files: declared,
|
|
6267
6273
|
shared: options.shared !== false,
|