synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
180 lines (179 loc) • 6.43 kB
JavaScript
import { jsx as o, jsxs as F, Fragment as x } from "react/jsx-runtime";
import { useState as K, createElement as M } from "react";
import { useGetEntity as I } from "../../synapse-queries/entity/useEntity.js";
import "../../utils/PermissionLevelToAccessType.js";
import { DEFAULT_PAGE_SIZE as O, BUNDLE_MASK_QUERY_FACETS as b, BUNDLE_MASK_QUERY_COUNT as B, BUNDLE_MASK_QUERY_SELECT_COLUMNS as P, BUNDLE_MASK_QUERY_COLUMN_MODELS as v, BUNDLE_MASK_QUERY_RESULTS as V, BUNDLE_MASK_LAST_UPDATED_ON as W } from "../../utils/SynapseConstants.js";
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 { parseEntityIdFromSqlStatement as C, getAdditionalFilters as Y } from "../../utils/functions/SqlFunctions.js";
import { isTable as k } from "../../utils/functions/EntityTypeUtils.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "@mui/material";
import "@sage-bionetworks/synapse-client";
import "@sage-bionetworks/synapse-types";
import "../../utils/types/IsType.js";
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 "react-router";
import { FullTextSearch as z } from "../FullTextSearch/FullTextSearch.js";
import { QueryContextConsumer as j } from "../QueryContext/QueryContext.js";
import { QueryVisualizationWrapper as G } from "../QueryVisualizationWrapper/QueryVisualizationWrapper.js";
import { QueryVisualizationContextConsumer as J } from "../QueryVisualizationWrapper/QueryVisualizationContext.js";
import { QueryWrapper as Z } from "../QueryWrapper/QueryWrapper.js";
import { RowSetView as H } from "../QueryWrapperPlotNav/RowSetView.js";
import { NoContentPlaceholderType as f } from "../SynapseTable/NoContentPlaceholderType.js";
import X from "../SynapseTable/SearchV2.js";
import { SqlEditor as $ } from "../SynapseTable/SqlEditor.js";
import tt from "../SynapseTable/TopLevelControls/TopLevelControls.js";
import { CustomControls as ot } from "../SynapseTable/CustomControls/CustomControls.js";
import rt from "../TotalQueryResults.js";
const et = (t) => ({
partMask: b | B | P | v | V | W,
entityId: C(t.sql),
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest",
query: {
limit: O,
offset: 0,
...t
}
});
function it(t) {
if (t.query)
return t.query;
{
const r = Y(
t.searchParams,
t.sqlOperator,
t.additionalFiltersSessionStorageKey
);
return {
sql: t.sql,
additionalFilters: r,
offset: 0
};
}
}
function Jt(t) {
const { hideDownload: r } = t, {
showAccessColumn: y,
sql: S,
hideAddToDownloadListColumn: m = r,
hideQueryCount: E,
name: h,
showTopLevelControls: e = !1,
searchConfiguration: s,
unitDescription: _ = "Results",
rgbIndex: T,
showLastUpdatedOn: q,
noContentPlaceholderType: Q = e ? f.INTERACTIVE : f.STATIC,
cardConfiguration: l,
tableConfiguration: L,
shouldDeepLink: U,
customControls: g,
...i
} = t, [a, w] = K(1), u = () => {
w(a + 1);
}, A = t.query?.sql ?? S ?? "", D = it(t), p = et(D), N = C(A), { data: n } = I(N), R = JSON.stringify(p) + a;
return /* @__PURE__ */ M(
Z,
{
...i,
initQueryRequest: p,
shouldDeepLink: U,
key: R
},
/* @__PURE__ */ o(
G,
{
rgbIndex: T,
unitDescription: _,
showLastUpdatedOn: q,
noContentPlaceholderType: Q,
...i,
children: /* @__PURE__ */ o(j, { children: (d) => {
if (d === void 0)
throw new Error(
"No queryContext found when calling QueryContextConsumer"
);
return /* @__PURE__ */ o(J, { children: (c) => {
if (c === void 0)
throw new Error(
"No queryVisualizationContext found when calling QueryVisualizationContextConsumer"
);
return /* @__PURE__ */ F(x, { children: [
e && /* @__PURE__ */ o(
tt,
{
showColumnSelection: !0,
name: h,
hideDownload: m,
hideQueryCount: E,
hideFacetFilterControl: !0,
hideVisualizationsControl: !0,
remount: u,
customControls: g
}
),
n && k(n) && n.isSearchEnabled ? /* @__PURE__ */ o(
z,
{
ftsConfig: s?.ftsConfig
}
) : /* @__PURE__ */ o(
X,
{
...s,
queryContext: d,
queryVisualizationContext: c
}
),
/* @__PURE__ */ o($, {}),
e && /* @__PURE__ */ o(rt, { frontText: "" }),
/* @__PURE__ */ o(
ot,
{
customControls: t.customControls,
remount: u
}
),
/* @__PURE__ */ o(
H,
{
tableConfiguration: l ? void 0 : {
...L,
// if exist, use tableConfiguration property
showAccessColumn: y,
hideAddToDownloadListColumn: m,
...i
},
cardConfiguration: l
}
)
] });
} });
} })
}
)
);
}
export {
Jt as default,
et as generateInitQueryRequest,
it as getQueryFromProps
};
//# sourceMappingURL=StandaloneQueryWrapper.js.map