synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
122 lines (121 loc) • 4.29 kB
JavaScript
import { jsx as r, jsxs as n, Fragment as i } from "react/jsx-runtime";
import "../../synapse-client/SynapseClient.js";
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
import "@sage-bionetworks/synapse-types";
import "../../utils/functions/EntityTypeUtils.js";
import { BUNDLE_MASK_COMBINED_SQL as w } from "../../utils/SynapseConstants.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "@tanstack/react-query";
import "../../utils/PermissionLevelToAccessType.js";
import { useState as D, useEffect as S, useMemo as s } from "react";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Link as m } from "@mui/material";
import "../../utils/hooks/useCookiePreferences.js";
import "../../utils/hooks/useSourceAppConfigs.js";
import "universal-cookie";
import "../../utils/AppUtils/session/ApplicationSessionContext.js";
import "../../utils/context/FullContextProvider.js";
import "../../utils/context/DocumentMetadataContext.js";
import '../../style/components/_spinner.css';/* empty css */
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "react-router";
import "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
import { useGetQueryResultBundleWithAsyncStatus as N } from "../../synapse-queries/entity/useGetQueryResultBundle.js";
import { PYTHON_CLIENT_IMPORT_AND_LOGIN as q, R_CLIENT_IMPORT_AND_LOGIN as _ } from "../DownloadCart/DirectProgrammaticDownload.js";
import { ProgrammaticInstructionsModal as I } from "../ProgrammaticInstructionsModal/ProgrammaticInstructionsModal.js";
function no({
queryBundleRequest: p,
onHide: d
}) {
const [o, c] = D("..."), {
data: h,
isLoading: f,
isPlaceholderData: y
} = N(
{
...p,
partMask: w
},
{
placeholderData: (e) => e,
throwOnError: !0
}
), t = h?.responseBody?.combinedSql, a = f || y;
S(() => {
if (t && !a) {
const e = t.toUpperCase().indexOf("FROM SYN"), g = `SELECT * ${t.substring(
e
)}`;
c(g);
}
}, [t, a]);
const u = s(
() => o.replace(/(["`])/g, "\\$1"),
[o]
), l = s(
() => o.replace(/"/g, '\\"'),
[o]
);
return /* @__PURE__ */ r(
I,
{
show: !0,
onClose: d,
title: "Download Programmatically",
cliNotes: /* @__PURE__ */ r(i, { children: "This command line code will download Synapse files AND file annotations to your working directory." }),
cliCode: `synapse get -q "${u}"`,
rNotes: /* @__PURE__ */ n(i, { children: [
"This R code will download file annotations only. Use",
" ",
/* @__PURE__ */ n(
m,
{
target: "_blank",
rel: "noopener noreferrer",
href: "https://help.synapse.org/docs/Get-Started-with-Downloading-Data.2004254837.html#GetStartedwithDownloadingData-DownloadingFiles",
children: [
"synGet",
"()"
]
}
),
" ",
"to loop over the list of Synapse IDs from the file annotations to download files."
] }),
rCode: `${_}
query <- synTableQuery("${l}")
read.table(query$filepath, sep = ",")`,
pythonNotes: /* @__PURE__ */ n(i, { children: [
"This Python code will download file annotations only. Use",
" ",
/* @__PURE__ */ r(
m,
{
target: "_blank",
rel: "noopener noreferrer",
href: "https://help.synapse.org/docs/Get-Started-with-Downloading-Data.2004254837.html#GetStartedwithDownloadingData-DownloadingFiles",
children: "syn.get"
}
),
" ",
"to loop over the list of Synapse IDs from the file annotations to download files."
] }),
pythonCode: `${q}
query = syn.tableQuery("${l}")
query.asDataFrame()`
}
);
}
export {
no as ProgrammaticTableDownload,
no as default
};
//# sourceMappingURL=ProgrammaticTableDownload.js.map