(
connections: { [key: string]: ServiceConnection[] },
afterNodeInsertion: boolean
)
| 22 | * 2. Be inserted in the patch mutation, afterNodeInsertion = true |
| 23 | */ |
| 24 | export 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) |
no outgoing calls
no test coverage detected