MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / filterConnectionsByPriorityOfInsertion

Function filterConnectionsByPriorityOfInsertion

src/utils/data.ts:24–39  ·  view source on GitHub ↗
(
  connections: { [key: string]: ServiceConnection[] },
  afterNodeInsertion: boolean
)

Source from the content-addressed store, hash-verified

22 * 2. Be inserted in the patch mutation, afterNodeInsertion = true
23 */
24export const filterConnectionsByPriorityOfInsertion = (
25 connections: { [key: string]: ServiceConnection[] },
26 afterNodeInsertion: boolean
27): { [key: string]: ServiceConnection[] } => {
28 const filteredConnections: { [key: string]: ServiceConnection[] } = {}
29 Object.entries(connections).map(([id, sConnections]) => {
30 const fConnections = sConnections.filter(
31 (i: ServiceConnection) =>
32 !!i.insertAfterNodeInsertion === afterNodeInsertion
33 )
34 if (!isEmpty(fConnections)) {
35 filteredConnections[id] = fConnections
36 }
37 })
38 return filteredConnections
39}
40// the afterNodeInsertion flag provides input
41// to whether filter connections that need to be inserted
42// in the main add mutation(batch mutation, that pushes fresh nodes and connections)

Callers 2

getConnectedEntityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected