@jupiterone/integration-sdk-cli 9.4.0 → 9.5.0

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 (58) hide show
  1. package/dist/src/commands/collect.js +5 -1
  2. package/dist/src/commands/collect.js.map +1 -1
  3. package/dist/src/commands/document.js +5 -1
  4. package/dist/src/commands/document.js.map +1 -1
  5. package/dist/src/commands/generate-ingestion-sources-config.d.ts +3 -3
  6. package/dist/src/commands/generate-ingestion-sources-config.js +9 -6
  7. package/dist/src/commands/generate-ingestion-sources-config.js.map +1 -1
  8. package/dist/src/commands/generate-integration-graph-schema.d.ts +4 -4
  9. package/dist/src/commands/generate-integration-graph-schema.js +5 -1
  10. package/dist/src/commands/generate-integration-graph-schema.js.map +1 -1
  11. package/dist/src/commands/index.js +5 -1
  12. package/dist/src/commands/index.js.map +1 -1
  13. package/dist/src/commands/neo4j.js +5 -1
  14. package/dist/src/commands/neo4j.js.map +1 -1
  15. package/dist/src/commands/run.js +5 -1
  16. package/dist/src/commands/run.js.map +1 -1
  17. package/dist/src/commands/sync.js +5 -1
  18. package/dist/src/commands/sync.js.map +1 -1
  19. package/dist/src/commands/validate-question-file.js +5 -1
  20. package/dist/src/commands/validate-question-file.js.map +1 -1
  21. package/dist/src/commands/visualize-types.js +5 -1
  22. package/dist/src/commands/visualize-types.js.map +1 -1
  23. package/dist/src/commands/visualize.js +5 -1
  24. package/dist/src/commands/visualize.js.map +1 -1
  25. package/dist/src/config.js +5 -1
  26. package/dist/src/config.js.map +1 -1
  27. package/dist/src/neo4j/index.js +5 -1
  28. package/dist/src/neo4j/index.js.map +1 -1
  29. package/dist/src/neo4j/neo4jGraphStore.js +5 -1
  30. package/dist/src/neo4j/neo4jGraphStore.js.map +1 -1
  31. package/dist/src/neo4j/uploadToNeo4j.d.ts +1 -1
  32. package/dist/src/neo4j/wipeNeo4j.d.ts +2 -2
  33. package/dist/src/questions/managedQuestionFileValidator.d.ts +3 -3
  34. package/dist/src/questions/managedQuestionFileValidator.js +5 -1
  35. package/dist/src/questions/managedQuestionFileValidator.js.map +1 -1
  36. package/dist/src/services/queryLanguage.d.ts +2 -2
  37. package/dist/src/troubleshoot/index.js +5 -1
  38. package/dist/src/troubleshoot/index.js.map +1 -1
  39. package/dist/src/troubleshoot/troubleshoot.js +5 -1
  40. package/dist/src/troubleshoot/troubleshoot.js.map +1 -1
  41. package/dist/src/troubleshoot/utils.js +7 -2
  42. package/dist/src/troubleshoot/utils.js.map +1 -1
  43. package/dist/src/utils/getSortedJupiterOneTypes.js +5 -1
  44. package/dist/src/utils/getSortedJupiterOneTypes.js.map +1 -1
  45. package/dist/src/visualization/createMappedRelationshipNodesAndEdges.d.ts +1 -1
  46. package/dist/src/visualization/generateDependencyVisualization.js +5 -1
  47. package/dist/src/visualization/generateDependencyVisualization.js.map +1 -1
  48. package/dist/src/visualization/generateVisualization.js +5 -1
  49. package/dist/src/visualization/generateVisualization.js.map +1 -1
  50. package/dist/src/visualization/index.js +5 -1
  51. package/dist/src/visualization/index.js.map +1 -1
  52. package/dist/src/visualization/types/index.js +5 -1
  53. package/dist/src/visualization/types/index.js.map +1 -1
  54. package/dist/src/visualization/utils.d.ts +1 -1
  55. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  56. package/package.json +4 -4
  57. package/src/commands/generate-ingestion-sources-config.test.ts +32 -24
  58. package/src/commands/generate-ingestion-sources-config.ts +12 -10
@@ -63,6 +63,33 @@ describe('#generateIngestionSourcesConfig', () => {
63
63
  });
64
64
 
65
65
  it('should return the ingestionConfig with childIngestionSources', () => {
66
+ const stepFetchVulnerabilityAlerts = {
67
+ id: 'fetch-vulnerability-alerts',
68
+ name: 'Fetch Vulnerability Alerts',
69
+ entities: [
70
+ {
71
+ resourceName: 'GitHub Vulnerability Alerts',
72
+ _type: 'github_finding',
73
+ _class: ['Finding'],
74
+ },
75
+ ],
76
+ relationships: [],
77
+ dependsOn: ['fetch-repos'],
78
+ ingestionSourceId: INGESTION_SOURCE_IDS.FINDING_ALERTS,
79
+ };
80
+ const stepFetchIssues = {
81
+ id: 'fetch-issues',
82
+ name: 'Fetch Issues',
83
+ entities: [
84
+ {
85
+ resourceName: 'GitHub Issue',
86
+ _type: 'github_issue',
87
+ _class: ['Issue'],
88
+ },
89
+ ],
90
+ relationships: [],
91
+ dependsOn: ['fetch-repos', 'fetch-users', 'fetch-collaborators'],
92
+ };
66
93
  const integrationSteps: IntegrationStep<IntegrationInstanceConfig>[] = [
67
94
  {
68
95
  id: 'fetch-repos',
@@ -80,32 +107,11 @@ describe('#generateIngestionSourcesConfig', () => {
80
107
  executionHandler: jest.fn(),
81
108
  },
82
109
  {
83
- id: 'fetch-vulnerability-alerts',
84
- name: 'Fetch Vulnerability Alerts',
85
- entities: [
86
- {
87
- resourceName: 'GitHub Vulnerability Alerts',
88
- _type: 'github_finding',
89
- _class: ['Finding'],
90
- },
91
- ],
92
- relationships: [],
93
- dependsOn: ['fetch-repos'],
94
- ingestionSourceId: INGESTION_SOURCE_IDS.FINDING_ALERTS,
110
+ ...stepFetchVulnerabilityAlerts,
95
111
  executionHandler: jest.fn(),
96
112
  },
97
113
  {
98
- id: 'fetch-issues',
99
- name: 'Fetch Issues',
100
- entities: [
101
- {
102
- resourceName: 'GitHub Issue',
103
- _type: 'github_issue',
104
- _class: ['Issue'],
105
- },
106
- ],
107
- relationships: [],
108
- dependsOn: ['fetch-repos', 'fetch-users', 'fetch-collaborators'],
114
+ ...stepFetchIssues,
109
115
  executionHandler: jest.fn(),
110
116
  },
111
117
  {
@@ -135,7 +141,9 @@ describe('#generateIngestionSourcesConfig', () => {
135
141
  expect(
136
142
  ingestionSourcesConfig[INGESTION_SOURCE_IDS.FETCH_REPOS]
137
143
  .childIngestionSources,
138
- ).toEqual(['fetch-vulnerability-alerts', 'fetch-issues']);
144
+ ).toEqual(
145
+ expect.arrayContaining([stepFetchVulnerabilityAlerts, stepFetchIssues]),
146
+ );
139
147
  // For FINDING_ALERTS the ingestionConfig keep exactly the same
140
148
  expect(
141
149
  ingestionSourcesConfig[INGESTION_SOURCE_IDS.FINDING_ALERTS],
@@ -4,6 +4,7 @@ import {
4
4
  IntegrationSourceId,
5
5
  Step,
6
6
  StepExecutionContext,
7
+ StepMetadata,
7
8
  } from '@jupiterone/integration-sdk-core';
8
9
  import { createCommand } from 'commander';
9
10
  import { loadConfigFromTarget } from '../config';
@@ -59,7 +60,7 @@ export function generateIngestionSourcesConfigCommand() {
59
60
 
60
61
  export type EnhancedIntegrationIngestionConfigFieldMap = Record<
61
62
  IntegrationSourceId,
62
- IntegrationIngestionConfigField & { childIngestionSources?: string[] }
63
+ IntegrationIngestionConfigField & { childIngestionSources?: StepMetadata[] }
63
64
  >;
64
65
 
65
66
  /**
@@ -91,18 +92,19 @@ export function generateIngestionSourcesConfig<
91
92
  // Skip iteration if there are no steps pointing to the current ingestionSourceId
92
93
  return;
93
94
  }
94
- // Get the stepIds that have any dependencies on the matched step ids
95
- const childIngestionSources = integrationSteps
96
- .filter((step) =>
97
- step.dependsOn?.some((value) =>
98
- matchedIntegrationStepIds.includes(value),
99
- ),
100
- )
101
- .map(({ id }) => id);
95
+ // Get the dependent steps for the given matchedIntegrationStepIds
96
+ const childIngestionSources = integrationSteps.filter((step) =>
97
+ step.dependsOn?.some((value) =>
98
+ matchedIntegrationStepIds.includes(value),
99
+ ),
100
+ );
102
101
  // Generate ingestionConfig with the childIngestionSources
103
102
  newIngestionConfig[key] = {
104
103
  ...ingestionConfig[key],
105
- childIngestionSources,
104
+ // Drop execution handler from returned object
105
+ childIngestionSources: childIngestionSources.map(
106
+ ({ executionHandler, ...keepAttrs }) => keepAttrs,
107
+ ),
106
108
  };
107
109
  } else {
108
110
  log.warn(`The key ${key} does not exist in the ingestionConfig`);