synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
84 lines (83 loc) • 2.17 kB
JavaScript
import { isEntityView as a, isDataset as c, isDatasetCollection as l, hasFilesInView as I } from "../../utils/functions/EntityTypeUtils.js";
import { ColumnTypeEnum as t } from "@sage-bionetworks/synapse-types";
const f = "You must be signed in to send results to an analysis platform.", S = (e, ...s) => {
const n = [];
return e?.selectColumns?.forEach((r, i) => {
s.includes(r.columnType) && n.push(i);
}), n;
}, m = (e, s, n) => {
const r = /* @__PURE__ */ new Set();
return e.queryResult?.queryResults.rows.forEach((i) => {
i.values.forEach((o, u) => {
o != null && n.includes(u) && !Object.prototype.hasOwnProperty.call(s, o) && o && r.add(o);
});
}), r;
};
function E(e) {
return e && (a(e) && I(e) || c(e));
}
const D = (e) => {
if (!e)
return;
const s = e?.filter(
(r) => r.columnType === t.ENTITYID
);
if (s?.length === 1)
return s[0].id;
const n = s?.filter((r) => r.name === "id");
if (n.length === 1)
return n[0].id;
};
function N(e) {
switch (e) {
case t.STRING:
case t.DOUBLE:
case t.BOOLEAN:
case t.INTEGER:
case t.DATE:
case t.LINK:
case t.MEDIUMTEXT:
case t.LARGETEXT:
return !0;
case t.USERID:
case t.ENTITYID:
case t.FILEHANDLEID:
case t.STRING_LIST:
case t.INTEGER_LIST:
case t.BOOLEAN_LIST:
case t.DATE_LIST:
case t.USERID_LIST:
case t.ENTITYID_LIST:
case t.EVALUATIONID:
case t.SUBMISSIONID:
case t.JSON:
return !1;
default:
return console.warn(`Unhandled column type: ${e}`), !1;
}
}
function O(e, s) {
if (E(e) && s?.find((n) => n.name === "id"))
return ["id"];
}
function L(e) {
return !!(e && (a(e) || c(e) || l(e)));
}
function p(e, s) {
return Object.entries(s).reduce(
(n, [r, i]) => (n[r] = e[i], n),
{}
);
}
export {
f as SEND_TO_ANALYSIS_PLATFORM_SIGN_IN_MESSAGE,
S as getColumnIndicesWithType,
O as getDefaultPrimaryKey,
D as getFileColumnModelId,
m as getUniqueEntities,
L as isEntityViewOrDatasetOrCollection,
E as isFileViewOrDataset,
N as isSortableColumn,
p as mapRowToRecord
};
//# sourceMappingURL=SynapseTableUtils.js.map