Skip to content

Commit

Permalink
feat: Support EntityMutations object
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranceschit committed May 11, 2022
1 parent 0ea6f82 commit 10cdbd0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CloudGraph, {
ServiceConnection,
Client,
Logger,
EntityMutations,
} from '@cloudgraph/sdk'

import { scanReport, scanDataType, scanResult } from '../reports'
Expand Down Expand Up @@ -133,9 +134,11 @@ export const processConnectionsBetweenEntities = ({

if (storageRunning) {
// Add service mutation to promises array
const query: string =
(mutation as EntityMutations)?.upsert || (mutation as string)
storageEngine.push({
query:
mutation ||
query ||
(provider &&
generateMutation({ type: 'add', provider, entity, schemaMap })) ||
'',
Expand Down Expand Up @@ -165,10 +168,16 @@ export function insertEntitiesAndConnections({
return getConnectedEntity(service, providerData, name)
})
if (storageRunning) {
const query =
mutation ||
generateMutation({ type: 'add', provider, entity, schemaMap })
storageEngine.push({ query, input: connectedData, name })
const query: string =
(mutation as EntityMutations)?.upsert || (mutation as string)
storageEngine.push({
query:
query ||
generateMutation({ type: 'add', provider, entity, schemaMap }) ||
'',
input: connectedData,
name,
})
}
} catch (error) {
logger.debug(error)
Expand Down

0 comments on commit 10cdbd0

Please sign in to comment.