synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
114 lines (113 loc) • 2.67 kB
JavaScript
import { getProvenanceNode as N, getProvenanceEdge as y, getNodeId as a, NodeType as i } from "./ProvenanceUtils.js";
const E = (t) => {
const { entityHeader: o, rootEntityHeaders: e } = t;
return e?.find((n) => o.id == n.id && o.versionNumber == n.versionNumber) !== void 0;
}, c = (t, o) => o.find((d) => d.id === a(t)) === void 0, T = (t, o) => {
const e = {
type: i.ENTITY,
data: t
};
return o.find((d) => d.id === a(e));
}, P = (t, o, e) => e.find((n) => n.source === a(t) && n.target === a(o)) === void 0, p = (t) => {
const { newNodeProps: o, existingNodeProps: e, nodesCopy: d, edgesCopy: n } = t;
c(o, d) && d.push(N(o)), P(o, e, n) && n.push(y(o, e));
}, g = (t) => {
const { activity: o, entityHeader: e, nodesCopy: d, edgesCopy: n } = t, s = {
type: i.ACTIVITY,
data: o
}, r = {
type: i.ENTITY,
data: e
};
p({
newNodeProps: s,
existingNodeProps: r,
nodesCopy: d,
edgesCopy: n
});
}, C = (t) => {
const { entityHeader: o, itemCount: e = 0, nodesCopy: d, edgesCopy: n } = t, s = {
type: i.EXPAND,
data: {
itemCount: e,
entityHeader: o
}
}, r = {
type: i.ENTITY,
data: o
};
p({
newNodeProps: s,
existingNodeProps: r,
nodesCopy: d,
edgesCopy: n
});
}, f = (t) => {
const { ref: o, activity: e, nodesCopy: d, edgesCopy: n } = t, s = {
type: i.ENTITY_PLACEHOLDER,
data: o
}, r = {
type: i.ACTIVITY,
data: e
};
p({
newNodeProps: s,
existingNodeProps: r,
nodesCopy: d,
edgesCopy: n
});
}, v = (t) => {
const { entityHeader: o, nodesCopy: e, edgesCopy: d } = t, n = {
type: i.UNDEFINED,
data: o
}, s = {
type: i.ENTITY,
data: o
};
p({
newNodeProps: n,
existingNodeProps: s,
nodesCopy: e,
edgesCopy: d
});
}, I = (t) => {
const { usedURL: o, activity: e, nodesCopy: d, edgesCopy: n } = t, s = {
type: i.ACTIVITY,
data: e
}, r = {
type: i.EXTERNAL,
data: o
};
p({
newNodeProps: r,
existingNodeProps: s,
nodesCopy: d,
edgesCopy: n
});
}, x = (t) => {
const { entityHeader: o, activity: e, nodesCopy: d, edgesCopy: n } = t, s = {
type: i.ENTITY,
data: o
};
if (c(s, d) && (d.push(N(s)), e)) {
const r = {
type: i.ACTIVITY,
data: e
};
n.push(y(s, r));
}
};
export {
g as addActivityNode,
x as addEntityNode,
f as addEntityPlaceholderNode,
C as addExpandNode,
I as addExternalNode,
p as addNodeAndEdge,
v as addUndefinedNode,
T as findEntityNode,
P as isEdgeNotFound,
c as isNodeNotFound,
E as isRootEntity
};
//# sourceMappingURL=ProvenanceGraphUtils.js.map