@jupiterone/integration-sdk-cli 9.5.0 → 9.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/src/commands/generate.d.ts +1 -0
  2. package/dist/src/commands/generate.js +29 -0
  3. package/dist/src/commands/generate.js.map +1 -0
  4. package/dist/src/commands/index.d.ts +1 -0
  5. package/dist/src/commands/index.js +1 -0
  6. package/dist/src/commands/index.js.map +1 -1
  7. package/dist/src/generator/actions.d.ts +4 -0
  8. package/dist/src/generator/actions.js +38 -0
  9. package/dist/src/generator/actions.js.map +1 -0
  10. package/dist/src/generator/configFieldsFlow.d.ts +7 -0
  11. package/dist/src/generator/configFieldsFlow.js +53 -0
  12. package/dist/src/generator/configFieldsFlow.js.map +1 -0
  13. package/dist/src/generator/entitiesFlow.d.ts +7 -0
  14. package/dist/src/generator/entitiesFlow.js +175 -0
  15. package/dist/src/generator/entitiesFlow.js.map +1 -0
  16. package/dist/src/generator/helpers.d.ts +2 -0
  17. package/dist/src/generator/helpers.js +9 -0
  18. package/dist/src/generator/helpers.js.map +1 -0
  19. package/dist/src/generator/newIntegration.d.ts +1 -0
  20. package/dist/src/generator/newIntegration.js +124 -0
  21. package/dist/src/generator/newIntegration.js.map +1 -0
  22. package/dist/src/generator/relationshipsFlow.d.ts +7 -0
  23. package/dist/src/generator/relationshipsFlow.js +65 -0
  24. package/dist/src/generator/relationshipsFlow.js.map +1 -0
  25. package/dist/src/generator/stepTemplate/index.ts.hbs +24 -0
  26. package/dist/src/generator/stepsFlow.d.ts +10 -0
  27. package/dist/src/generator/stepsFlow.js +94 -0
  28. package/dist/src/generator/stepsFlow.js.map +1 -0
  29. package/dist/src/generator/template/.env.example.hbs +3 -0
  30. package/dist/src/generator/template/.eslintignore.hbs +1 -0
  31. package/dist/src/generator/template/.eslintrc.hbs +6 -0
  32. package/dist/src/generator/template/.github/pull_request_template.md.hbs +17 -0
  33. package/dist/src/generator/template/.github/workflows/build.yml.hbs +53 -0
  34. package/dist/src/generator/template/.github/workflows/codeql-analysis.yml.hbs +69 -0
  35. package/dist/src/generator/template/.github/workflows/integration-deployment.yml.hbs +36 -0
  36. package/dist/src/generator/template/.github/workflows/peril.yml.hbs +90 -0
  37. package/dist/src/generator/template/.github/workflows/questions.yml.hbs +40 -0
  38. package/dist/src/generator/template/.gitignore.hbs +8 -0
  39. package/dist/src/generator/template/.node-version.hbs +1 -0
  40. package/dist/src/generator/template/.prettierignore.hbs +5 -0
  41. package/dist/src/generator/template/CHANGELOG.md.hbs +9 -0
  42. package/dist/src/generator/template/CODEOWNERS.hbs +3 -0
  43. package/dist/src/generator/template/Dockerfile.hbs +25 -0
  44. package/dist/src/generator/template/LICENSE.hbs +373 -0
  45. package/dist/src/generator/template/README.md.hbs +114 -0
  46. package/dist/src/generator/template/docs/development.md.hbs +28 -0
  47. package/dist/src/generator/template/docs/jupiterone.md.hbs +1 -0
  48. package/dist/src/generator/template/husky.config.js.hbs +1 -0
  49. package/dist/src/generator/template/jest.config.js.hbs +1 -0
  50. package/dist/src/generator/template/jupiterone/questions/questions.yaml.hbs +16 -0
  51. package/dist/src/generator/template/lint-staged.config.js.hbs +1 -0
  52. package/dist/src/generator/template/package.json.hbs +63 -0
  53. package/dist/src/generator/template/prettier.config.js.hbs +1 -0
  54. package/dist/src/generator/template/scripts/execute.sh.hbs +7 -0
  55. package/dist/src/generator/template/src/client.ts.hbs +23 -0
  56. package/dist/src/generator/template/src/config.ts.hbs +39 -0
  57. package/dist/src/generator/template/src/index.ts.hbs +14 -0
  58. package/dist/src/generator/template/src/steps/constants.ts.hbs +34 -0
  59. package/dist/src/generator/template/src/steps/index.ts.hbs +7 -0
  60. package/dist/src/generator/template/src/validateInvocation.ts.hbs +23 -0
  61. package/dist/src/generator/template/test/README.md.hbs +4 -0
  62. package/dist/src/generator/template/test/config.ts.hbs +30 -0
  63. package/dist/src/generator/template/test/recording.ts.hbs +74 -0
  64. package/dist/src/generator/template/tsconfig.dist.json.hbs +13 -0
  65. package/dist/src/generator/template/tsconfig.json.hbs +7 -0
  66. package/dist/src/generator/util.d.ts +9 -0
  67. package/dist/src/generator/util.js +35 -0
  68. package/dist/src/generator/util.js.map +1 -0
  69. package/dist/src/index.js +2 -1
  70. package/dist/src/index.js.map +1 -1
  71. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  72. package/package.json +12 -6
  73. package/src/commands/generate.ts +28 -0
  74. package/src/commands/index.ts +1 -0
  75. package/src/generator/actions.ts +37 -0
  76. package/src/generator/configFieldsFlow.ts +60 -0
  77. package/src/generator/entitiesFlow.ts +185 -0
  78. package/src/generator/helpers.ts +6 -0
  79. package/src/generator/newIntegration.ts +137 -0
  80. package/src/generator/relationshipsFlow.ts +73 -0
  81. package/src/generator/stepTemplate/index.ts.hbs +24 -0
  82. package/src/generator/stepsFlow.ts +123 -0
  83. package/src/generator/template/.env.example.hbs +3 -0
  84. package/src/generator/template/.eslintignore.hbs +1 -0
  85. package/src/generator/template/.eslintrc.hbs +6 -0
  86. package/src/generator/template/.github/pull_request_template.md.hbs +17 -0
  87. package/src/generator/template/.github/workflows/build.yml.hbs +53 -0
  88. package/src/generator/template/.github/workflows/codeql-analysis.yml.hbs +69 -0
  89. package/src/generator/template/.github/workflows/integration-deployment.yml.hbs +36 -0
  90. package/src/generator/template/.github/workflows/peril.yml.hbs +90 -0
  91. package/src/generator/template/.github/workflows/questions.yml.hbs +40 -0
  92. package/src/generator/template/.gitignore.hbs +8 -0
  93. package/src/generator/template/.node-version.hbs +1 -0
  94. package/src/generator/template/.prettierignore.hbs +5 -0
  95. package/src/generator/template/CHANGELOG.md.hbs +9 -0
  96. package/src/generator/template/CODEOWNERS.hbs +3 -0
  97. package/src/generator/template/Dockerfile.hbs +25 -0
  98. package/src/generator/template/LICENSE.hbs +373 -0
  99. package/src/generator/template/README.md.hbs +114 -0
  100. package/src/generator/template/docs/development.md.hbs +28 -0
  101. package/src/generator/template/docs/jupiterone.md.hbs +1 -0
  102. package/src/generator/template/husky.config.js.hbs +1 -0
  103. package/src/generator/template/jest.config.js.hbs +1 -0
  104. package/src/generator/template/jupiterone/questions/questions.yaml.hbs +16 -0
  105. package/src/generator/template/lint-staged.config.js.hbs +1 -0
  106. package/src/generator/template/package.json.hbs +63 -0
  107. package/src/generator/template/prettier.config.js.hbs +1 -0
  108. package/src/generator/template/scripts/execute.sh.hbs +7 -0
  109. package/src/generator/template/src/client.ts.hbs +23 -0
  110. package/src/generator/template/src/config.ts.hbs +39 -0
  111. package/src/generator/template/src/index.ts.hbs +14 -0
  112. package/src/generator/template/src/steps/constants.ts.hbs +34 -0
  113. package/src/generator/template/src/steps/index.ts.hbs +7 -0
  114. package/src/generator/template/src/validateInvocation.ts.hbs +23 -0
  115. package/src/generator/template/test/README.md.hbs +4 -0
  116. package/src/generator/template/test/config.ts.hbs +30 -0
  117. package/src/generator/template/test/recording.ts.hbs +74 -0
  118. package/src/generator/template/tsconfig.dist.json.hbs +13 -0
  119. package/src/generator/template/tsconfig.json.hbs +7 -0
  120. package/src/generator/util.ts +39 -0
  121. package/src/index.ts +3 -1
  122. package/tsconfig.dist.json +3 -1
@@ -0,0 +1 @@
1
+ export declare function generate(): import("commander").Command;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generate = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const commander_1 = require("commander");
9
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
10
+ function generate() {
11
+ return (0, commander_1.createCommand)('generate')
12
+ .description('generate integrations in whole and in part')
13
+ .action(async (cmdOpts) => {
14
+ const Plop = await dynamicImport('plop');
15
+ const configPath = path_1.default.resolve(path_1.default.join(__dirname, '../generator/newIntegration.js'));
16
+ Plop.Plop.prepare({
17
+ cwd: process.cwd(),
18
+ configPath,
19
+ }, (env) => Plop.Plop.execute(env, (env) => {
20
+ const options = {
21
+ ...env,
22
+ dest: process.cwd(),
23
+ };
24
+ return Plop.run(options, undefined, true);
25
+ }));
26
+ });
27
+ }
28
+ exports.generate = generate;
29
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/generate.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,yCAA0C;AAC1C,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;AAE5E,SAAgB,QAAQ;IACtB,OAAO,IAAA,yBAAa,EAAC,UAAU,CAAC;SAC7B,WAAW,CAAC,4CAA4C,CAAC;SACzD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAC7B,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gCAAgC,CAAC,CACvD,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,OAAO,CACf;YACE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,UAAU;SACX,EACD,CAAC,GAAG,EAAE,EAAE,CACN,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,MAAM,OAAO,GAAG;gBACd,GAAG,GAAG;gBACN,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE;aACpB,CAAC;YACF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAvBD,4BAuBC"}
@@ -11,3 +11,4 @@ export * from './visualize-dependencies';
11
11
  export * from './generate-integration-graph-schema';
12
12
  export * from './troubleshoot';
13
13
  export * from './generate-ingestion-sources-config';
14
+ export * from './generate';
@@ -27,4 +27,5 @@ __exportStar(require("./visualize-dependencies"), exports);
27
27
  __exportStar(require("./generate-integration-graph-schema"), exports);
28
28
  __exportStar(require("./troubleshoot"), exports);
29
29
  __exportStar(require("./generate-ingestion-sources-config"), exports);
30
+ __exportStar(require("./generate"), exports);
30
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B;AAC5B,yCAAuB;AACvB,wCAAsB;AACtB,6CAA2B;AAC3B,oDAAkC;AAClC,2DAAyC;AACzC,0CAAwB;AACxB,2DAAyC;AACzC,sEAAoD;AACpD,iDAA+B;AAC/B,sEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B;AAC5B,yCAAuB;AACvB,wCAAsB;AACtB,6CAA2B;AAC3B,oDAAkC;AAClC,2DAAyC;AACzC,0CAAwB;AACxB,2DAAyC;AACzC,sEAAoD;AACpD,iDAA+B;AAC/B,sEAAoD;AACpD,6CAA2B"}
@@ -0,0 +1,4 @@
1
+ declare function yarnInstall(_answers: any, config: any, _plop: any): Promise<string>;
2
+ declare function yarnFormat(_answers: any, config: any, _plop: any): Promise<string>;
3
+ declare function yarnLint(_answers: any, config: any, _plop: any): Promise<string>;
4
+ export { yarnInstall, yarnFormat, yarnLint };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.yarnLint = exports.yarnFormat = exports.yarnInstall = void 0;
4
+ const child_process_1 = require("child_process");
5
+ async function spawnCommand(config, command, args) {
6
+ const spawnOptions = config.verbose
7
+ ? {
8
+ cwd: config.path,
9
+ shell: true,
10
+ }
11
+ : {
12
+ cwd: config.path,
13
+ };
14
+ return new Promise((resolve, reject) => {
15
+ const cmd = (0, child_process_1.spawn)(command, args, spawnOptions);
16
+ cmd.on('close', (code) => {
17
+ if (code === 0) {
18
+ resolve(`${code}`);
19
+ }
20
+ else {
21
+ reject(`exited with ${code}`);
22
+ }
23
+ });
24
+ });
25
+ }
26
+ async function yarnInstall(_answers, config, _plop) {
27
+ return spawnCommand(config, 'yarn', ['install']);
28
+ }
29
+ exports.yarnInstall = yarnInstall;
30
+ async function yarnFormat(_answers, config, _plop) {
31
+ return spawnCommand(config, 'yarn', [`format`]);
32
+ }
33
+ exports.yarnFormat = yarnFormat;
34
+ async function yarnLint(_answers, config, _plop) {
35
+ return spawnCommand(config, 'yarn', ['lint']);
36
+ }
37
+ exports.yarnLint = yarnLint;
38
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/generator/actions.ts"],"names":[],"mappings":";;;AAAA,iDAAsC;AAEtC,KAAK,UAAU,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO;QACjC,CAAC,CAAC;YACE,GAAG,EAAE,MAAM,CAAC,IAAI;YAChB,KAAK,EAAE,IAAI;SACZ;QACH,CAAC,CAAC;YACE,GAAG,EAAE,MAAM,CAAC,IAAI;SACjB,CAAC;IAEN,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAA,qBAAK,EAAC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAC/C,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;aACpB;iBAAM;gBACL,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC;AAUQ,kCAAW;AARpB,KAAK,UAAU,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK;IAC/C,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AAClD,CAAC;AAMqB,gCAAU;AAJhC,KAAK,UAAU,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK;IAC7C,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AAEiC,4BAAQ"}
@@ -0,0 +1,7 @@
1
+ type FieldType = 'json' | 'string' | 'boolean';
2
+ declare function configFieldsFlow(inquirer: any): Promise<{
3
+ field: string;
4
+ type: FieldType;
5
+ mask: boolean;
6
+ }[]>;
7
+ export { configFieldsFlow };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configFieldsFlow = void 0;
4
+ const util_1 = require("./util");
5
+ async function configFieldsFlow(inquirer) {
6
+ const configFields = [];
7
+ const { doPrompt } = await inquirer.prompt({
8
+ type: 'confirm',
9
+ name: 'doPrompt',
10
+ message: 'Do you want to add config fields?',
11
+ });
12
+ if (!doPrompt)
13
+ return configFields;
14
+ await (0, util_1.askRepeatedly)(inquirer, async () => {
15
+ const configField = await configFieldPrompt(inquirer);
16
+ configFields.push(configField);
17
+ });
18
+ return configFields;
19
+ }
20
+ exports.configFieldsFlow = configFieldsFlow;
21
+ async function configFieldPrompt(inquirer) {
22
+ const { field } = await inquirer.prompt({
23
+ type: 'input',
24
+ name: 'field',
25
+ message: 'The config field name (ex. apiKey)',
26
+ });
27
+ const { type } = await inquirer.prompt({
28
+ type: 'list',
29
+ name: 'type',
30
+ message: 'The type of the config field',
31
+ choices: [
32
+ {
33
+ name: 'string',
34
+ value: 'string',
35
+ },
36
+ {
37
+ name: 'boolean',
38
+ value: 'boolean',
39
+ },
40
+ {
41
+ name: 'json',
42
+ value: 'json',
43
+ },
44
+ ],
45
+ });
46
+ const { mask } = await inquirer.prompt({
47
+ name: 'mask',
48
+ type: 'confirm',
49
+ message: 'Should the field be masked?',
50
+ });
51
+ return { field, type, mask };
52
+ }
53
+ //# sourceMappingURL=configFieldsFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configFieldsFlow.js","sourceRoot":"","sources":["../../../src/generator/configFieldsFlow.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AAIvC,KAAK,UAAU,gBAAgB,CAAC,QAAQ;IACtC,MAAM,YAAY,GAAwD,EAAE,CAAC;IAE7E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACzC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,mCAAmC;KAC7C,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ;QAAE,OAAO,YAAY,CAAC;IAEnC,MAAM,IAAA,oBAAa,EAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACtD,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAsCQ,4CAAgB;AApCzB,KAAK,UAAU,iBAAiB,CAAC,QAAQ;IACvC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACtC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,oCAAoC;KAC9C,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,8BAA8B;QACvC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,SAAS;aACjB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;aACd;SACF;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,6BAA6B;KACvC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type Entity = {
2
+ resourceName: string;
3
+ _type: string;
4
+ _class: string[];
5
+ };
6
+ declare function entitiesFlow(inquirer: any, vendorName: any): Promise<Entity[]>;
7
+ export { entitiesFlow };
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entitiesFlow = void 0;
4
+ const util_1 = require("./util");
5
+ const lodash_1 = require("lodash");
6
+ async function entitiesFlow(inquirer, vendorName) {
7
+ const entities = [];
8
+ const { doPrompt } = await inquirer.prompt({
9
+ type: 'confirm',
10
+ name: 'doPrompt',
11
+ message: 'Do you want to declare entities?',
12
+ });
13
+ if (!doPrompt)
14
+ return entities;
15
+ await (0, util_1.askRepeatedly)(inquirer, async () => {
16
+ const entity = await createEntityPrompt(inquirer, vendorName);
17
+ entities.push(entity);
18
+ });
19
+ return entities;
20
+ }
21
+ exports.entitiesFlow = entitiesFlow;
22
+ async function createEntityPrompt(inquirer, vendorName) {
23
+ const { resourceName } = await inquirer.prompt({
24
+ type: 'input',
25
+ name: 'resourceName',
26
+ message: 'What is the name of the entity? ex. User, EC2 Instance, Access Key',
27
+ });
28
+ const { _class } = await inquirer.prompt({
29
+ type: 'checkbox-plus',
30
+ name: '_class',
31
+ message: 'Which classes should the entity have?',
32
+ searchable: true,
33
+ pageSize: 10,
34
+ validate(input) {
35
+ if (input?.length > 0) {
36
+ return true;
37
+ }
38
+ else {
39
+ return false;
40
+ }
41
+ },
42
+ source: function (ans, input) {
43
+ return new Promise((resolve) => {
44
+ if (!input) {
45
+ resolve(entityClassesChoices);
46
+ return;
47
+ }
48
+ else {
49
+ const choices = entityClassesChoices.filter(({ name }) => name.toLowerCase().includes(input.toLowerCase()));
50
+ resolve(choices);
51
+ }
52
+ });
53
+ },
54
+ });
55
+ const { _type } = await inquirer.prompt({
56
+ Type: 'input',
57
+ name: '_type',
58
+ message: 'What should the _type be?',
59
+ default: `${(0, lodash_1.snakeCase)(vendorName)}_${(0, lodash_1.snakeCase)(resourceName)}`,
60
+ validate(input) {
61
+ const valid = /^[a-z0-9_]+$/.test(input);
62
+ if (!valid) {
63
+ return '_type must be lowercased, alphanumeric, and use underscores for spacing';
64
+ }
65
+ return valid;
66
+ },
67
+ });
68
+ return {
69
+ resourceName,
70
+ _type,
71
+ _class,
72
+ };
73
+ }
74
+ const entityClassesChoices = [
75
+ { name: 'AccessKey' },
76
+ { name: 'AccessPolicy' },
77
+ { name: 'AccessRole' },
78
+ { name: 'Account' },
79
+ { name: 'Alert' },
80
+ { name: 'Application' },
81
+ { name: 'ApplicationEndpoint' },
82
+ { name: 'Assessment' },
83
+ { name: 'Attacker' },
84
+ { name: 'Backup' },
85
+ { name: 'Certificate' },
86
+ { name: 'Channel' },
87
+ { name: 'Cluster' },
88
+ { name: 'CodeCommit' },
89
+ { name: 'CodeDeploy' },
90
+ { name: 'CodeModule' },
91
+ { name: 'CodeRepo' },
92
+ { name: 'CodeReview' },
93
+ { name: 'Configuration' },
94
+ { name: 'Container' },
95
+ { name: 'Control' },
96
+ { name: 'ControlPolicy' },
97
+ { name: 'CryptoKey' },
98
+ { name: 'DataCollection' },
99
+ { name: 'DataObject' },
100
+ { name: 'DataStore' },
101
+ { name: 'Database' },
102
+ { name: 'Deployment' },
103
+ { name: 'Device' },
104
+ { name: 'Directory' },
105
+ { name: 'Disk' },
106
+ { name: 'Document' },
107
+ { name: 'Domain' },
108
+ { name: 'DomainRecord' },
109
+ { name: 'DomainZone' },
110
+ { name: 'Entity' },
111
+ { name: 'Finding' },
112
+ { name: 'Firewall' },
113
+ { name: 'Framework' },
114
+ { name: 'Function' },
115
+ { name: 'Gateway' },
116
+ { name: 'GraphObject' },
117
+ { name: 'Group' },
118
+ { name: 'Host' },
119
+ { name: 'HostAgent' },
120
+ { name: 'Image' },
121
+ { name: 'Incident' },
122
+ { name: 'Internet' },
123
+ { name: 'IpAddress' },
124
+ { name: 'Issue' },
125
+ { name: 'Key' },
126
+ { name: 'Logs' },
127
+ { name: 'Model' },
128
+ { name: 'Module' },
129
+ { name: 'Network' },
130
+ { name: 'NetworkEndpoint' },
131
+ { name: 'NetworkInterface' },
132
+ { name: 'Organization' },
133
+ { name: 'PR' },
134
+ { name: 'PasswordPolicy' },
135
+ { name: 'Person' },
136
+ { name: 'Policy' },
137
+ { name: 'Problem' },
138
+ { name: 'Procedure' },
139
+ { name: 'Process' },
140
+ { name: 'Product' },
141
+ { name: 'Program' },
142
+ { name: 'Project' },
143
+ { name: 'Question' },
144
+ { name: 'Queue' },
145
+ { name: 'Record' },
146
+ { name: 'RecordEntity' },
147
+ { name: 'Repository' },
148
+ { name: 'Requirement' },
149
+ { name: 'Resource' },
150
+ { name: 'Review' },
151
+ { name: 'Risk' },
152
+ { name: 'Root' },
153
+ { name: 'Rule' },
154
+ { name: 'Ruleset' },
155
+ { name: 'Scanner' },
156
+ { name: 'Secret' },
157
+ { name: 'Section' },
158
+ { name: 'Service' },
159
+ { name: 'Site' },
160
+ { name: 'Standard' },
161
+ { name: 'Subscription' },
162
+ { name: 'Task' },
163
+ { name: 'Team' },
164
+ { name: 'ThreatIntel' },
165
+ { name: 'Training' },
166
+ { name: 'User' },
167
+ { name: 'UserGroup' },
168
+ { name: 'Vault' },
169
+ { name: 'Vendor' },
170
+ { name: 'Vulnerability' },
171
+ { name: 'Weakness' },
172
+ { name: 'Workflow' },
173
+ { name: 'Workload' },
174
+ ].map((v) => ({ name: v.name, value: v.name }));
175
+ //# sourceMappingURL=entitiesFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitiesFlow.js","sourceRoot":"","sources":["../../../src/generator/entitiesFlow.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AACvC,mCAAmC;AAQnC,KAAK,UAAU,YAAY,CAAC,QAAQ,EAAE,UAAU;IAC9C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACzC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,kCAAkC;KAC5C,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE/B,MAAM,IAAA,oBAAa,EAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC9D,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAiKQ,oCAAY;AA/JrB,KAAK,UAAU,kBAAkB,CAAC,QAAQ,EAAE,UAAU;IACpD,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EACL,oEAAo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EAAE;IACpB,EAAE,IAAI,EAAE,UAAU,EAAE;CACrB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function generateRelationshipName(relationship: any): string;
2
+ export { generateRelationshipName };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateRelationshipName = void 0;
4
+ function generateRelationshipName(relationship) {
5
+ const { from, to, _class } = relationship;
6
+ return `${from.resourceName}_${_class}_${to.resourceName}`;
7
+ }
8
+ exports.generateRelationshipName = generateRelationshipName;
9
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/generator/helpers.ts"],"names":[],"mappings":";;;AAAA,SAAS,wBAAwB,CAAC,YAAY;IAC5C,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAC1C,OAAO,GAAG,IAAI,CAAC,YAAY,IAAI,MAAM,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC;AAC7D,CAAC;AAEQ,4DAAwB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const entitiesFlow_1 = require("./entitiesFlow");
7
+ const relationshipsFlow_1 = require("./relationshipsFlow");
8
+ const configFieldsFlow_1 = require("./configFieldsFlow");
9
+ const stepsFlow_1 = require("./stepsFlow");
10
+ const helpers_1 = require("./helpers");
11
+ const integration_sdk_core_1 = require("@jupiterone/integration-sdk-core");
12
+ const actions_1 = require("./actions");
13
+ const lodash_1 = require("lodash");
14
+ const inquirer_checkbox_plus_prompt_1 = __importDefault(require("inquirer-checkbox-plus-prompt"));
15
+ const path_1 = __importDefault(require("path"));
16
+ function newIntegration(plop) {
17
+ plop.setHelper('generateRelationshipType', function () {
18
+ return (0, integration_sdk_core_1.generateRelationshipType)(this._class, this.from, this.to);
19
+ });
20
+ plop.setHelper('generateRelationshipName', helpers_1.generateRelationshipName);
21
+ plop.setActionType('yarnFormat', actions_1.yarnFormat);
22
+ plop.setActionType('yarnInstall', actions_1.yarnInstall);
23
+ plop.setActionType('yarnLint', actions_1.yarnLint);
24
+ plop.setPrompt('checkbox-plus', inquirer_checkbox_plus_prompt_1.default);
25
+ plop.setGenerator('new:integration', {
26
+ description: 'Create a new integration',
27
+ prompts: async function (inquirer) {
28
+ const { vendorName } = await inquirer.prompt({
29
+ type: 'input',
30
+ name: 'vendorName',
31
+ message: 'The integration vendor name (ex. AWS, Google Workspace, CrowdStrike)',
32
+ validate(input) {
33
+ if (!input) {
34
+ return 'Cannot be an empty string';
35
+ }
36
+ return true;
37
+ },
38
+ });
39
+ const { packageName } = await inquirer.prompt({
40
+ type: 'input',
41
+ name: 'packageName',
42
+ default: `@jupiterone/graph-${(0, lodash_1.kebabCase)(vendorName)}`,
43
+ message: 'The npm package name',
44
+ validate(input) {
45
+ if (!input) {
46
+ return 'Cannot be an empty string';
47
+ }
48
+ return true;
49
+ },
50
+ });
51
+ const { packageDescription } = await inquirer.prompt({
52
+ type: 'input',
53
+ name: 'packageDescription',
54
+ message: 'A description for package',
55
+ default: `An integration and graph conversion project for ${vendorName}`,
56
+ validate(input) {
57
+ if (!input) {
58
+ return 'Cannot be an empty string';
59
+ }
60
+ return true;
61
+ },
62
+ });
63
+ const configFields = await (0, configFieldsFlow_1.configFieldsFlow)(inquirer);
64
+ const entities = await (0, entitiesFlow_1.entitiesFlow)(inquirer, vendorName);
65
+ let relationships = [];
66
+ let steps = [];
67
+ if (entities.length) {
68
+ relationships = await (0, relationshipsFlow_1.relationshipsFlow)(inquirer, entities);
69
+ steps = await (0, stepsFlow_1.stepsFlow)(inquirer, entities, relationships);
70
+ }
71
+ return {
72
+ vendorName,
73
+ packageName,
74
+ packageDescription,
75
+ configFields,
76
+ entities,
77
+ relationships,
78
+ steps,
79
+ };
80
+ },
81
+ actions: function (data) {
82
+ if (!data) {
83
+ return [];
84
+ }
85
+ const actions = [];
86
+ actions.push({
87
+ type: 'addMany',
88
+ destination: '.',
89
+ base: path_1.default.join(__dirname, '/template'),
90
+ templateFiles: path_1.default.join(__dirname + '/template/**'),
91
+ globOptions: { dot: true },
92
+ force: true,
93
+ data,
94
+ });
95
+ for (const step of data.steps) {
96
+ actions.push({
97
+ type: 'add',
98
+ path: path_1.default.normalize(`src/steps/${(0, lodash_1.kebabCase)(step.name)}/index.ts`),
99
+ templateFile: path_1.default.join(__dirname, 'stepTemplate/index.ts.hbs'),
100
+ data: step,
101
+ force: true,
102
+ });
103
+ }
104
+ actions.push({
105
+ type: 'yarnInstall',
106
+ path: '.',
107
+ verbose: true,
108
+ });
109
+ actions.push({
110
+ type: 'yarnFormat',
111
+ path: '.',
112
+ verbose: true,
113
+ });
114
+ actions.push({
115
+ type: 'yarnLint',
116
+ path: '.',
117
+ verbose: true,
118
+ });
119
+ return actions;
120
+ },
121
+ });
122
+ }
123
+ module.exports = newIntegration;
124
+ //# sourceMappingURL=newIntegration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"newIntegration.js","sourceRoot":"","sources":["../../../src/generator/newIntegration.ts"],"names":[],"mappings":";;;;;AAAA,iDAA8C;AAC9C,2DAAwD;AACxD,yDAAsD;AACtD,2CAAwC;AACxC,uCAAqD;AACrD,2EAA4E;AAC5E,uCAA8D;AAC9D,mCAAmC;AACnC,kGAAyD;AACzD,gDAAwB;AAMxB,SAAS,cAAc,CAAC,IAAiB;IACvC,IAAI,CAAC,SAAS,CAAC,0BAA0B,EAAE;QACzC,OAAO,IAAA,+CAAwB,EAAC,IAAI,CAAC,MAAM,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gBACX,IAAI;aACL,CAAC,CAAC;YAEH,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;gBAC7B,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,cAAI,CAAC,SAAS,CAAC,aAAa,IAAA,kBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;oBAClE,YAAY,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC;oBAC/D,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;aACJ;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type Relationship = {
2
+ from: any;
3
+ to: any;
4
+ _class: any;
5
+ };
6
+ declare function relationshipsFlow(inquirer: any, entities: any): Promise<Relationship[]>;
7
+ export { relationshipsFlow };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.relationshipsFlow = void 0;
4
+ const util_1 = require("./util");
5
+ const data_model_1 = require("@jupiterone/data-model");
6
+ async function relationshipsFlow(inquirer, entities) {
7
+ const relationships = [];
8
+ const { doPrompt } = await inquirer.prompt({
9
+ type: 'confirm',
10
+ name: 'doPrompt',
11
+ message: 'Do you want to add relationships?',
12
+ });
13
+ if (!doPrompt)
14
+ return relationships;
15
+ const entityChoices = (0, util_1.generateChoicesFromEntities)(entities);
16
+ await (0, util_1.askRepeatedly)(inquirer, async () => {
17
+ const relationship = await createRelationship(inquirer, entityChoices);
18
+ relationships.push(relationship);
19
+ });
20
+ return relationships;
21
+ }
22
+ exports.relationshipsFlow = relationshipsFlow;
23
+ async function createRelationship(inquirer, entityChoices) {
24
+ const { from } = await inquirer.prompt({
25
+ type: 'list',
26
+ name: 'from',
27
+ message: 'What entity should the relationship be from?',
28
+ choices: entityChoices,
29
+ pageSize: entityChoices.length,
30
+ });
31
+ const { to } = await inquirer.prompt({
32
+ type: 'list',
33
+ name: 'to',
34
+ message: 'What entity should the relationship be to?',
35
+ choices: entityChoices,
36
+ pageSize: entityChoices.length,
37
+ });
38
+ const { _class } = await inquirer.prompt({
39
+ type: 'list',
40
+ name: '_class',
41
+ message: 'What should the _class be?',
42
+ choices: relationshipClassChoices(),
43
+ pageSize: 10,
44
+ });
45
+ return { from, to, _class };
46
+ }
47
+ function relationshipClassChoices() {
48
+ const choices = [];
49
+ for (const [name, value] of Object.entries(data_model_1.RelationshipClass)) {
50
+ choices.push({
51
+ name,
52
+ value,
53
+ });
54
+ }
55
+ choices.sort((a, b) => {
56
+ if (a.name < b.name) {
57
+ return -1;
58
+ }
59
+ else {
60
+ return 1;
61
+ }
62
+ });
63
+ return choices;
64
+ }
65
+ //# sourceMappingURL=relationshipsFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationshipsFlow.js","sourceRoot":"","sources":["../../../src/generator/relationshipsFlow.ts"],"names":[],"mappings":";;;AAAA,iCAAoE;AACpE,uDAA2D;AAQ3D,KAAK,UAAU,iBAAiB,CAAC,QAAQ,EAAE,QAAQ;IACjD,MAAM,aAAa,GAAmB,EAAE,CAAC;IACzC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,C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AAM,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,wBAAwB;IAC/B,MAAM,OAAO,GAAsC,EAAE,CAAC;IACtD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,8BAAiB,CAAC,EAAE;QAC7D,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;KACJ;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE;YACnB,OAAO,CAAC,CAAC,CAAC;SACX;aAAM;YACL,OAAO,CAAC,CAAC;SACV;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import {
2
+ IntegrationStep,
3
+ IntegrationStepExecutionContext,
4
+ } from '@jupiterone/integration-sdk-core';
5
+
6
+ import { IntegrationConfig } from '../../config';
7
+ import { Steps{{#if entities}}, Entities{{/if}}{{#if relationships}}, Relationships{{/if}} } from '../constants';
8
+
9
+ export const {{camelCase name}}Steps: IntegrationStep<IntegrationConfig>[] = [
10
+ {
11
+ id: Steps.{{constantCase name}},
12
+ name: '{{titleCase name}}',
13
+ entities: [{{#each entities}}Entities.{{constantCase resourceName}}{{#unless @last}},{{/unless}}{{/each}}],
14
+ relationships: [{{#each relationships}}Relationships.{{constantCase (generateRelationshipName this)}}{{#unless @last}},{{/unless}}{{/each}}],
15
+ dependsOn: [],
16
+ executionHandler: {{camelCase name}},
17
+ },
18
+ ];
19
+
20
+ export async function {{camelCase name}}({
21
+ jobState,
22
+ }: IntegrationStepExecutionContext<IntegrationConfig>) {
23
+ // TODO
24
+ }
@@ -0,0 +1,10 @@
1
+ import { Entity } from './entitiesFlow';
2
+ import { Relationship } from './relationshipsFlow';
3
+ export type Step = {
4
+ name: string;
5
+ entities: Entity[];
6
+ relationships: Relationship[];
7
+ dependsOn?: string[];
8
+ };
9
+ declare function stepsFlow(inquirer: any, entities: any, relationships: any): Promise<Step[]>;
10
+ export { stepsFlow };