Skip to content

Commit 85f9167

Browse files
authored
Merge pull request #94 from cloudgraphdev/beta
RELEASE: 0.23.0
2 parents 53a92f5 + b93f91d commit 85f9167

6 files changed

Lines changed: 64 additions & 823 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# [0.23.0-beta.1](https://github.com/cloudgraphdev/cli/compare/0.22.0...0.23.0-beta.1) (2022-07-07)
2+
3+
4+
### Features
5+
6+
* adapt CLI to pass data instead of queries ([1244617](https://github.com/cloudgraphdev/cli/commit/1244617f21abb7ae0686b16487c246b51be8dd21))
7+
* update sdk version ([fc6ad87](https://github.com/cloudgraphdev/cli/commit/fc6ad873761d02cf9e5961e4713ac027d99d0bb0))
8+
9+
# [0.23.0-alpha.1](https://github.com/cloudgraphdev/cli/compare/0.22.0...0.23.0-alpha.1) (2022-07-07)
10+
11+
12+
### Features
13+
14+
* adapt CLI to pass data instead of queries ([1244617](https://github.com/cloudgraphdev/cli/commit/1244617f21abb7ae0686b16487c246b51be8dd21))
15+
* update sdk version ([fc6ad87](https://github.com/cloudgraphdev/cli/commit/fc6ad873761d02cf9e5961e4713ac027d99d0bb0))
16+
117
# [0.22.0](https://github.com/cloudgraphdev/cli/compare/0.21.4...0.22.0) (2022-05-27)
218

319

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ EXAMPLES
14501450
$ cg init aws -r [Specify resources to crawl]
14511451
```
14521452

1453-
_See code: [src/commands/init.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/init.ts)_
1453+
_See code: [src/commands/init.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/init.ts)_
14541454

14551455
## `cg launch [PROVIDER]`
14561456

@@ -1482,7 +1482,7 @@ EXAMPLES
14821482
$ cg launch
14831483
```
14841484

1485-
_See code: [src/commands/launch.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/launch.ts)_
1485+
_See code: [src/commands/launch.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/launch.ts)_
14861486

14871487
## `cg load [PROVIDER]`
14881488

@@ -1516,7 +1516,7 @@ EXAMPLES
15161516
$ cg load aws [Load data for AWS]
15171517
```
15181518

1519-
_See code: [src/commands/load.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/load.ts)_
1519+
_See code: [src/commands/load.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/load.ts)_
15201520

15211521
## `cg policy [PROVIDER]`
15221522

@@ -1545,7 +1545,7 @@ DESCRIPTION
15451545
Commands to manage policy pack modules, run $ cg policy for more info.
15461546
```
15471547

1548-
_See code: [src/commands/policy/index.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/policy/index.ts)_
1548+
_See code: [src/commands/policy/index.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/policy/index.ts)_
15491549

15501550
## `cg policy add [PROVIDER]`
15511551

@@ -1758,7 +1758,7 @@ DESCRIPTION
17581758
Commands to manage provider modules, run $ cg provider for more info.
17591759
```
17601760

1761-
_See code: [src/commands/provider/index.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/provider/index.ts)_
1761+
_See code: [src/commands/provider/index.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/provider/index.ts)_
17621762

17631763
## `cg provider add [PROVIDER]`
17641764

@@ -1980,7 +1980,7 @@ EXAMPLES
19801980
$ cg scan aws --no-serve [Do not start the query engine]
19811981
```
19821982

1983-
_See code: [src/commands/scan.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/scan.ts)_
1983+
_See code: [src/commands/scan.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/scan.ts)_
19841984

19851985
## `cg serve [PROVIDER]`
19861986

@@ -2012,7 +2012,7 @@ EXAMPLES
20122012
$ cg serve
20132013
```
20142014

2015-
_See code: [src/commands/serve.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/serve.ts)_
2015+
_See code: [src/commands/serve.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/serve.ts)_
20162016

20172017
## `cg teardown [PROVIDER]`
20182018

@@ -2034,7 +2034,7 @@ EXAMPLES
20342034
$ cg teardown --delete-image
20352035
```
20362036

2037-
_See code: [src/commands/teardown.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/teardown.ts)_
2037+
_See code: [src/commands/teardown.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/teardown.ts)_
20382038

20392039
## `cg update [PROVIDER]`
20402040

@@ -2070,5 +2070,5 @@ EXAMPLES
20702070
$ cg update
20712071
```
20722072

2073-
_See code: [src/commands/update.ts](https://github.com/cloudgraphdev/cli/blob/v0.22.0/src/commands/update.ts)_
2073+
_See code: [src/commands/update.ts](https://github.com/cloudgraphdev/cli/blob/v0.23.0-beta.1/src/commands/update.ts)_
20742074
<!-- commandsstop -->

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cloudgraph/cli",
33
"description": "Scan your cloud infrastructure data and query it with GraphQL",
4-
"version": "0.22.0",
4+
"version": "0.23.0-beta.1",
55
"author": "AutoCloud",
66
"license": "MPL-2.0",
77
"publishConfig": {
@@ -15,7 +15,7 @@
1515
},
1616
"bugs": "https://github.com/cloudgraphdev/cli/issues",
1717
"dependencies": {
18-
"@cloudgraph/sdk": "^0.18.1",
18+
"@cloudgraph/sdk": "^0.21.0",
1919
"@graphql-tools/load-files": "^6.3.2",
2020
"@graphql-tools/merge": "^8.2.0",
2121
"@oclif/core": "1.6.1",

src/commands/scan.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import chalk from 'chalk'
22
import fs from 'fs'
33
import path from 'path'
4-
import { Opts, pluginMap, PluginType, StorageEngine } from '@cloudgraph/sdk'
4+
import { Opts, pluginMap, PluginType, ProviderData, StorageEngine } from '@cloudgraph/sdk'
55
import { range } from 'lodash'
66

77
import Command from './base'
@@ -34,6 +34,7 @@ export default class Scan extends Command {
3434
private async plugins({
3535
storage: { isRunning, engine },
3636
flags,
37+
providerData,
3738
}: {
3839
storage: {
3940
isRunning: boolean
@@ -42,6 +43,7 @@ export default class Scan extends Command {
4243
flags: {
4344
[flag: string]: any
4445
}
46+
providerData: ProviderData
4547
}): Promise<void> {
4648
const config = this.getCGConfig('cloudGraph')
4749
const { plugins = {} } = config
@@ -80,6 +82,7 @@ export default class Scan extends Command {
8082
await PluginInstance.execute({
8183
storageRunning: isRunning,
8284
storageEngine: engine,
85+
providerData,
8386
processConnectionsBetweenEntities,
8487
})
8588
}
@@ -167,6 +170,7 @@ export default class Scan extends Command {
167170
* loop through providers and attempt to scan each of them
168171
*/
169172
const failedProviderList: string[] = []
173+
const allProviderData: ProviderData = { entities: [], connections: {} }
170174
for (const provider of allProviders) {
171175
this.logger.info(
172176
`Beginning ${chalk.italic.green('SCAN')} for ${provider}`
@@ -203,6 +207,10 @@ export default class Scan extends Command {
203207
`${chalk.italic.green(provider)} data scanned successfully`
204208
)
205209

210+
// Merge all providers data
211+
allProviderData.entities.push(...providerData.entities)
212+
Object.assign(allProviderData.connections, providerData.connections)
213+
206214
// Handle schema, write provider and combined schema to file and store in Dgraph if running
207215
this.logger.startSpinner(
208216
`updating ${chalk.italic.green('Schema')} for ${chalk.italic.green(
@@ -297,6 +305,7 @@ export default class Scan extends Command {
297305
isRunning: storageRunning,
298306
engine: storageEngine,
299307
},
308+
providerData: allProviderData
300309
})
301310
}
302311

src/utils/data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const processConnectionsBetweenEntities = ({
135135
// Add service mutation to promises array
136136
storageEngine.push({
137137
query:
138-
mutation ||
138+
mutation?.toString() ||
139139
(provider &&
140140
generateMutation({ type: 'add', provider, entity, schemaMap })) ||
141141
'',
@@ -166,7 +166,7 @@ export function insertEntitiesAndConnections({
166166
})
167167
if (storageRunning) {
168168
const query =
169-
mutation ||
169+
mutation?.toString() ||
170170
generateMutation({ type: 'add', provider, entity, schemaMap })
171171
storageEngine.push({ query, input: connectedData, name })
172172
}

0 commit comments

Comments
 (0)