synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
107 lines (106 loc) • 3.9 kB
JavaScript
import { isColumnSingleValueQueryFilter as c, isColumnMultiValueFunctionQueryFilter as d } from "../types/IsType.js";
import { cloneDeep as r, isMatch as m, isEqualWith as f, isNil as a, isEqual as h } from "lodash-es";
import { BUNDLE_MASK_QUERY_RESULTS as i, VALUE_NOT_SET as F } from "../SynapseConstants.js";
import { isEntityView as u, hasFilesInView as C, isDatasetCollection as g, isFileView as p, isDataset as w } from "./EntityTypeUtils.js";
const j = (e, t) => e == null ? -1 : t?.selectColumns?.findIndex((n) => n.name === e) ?? -1, E = (e, t) => {
const n = e.toLowerCase();
return t?.queryResult?.queryResults.headers.findIndex((o) => o.name.toLowerCase() === n) ?? -1;
};
function I(e, t = []) {
return t.reduce((n, o, l) => o.columnType === e ? [...n, l] : n, []);
}
const T = (e, t) => e == null || t == null || e.length === 0 || t.length === 0 ? !1 : e.filter((o) => !N(o) && t.find((l) => l.name === o.columnName)).length > 0, N = (e) => e.facetType === "enumeration" && e.facetValues.length == 1 && e.facetValues[0].value == F;
function P(e, t) {
const n = t?.columnName;
if (n && e) {
const o = r(e), l = o.facets?.filter(
(s) => s.columnName.toLowerCase() !== n.toLowerCase()
);
return o.facets = l, o;
} else
return e;
}
function v(e, t) {
const n = Array.isArray(e.selectedFacets) && e.selectedFacets.filter(
(l) => l.columnName.toLowerCase() !== t?.columnName?.toLowerCase()
).length > 0, o = Array.isArray(e.additionalFilters) && e.additionalFilters.filter(
(l) => c(l) || d(l) ? l.columnName.toLowerCase() !== t?.columnName?.toLowerCase() : !0
).length > 0;
return n || o;
}
function D(e, t) {
return (
// EntityViews without the file bit mask cannot contain files
e && u(e) && !C(e) || // DatasetCollections cannot contain files
e && g(e) ? !1 : !!(t || e && (u(e) && p(e) || w(e)))
);
}
function R(e, t) {
const n = r(e);
delete n.limit, delete n.offset, delete n.sort;
const o = r(t);
return delete o.limit, delete o.offset, delete o.sort, f(n, o, (l, s) => a(l) && a(s) ? !0 : h(l, s));
}
function Q(e) {
const t = r(e);
return t.limit == null && delete t.limit, (t.offset == null || t.offset == 0) && delete t.offset, (t.sort == null || t.sort.length == 0) && delete t.sort, (t.selectedFacets == null || t.selectedFacets.length == 0) && delete t.selectedFacets, (t.additionalFilters == null || t.additionalFilters.length == 0) && delete t.additionalFilters, t;
}
function k(e, t) {
let n = t.find((o) => o.name === e.columnName);
return e.jsonPath && n && n.jsonSubColumns && (n = n.jsonSubColumns.find(
(o) => o.jsonPath === e.jsonPath
)), n;
}
function x(e, t) {
return t?.find(
(n) => L(e, n)
);
}
function L(e, t) {
return m(
{
columnName: e.columnName,
jsonPath: e.jsonPath
},
{ columnName: t.columnName, jsonPath: t.jsonPath }
);
}
function y(e) {
const t = {
...e,
// Get just the rows (if they were originally requested)
partMask: e.partMask & i
}, n = {
...e,
query: {
...e.query,
// Remove query fields that don't affect the results.
offset: void 0,
limit: void 0,
sort: void 0
},
// Bitwise remove the query result flag from the mask
partMask: e.partMask & ~i
};
return {
rowDataRequest: t,
queryMetadataRequest: n
};
}
export {
D as canTableQueryBeAddedToDownloadList,
L as facetObjectMatchesDefinition,
k as getCorrespondingColumnForFacet,
x as getCorrespondingSelectedFacet,
j as getFieldIndex,
E as getHeaderIndex,
I as getTypeIndices,
T as hasFacetedSelectColumn,
v as hasResettableFilters,
N as isSingleNotSetValue,
y as partitionQueryBundleRequestIntoRowsAndMetadata,
R as queryRequestsHaveSameTotalResults,
Q as removeEmptyQueryParams,
P as removeLockedColumnFromFacetData
};
//# sourceMappingURL=queryUtils.js.map