@postrun/react 3.0.0 → 3.2.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 +1 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -44
- package/dist/index.d.ts +45 -44
- package/dist/index.js +2 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -679,26 +679,6 @@ function Connect({
|
|
|
679
679
|
});
|
|
680
680
|
return children(api);
|
|
681
681
|
}
|
|
682
|
-
var MEDIA_POLL_INTERVAL_MS = 1500;
|
|
683
|
-
var MEDIA_POLL_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
684
|
-
async function pollUntilSettled(client, id, signal, onTick) {
|
|
685
|
-
let latest;
|
|
686
|
-
await pWaitFor__default.default(
|
|
687
|
-
async () => {
|
|
688
|
-
if (signal.aborted) {
|
|
689
|
-
throw new DOMException("Upload aborted", "AbortError");
|
|
690
|
-
}
|
|
691
|
-
latest = (await js.mediaGet({ client, path: { id } })).data;
|
|
692
|
-
onTick?.(latest);
|
|
693
|
-
return latest.status === "ready" || latest.status === "failed";
|
|
694
|
-
},
|
|
695
|
-
{ interval: MEDIA_POLL_INTERVAL_MS, timeout: MEDIA_POLL_TIMEOUT_MS }
|
|
696
|
-
);
|
|
697
|
-
if (!latest) {
|
|
698
|
-
throw new Error("Media polling returned no result.");
|
|
699
|
-
}
|
|
700
|
-
return latest;
|
|
701
|
-
}
|
|
702
682
|
async function runUpload(client, file, options, signal, callbacks) {
|
|
703
683
|
const created = (await js.mediaCreate({
|
|
704
684
|
client,
|
|
@@ -721,7 +701,7 @@ async function runUpload(client, file, options, signal, callbacks) {
|
|
|
721
701
|
});
|
|
722
702
|
}
|
|
723
703
|
callbacks.onProcessing();
|
|
724
|
-
return
|
|
704
|
+
return js.waitForMedia(created.id, { client, signal, onPoll: callbacks.onPoll });
|
|
725
705
|
}
|
|
726
706
|
function toFileArray(files) {
|
|
727
707
|
if (files instanceof File) return [files];
|