@jupiterone/integration-sdk-cli 12.8.1 → 13.0.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.
- package/dist/src/bocchi/actions/steps.d.ts +4 -0
- package/dist/src/bocchi/actions/steps.js +20 -0
- package/dist/src/bocchi/actions/steps.js.map +1 -0
- package/dist/src/bocchi/bocchi.d.ts +1 -0
- package/dist/src/bocchi/bocchi.js +260 -0
- package/dist/src/bocchi/bocchi.js.map +1 -0
- package/dist/src/bocchi/templates/partials/directRelationships.hbs +26 -0
- package/dist/src/bocchi/templates/partials/mappedRelationships.hbs +36 -0
- package/dist/src/bocchi/templates/partials/stepMap.hbs +47 -0
- package/dist/src/bocchi/templates/steps/child-singleton.ts.hbs +47 -0
- package/dist/src/bocchi/templates/steps/fetch-child-entities.ts.hbs +58 -0
- package/dist/src/bocchi/templates/steps/fetch-entities.ts.hbs +47 -0
- package/dist/src/bocchi/templates/steps/index.test.ts.hbs +41 -0
- package/dist/src/bocchi/templates/steps/singleton.ts.hbs +45 -0
- package/dist/src/bocchi/templates/steps/spec.ts.hbs +73 -0
- package/dist/src/bocchi/templates/top-level/.env.example.hbs +3 -0
- package/dist/src/bocchi/templates/top-level/.eslintignore.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/.eslintrc.hbs +6 -0
- package/dist/src/bocchi/templates/top-level/.github/workflows/build.yml.hbs +29 -0
- package/dist/src/bocchi/templates/top-level/.github/workflows/questions.yml.hbs +40 -0
- package/dist/src/bocchi/templates/top-level/.gitignore.hbs +8 -0
- package/dist/src/bocchi/templates/top-level/.node-version.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/.prettierignore.hbs +6 -0
- package/dist/src/bocchi/templates/top-level/CHANGELOG.md.hbs +9 -0
- package/dist/src/bocchi/templates/top-level/CODEOWNERS.hbs +3 -0
- package/dist/src/bocchi/templates/top-level/Dockerfile.hbs +25 -0
- package/dist/src/bocchi/templates/top-level/LICENSE.hbs +373 -0
- package/dist/src/bocchi/templates/top-level/README.md.hbs +114 -0
- package/dist/src/bocchi/templates/top-level/docs/development.md.hbs +28 -0
- package/dist/src/bocchi/templates/top-level/docs/jupiterone.md.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/docs/spec/index.ts.hbs +14 -0
- package/dist/src/bocchi/templates/top-level/husky.config.js.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/jest.config.js.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/jupiterone/questions/questions.yaml.hbs +16 -0
- package/dist/src/bocchi/templates/top-level/lint-staged.config.js.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/package.json.hbs +49 -0
- package/dist/src/bocchi/templates/top-level/prettier.config.js.hbs +1 -0
- package/dist/src/bocchi/templates/top-level/src/client.ts.hbs +116 -0
- package/dist/src/bocchi/templates/top-level/src/config.ts.hbs +41 -0
- package/dist/src/bocchi/templates/top-level/src/index.test.ts.hbs +6 -0
- package/dist/src/bocchi/templates/top-level/src/index.ts.hbs +14 -0
- package/dist/src/bocchi/templates/top-level/src/steps/constants.ts.hbs +60 -0
- package/dist/src/bocchi/templates/top-level/src/steps/converters.ts.hbs +37 -0
- package/dist/src/bocchi/templates/top-level/src/steps/index.ts.hbs +13 -0
- package/dist/src/bocchi/templates/top-level/src/steps/types.ts.hbs +6 -0
- package/dist/src/bocchi/templates/top-level/test/README.md.hbs +5 -0
- package/dist/src/bocchi/templates/top-level/test/config.ts.hbs +30 -0
- package/dist/src/bocchi/templates/top-level/test/recording.ts.hbs +74 -0
- package/dist/src/bocchi/templates/top-level/tsconfig.dist.json.hbs +13 -0
- package/dist/src/bocchi/templates/top-level/tsconfig.json.hbs +7 -0
- package/dist/src/bocchi/utils/types.d.ts +98 -0
- package/dist/src/bocchi/utils/types.js +10 -0
- package/dist/src/bocchi/utils/types.js.map +1 -0
- package/dist/src/commands/bocchi.d.ts +1 -0
- package/dist/src/commands/bocchi.js +29 -0
- package/dist/src/commands/bocchi.js.map +1 -0
- package/dist/src/commands/collect.js.map +1 -1
- package/dist/src/commands/diff.js.map +1 -1
- package/dist/src/commands/document.js.map +1 -1
- package/dist/src/commands/generate-ingestion-sources-config.js.map +1 -1
- package/dist/src/commands/generate-integration-graph-schema.js.map +1 -1
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.js +1 -0
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/run.js.map +1 -1
- package/dist/src/commands/validate-question-file.js.map +1 -1
- package/dist/src/commands/visualize-types.js.map +1 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/generator/actions.d.ts +2 -1
- package/dist/src/generator/actions.js +5 -1
- package/dist/src/generator/actions.js.map +1 -1
- package/dist/src/generator/entitiesFlow.js.map +1 -1
- package/dist/src/generator/newIntegration.js.map +1 -1
- package/dist/src/generator/relationshipsFlow.js.map +1 -1
- package/dist/src/generator/stepsFlow.js.map +1 -1
- package/dist/src/generator/util.js.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/log.js.map +1 -1
- package/dist/src/neo4j/neo4jGraphStore.js.map +1 -1
- package/dist/src/neo4j/neo4jUtilities.js.map +1 -1
- package/dist/src/neo4j/uploadToNeo4j.js.map +1 -1
- package/dist/src/neo4j/wipeNeo4j.js.map +1 -1
- package/dist/src/questions/managedQuestionFileValidator.js.map +1 -1
- package/dist/src/services/queryLanguage.js.map +1 -1
- package/dist/src/troubleshoot/utils.js.map +1 -1
- package/dist/src/utils/generateVisHTML.js.map +1 -1
- package/dist/src/utils/getSortedJupiterOneTypes.js.map +1 -1
- package/dist/src/visualization/createMappedRelationshipNodesAndEdges.js.map +1 -1
- package/dist/src/visualization/generateDependencyVisualization.js.map +1 -1
- package/dist/src/visualization/generateVisualization.js.map +1 -1
- package/dist/src/visualization/retrieveIntegrationData.js.map +1 -1
- package/dist/src/visualization/utils.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/src/bocchi/README.md +95 -0
- package/src/bocchi/actions/steps.ts +17 -0
- package/src/bocchi/bocchi.ts +311 -0
- package/src/bocchi/docs/template/README.md +140 -0
- package/src/bocchi/docs/template/authentication.md +100 -0
- package/src/bocchi/docs/template/examples/example.json +127 -0
- package/src/bocchi/docs/template/examples/signalSciences.json +128 -0
- package/src/bocchi/docs/template/steps.md +656 -0
- package/src/bocchi/templates/partials/directRelationships.hbs +26 -0
- package/src/bocchi/templates/partials/mappedRelationships.hbs +36 -0
- package/src/bocchi/templates/partials/stepMap.hbs +47 -0
- package/src/bocchi/templates/steps/child-singleton.ts.hbs +47 -0
- package/src/bocchi/templates/steps/fetch-child-entities.ts.hbs +58 -0
- package/src/bocchi/templates/steps/fetch-entities.ts.hbs +47 -0
- package/src/bocchi/templates/steps/index.test.ts.hbs +41 -0
- package/src/bocchi/templates/steps/singleton.ts.hbs +45 -0
- package/src/bocchi/templates/steps/spec.ts.hbs +73 -0
- package/src/bocchi/templates/top-level/.env.example.hbs +3 -0
- package/src/bocchi/templates/top-level/.eslintignore.hbs +1 -0
- package/src/bocchi/templates/top-level/.eslintrc.hbs +6 -0
- package/src/bocchi/templates/top-level/.github/workflows/build.yml.hbs +29 -0
- package/src/bocchi/templates/top-level/.github/workflows/questions.yml.hbs +40 -0
- package/src/bocchi/templates/top-level/.gitignore.hbs +8 -0
- package/src/bocchi/templates/top-level/.node-version.hbs +1 -0
- package/src/bocchi/templates/top-level/.prettierignore.hbs +6 -0
- package/src/bocchi/templates/top-level/CHANGELOG.md.hbs +9 -0
- package/src/bocchi/templates/top-level/CODEOWNERS.hbs +3 -0
- package/src/bocchi/templates/top-level/Dockerfile.hbs +25 -0
- package/src/bocchi/templates/top-level/LICENSE.hbs +373 -0
- package/src/bocchi/templates/top-level/README.md.hbs +114 -0
- package/src/bocchi/templates/top-level/docs/development.md.hbs +28 -0
- package/src/bocchi/templates/top-level/docs/jupiterone.md.hbs +1 -0
- package/src/bocchi/templates/top-level/docs/spec/index.ts.hbs +14 -0
- package/src/bocchi/templates/top-level/husky.config.js.hbs +1 -0
- package/src/bocchi/templates/top-level/jest.config.js.hbs +1 -0
- package/src/bocchi/templates/top-level/jupiterone/questions/questions.yaml.hbs +16 -0
- package/src/bocchi/templates/top-level/lint-staged.config.js.hbs +1 -0
- package/src/bocchi/templates/top-level/package.json.hbs +49 -0
- package/src/bocchi/templates/top-level/prettier.config.js.hbs +1 -0
- package/src/bocchi/templates/top-level/src/client.ts.hbs +116 -0
- package/src/bocchi/templates/top-level/src/config.ts.hbs +41 -0
- package/src/bocchi/templates/top-level/src/index.test.ts.hbs +6 -0
- package/src/bocchi/templates/top-level/src/index.ts.hbs +14 -0
- package/src/bocchi/templates/top-level/src/steps/constants.ts.hbs +60 -0
- package/src/bocchi/templates/top-level/src/steps/converters.ts.hbs +37 -0
- package/src/bocchi/templates/top-level/src/steps/index.ts.hbs +13 -0
- package/src/bocchi/templates/top-level/src/steps/types.ts.hbs +6 -0
- package/src/bocchi/templates/top-level/test/README.md.hbs +5 -0
- package/src/bocchi/templates/top-level/test/config.ts.hbs +30 -0
- package/src/bocchi/templates/top-level/test/recording.ts.hbs +74 -0
- package/src/bocchi/templates/top-level/tsconfig.dist.json.hbs +13 -0
- package/src/bocchi/templates/top-level/tsconfig.json.hbs +7 -0
- package/src/bocchi/utils/types.ts +106 -0
- package/src/commands/bocchi.ts +28 -0
- package/src/commands/generate-ingestion-sources-config.ts +4 -5
- package/src/commands/index.ts +1 -0
- package/src/generator/actions.ts +13 -1
- package/src/index.ts +3 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
id: Steps.{{constantCase id}},
|
|
3
|
+
name: '{{name}}',
|
|
4
|
+
entities: [Entities.{{constantCase entity.name}}],
|
|
5
|
+
relationships: [
|
|
6
|
+
{{#if parentAssociation}}
|
|
7
|
+
Relationships.{{#with (getStepByType parentAssociation.parentEntityType)}}{{constantCase entity.name}}{{/with}}_{{constantCase parentAssociation.relationshipClass}}_{{constantCase entity.name}},
|
|
8
|
+
{{/if}}
|
|
9
|
+
],
|
|
10
|
+
dependsOn: [
|
|
11
|
+
{{#each dependsOn}}
|
|
12
|
+
Steps.{{constantCase this}},
|
|
13
|
+
{{/each}}
|
|
14
|
+
],
|
|
15
|
+
executionHandler: {{camelCase id}},
|
|
16
|
+
},
|
|
17
|
+
{{#if directRelationships}}
|
|
18
|
+
{{#with (getDirectRelationships this)}}
|
|
19
|
+
{{#each this}}
|
|
20
|
+
{
|
|
21
|
+
id: Steps.BUILD_{{constantCase sourceStep.entity.name}}_{{constantCase targetStep.entity.name}}_RELATIONSHIPS,
|
|
22
|
+
name: 'Build {{sourceStep.entity.name}} {{targetStep.entity.name}} Relationships',
|
|
23
|
+
entities: [],
|
|
24
|
+
relationships: [
|
|
25
|
+
Relationships.{{constantCase sourceStep.entity.name}}_{{constantCase relationshipClass}}_{{constantCase targetStep.entity.name}},
|
|
26
|
+
],
|
|
27
|
+
dependsOn: [
|
|
28
|
+
Steps.{{constantCase sourceStep.id}},
|
|
29
|
+
Steps.{{constantCase targetStep.id}},
|
|
30
|
+
],
|
|
31
|
+
executionHandler: build{{pascalCase sourceStep.entity.name}}{{pascalCase relationshipClass}}{{pascalCase targetStep.entity.name}}Relationships,
|
|
32
|
+
},
|
|
33
|
+
{{/each}}
|
|
34
|
+
{{/with}}
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if mappedRelationships}}
|
|
37
|
+
{
|
|
38
|
+
id: Steps.BUILD_{{constantCase entity.name}}_MAPPED_RELATIONSHIPS,
|
|
39
|
+
name: 'Build {{entity.name}} Mapped Relationships',
|
|
40
|
+
entities: [],
|
|
41
|
+
relationships: [],
|
|
42
|
+
dependsOn: [
|
|
43
|
+
Steps.{{constantCase id}},
|
|
44
|
+
],
|
|
45
|
+
executionHandler: build{{pascalCase entity.name}}MappedRelationships,
|
|
46
|
+
},
|
|
47
|
+
{{/if}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import {
|
|
3
|
+
IntegrationStep,
|
|
4
|
+
IntegrationStepExecutionContext,
|
|
5
|
+
RelationshipClass,
|
|
6
|
+
{{#if directRelationships}}
|
|
7
|
+
createDirectRelationship,
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if mappedRelationships}}
|
|
10
|
+
PrimitiveEntity,
|
|
11
|
+
RelationshipDirection,
|
|
12
|
+
createMappedRelationship,
|
|
13
|
+
{{/if}}
|
|
14
|
+
} from '@jupiterone/integration-sdk-core';
|
|
15
|
+
|
|
16
|
+
import { IntegrationConfig } from '../../config';
|
|
17
|
+
import {
|
|
18
|
+
Steps,
|
|
19
|
+
Entities,
|
|
20
|
+
Relationships,
|
|
21
|
+
} from '../constants';
|
|
22
|
+
{{#if request}}import { createAPIClient } from '../../client';{{/if}}
|
|
23
|
+
import { create{{pascalCase entity.name}}Entity } from '../converters';
|
|
24
|
+
|
|
25
|
+
export const {{camelCase entity.name}}Steps: IntegrationStep<IntegrationConfig>[] = [
|
|
26
|
+
{{> stepMap }}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export async function {{camelCase id}}({
|
|
30
|
+
jobState,
|
|
31
|
+
instance,
|
|
32
|
+
logger
|
|
33
|
+
}: IntegrationStepExecutionContext<IntegrationConfig>) {
|
|
34
|
+
const client = createAPIClient(instance.config, logger);
|
|
35
|
+
|
|
36
|
+
await jobState.iterateEntities(
|
|
37
|
+
{ _type: '{{ parentAssociation.parentEntityType }}' },
|
|
38
|
+
async (parentEntity) => {
|
|
39
|
+
const data = await client.get{{pascalCase entity.name}}(parentEntity);
|
|
40
|
+
await jobState.addEntity(create{{pascalCase entity.name}}Entity(data));
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
{{> directRelationships}}
|
|
46
|
+
{{> mappedRelationships}}
|
|
47
|
+
{{/with}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import {
|
|
3
|
+
createDirectRelationship,
|
|
4
|
+
IntegrationStep,
|
|
5
|
+
IntegrationStepExecutionContext,
|
|
6
|
+
RelationshipClass,
|
|
7
|
+
{{#if directRelationships}}
|
|
8
|
+
createDirectRelationship,
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#if mappedRelationships}}
|
|
11
|
+
PrimitiveEntity,
|
|
12
|
+
RelationshipDirection,
|
|
13
|
+
createMappedRelationship,
|
|
14
|
+
{{/if}}
|
|
15
|
+
} from '@jupiterone/integration-sdk-core';
|
|
16
|
+
|
|
17
|
+
import { IntegrationConfig } from '../../config';
|
|
18
|
+
import {
|
|
19
|
+
Steps,
|
|
20
|
+
Entities,
|
|
21
|
+
Relationships,
|
|
22
|
+
} from '../constants';
|
|
23
|
+
import { createAPIClient } from '../../client';
|
|
24
|
+
import { create{{pascalCase entity.name}}Entity } from '../converters';
|
|
25
|
+
|
|
26
|
+
export const {{camelCase entity.name}}Steps: IntegrationStep<IntegrationConfig>[] = [
|
|
27
|
+
{{> stepMap }}
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export async function {{camelCase id}}({
|
|
31
|
+
instance,
|
|
32
|
+
jobState,
|
|
33
|
+
logger
|
|
34
|
+
}: IntegrationStepExecutionContext<IntegrationConfig>): Promise<void> {
|
|
35
|
+
const client = createAPIClient(instance.config, logger);
|
|
36
|
+
|
|
37
|
+
await jobState.iterateEntities(
|
|
38
|
+
{ _type: '{{ parentAssociation.parentEntityType }}' },
|
|
39
|
+
async (parentEntity) => {
|
|
40
|
+
await client.iterate{{pascalCase entity.name}}s(
|
|
41
|
+
parentEntity,
|
|
42
|
+
async (data) => {
|
|
43
|
+
const entity = await jobState.addEntity(create{{pascalCase entity.name}}Entity(data));
|
|
44
|
+
|
|
45
|
+
await jobState.addRelationship(createDirectRelationship({
|
|
46
|
+
from: parentEntity,
|
|
47
|
+
_class: RelationshipClass.{{ parentAssociation.relationshipClass }},
|
|
48
|
+
to: entity,
|
|
49
|
+
}));
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
{{> directRelationships}}
|
|
57
|
+
{{> mappedRelationships}}
|
|
58
|
+
{{/with}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import {
|
|
3
|
+
IntegrationStep,
|
|
4
|
+
IntegrationStepExecutionContext,
|
|
5
|
+
{{#if directRelationships}}
|
|
6
|
+
RelationshipClass,
|
|
7
|
+
createDirectRelationship,
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if mappedRelationships}}
|
|
10
|
+
PrimitiveEntity,
|
|
11
|
+
RelationshipDirection,
|
|
12
|
+
createMappedRelationship,
|
|
13
|
+
{{/if}}
|
|
14
|
+
} from '@jupiterone/integration-sdk-core';
|
|
15
|
+
|
|
16
|
+
import { IntegrationConfig } from '../../config';
|
|
17
|
+
import {
|
|
18
|
+
Steps,
|
|
19
|
+
Entities,
|
|
20
|
+
{{#if directRelationships}}
|
|
21
|
+
Relationships,
|
|
22
|
+
{{/if}}
|
|
23
|
+
} from '../constants';
|
|
24
|
+
import { createAPIClient } from '../../client';
|
|
25
|
+
import { create{{pascalCase entity.name}}Entity } from '../converters';
|
|
26
|
+
|
|
27
|
+
export const {{camelCase entity.name}}Steps: IntegrationStep<IntegrationConfig>[] = [
|
|
28
|
+
{{> stepMap }}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export async function {{camelCase id}}({
|
|
32
|
+
instance,
|
|
33
|
+
jobState,
|
|
34
|
+
logger
|
|
35
|
+
}: IntegrationStepExecutionContext<IntegrationConfig>): Promise<void> {
|
|
36
|
+
const client = createAPIClient(instance.config, logger);
|
|
37
|
+
|
|
38
|
+
await client.iterate{{pascalCase entity.name}}s(
|
|
39
|
+
async (data) => {
|
|
40
|
+
await jobState.addEntity(create{{pascalCase entity.name}}Entity(data));
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
{{> directRelationships}}
|
|
46
|
+
{{> mappedRelationships}}
|
|
47
|
+
{{/with}}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import { executeStepWithDependencies } from '@jupiterone/integration-sdk-testing';
|
|
3
|
+
|
|
4
|
+
import { buildStepTestConfigForStep } from '../../../test/config';
|
|
5
|
+
import { Recording, setupProjectRecording } from '../../../test/recording';
|
|
6
|
+
import { Steps } from '../constants';
|
|
7
|
+
|
|
8
|
+
let recording: Recording;
|
|
9
|
+
afterEach(async () => {
|
|
10
|
+
await recording.stop();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('{{kebabCase id}}', async () => {
|
|
14
|
+
recording = setupProjectRecording({
|
|
15
|
+
directory: __dirname,
|
|
16
|
+
name: '{{kebabCase id}}',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const stepConfig = buildStepTestConfigForStep(Steps.{{constantCase id}});
|
|
20
|
+
const stepResult = await executeStepWithDependencies(stepConfig);
|
|
21
|
+
expect(stepResult).toMatchStepMetadata(stepConfig);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
{{#if directRelationships}}
|
|
25
|
+
{{#with (getDirectRelationships this)}}
|
|
26
|
+
{{#each this}}
|
|
27
|
+
test('build-{{kebabCase sourceStep.entity.name}}-{{kebabCase targetStep.entity.name}}-relationships', async () => {
|
|
28
|
+
recording = setupProjectRecording({
|
|
29
|
+
directory: __dirname,
|
|
30
|
+
name: 'build-{{kebabCase sourceStep.entity.name}}-{{kebabCase targetStep.entity.name}}-relationships',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const stepConfig = buildStepTestConfigForStep(Steps.BUILD_{{constantCase sourceStep.entity.name}}_{{constantCase targetStep.entity.name}}_RELATIONSHIPS);
|
|
34
|
+
const stepResult = await executeStepWithDependencies(stepConfig);
|
|
35
|
+
expect(stepResult).toMatchStepMetadata(stepConfig);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
{{/each}}
|
|
39
|
+
{{/with}}
|
|
40
|
+
{{/if}}
|
|
41
|
+
{{/with}}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import {
|
|
3
|
+
IntegrationStep,
|
|
4
|
+
IntegrationStepExecutionContext,
|
|
5
|
+
{{#if directRelationships}}
|
|
6
|
+
RelationshipClass,
|
|
7
|
+
createDirectRelationship,
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if mappedRelationships}}
|
|
10
|
+
PrimitiveEntity,
|
|
11
|
+
RelationshipDirection,
|
|
12
|
+
createMappedRelationship,
|
|
13
|
+
{{/if}}
|
|
14
|
+
} from '@jupiterone/integration-sdk-core';
|
|
15
|
+
|
|
16
|
+
import { IntegrationConfig } from '../../config';
|
|
17
|
+
import {
|
|
18
|
+
Steps,
|
|
19
|
+
Entities,
|
|
20
|
+
{{#if directRelationships}}
|
|
21
|
+
Relationships,
|
|
22
|
+
{{/if}}
|
|
23
|
+
} from '../constants';
|
|
24
|
+
{{#if request}}import { createAPIClient } from '../../client';{{/if}}
|
|
25
|
+
import { create{{pascalCase entity.name}}Entity } from '../converters';
|
|
26
|
+
|
|
27
|
+
export const {{camelCase entity.name}}Steps: IntegrationStep<IntegrationConfig>[] = [
|
|
28
|
+
{{> stepMap }}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export async function {{camelCase id}}({
|
|
32
|
+
jobState,
|
|
33
|
+
instance,
|
|
34
|
+
}: IntegrationStepExecutionContext<IntegrationConfig>) {
|
|
35
|
+
{{#if request}}
|
|
36
|
+
const client = createAPIClient(instance.config);
|
|
37
|
+
|
|
38
|
+
const data = await client.get{{camelCase entity.name}}();
|
|
39
|
+
{{/if}}
|
|
40
|
+
await jobState.addEntity(create{{pascalCase entity.name}}Entity({{#if request}}data{{/if}}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
{{> directRelationships}}
|
|
44
|
+
{{> mappedRelationships}}
|
|
45
|
+
{{/with}}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{{#with step}}
|
|
2
|
+
import {
|
|
3
|
+
RelationshipClass,
|
|
4
|
+
StepSpec,
|
|
5
|
+
} from '@jupiterone/integration-sdk-core';
|
|
6
|
+
import { IntegrationConfig } from '../../../src/config';
|
|
7
|
+
|
|
8
|
+
export const {{camelCase entity.name}}Spec: StepSpec<IntegrationConfig>[] = [
|
|
9
|
+
{
|
|
10
|
+
id: '{{kebabCase id}}',
|
|
11
|
+
name: '{{name}}',
|
|
12
|
+
entities: [
|
|
13
|
+
{
|
|
14
|
+
resourceName: '{{entity.name}}',
|
|
15
|
+
_type: '{{entity._type}}',
|
|
16
|
+
_class: ['{{entity._class}}'],
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
relationships: [
|
|
20
|
+
{{#if parentAssociation}}
|
|
21
|
+
{
|
|
22
|
+
sourceType: '{{parentAssociation.parentEntityType}}',
|
|
23
|
+
_class: RelationshipClass.{{constantCase parentAssociation.relationshipClass}},
|
|
24
|
+
targetType: '{{entity._type}}',
|
|
25
|
+
_type: '{{getRelationshipType parentAssociation.relationshipClass parentAssociation.parentEntityType entity._type}}',
|
|
26
|
+
},
|
|
27
|
+
{{/if}}
|
|
28
|
+
],
|
|
29
|
+
dependsOn: [
|
|
30
|
+
{{#each dependsOn}}
|
|
31
|
+
'{{this}}',
|
|
32
|
+
{{/each}}
|
|
33
|
+
],
|
|
34
|
+
implemented: true,
|
|
35
|
+
},
|
|
36
|
+
{{#if directRelationships}}
|
|
37
|
+
{{#with (getDirectRelationships this)}}
|
|
38
|
+
{{#each this}}
|
|
39
|
+
{
|
|
40
|
+
id: 'build-{{kebabCase sourceStep.entity.name}}-{{kebabCase targetStep.entity.name}}-relationships',
|
|
41
|
+
name: 'Build {{sourceStep.entity.name}} {{targetStep.entity.name}} Relationships',
|
|
42
|
+
entities: [],
|
|
43
|
+
relationships: [
|
|
44
|
+
{
|
|
45
|
+
sourceType: '{{sourceStep.entity._type}}',
|
|
46
|
+
_class: RelationshipClass.{{constantCase relationshipClass}},
|
|
47
|
+
targetType: '{{targetStep.entity._type}}',
|
|
48
|
+
_type: '{{getRelationshipType relationshipClass sourceStep.entity._type targetStep.entity._type}}',
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
dependsOn: [
|
|
52
|
+
'{{sourceStep.id}}',
|
|
53
|
+
'{{targetStep.id}}',
|
|
54
|
+
],
|
|
55
|
+
implemented: true,
|
|
56
|
+
},
|
|
57
|
+
{{/each}}
|
|
58
|
+
{{/with}}
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{#if mappedRelationships}}
|
|
61
|
+
{
|
|
62
|
+
id: 'build-{{kebabCase entity.name}}-mapped-relationships',
|
|
63
|
+
name: 'Build {{entity.name}} Mapped Relationships',
|
|
64
|
+
entities: [],
|
|
65
|
+
relationships: [],
|
|
66
|
+
dependsOn: [
|
|
67
|
+
'{{id}}',
|
|
68
|
+
],
|
|
69
|
+
implemented: true,
|
|
70
|
+
},
|
|
71
|
+
{{/if}}
|
|
72
|
+
];
|
|
73
|
+
{{/with}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Check out code repository source code
|
|
13
|
+
uses: actions/checkout@v3
|
|
14
|
+
|
|
15
|
+
- id: setup-node
|
|
16
|
+
name: Setup Node
|
|
17
|
+
uses: actions/setup-node@v3
|
|
18
|
+
with:
|
|
19
|
+
node-version: 18.x
|
|
20
|
+
cache: yarn
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: yarn --frozen-lockfile
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: yarn test:ci
|
|
27
|
+
|
|
28
|
+
- name: Run build
|
|
29
|
+
run: yarn build
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Questions
|
|
2
|
+
on: [pull_request_target]
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
validate:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
- name: Check out `main` branch
|
|
10
|
+
uses: actions/checkout@v3
|
|
11
|
+
with:
|
|
12
|
+
path: source
|
|
13
|
+
|
|
14
|
+
- name: Check out target branch questions
|
|
15
|
+
uses: actions/checkout@v3
|
|
16
|
+
with:
|
|
17
|
+
ref: $\{{github.event.pull_request.head.ref}}
|
|
18
|
+
repository: $\{{github.event.pull_request.head.repo.full_name}}
|
|
19
|
+
path: target
|
|
20
|
+
|
|
21
|
+
- id: setup-node
|
|
22
|
+
name: Setup Node
|
|
23
|
+
uses: actions/setup-node@v3
|
|
24
|
+
with:
|
|
25
|
+
node-version: 18.x
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies for `main` branch
|
|
28
|
+
run: yarn install --cwd source --frozen-lockfile
|
|
29
|
+
|
|
30
|
+
- name: Validate questions on target branch
|
|
31
|
+
env:
|
|
32
|
+
MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID:
|
|
33
|
+
$\{{ secrets.MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID }}
|
|
34
|
+
MANAGED_QUESTIONS_JUPITERONE_API_KEY:
|
|
35
|
+
$\{{ secrets.MANAGED_QUESTIONS_JUPITERONE_API_KEY }}
|
|
36
|
+
run:
|
|
37
|
+
yarn --cwd source j1-integration validate-question-file -a
|
|
38
|
+
--frozen-lockfile $MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k
|
|
39
|
+
$MANAGED_QUESTIONS_JUPITERONE_API_KEY -p
|
|
40
|
+
../target/jupiterone/questions/questions.yaml
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
18
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to
|
|
7
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM node:18-bullseye-slim as builder
|
|
2
|
+
|
|
3
|
+
ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration
|
|
4
|
+
|
|
5
|
+
COPY package.json yarn.lock tsconfig.dist.json tsconfig.json LICENSE ${JUPITERONE_INTEGRATION_DIR}/
|
|
6
|
+
COPY src/ ${JUPITERONE_INTEGRATION_DIR}/src
|
|
7
|
+
WORKDIR ${JUPITERONE_INTEGRATION_DIR}
|
|
8
|
+
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/api/lists/*
|
|
9
|
+
RUN yarn install
|
|
10
|
+
RUN yarn build:docker
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
FROM node:18-bullseye-slim
|
|
14
|
+
ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration
|
|
15
|
+
COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/dist ${JUPITERONE_INTEGRATION_DIR}
|
|
16
|
+
COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/yarn.lock ${JUPITERONE_INTEGRATION_DIR}
|
|
17
|
+
COPY scripts/ ${JUPITERONE_INTEGRATION_DIR}/scripts
|
|
18
|
+
WORKDIR ${JUPITERONE_INTEGRATION_DIR}
|
|
19
|
+
RUN apt-get update && apt-get install -y python3
|
|
20
|
+
RUN yarn install --production --fronzen-lockfile --cache-folder ./ycache && yarn global add --cache-folder ./ycache @jupiterone/integration-sdk-cli && rm -rf ./ycache && chown -R node:node /opt/jupiterone
|
|
21
|
+
RUN export PATH="$(yarn global bin):$PATH"
|
|
22
|
+
|
|
23
|
+
USER node
|
|
24
|
+
|
|
25
|
+
CMD ["sh", "scripts/execute.sh"]
|