synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
54 lines (53 loc) • 1.28 kB
JavaScript
import { calculateMd5 as F } from "../../synapse-client/SynapseClient.js";
import { useMutation as w } from "@tanstack/react-query";
import { uploadToS3 as x } from "./UploadToS3.js";
import { useCreateExternalFileHandle as H } from "./useFileHandle.js";
function T(r) {
const { mutateAsync: l } = H();
return w({
...r,
mutationFn: async (i) => {
const {
accessKey: c,
secretKey: s,
bucketName: d,
endpoint: m,
fileName: t,
contentType: o,
blob: e,
progressCallback: p,
keyPrefixUUID: u,
storageLocationId: f,
onMd5Computed: n,
abortController: y
} = i, b = await F(e);
n && n();
const a = `${u}/${t}`;
return await x(
e,
a,
m,
c,
s,
d,
o,
y,
p
), await l({
externalFileHandleInterface: {
concreteType: "org.sagebionetworks.repo.model.file.ExternalObjectStoreFileHandle",
contentMd5: b,
contentSize: e.size,
contentType: o,
fileKey: a,
fileName: t,
storageLocationId: f
}
});
}
});
}
export {
T as useDirectUploadToS3
};
//# sourceMappingURL=useDirectUploadToS3.js.map