├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .huskyrc.js ├── .lintstagedrc ├── .node-version ├── .prettierignore ├── .prettierrc ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── README.md ├── babel.config.js ├── cortex.yaml ├── docs └── integrations │ ├── development.md │ ├── development_guide.md │ ├── snippets.md │ ├── step-patterns.md │ └── testing.md ├── jest.config.base.js ├── jest.config.js ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── cli │ ├── __mocks__ │ │ ├── fs.ts │ │ └── ora.ts │ ├── babel.config.js │ ├── bin │ │ └── j1 │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── cli-export.test.ts │ │ │ ├── cli-import.test.ts │ │ │ └── utils │ │ │ │ ├── constants.ts │ │ │ │ ├── fetchAssetsContents.ts │ │ │ │ └── index.ts │ │ ├── commands │ │ │ ├── index.ts │ │ │ ├── j1Export.ts │ │ │ └── j1Import.ts │ │ ├── export │ │ │ ├── __tests__ │ │ │ │ ├── bulkDownloadToJson.test.ts │ │ │ │ ├── exportAssetsToJson.test.ts │ │ │ │ ├── exportJsonAssetsToCsv.test.ts │ │ │ │ ├── groupJsonAssetsByType.test.ts │ │ │ │ ├── utils │ │ │ │ │ ├── createEntity.ts │ │ │ │ │ ├── createRelationship.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── parseCsvToJson.ts │ │ │ │ │ └── parseToCsv.ts │ │ │ │ └── writeAssetsToCsv.test.ts │ │ │ ├── bulkDownloadToJson.ts │ │ │ ├── exportAssets.ts │ │ │ ├── exportAssetsToJson.ts │ │ │ ├── exportJsonAssetsToCsv.ts │ │ │ ├── groupJsonAssetsByType.ts │ │ │ ├── util.ts │ │ │ └── writeAssetsToCsv.ts │ │ ├── fileSystem.ts │ │ ├── import │ │ │ ├── importAssets.ts │ │ │ └── importAssetsFromCsv.ts │ │ ├── index.ts │ │ ├── log.ts │ │ ├── pause.ts │ │ └── validateOption.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-benchmark │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── package.json │ └── src │ │ ├── benchmarks │ │ ├── FileSystemGraphObjectStore.addEntities.js │ │ ├── InMemoryGraphObjectStore.addEntities.js │ │ └── JobState.addEntities.js │ │ └── util │ │ ├── entity.js │ │ └── eventCollector.js ├── integration-sdk-cli │ ├── LICENSE │ ├── README.md │ ├── __mocks__ │ │ ├── fs.ts │ │ └── graceful-fs.ts │ ├── babel.config.js │ ├── bin │ │ └── j1-integration │ ├── jest.config.js │ ├── jest.setup.ts │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── __snapshots__ │ │ │ │ └── cli.test.ts.snap │ │ │ ├── cli-run-failure.test.ts │ │ │ ├── cli-run.test.ts │ │ │ ├── cli-sync.test.ts │ │ │ ├── cli.test.ts │ │ │ ├── cli │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── visualize-types.test.ts.snap │ │ │ │ ├── validate-question-file.test.ts │ │ │ │ └── visualize-types.test.ts │ │ │ ├── options.test.ts │ │ │ └── util │ │ │ │ ├── recording.ts │ │ │ │ └── synchronization.ts │ │ ├── bocchi │ │ │ ├── README.md │ │ │ ├── actions │ │ │ │ └── steps.ts │ │ │ ├── bocchi.ts │ │ │ ├── docs │ │ │ │ └── template │ │ │ │ │ ├── README.md │ │ │ │ │ ├── authentication.md │ │ │ │ │ ├── examples │ │ │ │ │ ├── example.json │ │ │ │ │ └── signalSciences.json │ │ │ │ │ └── steps.md │ │ │ ├── templates │ │ │ │ ├── partials │ │ │ │ │ ├── directRelationships.hbs │ │ │ │ │ ├── mappedRelationships.hbs │ │ │ │ │ └── stepMap.hbs │ │ │ │ ├── steps │ │ │ │ │ ├── child-singleton.ts.hbs │ │ │ │ │ ├── fetch-child-entities.ts.hbs │ │ │ │ │ ├── fetch-entities.ts.hbs │ │ │ │ │ ├── index.test.ts.hbs │ │ │ │ │ ├── singleton.ts.hbs │ │ │ │ │ └── spec.ts.hbs │ │ │ │ └── top-level │ │ │ │ │ ├── .env.example.hbs │ │ │ │ │ ├── .eslintignore.hbs │ │ │ │ │ ├── .eslintrc.hbs │ │ │ │ │ ├── .github │ │ │ │ │ └── workflows │ │ │ │ │ │ ├── build.yml.hbs │ │ │ │ │ │ └── questions.yml.hbs │ │ │ │ │ ├── .gitignore.hbs │ │ │ │ │ ├── .node-version.hbs │ │ │ │ │ ├── .prettierignore.hbs │ │ │ │ │ ├── CHANGELOG.md.hbs │ │ │ │ │ ├── CODEOWNERS.hbs │ │ │ │ │ ├── Dockerfile.hbs │ │ │ │ │ ├── LICENSE.hbs │ │ │ │ │ ├── README.md.hbs │ │ │ │ │ ├── docs │ │ │ │ │ ├── development.md.hbs │ │ │ │ │ ├── jupiterone.md.hbs │ │ │ │ │ └── spec │ │ │ │ │ │ └── index.ts.hbs │ │ │ │ │ ├── husky.config.js.hbs │ │ │ │ │ ├── jest.config.js.hbs │ │ │ │ │ ├── jupiterone │ │ │ │ │ └── questions │ │ │ │ │ │ └── questions.yaml.hbs │ │ │ │ │ ├── lint-staged.config.js.hbs │ │ │ │ │ ├── package.json.hbs │ │ │ │ │ ├── prettier.config.js.hbs │ │ │ │ │ ├── src │ │ │ │ │ ├── client.ts.hbs │ │ │ │ │ ├── config.ts.hbs │ │ │ │ │ ├── index.test.ts.hbs │ │ │ │ │ ├── index.ts.hbs │ │ │ │ │ └── steps │ │ │ │ │ │ ├── constants.ts.hbs │ │ │ │ │ │ ├── converters.ts.hbs │ │ │ │ │ │ ├── index.ts.hbs │ │ │ │ │ │ └── types.ts.hbs │ │ │ │ │ ├── test │ │ │ │ │ ├── README.md.hbs │ │ │ │ │ ├── config.ts.hbs │ │ │ │ │ └── recording.ts.hbs │ │ │ │ │ ├── tsconfig.dist.json.hbs │ │ │ │ │ └── tsconfig.json.hbs │ │ │ └── utils │ │ │ │ └── types.ts │ │ ├── commands │ │ │ ├── bocchi.ts │ │ │ ├── collect.ts │ │ │ ├── diff.ts │ │ │ ├── document.ts │ │ │ ├── generate-ingestion-sources-config.test.ts │ │ │ ├── generate-ingestion-sources-config.ts │ │ │ ├── generate-integration-graph-schema.test.ts │ │ │ ├── generate-integration-graph-schema.ts │ │ │ ├── generate.ts │ │ │ ├── index.ts │ │ │ ├── neo4j.ts │ │ │ ├── options.ts │ │ │ ├── run.ts │ │ │ ├── sync.ts │ │ │ ├── troubleshoot.ts │ │ │ ├── validate-question-file.ts │ │ │ ├── visualize-dependencies.ts │ │ │ ├── visualize-types.test.ts │ │ │ ├── visualize-types.ts │ │ │ └── visualize.ts │ │ ├── config.ts │ │ ├── generator │ │ │ ├── actions.ts │ │ │ ├── configFieldsFlow.ts │ │ │ ├── entitiesFlow.ts │ │ │ ├── helpers.ts │ │ │ ├── newIntegration.ts │ │ │ ├── relationshipsFlow.ts │ │ │ ├── stepTemplate │ │ │ │ └── index.ts.hbs │ │ │ ├── stepsFlow.ts │ │ │ ├── template │ │ │ │ ├── .env.example.hbs │ │ │ │ ├── .eslintignore.hbs │ │ │ │ ├── .eslintrc.hbs │ │ │ │ ├── .github │ │ │ │ │ ├── pull_request_template.md.hbs │ │ │ │ │ └── workflows │ │ │ │ │ │ ├── build.yml.hbs │ │ │ │ │ │ └── questions.yml.hbs │ │ │ │ ├── .gitignore.hbs │ │ │ │ ├── .node-version.hbs │ │ │ │ ├── .prettierignore.hbs │ │ │ │ ├── CHANGELOG.md.hbs │ │ │ │ ├── CODEOWNERS.hbs │ │ │ │ ├── Dockerfile.hbs │ │ │ │ ├── LICENSE.hbs │ │ │ │ ├── README.md.hbs │ │ │ │ ├── docs │ │ │ │ │ ├── development.md.hbs │ │ │ │ │ └── jupiterone.md.hbs │ │ │ │ ├── husky.config.js.hbs │ │ │ │ ├── jest.config.js.hbs │ │ │ │ ├── jupiterone │ │ │ │ │ └── questions │ │ │ │ │ │ └── questions.yaml.hbs │ │ │ │ ├── lint-staged.config.js.hbs │ │ │ │ ├── package.json.hbs │ │ │ │ ├── prettier.config.js.hbs │ │ │ │ ├── scripts │ │ │ │ │ └── execute.sh.hbs │ │ │ │ ├── src │ │ │ │ │ ├── client.ts.hbs │ │ │ │ │ ├── config.ts.hbs │ │ │ │ │ ├── index.ts.hbs │ │ │ │ │ ├── steps │ │ │ │ │ │ ├── constants.ts.hbs │ │ │ │ │ │ └── index.ts.hbs │ │ │ │ │ └── validateInvocation.ts.hbs │ │ │ │ ├── test │ │ │ │ │ ├── README.md.hbs │ │ │ │ │ ├── config.ts.hbs │ │ │ │ │ └── recording.ts.hbs │ │ │ │ ├── tsconfig.dist.json.hbs │ │ │ │ └── tsconfig.json.hbs │ │ │ └── util.ts │ │ ├── index.ts │ │ ├── log.ts │ │ ├── neo4j │ │ │ ├── README.md │ │ │ ├── __tests__ │ │ │ │ ├── neo4jGraphStore.test.ts │ │ │ │ └── neo4jUtilities.test.ts │ │ │ ├── index.ts │ │ │ ├── neo4jGraphStore.ts │ │ │ ├── neo4jUtilities.ts │ │ │ ├── uploadToNeo4j.ts │ │ │ └── wipeNeo4j.ts │ │ ├── questions │ │ │ ├── __fixtures__ │ │ │ │ └── questions │ │ │ │ │ ├── basic.yaml │ │ │ │ │ ├── compliance.yaml │ │ │ │ │ ├── empty-questions.yaml │ │ │ │ │ ├── invalid-results-are.yaml │ │ │ │ │ ├── invalid-yaml.yaml │ │ │ │ │ ├── multiple-queries.yaml │ │ │ │ │ ├── multiple-questions.yaml │ │ │ │ │ ├── non-unique-question-id.yaml │ │ │ │ │ ├── non-unique-question-name.yaml │ │ │ │ │ ├── non-unique-question-tag.yaml │ │ │ │ │ ├── non-unique-question-title.yaml │ │ │ │ │ └── results-are.yaml │ │ │ ├── managedQuestionFileValidator.test.ts │ │ │ └── managedQuestionFileValidator.ts │ │ ├── services │ │ │ └── queryLanguage.ts │ │ ├── troubleshoot │ │ │ ├── index.ts │ │ │ ├── troubleshoot.ts │ │ │ └── utils.ts │ │ ├── utils │ │ │ ├── generateVisHTML.ts │ │ │ ├── getSortedJupiterOneTypes.test.ts │ │ │ └── getSortedJupiterOneTypes.ts │ │ └── visualization │ │ │ ├── __tests__ │ │ │ ├── __snapshots__ │ │ │ │ └── generateVisHTML.test.ts.snap │ │ │ ├── createMappedRelationshipNodesAndEdges.test.ts │ │ │ ├── generateVisHTML.test.ts │ │ │ ├── generateVisualization.test.ts │ │ │ └── retrieveIntegrationData.test.ts │ │ │ ├── createMappedRelationshipNodesAndEdges.ts │ │ │ ├── error.ts │ │ │ ├── generateDependencyVisualization.ts │ │ │ ├── generateVisualization.ts │ │ │ ├── index.ts │ │ │ ├── retrieveIntegrationData.ts │ │ │ ├── types │ │ │ ├── IntegrationData.ts │ │ │ └── index.ts │ │ │ └── utils.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-core │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── docs │ │ └── createIntegrationHelpers.md │ ├── jest.config.js │ ├── jest.setup.ts │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── index.test.ts │ │ ├── data │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── createIntegrationHelpers.test.ts.snap │ │ │ │ ├── converters.test.ts │ │ │ │ ├── createIntegrationEntity.test.ts │ │ │ │ ├── createIntegrationHelpers.test.ts │ │ │ │ ├── createIntegrationRelationship.test.ts │ │ │ │ ├── ip.test.ts │ │ │ │ ├── rawData.test.ts │ │ │ │ └── tagging.test.ts │ │ │ ├── converters.ts │ │ │ ├── createIntegrationEntity.ts │ │ │ ├── createIntegrationHelpers.ts │ │ │ ├── createIntegrationRelationship.ts │ │ │ ├── index.ts │ │ │ ├── ip.ts │ │ │ ├── rawData.ts │ │ │ └── tagging.ts │ │ ├── errors.test.ts │ │ ├── errors.ts │ │ ├── index.ts │ │ └── types │ │ │ ├── config.ts │ │ │ ├── context.ts │ │ │ ├── entity.ts │ │ │ ├── index.ts │ │ │ ├── instance.ts │ │ │ ├── jobState.ts │ │ │ ├── logger.ts │ │ │ ├── metric.ts │ │ │ ├── partialDatasets.ts │ │ │ ├── persistedObject.ts │ │ │ ├── relationship.ts │ │ │ ├── spec.ts │ │ │ ├── step.ts │ │ │ ├── storage.ts │ │ │ ├── synchronization.ts │ │ │ └── validation.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-dev-tools │ ├── README.md │ ├── babel.config.js │ ├── config │ │ ├── eslint.json │ │ ├── husky.js │ │ ├── jest.js │ │ ├── lint-staged.js │ │ ├── prettier.js │ │ ├── setupJestTestFramework.js │ │ └── typescript.json │ └── package.json ├── integration-sdk-entities │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── jest.config.js │ ├── jest.setup.ts │ ├── package.json │ ├── src │ │ ├── AccessKey.d.ts │ │ ├── AccessPolicy.d.ts │ │ ├── AccessRole.d.ts │ │ ├── Account.d.ts │ │ ├── Alert.d.ts │ │ ├── Application.d.ts │ │ ├── ApplicationEndpoint.d.ts │ │ ├── Assessment.d.ts │ │ ├── Attacker.d.ts │ │ ├── Backup.d.ts │ │ ├── Base.ts │ │ ├── Certificate.d.ts │ │ ├── Channel.d.ts │ │ ├── Cluster.d.ts │ │ ├── CodeCommit.d.ts │ │ ├── CodeDeploy.d.ts │ │ ├── CodeModule.d.ts │ │ ├── CodeRepo.d.ts │ │ ├── CodeReview.d.ts │ │ ├── Configuration.d.ts │ │ ├── Container.d.ts │ │ ├── Control.d.ts │ │ ├── ControlPolicy.d.ts │ │ ├── CryptoKey.d.ts │ │ ├── DataCollection.d.ts │ │ ├── DataObject.d.ts │ │ ├── DataStore.d.ts │ │ ├── Database.d.ts │ │ ├── Deployment.d.ts │ │ ├── Device.d.ts │ │ ├── Directory.d.ts │ │ ├── Disk.d.ts │ │ ├── Document.d.ts │ │ ├── Domain.d.ts │ │ ├── DomainRecord.d.ts │ │ ├── DomainZone.d.ts │ │ ├── Entity.d.ts │ │ ├── Finding.d.ts │ │ ├── Firewall.d.ts │ │ ├── Framework.d.ts │ │ ├── Function.d.ts │ │ ├── Gateway.d.ts │ │ ├── GraphObject.d.ts │ │ ├── Group.d.ts │ │ ├── Host.d.ts │ │ ├── HostAgent.d.ts │ │ ├── Image.d.ts │ │ ├── Incident.d.ts │ │ ├── Internet.d.ts │ │ ├── IpAddress.d.ts │ │ ├── Issue.d.ts │ │ ├── Key.d.ts │ │ ├── Logs.d.ts │ │ ├── Model.d.ts │ │ ├── Module.d.ts │ │ ├── Network.d.ts │ │ ├── NetworkEndpoint.d.ts │ │ ├── NetworkInterface.d.ts │ │ ├── Organization.d.ts │ │ ├── PR.d.ts │ │ ├── PasswordPolicy.d.ts │ │ ├── Person.d.ts │ │ ├── Policy.d.ts │ │ ├── Problem.d.ts │ │ ├── Procedure.d.ts │ │ ├── Process.d.ts │ │ ├── Product.d.ts │ │ ├── Program.d.ts │ │ ├── Project.d.ts │ │ ├── Question.d.ts │ │ ├── Queue.d.ts │ │ ├── Record.d.ts │ │ ├── RecordEntity.d.ts │ │ ├── Repository.d.ts │ │ ├── Requirement.d.ts │ │ ├── Resource.d.ts │ │ ├── Review.d.ts │ │ ├── Risk.d.ts │ │ ├── Root.d.ts │ │ ├── Rule.d.ts │ │ ├── Ruleset.d.ts │ │ ├── Scanner.d.ts │ │ ├── Secret.d.ts │ │ ├── Section.d.ts │ │ ├── Service.d.ts │ │ ├── Site.d.ts │ │ ├── Standard.d.ts │ │ ├── Subscription.d.ts │ │ ├── Task.d.ts │ │ ├── Team.d.ts │ │ ├── ThreatIntel.d.ts │ │ ├── Training.d.ts │ │ ├── User.d.ts │ │ ├── UserGroup.d.ts │ │ ├── Vault.d.ts │ │ ├── Vendor.d.ts │ │ ├── Vulnerability.d.ts │ │ ├── Weakness.d.ts │ │ ├── Workflow.d.ts │ │ ├── Workload.d.ts │ │ └── index.ts │ ├── tools │ │ ├── copy-schemas │ │ │ ├── .gitignore │ │ │ ├── _schemas │ │ │ │ └── .gitkeep │ │ │ └── index.js │ │ └── create-barrel │ │ │ └── index.js │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-entity-validator │ ├── LICENSE │ ├── babel.config.js │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── entityValidationError.test.ts │ │ │ └── validator.test.ts │ │ ├── assertEntity.ts │ │ ├── entityValidationError.ts │ │ ├── index.ts │ │ ├── j1Formats.ts │ │ ├── singleton.ts │ │ └── validator.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-http-client │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── jest.config.js │ ├── jest.setup.ts │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── index.test.ts │ │ ├── client.ts │ │ ├── errors.ts │ │ ├── index.ts │ │ └── types.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── integration-sdk-private-test-utils │ ├── README.md │ ├── __fixtures__ │ │ ├── .gitignore │ │ ├── docsInstanceArrayEntityClasses │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceCustomDocLoc │ │ │ ├── .gitignore │ │ │ ├── custom-docs │ │ │ │ └── custom-jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceDuplicateEntityTypes │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceDuplicateRelationshipTypes │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceEntitiesAlphabetize │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchData.ts │ │ ├── docsInstanceNoEntities │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchAccounts.ts │ │ ├── docsInstanceNoEntitiesNoRelationships │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceRelationshipsAlphabetize │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchAccounts.ts │ │ ├── docsInstanceWithDependentStepsNoRelationships │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ ├── fetchGroups.ts │ │ │ │ └── fetchUsers.ts │ │ ├── docsInstanceWithMappedRelationships │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsInstanceWithRelationships │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsWithExistingGeneratedDocs │ │ │ ├── .gitignore │ │ │ ├── docs │ │ │ │ └── jupiterone.md │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── docsWithoutExistingDoc │ │ │ ├── .gitignore │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── steps │ │ │ │ └── fetchGroups.ts │ │ ├── generate-integration-graph-schema_all-graph-data-types-dist │ │ │ ├── .gitignore │ │ │ └── dist │ │ │ │ └── index.js │ │ ├── generate-integration-graph-schema_all-graph-data-types │ │ │ ├── .gitignore │ │ │ └── src │ │ │ │ └── index.ts │ │ ├── indexFileEntrypoint │ │ │ └── src │ │ │ │ └── index.ts │ │ ├── indexFileEntrypointFailure │ │ │ └── src │ │ │ │ └── index.ts │ │ ├── instanceConfigWithoutEnv │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ └── instanceConfigFields.json │ │ ├── instanceWithDependentCachedSteps │ │ │ ├── .env │ │ │ ├── .gitignore │ │ │ ├── .j1-integration-cache │ │ │ │ └── graph │ │ │ │ │ └── fetch-accounts │ │ │ │ │ └── entities │ │ │ │ │ └── test-account.json │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ ├── fetchGroups.ts │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── instanceWithDependentSteps │ │ │ ├── .env │ │ │ ├── .gitignore │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ ├── fetchGroups.ts │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── instanceWithNonValidatingSteps │ │ │ ├── .env │ │ │ ├── .gitignore │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── javaScriptProject │ │ │ └── src │ │ │ │ ├── getStepStartStates.js │ │ │ │ ├── index.js │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.js │ │ │ │ └── fetchUsers.js │ │ │ │ └── validateInvocation.js │ │ ├── synchronization-compressed │ │ │ └── .j1-integration │ │ │ │ ├── graph │ │ │ │ ├── entities-1.json │ │ │ │ ├── entities-2.json │ │ │ │ ├── relationship-1.json │ │ │ │ └── relationship-2.json │ │ │ │ └── summary.json │ │ ├── synchronization │ │ │ └── .j1-integration │ │ │ │ ├── graph │ │ │ │ ├── entities-1.json │ │ │ │ ├── entities-2.json │ │ │ │ ├── relationship-1.json │ │ │ │ └── relationship-2.json │ │ │ │ └── summary.json │ │ ├── typeScriptIntegrationProject │ │ │ ├── .env │ │ │ ├── .gitignore │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── typeScriptProject │ │ │ ├── .env │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── typeScriptVisualizeProject │ │ │ ├── .env │ │ │ ├── custom-integration │ │ │ │ ├── .gitignore │ │ │ │ └── graph │ │ │ │ │ ├── entity │ │ │ │ │ └── entities │ │ │ │ │ │ └── index.json │ │ │ │ │ └── entity_has_entity │ │ │ │ │ └── relationships │ │ │ │ │ └── index.json │ │ │ └── src │ │ │ │ ├── getStepStartStates.ts │ │ │ │ ├── index.ts │ │ │ │ ├── instanceConfigFields.json │ │ │ │ ├── steps │ │ │ │ ├── fetchAccounts.ts │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ ├── validationFailure │ │ │ └── src │ │ │ │ ├── index.ts │ │ │ │ ├── steps │ │ │ │ └── fetchUsers.ts │ │ │ │ └── validateInvocation.ts │ │ └── visualizeTypesWithEntitiesAndRelationships │ │ │ ├── .gitignore │ │ │ └── src │ │ │ ├── index.ts │ │ │ └── steps │ │ │ └── fetchAccounts.ts │ ├── babel.config.js │ ├── package.json │ ├── src │ │ ├── graphObject.ts │ │ ├── graphObjectStore.ts │ │ ├── index.ts │ │ ├── loadProjectStructure.ts │ │ ├── step.ts │ │ ├── toUnixPath.ts │ │ └── util.ts │ └── tsconfig.json ├── integration-sdk-runtime │ ├── LICENSE │ ├── README.md │ ├── __mocks__ │ │ ├── fs.ts │ │ └── graceful-fs.ts │ ├── babel.config.js │ ├── jest.config.js │ ├── jest.setup.ts │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── index.test.ts │ │ ├── api │ │ │ ├── __tests__ │ │ │ │ └── index.test.ts │ │ │ ├── error.ts │ │ │ └── index.ts │ │ ├── execution │ │ │ ├── __tests__ │ │ │ │ ├── config.test.ts │ │ │ │ ├── dependencyGraph.test.ts │ │ │ │ ├── executeIntegration.test.ts │ │ │ │ ├── getMaskedFields.test.ts │ │ │ │ ├── instance.test.ts │ │ │ │ ├── jobState.test.ts │ │ │ │ ├── trimStringValues.test.ts │ │ │ │ ├── utils │ │ │ │ │ ├── createIntegrationConfig.ts │ │ │ │ │ ├── getIngestionSourceStepStartStates.test.ts │ │ │ │ │ └── processDeclaredTypesDiff.test.ts │ │ │ │ └── validation.test.ts │ │ │ ├── config.ts │ │ │ ├── dependencyGraph.test.ts │ │ │ ├── dependencyGraph.ts │ │ │ ├── duplicateKeyTracker.test.ts │ │ │ ├── duplicateKeyTracker.ts │ │ │ ├── executeIntegration.ts │ │ │ ├── index.ts │ │ │ ├── instance.ts │ │ │ ├── jobState.ts │ │ │ ├── onDiskDuplicateKeyTracker.test.ts │ │ │ ├── onDiskDuplicateKeyTracker.ts │ │ │ ├── step.ts │ │ │ ├── uploader.test.ts │ │ │ ├── uploader.ts │ │ │ ├── utils │ │ │ │ ├── bigMap.test.ts │ │ │ │ ├── bigMap.ts │ │ │ │ ├── getIngestionSourceStepStartStates.ts │ │ │ │ ├── getMaskedFields.ts │ │ │ │ ├── processDeclaredTypesDiff.ts │ │ │ │ ├── seperateStepsByDependencyGraph.ts │ │ │ │ └── trimStringValues.ts │ │ │ └── validation.ts │ │ ├── fileSystem.ts │ │ ├── index.ts │ │ ├── logger │ │ │ ├── __tests__ │ │ │ │ └── index.test.ts │ │ │ ├── index.ts │ │ │ ├── registerEventHandlers.test.ts │ │ │ └── registerEventHandlers.ts │ │ ├── metrics │ │ │ ├── __tests__ │ │ │ │ └── index.test.ts │ │ │ └── index.ts │ │ ├── storage │ │ │ ├── FileSystemGraphObjectStore │ │ │ │ ├── FileSystemGraphObjectStore.ts │ │ │ │ ├── __tests__ │ │ │ │ │ ├── FileSystemGraphObjectStore.test.ts │ │ │ │ │ └── flushDataToDisk.test.ts │ │ │ │ ├── flushDataToDisk.ts │ │ │ │ ├── index.ts │ │ │ │ ├── indices.ts │ │ │ │ └── path.ts │ │ │ ├── index.ts │ │ │ ├── memory.test.ts │ │ │ ├── memory.ts │ │ │ └── types.ts │ │ └── synchronization │ │ │ ├── __tests__ │ │ │ ├── batchSize.test.ts │ │ │ ├── events.test.ts │ │ │ ├── index.test.ts │ │ │ ├── shrinkBatchRawData.test.ts │ │ │ ├── uploadData.test.ts │ │ │ └── util │ │ │ │ └── generateSynchronizationJob.ts │ │ │ ├── batchBySize.ts │ │ │ ├── error.ts │ │ │ ├── events.ts │ │ │ ├── index.ts │ │ │ ├── shrinkBatchRawData.ts │ │ │ ├── types.ts │ │ │ └── util.ts │ ├── test │ │ ├── mocks │ │ │ └── mockWriteJsonToPath.ts │ │ └── util │ │ │ ├── expect.ts │ │ │ ├── fixtures.ts │ │ │ └── request.ts │ ├── tsconfig.dist.json │ └── tsconfig.json └── integration-sdk-testing │ ├── LICENSE │ ├── __mocks__ │ ├── fs.ts │ └── graceful-fs.ts │ ├── babel.config.js │ ├── jest.config.js │ ├── package.json │ ├── src │ ├── __tests__ │ │ ├── context.test.ts │ │ ├── executeStepWithDependencies.test.ts │ │ ├── getStepExecutionOrder.test.ts │ │ ├── jest.test.ts │ │ ├── jobState.test.ts │ │ └── recording.test.ts │ ├── config.ts │ ├── context.ts │ ├── executeStepWithDependencies.ts │ ├── filterGraphObjects.ts │ ├── getStepExecutionOrder.ts │ ├── index.ts │ ├── jest.ts │ ├── jobState.ts │ ├── logger.ts │ └── recording.ts │ ├── tsconfig.dist.json │ └── tsconfig.json ├── snippets └── integrations │ ├── .readme │ ├── j1-converter.gif │ ├── j1-entity-metadata.gif │ ├── j1-execution-handler-static.gif │ ├── j1-execution-handler.gif │ ├── j1-pagination.gif │ ├── j1-rate-limit.gif │ ├── j1-relationship-metadata.gif │ ├── j1-request-with-retries.gif │ ├── j1-spec.gif │ └── j1-step.gif │ ├── README.md │ └── typescript.json └── tsconfig.base.json /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{ts,json}] 2 | end_of_line = lf 3 | indent_size = 2 4 | indent_style = space -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | template 3 | testing.d.ts 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "./packages/integration-sdk-dev-tools/config/eslint.json" 4 | ], 5 | "ignorePatterns": ["node_modules/", "dist/", "work/", "coverage/"], 6 | "parserOptions": { 7 | "ecmaVersion": 2020, 8 | "project": "./tsconfig.base.json", 9 | "tsconfigRootDir": "." 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Ensure that Windows users are using LF line endings. GitHub action runners 2 | # respect properties of the `.gitattributes` file. Without this, 3 | # `prettier --check` will fail on Windows. 4 | # 5 | # See: https://prettier.io/docs/en/options.html#end-of-line 6 | * text=auto eol=lf 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | coverage/ 4 | .vscode/ 5 | .idea/ 6 | .env 7 | .j1 8 | 9 | .DS_Store 10 | yarn-error.log 11 | .npmrc 12 | 13 | .eslintcache 14 | 15 | *.bak 16 | *.bak.* 17 | 18 | tsconfig.tsbuildinfo 19 | -------------------------------------------------------------------------------- /.huskyrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | hooks: { 3 | 'pre-commit': 'lint-staged', 4 | 'pre-push': 'npm run prepush', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write" 3 | } 4 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | work/ 3 | dist/ 4 | .j1-integration 5 | .j1-integration-cache 6 | snippets/ 7 | lerna.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "proseWrap": "always", 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @jupiterone/integrations 2 | 3 | CODEOWNERS @jupiterone/security -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | function buildBabelConfig() { 2 | return (api) => { 3 | api.cache(true); 4 | 5 | return { 6 | presets: [ 7 | [ 8 | '@babel/preset-env', 9 | { 10 | targets: { 11 | node: '18', 12 | }, 13 | }, 14 | ], 15 | ['@babel/preset-typescript', {}], 16 | ], 17 | }; 18 | }; 19 | } 20 | 21 | module.exports = buildBabelConfig(); 22 | -------------------------------------------------------------------------------- /cortex.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: root 4 | description: Automatically generated package.json, please edit manually 5 | x-cortex-git: 6 | github: 7 | repository: JupiterOne/sdk 8 | x-cortex-owners: 9 | - type: group 10 | name: JupiterOne/integrations 11 | x-cortex-tag: root 12 | x-cortex-service-groups: 13 | - tier-4 14 | -------------------------------------------------------------------------------- /jest.config.base.js: -------------------------------------------------------------------------------- 1 | // This is a shared base config that is used by all packages 2 | module.exports = { 3 | clearMocks: true, 4 | restoreMocks: true, 5 | testMatch: [ 6 | '/**/*.test.ts', 7 | '!**/node_modules/*', 8 | '!**/dist/*', 9 | '!**/*.bak/*', 10 | ], 11 | globals: { 12 | 'ts-jest': { 13 | isolatedModules: true, 14 | }, 15 | }, 16 | testEnvironment: 'node', 17 | }; 18 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // This is a root level jest config for running tests 2 | // across all packages. 3 | module.exports = { 4 | projects: ['/packages/*'], 5 | }; 6 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmClient": "npm", 3 | "packages": [ 4 | "packages/integration-sdk-*", 5 | "packages/cli" 6 | ], 7 | "version": "17.0.0" 8 | } 9 | -------------------------------------------------------------------------------- /packages/cli/__mocks__/fs.ts: -------------------------------------------------------------------------------- 1 | export * from 'memfs'; 2 | -------------------------------------------------------------------------------- /packages/cli/__mocks__/ora.ts: -------------------------------------------------------------------------------- 1 | export default jest.fn().mockReturnValue({ 2 | start: jest.fn().mockReturnValue({ 3 | fail: jest.fn(), 4 | succeed: jest.fn(), 5 | }), 6 | }); 7 | -------------------------------------------------------------------------------- /packages/cli/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/cli/bin/j1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { createCli } = require('../dist/src'); 4 | 5 | createCli() 6 | .parseAsync(process.argv) 7 | .catch(err => { 8 | console.error(err); 9 | process.exitCode = 1; 10 | }) 11 | -------------------------------------------------------------------------------- /packages/cli/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | }; 4 | -------------------------------------------------------------------------------- /packages/cli/src/__tests__/utils/constants.ts: -------------------------------------------------------------------------------- 1 | import { DEFAULT_EXPORT_DIRECTORY } from '../../commands'; 2 | 3 | export const TEST_STORAGE_LOCATION = DEFAULT_EXPORT_DIRECTORY; 4 | export const TEST_ACCOUNT = 'account'; 5 | export const TEST_API_KEY = 'apiKey'; 6 | -------------------------------------------------------------------------------- /packages/cli/src/__tests__/utils/fetchAssetsContents.ts: -------------------------------------------------------------------------------- 1 | import { Volume } from 'memfs/lib/volume'; 2 | 3 | export function fetchAssetsContents(vol: Volume) { 4 | const files = vol.toJSON(); 5 | return Object.keys(files) 6 | .filter((filename) => filename.endsWith('.csv')) 7 | .map((filename) => files[filename]) as string[]; 8 | } 9 | -------------------------------------------------------------------------------- /packages/cli/src/__tests__/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './constants'; 2 | export * from './fetchAssetsContents'; 3 | -------------------------------------------------------------------------------- /packages/cli/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | export * from './j1Import'; 2 | export * from './j1Export'; 3 | -------------------------------------------------------------------------------- /packages/cli/src/export/__tests__/utils/createEntity.ts: -------------------------------------------------------------------------------- 1 | import { Entity } from '@jupiterone/integration-sdk-core'; 2 | 3 | export function createEntity({ 4 | type, 5 | id, 6 | optionalProps, 7 | }: { 8 | type: string; 9 | id: string; 10 | optionalProps?: object; 11 | }) { 12 | return { 13 | id: `entity-${id}`, 14 | name: `Entity ${id}`, 15 | displayName: `Entity ${id}`, 16 | createdOn: +`159183180889${id}`, 17 | _class: 'Entity', 18 | _type: `entity_type_${type}`, 19 | _key: `entity-${id}`, 20 | ...optionalProps, 21 | } as Entity; 22 | } 23 | -------------------------------------------------------------------------------- /packages/cli/src/export/__tests__/utils/createRelationship.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Entity, 3 | createDirectRelationship, 4 | } from '@jupiterone/integration-sdk-core'; 5 | import { RelationshipClass } from '@jupiterone/data-model'; 6 | 7 | interface CreateRelationshipParams { 8 | _class?: RelationshipClass; 9 | from: Entity; 10 | to: Entity; 11 | } 12 | 13 | export function createRelationship({ 14 | _class, 15 | from, 16 | to, 17 | }: CreateRelationshipParams) { 18 | return createDirectRelationship({ 19 | _class: _class || RelationshipClass.HAS, 20 | from, 21 | to, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/cli/src/export/__tests__/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './createEntity'; 2 | export * from './createRelationship'; 3 | export * from './parseToCsv'; 4 | -------------------------------------------------------------------------------- /packages/cli/src/export/__tests__/utils/parseCsvToJson.ts: -------------------------------------------------------------------------------- 1 | import csvToJson from 'csvtojson'; 2 | 3 | export function parseCsvToJson(json: string) { 4 | return csvToJson({ 5 | checkType: true, 6 | flatKeys: true, 7 | }).fromString(json); 8 | } 9 | -------------------------------------------------------------------------------- /packages/cli/src/export/__tests__/utils/parseToCsv.ts: -------------------------------------------------------------------------------- 1 | import jsonexport from 'jsonexport'; 2 | 3 | export function parseToCsv(content: object[]): Promise { 4 | return jsonexport(content); 5 | } 6 | -------------------------------------------------------------------------------- /packages/cli/src/export/exportAssets.ts: -------------------------------------------------------------------------------- 1 | import { ExportOptions } from '../commands'; 2 | import * as log from '../log'; 3 | import { deleteDirectory } from '../fileSystem'; 4 | import { exportAssetsToJson } from './exportAssetsToJson'; 5 | import { exportJsonAssetsToCsv } from './exportJsonAssetsToCsv'; 6 | 7 | export type ExportAssetsParams = Omit & { 8 | storageDirectory: string; 9 | }; 10 | 11 | export default async function exportAssets(options: ExportAssetsParams) { 12 | log.info( 13 | `Starting account export to the [${options.storageDirectory}] directory`, 14 | ); 15 | log.info(`Exporting Entities: ${options.includeEntities}`); 16 | log.info(`Exporting Relationships: ${options.includeRelationships}`); 17 | log.info(`Include Deleted Assets: ${options.includeDeleted}`); 18 | 19 | try { 20 | await deleteDirectory(options.storageDirectory); 21 | await exportAssetsToJson(options); 22 | await exportJsonAssetsToCsv(options); 23 | } catch (e) { 24 | log.error(e); 25 | throw e; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/cli/src/export/groupJsonAssetsByType.ts: -------------------------------------------------------------------------------- 1 | import globby from 'globby'; 2 | import upath from 'upath'; 3 | import path from 'path'; 4 | import _ from 'lodash'; 5 | 6 | interface BatchAssetParams { 7 | assetDirectory: string; 8 | } 9 | 10 | export async function groupJsonAssetsByType({ 11 | assetDirectory, 12 | }: BatchAssetParams) { 13 | const assetJsonFiles = await globby([ 14 | upath.toUnix(`${assetDirectory}/**/*.json`), 15 | ]); 16 | 17 | const assetJsonFilesByType = _.groupBy(assetJsonFiles, (p) => 18 | path.basename(path.dirname(p)), 19 | ); 20 | 21 | return Object.keys(assetJsonFilesByType).reduce( 22 | (acc, key) => { 23 | acc[key] = assetJsonFilesByType[key]; 24 | return acc; 25 | }, 26 | {} as { [key: string]: string[] }, 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /packages/cli/src/export/util.ts: -------------------------------------------------------------------------------- 1 | export function sanitizeContent(content: string) { 2 | return content.replace(/\\n/g, '\\\\n').replace(/\\r/g, '\\\\r'); 3 | } 4 | -------------------------------------------------------------------------------- /packages/cli/src/import/importAssets.ts: -------------------------------------------------------------------------------- 1 | import { ImportOptions } from '../commands'; 2 | import * as log from '../log'; 3 | import { importAssetsFromCsv } from './importAssetsFromCsv'; 4 | 5 | export type ImportAssetsParams = Omit & { 6 | storageDirectory: string; 7 | }; 8 | 9 | export async function importAssets(options: ImportAssetsParams) { 10 | log.info( 11 | `Starting account import from the [${options.storageDirectory}] directory`, 12 | ); 13 | log.info(`Importing Entities: ${options.includeEntities}`); 14 | log.info(`Importing Relationships: ${options.includeRelationships}`); 15 | 16 | try { 17 | await importAssetsFromCsv(options); 18 | } catch (e) { 19 | log.error(e); 20 | throw e; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/cli/src/index.ts: -------------------------------------------------------------------------------- 1 | import { createCommand } from 'commander'; 2 | 3 | import { j1Export, j1Import } from './commands'; 4 | 5 | export function createCli() { 6 | return createCommand().addCommand(j1Import()).addCommand(j1Export()); 7 | } 8 | -------------------------------------------------------------------------------- /packages/cli/src/log.ts: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk'; 2 | 3 | /* eslint-disable no-console */ 4 | export function debug(msg: string) { 5 | console.log(`${chalk.gray(msg)}`); 6 | } 7 | 8 | export function info(msg: string) { 9 | console.log(`${chalk.white(msg)}`); 10 | } 11 | 12 | export function warn(msg: string) { 13 | console.log(`${chalk.yellow(msg)}`); 14 | } 15 | 16 | export function error(msg: string) { 17 | console.log(`${chalk.red(msg)}`); 18 | } 19 | -------------------------------------------------------------------------------- /packages/cli/src/pause.ts: -------------------------------------------------------------------------------- 1 | export function pause(time: number) { 2 | return new Promise((resolve) => setTimeout(resolve, time)); 3 | } 4 | -------------------------------------------------------------------------------- /packages/cli/src/validateOption.ts: -------------------------------------------------------------------------------- 1 | export function validateOption(options: { 2 | option: string; 3 | value: string | undefined; 4 | defaultEnvironmentVariable: string; 5 | }) { 6 | const { option, value: passedValue, defaultEnvironmentVariable } = options; 7 | 8 | const value = passedValue ?? process.env[defaultEnvironmentVariable]; 9 | 10 | if (!value) { 11 | throw new Error( 12 | `Missing option! Set the ${defaultEnvironmentVariable} environment variable or supply the ${option} option.`, 13 | ); 14 | } 15 | 16 | return value; 17 | } 18 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "include": ["src"], 7 | "exclude": [ 8 | "jest.config.js", 9 | "**/dist/**/*", 10 | "**/*.test.ts", 11 | "**/__tests__/**/*.ts", 12 | "**/__mocks__/**/*.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [ 8 | { 9 | "path": "../integration-sdk-core" 10 | }, 11 | { 12 | "path": "../integration-sdk-runtime" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-benchmark/README.md: -------------------------------------------------------------------------------- 1 | # SDK Benchmarks 2 | 3 | Benchmarks for the SDK! When making performance changes to the SDK, developers 4 | should be conscious of existing benchmarks and the impact that their changes may 5 | have. 6 | 7 | ## Usage 8 | 9 | ``` 10 | npm run benchmark 11 | ``` 12 | 13 | ## Results 14 | 15 | The benchmark was run using the following specs: 16 | 17 | - Node.js v14.18.2 18 | - OS: Ubuntu 20.04.3 LTS 64-bit 19 | - Processor: Intel Core i7-9700K CPU @ 3.60GHz × 8 20 | - Memory: 32 GB 2133 MT/s DDR4 21 | 22 | ### `FileSystemGraphObjectStore` 23 | 24 | ``` 25 | FileSystemGraphObjectStore#addEntity 100_000 Entities x 11.80 ops/sec ±3.66% (30 runs sampled) 26 | ``` 27 | -------------------------------------------------------------------------------- /packages/integration-sdk-benchmark/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-benchmark/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jupiterone/integration-sdk-benchmark", 3 | "version": "17.0.0", 4 | "private": true, 5 | "description": "SDK benchmarking scripts", 6 | "main": "./src/index.js", 7 | "repository": "git@github.com:JupiterOne/sdk.git", 8 | "author": "JupiterOne ", 9 | "license": "MPL-2.0", 10 | "engines": { 11 | "node": ">=18.0.0 <21.x" 12 | }, 13 | "scripts": { 14 | "prebenchmark": "rm -rf .j1-integration", 15 | "benchmark": "for file in ./src/benchmarks/*; do npm run prebenchmark && node $file; done" 16 | }, 17 | "dependencies": { 18 | "@jupiterone/integration-sdk-core": "^17.0.0", 19 | "@jupiterone/integration-sdk-runtime": "^17.0.0", 20 | "benchmark": "^2.1.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/integration-sdk-benchmark/src/util/eventCollector.js: -------------------------------------------------------------------------------- 1 | class EventCollector { 2 | constructor() { 3 | this.events = []; 4 | } 5 | 6 | /** 7 | * addEvent adds an event to the EventCollector 8 | * 9 | * @param event - The benchmark.js event to be recorded 10 | */ 11 | addEvent(event) { 12 | this.events.push(event); 13 | } 14 | 15 | /** 16 | * publishEvents formats all the recorded events and output the results into 17 | * a human readable format 18 | */ 19 | publishEvents() { 20 | this.events.sort((event1, event2) => { 21 | return event1.target.name > event2.target.name; 22 | }); 23 | 24 | /* eslint-disable no-console */ 25 | for (const event of this.events) { 26 | console.log( 27 | event.target.name, 28 | '\t', 29 | event.target.hz.toFixed(3), 30 | 'ops/sec', 31 | ); 32 | } 33 | } 34 | } 35 | 36 | function createEventCollector() { 37 | return new EventCollector(); 38 | } 39 | 40 | module.exports = { 41 | createEventCollector, 42 | }; 43 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/README.md: -------------------------------------------------------------------------------- 1 | # @jupiterone/integration-sdk-cli 2 | 3 | This package exposes a CLI tool that assists with executing integrations 4 | locally. 5 | 6 | ## Integration graph generator 7 | 8 | Create a git repository for your integration graph with 9 | `graph-(integrationName)` name and execute the following command inside it: 10 | 11 | ``` 12 | npx @jupiterone/integration-sdk-cli generate 13 | ``` 14 | 15 | You will be prompted with some questions and the graph code will be generated so 16 | you can start development. 17 | 18 | ## Installation 19 | 20 | ``` 21 | npm install @jupiterone/integration-sdk-cli 22 | 23 | # or 24 | 25 | yarn add @jupiterone/integration-sdk-cli 26 | ``` 27 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/__mocks__/fs.ts: -------------------------------------------------------------------------------- 1 | // some dependencies depend on the sync fs apis, 2 | // just expose everything 3 | export * from 'memfs'; 4 | 5 | // needed for loading the j1 data model 6 | export const readdirSync = jest.requireActual('fs').readdirSync; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/__mocks__/graceful-fs.ts: -------------------------------------------------------------------------------- 1 | // HACK: to get around an issue with graceful-fs attempting to patch 2 | // fs twice in recording tests, replace the implementation 3 | // with our own fs mock 4 | export * from 'fs'; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/bin/j1-integration: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { createCli } = require('../dist/src'); 4 | 5 | createCli() 6 | .parseAsync(process.argv) 7 | .catch(err => { 8 | console.error(err); 9 | process.exitCode = 1; 10 | }) 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | setupFilesAfterEnv: ['jest-extended/all', './jest.setup.ts'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/jest.setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | 3 | jest.mock('bunyan', () => { 4 | const Logger = jest.requireActual('bunyan'); 5 | 6 | const LOG_LEVELS = ['trace', 'debug', 'info', 'fatal', 'warn', 'error']; 7 | for (const logLevel of LOG_LEVELS) { 8 | jest.spyOn(Logger.prototype, logLevel); 9 | } 10 | 11 | function MockLogger(options: any) { 12 | const ringbuffer = new Logger.RingBuffer({ limit: 100 }); 13 | options.streams = [ 14 | { 15 | level: 'trace', 16 | type: 'raw', 17 | stream: ringbuffer, 18 | }, 19 | ]; 20 | return new Logger(options); 21 | } 22 | 23 | MockLogger.createLogger = function (options: any) { 24 | return new (MockLogger as any)(options); 25 | }; 26 | 27 | MockLogger.stdSerializers = Logger.stdSerializers; 28 | 29 | return MockLogger; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/__tests__/util/recording.ts: -------------------------------------------------------------------------------- 1 | import { Polly, PollyConfig } from '@pollyjs/core'; 2 | 3 | export function createTestPolly( 4 | recordingName: string, 5 | pollyConfigOverrides?: PollyConfig, 6 | ) { 7 | return new Polly(recordingName, { 8 | adapters: ['node-http'], 9 | persister: 'fs', 10 | logLevel: 'silent', 11 | matchRequestsBy: { 12 | headers: false, 13 | }, 14 | ...pollyConfigOverrides, 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/actions/steps.ts: -------------------------------------------------------------------------------- 1 | import { Step, StepType } from '../utils/types'; 2 | 3 | export function stepTemplateHelper(step: Step) { 4 | return { 5 | stepTemplateFile: `${determineTypeOfStep(step)}.ts.hbs`, 6 | }; 7 | } 8 | 9 | function determineTypeOfStep(step: Step): string { 10 | return step.response.responseType === 'SINGLETON' 11 | ? step.parentAssociation 12 | ? StepType.CHILD_SINGLETON 13 | : StepType.SINGLETON 14 | : step.parentAssociation 15 | ? StepType.FETCH_CHILD_ENTITIES 16 | : StepType.FETCH_ENTITIES; 17 | } 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.env.example.hbs: -------------------------------------------------------------------------------- 1 | {{#each template.instanceConfigFields}} 2 | {{constantCase @key}}= 3 | {{/each}} 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.eslintignore.hbs: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.eslintrc.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": [ 4 | "./node_modules/@jupiterone/integration-sdk-dev-tools/config/eslint.json" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.github/workflows/build.yml.hbs: -------------------------------------------------------------------------------- 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 30 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.gitignore.hbs: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | .j1-integration/ 4 | .j1-integration-cache/ 5 | .env 6 | .eslintcache 7 | tsconfig.tsbuildinfo 8 | .npmrc 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.node-version.hbs: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/.prettierignore.hbs: -------------------------------------------------------------------------------- 1 | dist 2 | coverage/ 3 | .j1-integration 4 | .j1-integration-cache 5 | .gitleaks.yml 6 | CHANGELOG.md -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/CHANGELOG.md.hbs: -------------------------------------------------------------------------------- 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] 10 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/CODEOWNERS.hbs: -------------------------------------------------------------------------------- 1 | * @jupiterone/integrations 2 | 3 | CODEOWNERS @jupiterone/security 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/docs/jupiterone.md.hbs: -------------------------------------------------------------------------------- 1 | # {{titleCase vendorName}} 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/docs/spec/index.ts.hbs: -------------------------------------------------------------------------------- 1 | import { IntegrationSpecConfig } from '@jupiterone/integration-sdk-core'; 2 | import { IntegrationConfig } from '../../src/config'; 3 | {{#each template.steps}} 4 | import { {{camelCase entity.name}}Spec } from './{{kebabCase id}}'; 5 | {{/each}} 6 | 7 | export const invocationConfig: IntegrationSpecConfig = 8 | { 9 | integrationSteps: [ 10 | {{#each template.steps}} 11 | ...{{camelCase entity.name}}Spec, 12 | {{/each}} 13 | ], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/husky.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/husky'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/jest.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/jest'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/jupiterone/questions/questions.yaml.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:{{kebabCase vendorName}} 3 | integrationDefinitionId: '${integration_definition_id}' 4 | questions: 5 | [] 6 | # - id: integration-question-template-replace-me 7 | # title: What kinds of questions will this integration support? 8 | # description: 9 | # TODO Every integration should contribute questions! Please be careful 10 | # to replace this before deploying the integration to JupiterOne. 11 | # queries: 12 | # - name: good 13 | # query: | 14 | # find * with _integrationDefinitionId = '${integration_definition_id}' 15 | # tags: 16 | # - template 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/lint-staged.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/lint-staged'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/prettier.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/prettier'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/src/index.test.ts.hbs: -------------------------------------------------------------------------------- 1 | import { invocationConfig as implementedConfig } from '.'; 2 | import { invocationConfig as specConfig } from '../docs/spec'; 3 | 4 | test('implemented integration should match spec', () => { 5 | expect(implementedConfig).toImplementSpec(specConfig, { requireSpec: true }); 6 | }); -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/src/index.ts.hbs: -------------------------------------------------------------------------------- 1 | import { IntegrationInvocationConfig } from '@jupiterone/integration-sdk-core'; 2 | import { integrationSteps } from './steps'; 3 | import { 4 | validateInvocation, 5 | IntegrationConfig, 6 | instanceConfigFields, 7 | } from './config'; 8 | 9 | export const invocationConfig: IntegrationInvocationConfig = 10 | { 11 | instanceConfigFields, 12 | validateInvocation, 13 | integrationSteps, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/src/steps/index.ts.hbs: -------------------------------------------------------------------------------- 1 | {{#with template}} 2 | {{#each steps}} 3 | import { {{camelCase entity.name}}Steps } from './{{id}}'; 4 | {{/each}} 5 | 6 | const integrationSteps = [ 7 | {{#each steps}} 8 | ...{{camelCase entity.name}}Steps, 9 | {{/each}} 10 | ]; 11 | 12 | export { integrationSteps }; 13 | {{/with}} -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/src/steps/types.ts.hbs: -------------------------------------------------------------------------------- 1 | {{#with template}} 2 | {{#each steps}} 3 | export type {{pascalCase entity.name}} = any; 4 | 5 | {{/each}} 6 | {{/with}} -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/test/README.md.hbs: -------------------------------------------------------------------------------- 1 | # Testing Integrations 2 | 3 | For information on testing integrations see: 4 | 5 | [Testing Integrations](https://github.com/JupiterOne/sdk/blob/main/docs/integrations/testing.md) -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/tsconfig.dist.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src", "package.json"], 4 | "exclude": [ 5 | "dist", 6 | "**/*.test.ts", 7 | "**/*.test.js", 8 | "**/*/__tests__/**/*.ts", 9 | "**/*/__tests__/**/*.js", 10 | "**/*/__mocks__/**/*.ts", 11 | "**/*/__mocks__/**/*.js" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/bocchi/templates/top-level/tsconfig.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/@jupiterone/integration-sdk-dev-tools/config/typescript", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["dist"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/commands/bocchi.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import { createCommand } from 'commander'; 3 | const dynamicImport = new Function('specifier', 'return import(specifier)'); 4 | 5 | export function bocchi() { 6 | return createCommand('bocchi') 7 | .description('New graph project generator') 8 | .action(async (cmdOpts) => { 9 | const Plop = await dynamicImport('plop'); 10 | const configPath = path.resolve( 11 | path.join(__dirname, '../bocchi/bocchi.js'), 12 | ); 13 | Plop.Plop.prepare( 14 | { 15 | cwd: process.cwd(), 16 | configPath, 17 | }, 18 | (env) => 19 | 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 | } 29 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/commands/generate.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import { createCommand } from 'commander'; 3 | const dynamicImport = new Function('specifier', 'return import(specifier)'); 4 | 5 | export function generate() { 6 | return createCommand('generate') 7 | .description('generate integrations in whole and in part') 8 | .action(async () => { 9 | const Plop = await dynamicImport('plop'); 10 | const configPath = path.resolve( 11 | path.join(__dirname, '../generator/newIntegration.js'), 12 | ); 13 | Plop.Plop.prepare( 14 | { 15 | cwd: process.cwd(), 16 | configPath, 17 | }, 18 | (env) => 19 | 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 | } 29 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | export * from './collect'; 2 | export * from './diff'; 3 | export * from './visualize'; 4 | export * from './sync'; 5 | export * from './run'; 6 | export * from './document'; 7 | export * from './visualize-types'; 8 | export * from './validate-question-file'; 9 | export * from './neo4j'; 10 | export * from './visualize-dependencies'; 11 | export * from './generate-integration-graph-schema'; 12 | export * from './troubleshoot'; 13 | export * from './generate-ingestion-sources-config'; 14 | export * from './generate'; 15 | export * from './bocchi'; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/commands/troubleshoot.ts: -------------------------------------------------------------------------------- 1 | import { createCommand } from 'commander'; 2 | 3 | import { troubleshoot } from '../troubleshoot'; 4 | 5 | export function troubleshootLocalExecution() { 6 | return createCommand('troubleshoot') 7 | .description('troubleshoot common issues with local execution') 8 | .option( 9 | '-p, --project-path ', 10 | 'path to integration project directory', 11 | process.cwd(), 12 | ) 13 | .action(async (options) => { 14 | await troubleshoot(options); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/commands/visualize-dependencies.ts: -------------------------------------------------------------------------------- 1 | import { createCommand } from 'commander'; 2 | import path from 'path'; 3 | 4 | import { generateDependencyVisualization } from '../visualization'; 5 | 6 | export function visualizeDependencies() { 7 | return createCommand('visualize-dependencies') 8 | .description('visualize dependency graph of integration') 9 | .option( 10 | '-p, --project-path ', 11 | 'path to integration project directory', 12 | process.cwd(), 13 | ) 14 | .option( 15 | '-o, --output-file ', 16 | 'path of generated HTML file', 17 | path.resolve(process.cwd(), 'dependencies.html'), 18 | ) 19 | .action(async (options) => { 20 | const integrationDir = path.resolve(options.projectPath); 21 | const outputFile = path.resolve(options.outputFile); 22 | await generateDependencyVisualization(integrationDir, outputFile); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/helpers.ts: -------------------------------------------------------------------------------- 1 | function generateRelationshipName(relationship) { 2 | const { from, to, _class } = relationship; 3 | return `${from.resourceName}_${_class}_${to.resourceName}`; 4 | } 5 | 6 | export { generateRelationshipName }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/stepTemplate/index.ts.hbs: -------------------------------------------------------------------------------- 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[] = [ 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) { 23 | // TODO 24 | } 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.env.example.hbs: -------------------------------------------------------------------------------- 1 | {{#each configFields}} 2 | {{constantCase field}}= 3 | {{/each}} 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.eslintignore.hbs: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.eslintrc.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": [ 4 | "./node_modules/@jupiterone/integration-sdk-dev-tools/config/eslint.json" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.github/pull_request_template.md.hbs: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Thank you for contributing to a JupiterOne integration! 4 | 5 | ## Summary 6 | 7 | 8 | 9 | ## Type of change 10 | 11 | Please leave any irrelevant options unchecked. 12 | 13 | - [ ] Bug fix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to 16 | not work as expected) 17 | - [ ] This change requires a documentation update 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.gitignore.hbs: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | .j1-integration/ 4 | .j1-integration-cache/ 5 | .env 6 | .eslintcache 7 | tsconfig.tsbuildinfo 8 | .npmrc 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.node-version.hbs: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/.prettierignore.hbs: -------------------------------------------------------------------------------- 1 | dist 2 | coverage/ 3 | .j1-integration 4 | .j1-integration-cache 5 | .gitleaks.yml 6 | CHANGELOG.md -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/CHANGELOG.md.hbs: -------------------------------------------------------------------------------- 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] 10 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/CODEOWNERS.hbs: -------------------------------------------------------------------------------- 1 | * @jupiterone/integrations 2 | 3 | CODEOWNERS @jupiterone/security 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/docs/jupiterone.md.hbs: -------------------------------------------------------------------------------- 1 | # {{titleCase vendorName}} 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/husky.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/husky'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/jest.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/jest'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/jupiterone/questions/questions.yaml.hbs: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:{{kebabCase vendorName}} 3 | integrationDefinitionId: '${integration_definition_id}' 4 | questions: 5 | [] 6 | # - id: integration-question-template-replace-me 7 | # title: What kinds of questions will this integration support? 8 | # description: 9 | # TODO Every integration should contribute questions! Please be careful 10 | # to replace this before deploying the integration to JupiterOne. 11 | # queries: 12 | # - name: good 13 | # query: | 14 | # find * with _integrationDefinitionId = '${integration_definition_id}' 15 | # tags: 16 | # - template 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/lint-staged.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/lint-staged'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/prettier.config.js.hbs: -------------------------------------------------------------------------------- 1 | module.exports = require('@jupiterone/integration-sdk-dev-tools/config/prettier'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/scripts/execute.sh.hbs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -z "$JUPITERONE_API_BASE_URL" ] 3 | then 4 | JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT j1-integration run -i $INTEGRATION_INSTANCE_ID 5 | else 6 | JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT j1-integration run -i $INTEGRATION_INSTANCE_ID --api-base-url $JUPITERONE_API_BASE_URL 7 | fi 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/src/index.ts.hbs: -------------------------------------------------------------------------------- 1 | import { IntegrationInvocationConfig } from '@jupiterone/integration-sdk-core'; 2 | import { integrationSteps } from './steps'; 3 | import { 4 | validateInvocation, 5 | IntegrationConfig, 6 | instanceConfigFields, 7 | } from './config'; 8 | 9 | export const invocationConfig: IntegrationInvocationConfig = 10 | { 11 | instanceConfigFields, 12 | validateInvocation, 13 | integrationSteps, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/src/steps/index.ts.hbs: -------------------------------------------------------------------------------- 1 | {{#each steps}} 2 | import { {{camelCase name}}Steps } from './{{kebabCase name}}' 3 | {{/each}} 4 | 5 | const integrationSteps = [{{#each steps}}...{{camelCase name}}Steps{{#unless @last}},{{/unless}}{{/each}}]; 6 | 7 | export { integrationSteps }; 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/src/validateInvocation.ts.hbs: -------------------------------------------------------------------------------- 1 | import { Recording } from '@jupiterone/integration-sdk-testing'; 2 | 3 | describe('#validateInvocation', () => { 4 | let recording: Recording; 5 | 6 | afterEach(async () => { 7 | if (recording) { 8 | await recording.stop(); 9 | } 10 | }); 11 | 12 | test.todo('requires valid config', async () => { 13 | // TODO 14 | }); 15 | 16 | test.todo('successfully validates invocation', async () => { 17 | // TODO 18 | }); 19 | 20 | describe('fails validating invocation', () => { 21 | // TODO 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/test/README.md.hbs: -------------------------------------------------------------------------------- 1 | # Testing Integrations 2 | 3 | For information on testing integrations see: 4 | 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/tsconfig.dist.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src", "package.json"], 4 | "exclude": [ 5 | "dist", 6 | "**/*.test.ts", 7 | "**/*.test.js", 8 | "**/*/__tests__/**/*.ts", 9 | "**/*/__tests__/**/*.js", 10 | "**/*/__mocks__/**/*.ts", 11 | "**/*/__mocks__/**/*.js" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/template/tsconfig.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/@jupiterone/integration-sdk-dev-tools/config/typescript", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["dist"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/generator/util.ts: -------------------------------------------------------------------------------- 1 | import { Entity } from './entitiesFlow'; 2 | 3 | async function askRepeatedly( 4 | inquirer, 5 | cb: () => Promise, 6 | ): Promise { 7 | let again = false; 8 | do { 9 | await cb(); 10 | again = await askAgain(inquirer); 11 | } while (again); 12 | } 13 | 14 | function generateChoicesFromEntities(entities) { 15 | const choices: { name: string; value: Entity }[] = []; 16 | for (const entity of entities) { 17 | choices.push({ 18 | name: entity._type, 19 | value: entity, 20 | }); 21 | } 22 | return choices; 23 | } 24 | 25 | async function confirmPrompt(inquiurer, message) { 26 | return ( 27 | await inquiurer.prompt({ 28 | type: 'confirm', 29 | name: 'value', 30 | message, 31 | }) 32 | ).value; 33 | } 34 | 35 | async function askAgain(inquirer) { 36 | return await confirmPrompt(inquirer, 'Add another?'); 37 | } 38 | 39 | export { askAgain, askRepeatedly, confirmPrompt, generateChoicesFromEntities }; 40 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/neo4j/index.ts: -------------------------------------------------------------------------------- 1 | export * from './uploadToNeo4j'; 2 | export * from './wipeNeo4j'; 3 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/basic.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-disabled-project-services 6 | title: Which Google Cloud API services are disabled for my project? 7 | description: 8 | Finds all disabled Google Cloud API services in a specified project 9 | queries: 10 | - query: | 11 | FIND google_cloud_api_service WITH projectId = '{{projectId}}' AND enabled = false 12 | tags: 13 | - google-cloud 14 | - service 15 | - api 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/empty-questions.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: [] 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/invalid-results-are.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-corporate-login-credentials 6 | title: Ensure that corporate login credentials are used 7 | description: 8 | Use corporate login credentials instead of personal accounts, such as Gmail accounts. 9 | queries: 10 | - name: invalid 11 | query: find google_user with email $="@{{domain}}" 12 | resultsAre: INVALID_RESULTS_ARE_VALUE 13 | tags: 14 | - google-cloud 15 | - user 16 | - access 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/invalid-yaml.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | ### The following is invalid! 5 | questions 6 | - id: integration-question-google-cloud-disabled-project-services 7 | title: Which Google Cloud API services are disabled for my project? 8 | description: 9 | Finds all disabled Google Cloud API services in a specified project 10 | queries: 11 | - query: | 12 | FIND google_cloud_api_service WITH projectId = '{{projectId}}' AND enabled = false 13 | tags: 14 | - google-cloud 15 | - service 16 | - api 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/multiple-queries.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-corporate-login-credentials 6 | title: Ensure that corporate login credentials are used 7 | description: 8 | Use corporate login credentials instead of personal accounts, such as Gmail accounts. 9 | queries: 10 | - name: good 11 | query: find google_user with email $="@{{domain}}" 12 | - name: bad 13 | query: find google_user with email !$="@{{domain}}" 14 | tags: 15 | - google-cloud 16 | - user 17 | - access 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/multiple-questions.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-disabled-project-services 6 | title: Which Google Cloud API services are disabled for my project? 7 | description: 8 | Finds all disabled Google Cloud API services in a specified project 9 | queries: 10 | - query: | 11 | FIND google_cloud_api_service WITH projectId = '{{projectId}}' AND enabled = false 12 | tags: 13 | - google-cloud 14 | - service 15 | - api 16 | 17 | - id: integration-question-google-cloud-corporate-login-credentials 18 | title: Ensure that corporate login credentials are used 19 | description: 20 | Use corporate login credentials instead of personal accounts, such as Gmail accounts. 21 | queries: 22 | - query: | 23 | FIND google_user WITH email $="@{{domain}}" 24 | tags: 25 | - google-cloud 26 | - user 27 | - access 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/non-unique-question-name.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-corporate-login-credentials 6 | title: Ensure that corporate login credentials are used 7 | description: 8 | Use corporate login credentials instead of personal accounts, such as Gmail accounts. 9 | queries: 10 | - name: good 11 | query: find google_user with email $="@{{domain}}" 12 | ### NOTE: This name is _not_ unique and will cause an error to be thrown! 13 | - name: good 14 | query: find google_user with email !$="@{{domain}}" 15 | tags: 16 | - google-cloud 17 | - user 18 | - access 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/questions/__fixtures__/questions/non-unique-question-tag.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | sourceId: managed:google_cloud 3 | integrationDefinitionId: "${integration_definition_id}" 4 | questions: 5 | - id: integration-question-google-cloud-disabled-project-services 6 | title: Which Google Cloud API services are disabled for my project? 7 | description: 8 | Finds all disabled Google Cloud API services in a specified project 9 | queries: 10 | - query: | 11 | FIND google_cloud_api_service WITH projectId = '{{projectId}}' AND enabled = false 12 | tags: 13 | - google-cloud 14 | - service 15 | ### NOTE: This tag is _not_ unique and will cause an error to be thrown! 16 | - google-cloud 17 | - api 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/troubleshoot/index.ts: -------------------------------------------------------------------------------- 1 | export * from './troubleshoot'; 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/visualization/error.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationError } from '@jupiterone/integration-sdk-core'; 2 | 3 | export class IntegrationMissingCollectJSON extends IntegrationError { 4 | constructor(message: string) { 5 | super({ 6 | code: 'MISSING_COLLECT_JSON', 7 | message, 8 | }); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/visualization/index.ts: -------------------------------------------------------------------------------- 1 | export * from './generateVisualization'; 2 | export * from './generateDependencyVisualization'; 3 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/visualization/types/IntegrationData.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Entity, 3 | ExplicitRelationship, 4 | MappedRelationship, 5 | } from '@jupiterone/integration-sdk-core'; 6 | 7 | export interface IntegrationData { 8 | entities: Entity[]; 9 | relationships: ExplicitRelationship[]; 10 | mappedRelationships: MappedRelationship[]; 11 | } 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/src/visualization/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './IntegrationData'; 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "include": ["src"], 7 | "exclude": [ 8 | "jest.config.js", 9 | "jest.setup.ts", 10 | "**/dist/**/*", 11 | "**/*.test.ts", 12 | "**/__tests__/**/*.ts", 13 | "**/__mocks__/**/*.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [ 8 | { "path": "../integration-sdk-core" }, 9 | { "path": "../integration-sdk-runtime" }, 10 | { "path": "../integration-sdk-private-test-utils" } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/README.md: -------------------------------------------------------------------------------- 1 | # @jupiterone/integration-sdk-core 2 | 3 | _NOTE:_ This project is currently under development and the API interface is not 4 | stable. Use at your own risk. 5 | 6 | This package contains core utilties and types that integration developers will 7 | interface with. 8 | 9 | ## Installation 10 | 11 | ``` 12 | npm install @jupiterone/integration-sdk-core 13 | 14 | # or 15 | 16 | yarn add @jupiterone/integration-sdk-core 17 | ``` 18 | 19 | ## Docs 20 | 21 | - [createIntegrationHelpers](docs/createIntegrationHelpers.md) 22 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | setupFilesAfterEnv: ['jest-extended/all', './jest.setup.ts'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/jest.setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | 3 | jest.mock('bunyan', () => { 4 | const Logger = jest.requireActual('bunyan'); 5 | 6 | const LOG_LEVELS = ['trace', 'debug', 'info', 'fatal', 'warn', 'error']; 7 | for (const logLevel of LOG_LEVELS) { 8 | jest.spyOn(Logger.prototype, logLevel); 9 | } 10 | 11 | function MockLogger(options: any) { 12 | const ringbuffer = new Logger.RingBuffer({ limit: 100 }); 13 | options.streams = [ 14 | { 15 | level: 'trace', 16 | type: 'raw', 17 | stream: ringbuffer, 18 | }, 19 | ]; 20 | return new Logger(options); 21 | } 22 | 23 | MockLogger.createLogger = function (options: any) { 24 | return new (MockLogger as any)(options); 25 | }; 26 | 27 | MockLogger.stdSerializers = Logger.stdSerializers; 28 | 29 | return MockLogger; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/__tests__/index.test.ts: -------------------------------------------------------------------------------- 1 | import { RelationshipClass } from '../index'; 2 | 3 | describe('#RelationshipClass', () => { 4 | test('should export @jupiterone/data-model properties in the index', () => { 5 | expect( 6 | Object.values(RelationshipClass).filter((v) => typeof v !== 'string') 7 | .length, 8 | ).toEqual(0); 9 | expect(RelationshipClass.HAS).toEqual('HAS'); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/data/index.ts: -------------------------------------------------------------------------------- 1 | export * from './converters'; 2 | export * from './tagging'; 3 | export * from './ip'; 4 | export * from './rawData'; 5 | 6 | export * from './createIntegrationEntity'; 7 | export * from './createIntegrationRelationship'; 8 | export * from './createIntegrationHelpers'; 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/data/ip.ts: -------------------------------------------------------------------------------- 1 | export function isHost(ipAddress: string): boolean { 2 | return ( 3 | (ipAddress.includes(':') && ipAddress.endsWith('/128')) || 4 | ipAddress.endsWith('/32') 5 | ); 6 | } 7 | 8 | export function isInternet(ipAddress: string): boolean { 9 | return ipAddress.startsWith('0.0.0.0') || ipAddress === '::/0'; 10 | } 11 | 12 | export function isLoopback(ipAddress: string): boolean { 13 | return ipAddress.startsWith('127.0.0.1') || ipAddress === '::1/128'; 14 | } 15 | 16 | export function isPublicIp(ipAddress: string): boolean { 17 | return !ipAddress.match( 18 | /(^127\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)/, 19 | ); 20 | } 21 | 22 | export function isIpv4(ipAddress: string): boolean { 23 | return !!ipAddress.match(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}(?:\/[0-9]{1,2})?$/); 24 | } 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './data'; 2 | export * from './types'; 3 | export * from './errors'; 4 | export { Type as SchemaType } from '@sinclair/typebox'; 5 | export { RelationshipClass } from '@jupiterone/data-model'; 6 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './config'; 2 | export * from './context'; 3 | export * from './instance'; 4 | export * from './jobState'; 5 | export * from './logger'; 6 | export * from './partialDatasets'; 7 | export * from './spec'; 8 | export * from './step'; 9 | export * from './validation'; 10 | export * from './synchronization'; 11 | export * from './metric'; 12 | export * from './storage'; 13 | 14 | export * from './persistedObject'; 15 | export * from './entity'; 16 | export * from './relationship'; 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/types/metric.ts: -------------------------------------------------------------------------------- 1 | export interface Metric { 2 | name: string; 3 | value: number; 4 | 5 | /* 6 | * The unit that the metric value is associated with 7 | */ 8 | unit?: 'Milliseconds' | 'Bytes'; 9 | 10 | /** 11 | * Additional dimensions to add to a metric 12 | */ 13 | dimensions?: Record; 14 | 15 | /** 16 | * The time that the metric was collected. 17 | */ 18 | timestamp: number; 19 | } 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/types/partialDatasets.ts: -------------------------------------------------------------------------------- 1 | export interface PartialDatasets { 2 | types: string[]; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/types/spec.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationInvocationConfig } from './config'; 2 | import { IntegrationStepExecutionContext } from './context'; 3 | import { IntegrationInstanceConfig } from './instance'; 4 | import { Step } from './step'; 5 | 6 | export interface StepSpec 7 | extends Omit< 8 | Step>, 9 | 'executionHandler' 10 | > { 11 | implemented: boolean; 12 | } 13 | 14 | export interface IntegrationSpecConfig< 15 | TConfig extends IntegrationInstanceConfig = IntegrationInstanceConfig, 16 | > extends Omit { 17 | integrationSteps: StepSpec[]; 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/src/types/validation.ts: -------------------------------------------------------------------------------- 1 | import { ExecutionContext, IntegrationExecutionContext } from './context'; 2 | import { IntegrationInstanceConfig } from './instance'; 3 | 4 | export type InvocationValidationFunction = ( 5 | context: T, 6 | ) => Promise | void; 7 | 8 | export type IntegrationInvocationValidationFunction< 9 | TConfig extends IntegrationInstanceConfig = IntegrationInstanceConfig, 10 | > = InvocationValidationFunction>; 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "exclude": [ 7 | "jest.config.base.js", 8 | "jest.config.js", 9 | "jest.setup.ts", 10 | "**/dist/**/*", 11 | "**/*.test.ts", 12 | "**/__tests__/**/*.ts", 13 | "**/__mocks__/**/*.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [{ "path": "../integration-sdk-entity-validator" }] 8 | } 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/husky.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | hooks: { 3 | 'pre-commit': 4 | 'npm run j1-integration document && git add docs/jupiterone.md && lint-staged', 5 | 'pre-push': 'npm run prepush', 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/jest.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | clearMocks: true, 4 | restoreMocks: true, 5 | testMatch: [ 6 | '/**/*.test.ts', 7 | '!**/node_modules/*', 8 | '!**/dist/*', 9 | '!**/*.bak/*', 10 | ], 11 | collectCoverage: false, 12 | transform: { 13 | '^.+\\.[tj]sx?$': [ 14 | 'ts-jest', 15 | { 16 | isolatedModules: true, 17 | }, 18 | ], 19 | }, 20 | testEnvironment: 'node', 21 | setupFilesAfterEnv: [ 22 | '/node_modules/@jupiterone/integration-sdk-dev-tools/config/setupJestTestFramework.js', 23 | ], 24 | }; 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/lint-staged.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '*.{js,jsx,ts,tsx,md,html,css}': 'prettier --write', 3 | }; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/prettier.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | proseWrap: 'always', 3 | singleQuote: true, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/setupJestTestFramework.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-undef 2 | require('@jupiterone/integration-sdk-testing').registerMatchers(expect); 3 | -------------------------------------------------------------------------------- /packages/integration-sdk-dev-tools/config/typescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "incremental": true, 4 | "target": "ES2021", 5 | "lib": ["ES2021"], 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noUnusedLocals": true, 9 | "pretty": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "strictNullChecks": true, 15 | "strictFunctionTypes": true, 16 | "allowJs": false 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | setupFilesAfterEnv: ['jest-extended/all', './jest.setup.ts'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/jest.setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | 3 | jest.mock('bunyan', () => { 4 | const Logger = jest.requireActual('bunyan'); 5 | 6 | const LOG_LEVELS = ['trace', 'debug', 'info', 'fatal', 'warn', 'error']; 7 | for (const logLevel of LOG_LEVELS) { 8 | jest.spyOn(Logger.prototype, logLevel); 9 | } 10 | 11 | function MockLogger(options: any) { 12 | const ringbuffer = new Logger.RingBuffer({ limit: 100 }); 13 | options.streams = [ 14 | { 15 | level: 'trace', 16 | type: 'raw', 17 | stream: ringbuffer, 18 | }, 19 | ]; 20 | return new Logger(options); 21 | } 22 | 23 | MockLogger.createLogger = function (options: any) { 24 | return new (MockLogger as any)(options); 25 | }; 26 | 27 | MockLogger.stdSerializers = Logger.stdSerializers; 28 | 29 | return MockLogger; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/AccessKey.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Key } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A key used to grant access, such as ssh-key, access-key, api-key/token, mfa-token/device, etc. 12 | */ 13 | export type AccessKey = Key & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/AccessPolicy.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A policy for access control assigned to a Host, Role, User, UserGroup, or Service. 12 | */ 13 | export type AccessPolicy = Entity & { 14 | /** 15 | * Indicates if the policy grants administrative privilege. 16 | */ 17 | admin?: boolean; 18 | /** 19 | * Rules of this policy. Each rule is written 'as-code' that can be operationalized with a control provider or within JupiterOne's rules engine. 20 | */ 21 | rules?: string[]; 22 | /** 23 | * Content of a policy contains the raw policy rules, if applicable. For example, the JSON text of an AWS IAM Policy. This is stored in raw data. 24 | */ 25 | content?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/AccessRole.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An access control role mapped to a Principal (e.g. user, group, or service). 12 | */ 13 | export type AccessRole = Entity & { 14 | /** 15 | * Is the role an administrator role? 16 | */ 17 | superAdmin?: boolean; 18 | /** 19 | * Is this a system role? 20 | */ 21 | systemRole?: boolean; 22 | /** 23 | * The role's privilege service IDs 24 | */ 25 | privilegeServiceIds?: string[]; 26 | /** 27 | * The role's privilege names 28 | */ 29 | privilegeNames?: string[]; 30 | [k: string]: unknown; 31 | }; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Account.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An organizational account for a service or a set of services (e.g. AWS, Okta, Bitbucket Team, Google G-Suite account, Apple Developer Account). Each Account should be connected to a Service. 12 | */ 13 | export type Account = Entity & { 14 | /** 15 | * The main URL to access this account, e.g. https://jupiterone.okta.com 16 | */ 17 | accessURL?: string; 18 | /** 19 | * Specifies whether multi-factor authentication (MFA) is enabled/required for users of this account. 20 | */ 21 | mfaEnabled?: boolean; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Alert.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A notice of any unusual or dangerous circumstance that is sent to responsible parties for the purpose of triggering action. 12 | */ 13 | export type Alert = RecordEntity; 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/ApplicationEndpoint.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An application endpoint is a program interface that either initiates or receives a request, such as an API. 12 | */ 13 | export type ApplicationEndpoint = Entity & { 14 | /** 15 | * The endpoint address (e.g. an URI/URL, hostname) 16 | */ 17 | address: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Attacker.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An attacker or threat actor. 12 | */ 13 | export type Attacker = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Backup.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A specific repository or data store containing backup data. 12 | */ 13 | export type Backup = Entity & { 14 | /** 15 | * Indicates whether the backup data is encrypted. 16 | */ 17 | encrypted?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Certificate.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A digital Certificate such as an SSL or S/MIME certificate. 12 | */ 13 | export type Certificate = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Channel.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A communication channel, such as a Slack channel or AWS SNS topic. 12 | */ 13 | export type Channel = Entity & { 14 | /** 15 | * Indicates whether the communication channel is encrypted. 16 | */ 17 | encrypted?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Cluster.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A cluster of compute or database resources/workloads. 12 | */ 13 | export type Cluster = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CodeCommit.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A code commit to a repo. The commit id is captured in the _id property of the Entity. 12 | */ 13 | export type CodeCommit = Entity & { 14 | /** 15 | * The branch the code was committed to. 16 | */ 17 | branch: string; 18 | /** 19 | * The commit message. 20 | */ 21 | message: string; 22 | /** 23 | * Indicates if this commit is a merge, defaults to false. 24 | */ 25 | merge: boolean; 26 | /** 27 | * Indicates if this commit is a versionBump, defaults to false. 28 | */ 29 | versionBump: boolean; 30 | [k: string]: unknown; 31 | }; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CodeDeploy.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A code deploy job. 12 | */ 13 | export type CodeDeploy = RecordEntity & { 14 | /** 15 | * Build/deploy job name. 16 | */ 17 | jobName?: string; 18 | /** 19 | * Build/deploy job number. 20 | */ 21 | jobNumber?: number; 22 | /** 23 | * Descriptive text of the job. 24 | */ 25 | summary?: string; 26 | /** 27 | * Deploy action (e.g. plan, apply, destroy, rollback). 28 | */ 29 | action?: string; 30 | /** 31 | * Name of the target system or environment. 32 | */ 33 | target?: string; 34 | /** 35 | * Indicates if this is a production deploy, defaults to true. 36 | */ 37 | production?: boolean; 38 | [k: string]: unknown; 39 | }; 40 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CodeModule.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A software module. Such as an npm_module or java_library. 12 | */ 13 | export type CodeModule = Entity & { 14 | /** 15 | * Indicates if this is a public module. 16 | */ 17 | public?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CodeRepo.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A source code repository. A CodeRepo is also a DataRepository therefore should carry all the required properties of DataRepository. 12 | */ 13 | export type CodeRepo = Entity & { 14 | /** 15 | * The application that this repo is part of. 16 | */ 17 | application?: string; 18 | /** 19 | * The project that this repo belongs to. 20 | */ 21 | project?: string; 22 | /** 23 | * Indicates if this is a public repo. 24 | */ 25 | public?: boolean; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CodeReview.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A code review record. 12 | */ 13 | export type CodeReview = RecordEntity & { 14 | /** 15 | * The title text of the review. 16 | */ 17 | title: string; 18 | /** 19 | * The summary text of the review. 20 | */ 21 | summary?: string; 22 | /** 23 | * The state of the review. 24 | */ 25 | state?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Configuration.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A Configuration contains definitions that describe a resource such as a Task, Deployment or Workload. For example, an `aws_ecs_task_definition` is a `Configuration`. 12 | */ 13 | export type Configuration = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Container.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A standard unit of software that packages up code and all its dependencies and configurations. 12 | */ 13 | export type Container = Entity & { 14 | /** 15 | * The container image that the container is built from 16 | */ 17 | image?: string; 18 | /** 19 | * The version of the Docker Engine 20 | */ 21 | dockerVersion?: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/ControlPolicy.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An technical or operational policy with rules that govern (or enforce, evaluate, monitor) a security control. 12 | */ 13 | export type ControlPolicy = Entity & { 14 | /** 15 | * The category of policy. 16 | */ 17 | category?: 'compliance' | 'config' | 'password' | 'other'; 18 | /** 19 | * Rules of policy. 20 | */ 21 | rules?: string[]; 22 | /** 23 | * Contents of the raw rules, if applicable. 24 | */ 25 | content?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/CryptoKey.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Key } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A key used to perform cryptographic functions, such as an encryption key. 12 | */ 13 | export type CryptoKey = Key & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/DataStore.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Database.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A database cluster/instance. 12 | */ 13 | export type Database = Entity & { 14 | /** 15 | * URI to access the database. 16 | */ 17 | location?: string; 18 | /** 19 | * If the data needs to be encrypted 20 | */ 21 | encryptionRequired?: boolean; 22 | /** 23 | * If the repository is encrypted 24 | */ 25 | encrypted?: boolean | null; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Deployment.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A deployment of code, application, infrastructure or service. For example, a Kubernetes deployment. An auto scaling group is also considered a deployment. 12 | */ 13 | export type Deployment = Entity & { 14 | /** 15 | * Desired size (i.e. number of instances) associated with this deployment. 16 | */ 17 | desiredSize?: number; 18 | /** 19 | * Current size (i.e. number of instances) active with this deployment. 20 | */ 21 | currentSize?: number; 22 | /** 23 | * Maximum size (i.e. number of instances) limited by this deployment. 24 | */ 25 | maxSize?: number; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Directory.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * Directory, such as LDAP or Active Directory. 12 | */ 13 | export type Directory = Entity & { 14 | /** 15 | * Directory type. 16 | */ 17 | type?: string; 18 | /** 19 | * List of directory servers. 20 | */ 21 | directoryServers?: string[]; 22 | /** 23 | * List of domain controllers. 24 | */ 25 | domainControllers?: string[]; 26 | /** 27 | * Parent directory, if the entity is a sub-directory. 28 | */ 29 | parent?: string; 30 | [k: string]: unknown; 31 | }; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Disk.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { DataStore } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A disk storage device such as an AWS EBS volume 12 | */ 13 | export type Disk = DataStore; 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Document.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A document or data object. 12 | */ 13 | export type Document = Entity & { 14 | /** 15 | * The name of the product this document is applicable to. This reference is used when the document is product related, such as a product requirement document (PRD) or software bill-of-materials (SBOM). 16 | */ 17 | product?: string; 18 | /** 19 | * The version of this document. 20 | */ 21 | version?: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/DomainZone.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * The DNS Zone of an Internet Domain. 12 | */ 13 | export type DomainZone = Entity & { 14 | /** 15 | * Domain name. 16 | */ 17 | domainName: string; 18 | /** 19 | * Parent domain, if the entity is a sub-domain. 20 | */ 21 | parent?: string; 22 | /** 23 | * Total number of DNS records in this zone. 24 | */ 25 | recordsCount?: number; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Entity.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Finding.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Firewall.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A piece of hardware or software that protects a network/host/application. 12 | */ 13 | export type Firewall = Entity & { 14 | /** 15 | * The category of the Firewall. Indicates the scope that the Firewall applies to -- i.e. Network, Host, Application. 16 | */ 17 | category: ('network' | 'host' | 'application' | 'other')[]; 18 | /** 19 | * Indicates if the rules in the firewall is stateful. 20 | */ 21 | isStateful?: boolean; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/GraphObject.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Group.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A defined, generic group of Entities. This could represent a group of Resources, Users, Workloads, DataRepositories, etc. 12 | */ 13 | export type Group = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/HostAgent.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A software agent or sensor that runs on a host/endpoint. 12 | */ 13 | export type HostAgent = Entity & { 14 | /** 15 | * The function of sensor/agent 16 | */ 17 | function: ( 18 | | 'endpoint-compliance' 19 | | 'endpoint-configuration' 20 | | 'endpoint-protection' 21 | | 'anti-malware' 22 | | 'DLP' 23 | | 'FIM' 24 | | 'host-firewall' 25 | | 'HIDS' 26 | | 'log-monitor' 27 | | 'activity-monitor' 28 | | 'vulnerability-detection' 29 | | 'container-security' 30 | | 'other' 31 | )[]; 32 | [k: string]: unknown; 33 | }; 34 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Image.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A system image. For example, an AWS AMI (Amazon Machine Image). 12 | */ 13 | export type Image = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Internet.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { GraphObject } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * The Internet node in the graph. There should be only one Internet node. 12 | */ 13 | export type Internet = GraphObject & { 14 | /** 15 | * Display name 16 | */ 17 | displayName?: 'Internet'; 18 | /** 19 | * The IPv4 network CIDR block 20 | */ 21 | CIDR?: '0.0.0.0/0'; 22 | /** 23 | * The IPv6 network CIDR block 24 | */ 25 | CIDRv6?: '::/0'; 26 | /** 27 | * Indicates if the network is open to public access 28 | */ 29 | public?: true; 30 | [k: string]: unknown; 31 | }; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Issue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An issue as used by GitHub, Jira, or other project trackers. 12 | */ 13 | export type Issue = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Key.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Logs.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A specific repository or destination containing application, network, or system logs. 12 | */ 13 | export type Logs = Entity & { 14 | /** 15 | * The type of logs 16 | */ 17 | type?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Model.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A system of postulates, data, and inferences presented as a mathematical description of an entity or state of affairs. For example, a machine learning model. 12 | */ 13 | export type Model = Entity & { 14 | /** 15 | * Indicates whether the model is encrypted 16 | */ 17 | encrypted?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Module.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A software or hardware module. Such as an npm_module or java_library. 12 | */ 13 | export type Module = Entity & { 14 | /** 15 | * Indicates if this is a public module. 16 | */ 17 | public?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/NetworkEndpoint.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A network endpoint for connecting to or accessing network resources. For example, NFS mount targets or VPN endpoints. 12 | */ 13 | export type NetworkEndpoint = Entity & { 14 | /** 15 | * The endpoint IP address 16 | */ 17 | ipAddress?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Organization.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An organization, such as a company (e.g. JupiterOne) or a business unit (e.g. HR). An organization can be internal or external. Note that there is a more specific Vendor class. 12 | */ 13 | export type Organization = Entity & { 14 | /** 15 | * The type of organization (within the context of the primary organization). 16 | */ 17 | _type?: string; 18 | /** 19 | * The organization's main website URL. 20 | */ 21 | website?: string; 22 | /** 23 | * The domain name for internal organization email addresses. 24 | */ 25 | emailDomain?: string; 26 | /** 27 | * Indicates if this organization is external 28 | */ 29 | external?: boolean; 30 | [k: string]: unknown; 31 | }; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Problem.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Finding } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A problem identified from the analysis and correlation of assets and findings that is a notable issue worthy of action. It could be (or become) the cause, or potential cause, of one or more incidents or findings. 12 | */ 13 | export type Problem = Finding; 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Process.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A compute process -- i.e. an instance of a computer program / software application that is being executed by one or many threads. This is NOT a program level operational process (i.e. a Procedure). 12 | */ 13 | export type Process = Entity & { 14 | /** 15 | * Indicates the state of the process. 16 | */ 17 | state?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Program.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A program. For example, a bug bounty/vuln disclosure program. 12 | */ 13 | export type Program = Entity & { 14 | /** 15 | * The type of program. 16 | */ 17 | type?: string; 18 | /** 19 | * Program overview. 20 | */ 21 | overview?: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Question.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An object that represents an inquiry, usually around some matter of uncertainty or difficulty. 12 | */ 13 | export type Question = Entity & { 14 | /** 15 | * A request for information that contributes to answering a question. 16 | */ 17 | queries: string[]; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Queue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A scheduling queue of computing processes or devices. 12 | */ 13 | export type Queue = Entity & { 14 | /** 15 | * The priority of the queue 16 | */ 17 | priority?: number; 18 | /** 19 | * The items (processes, devices, jobs, etc.) in the queue 20 | */ 21 | items?: unknown[]; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Record.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A DNS record; or an official record (e.g. Risk); or a written document (e.g. Policy/Procedure); or a reference (e.g. Vulnerability/Weakness). The exact record type is captured in the _type property of the Entity. 12 | */ 13 | export type Record = RecordEntity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/RecordEntity.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Repository.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A repository that contains resources. For example, a Docker container registry repository hosting Docker container images. 12 | */ 13 | export type Repository = Entity & { 14 | /** 15 | * Indicates if this is a public repo. 16 | */ 17 | public?: boolean; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Requirement.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An individual requirement for security, compliance, regulation or design. 12 | */ 13 | export type Requirement = RecordEntity & { 14 | /** 15 | * The title text of the requirement. 16 | */ 17 | title: string; 18 | /** 19 | * The summary text of the requirement. 20 | */ 21 | summary?: string; 22 | /** 23 | * The state of the requirement (e.g. 'implemented'). 24 | */ 25 | state?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Resource.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A generic assignable resource. A resource is typically non-functional by itself unless used by or attached to a host or workload. 12 | */ 13 | export type Resource = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Review.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A review record. 12 | */ 13 | export type Review = RecordEntity & { 14 | /** 15 | * The title text of the review. 16 | */ 17 | title: string; 18 | /** 19 | * The summary text of the review. 20 | */ 21 | summary?: string; 22 | /** 23 | * The state of the review. 24 | */ 25 | state?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Root.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { GraphObject } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * The root node in the graph. There should be only one Root node per organization account. 12 | */ 13 | export type Root = GraphObject & { 14 | /** 15 | * Display name 16 | */ 17 | displayName?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Rule.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An operational or configuration compliance rule, often part of a Ruleset. 12 | */ 13 | export type Rule = Entity & { 14 | /** 15 | * The category of ruleset. 16 | */ 17 | category?: string; 18 | /** 19 | * Contents of the rule, if applicable. 20 | */ 21 | content?: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Ruleset.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An operational or configuration compliance ruleset with rules that govern (or enforce, evaluate, monitor) a security control or IT system. 12 | */ 13 | export type Ruleset = Entity & { 14 | /** 15 | * The category of ruleset. 16 | */ 17 | category?: string; 18 | /** 19 | * Rules of ruleset. Each rule is written 'as-code' that can be operationalized with a control provider or within JupiterOne's rules engine. 20 | */ 21 | rules?: string[]; 22 | /** 23 | * Contents of the raw rules, if applicable. 24 | */ 25 | content?: string; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Scanner.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A system vulnerability, application code or network infrastructure scanner. 12 | */ 13 | export type Scanner = Entity & { 14 | /** 15 | * The category of scanner 16 | */ 17 | category: string[]; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Secret.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A stored encrypted secret, accessed by permitted users or applications. 12 | */ 13 | export type Secret = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Section.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An object to represent a section such as a compliance section. 12 | */ 13 | export type Section = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Standard.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * An object to represent a standard such as a compliance or technical standard. 12 | */ 13 | export type Standard = Entity & { 14 | /** 15 | * The name of the standard. 16 | */ 17 | name: string; 18 | /** 19 | * The version of the standard. For example, OWASP may have version 2010, 2013, 2017. 20 | */ 21 | version: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Subscription.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A subscription to a service or channel. 12 | */ 13 | export type Subscription = Entity & { 14 | /** 15 | * Indicates whether the subscription is authenticated. 16 | */ 17 | authenticated?: boolean; 18 | /** 19 | * Indicates whether the subscription is pending. 20 | */ 21 | pending?: boolean; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Task.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A computational task. Examples include AWS Batch Job, ECS Task, etc. 12 | */ 13 | export type Task = Entity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Team.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A team consists of multiple member Person entities. For example, the Development team or the Security team. 12 | */ 13 | export type Team = Entity & { 14 | /** 15 | * The team email address 16 | */ 17 | email?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/ThreatIntel.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * Threat intelligence captures information collected from vulnerability risk analysis by those with substantive expertise and access to all-source information. Threat intelligence helps a security professional determine the risk of a vulnerability finding to their organization. 12 | */ 13 | export type ThreatIntel = RecordEntity & { 14 | /** 15 | * The array of links to references. 16 | */ 17 | references?: string[]; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Training.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A training module, such as a security awareness training or secure development training. 12 | */ 13 | export type Training = RecordEntity & { 14 | [k: string]: unknown; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/UserGroup.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A user group, typically associated with some type of access control, such as a group in Okta or in Office365. If a UserGroup has an access policy attached, and all member Users of the UserGroup would inherit the policy. 12 | */ 13 | export type UserGroup = Entity & { 14 | /** 15 | * The group email address 16 | */ 17 | email?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Vault.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A collection of secrets such as a key ring 12 | */ 13 | export type Vault = Entity & { 14 | /** 15 | * Name of the vault 16 | */ 17 | name: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Weakness.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { RecordEntity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A security weakness. 12 | */ 13 | export type Weakness = RecordEntity & { 14 | /** 15 | * The category of the vulnerability finding 16 | */ 17 | category?: string; 18 | /** 19 | * Indicates the likelihood of exploit. 20 | */ 21 | exploitability?: string; 22 | /** 23 | * The array of links to references. 24 | */ 25 | references?: string[]; 26 | [k: string]: unknown; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Workflow.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A workflow such as an AWS CodePipeline, GitHub repository workflow, or Apache Airflow. 12 | */ 13 | export type Workflow = Entity & { 14 | /** 15 | * Name of the workflow 16 | */ 17 | name?: string; 18 | [k: string]: unknown; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/src/Workload.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { Entity } from './Base'; 3 | 4 | /** 5 | * This file was automatically generated by json-schema-to-typescript. 6 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 7 | * and run json-schema-to-typescript to regenerate this file. 8 | */ 9 | 10 | /** 11 | * A virtual compute instance, it could be an aws-ec2-instance, a docker-container, an aws-lambda-function, an application-process, or a vmware-instance. The exact workload type is described in the _type property of the Entity. 12 | */ 13 | export type Workload = Entity & { 14 | /** 15 | * The image this workload is derived from, such as an AMI or docker image. At the abstract level, this usually maps to the _id of a Resource. 16 | */ 17 | image?: string; 18 | /** 19 | * The fully qualified domain name of attached to the instance, if applicable 20 | */ 21 | fqdn?: string; 22 | [k: string]: unknown; 23 | }; 24 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/tools/copy-schemas/.gitignore: -------------------------------------------------------------------------------- 1 | _schemas/*.json -------------------------------------------------------------------------------- /packages/integration-sdk-entities/tools/copy-schemas/_schemas/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/packages/integration-sdk-entities/tools/copy-schemas/_schemas/.gitkeep -------------------------------------------------------------------------------- /packages/integration-sdk-entities/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "include": ["src"], 7 | "exclude": [ 8 | "jest.config.js", 9 | "jest.setup.ts", 10 | "**/dist/**/*", 11 | "**/*.test.ts", 12 | "**/__tests__/**/*.ts", 13 | "**/__mocks__/**/*.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-entities/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | }; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jupiterone/integration-sdk-entity-validator", 3 | "version": "17.0.0", 4 | "description": "Validator for JupiterOne integration entities", 5 | "main": "dist/src/index.js", 6 | "types": "dist/src/index.d.ts", 7 | "repository": "git@github.com:JupiterOne/sdk.git", 8 | "author": "JupiterOne ", 9 | "license": "MPL-2.0", 10 | "files": [ 11 | "dist" 12 | ], 13 | "engines": { 14 | "node": ">=18.0.0 <21.x" 15 | }, 16 | "publishConfig": { 17 | "access": "public" 18 | }, 19 | "scripts": { 20 | "test": "jest", 21 | "prebuild:dist": "rm -rf dist && mkdir dist", 22 | "build:dist": "tsc -p tsconfig.dist.json --declaration", 23 | "prepack": "npm run build:dist" 24 | }, 25 | "devDependencies": { 26 | "@types/node": "^18.17.0", 27 | "ts-node": "10.9.2", 28 | "typescript": "5.5.2" 29 | }, 30 | "dependencies": { 31 | "ajv": "^8.12.0", 32 | "ajv-formats": "^3.0.1", 33 | "prettier": "^3.2.5" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/src/assertEntity.ts: -------------------------------------------------------------------------------- 1 | export function assertEntity(entity: object): asserts entity is { 2 | _type: string; 3 | _class: string | string[]; 4 | } { 5 | if (!('_type' in entity)) { 6 | throw { 7 | message: 'Entity does not contain a "_type" property', 8 | property: '_type', 9 | validation: 'required', 10 | }; 11 | } 12 | if (!('_class' in entity)) { 13 | throw { 14 | message: 'Entity does not contain a "_type" property', 15 | property: '_class', 16 | validation: 'required', 17 | }; 18 | } 19 | 20 | if (!(typeof entity._type === 'string')) { 21 | throw { 22 | message: 'Entity does not contain a "_type" property', 23 | property: '_type', 24 | validation: 'required', 25 | }; 26 | } 27 | if (!(typeof entity._class === 'string' || entity._class instanceof Array)) { 28 | throw { 29 | message: 'Entity does not contain a "_type" property', 30 | property: '_class', 31 | validation: 'required', 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './validator'; 2 | export { 3 | unknownPropertySymbol, 4 | isEntityValidationError, 5 | type EntityValidationError, 6 | } from './entityValidationError'; 7 | export { getValidator, getValidatorSync } from './singleton'; 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "exclude": [ 7 | "jest.config.js", 8 | "**/dist/**/*", 9 | "**/*.test.ts", 10 | "**/__tests__/**/*.ts", 11 | "**/__mocks__/**/*.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-entity-validator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | setupFilesAfterEnv: ['jest-extended/all', './jest.setup.ts'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/jest.setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | 3 | jest.mock('bunyan', () => { 4 | const Logger = jest.requireActual('bunyan'); 5 | 6 | const LOG_LEVELS = ['trace', 'debug', 'info', 'fatal', 'warn', 'error']; 7 | for (const logLevel of LOG_LEVELS) { 8 | jest.spyOn(Logger.prototype, logLevel); 9 | } 10 | 11 | function MockLogger(options: any) { 12 | const ringbuffer = new Logger.RingBuffer({ limit: 100 }); 13 | options.streams = [ 14 | { 15 | level: 'trace', 16 | type: 'raw', 17 | stream: ringbuffer, 18 | }, 19 | ]; 20 | return new Logger(options); 21 | } 22 | 23 | MockLogger.createLogger = function (options: any) { 24 | return new (MockLogger as any)(options); 25 | }; 26 | 27 | MockLogger.stdSerializers = Logger.stdSerializers; 28 | 29 | return MockLogger; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './client'; 2 | export * from './errors'; 3 | export * from './types'; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "include": ["src"], 7 | "exclude": [ 8 | "jest.config.js", 9 | "jest.setup.ts", 10 | "**/dist/**/*", 11 | "**/*.test.ts", 12 | "**/__tests__/**/*.ts", 13 | "**/__mocks__/**/*.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-http-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [ 8 | { "path": "../integration-sdk-core" }, 9 | { "path": "../integration-sdk-private-test-utils" } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/README.md: -------------------------------------------------------------------------------- 1 | # @jupiterone/integration-sdk-private-test-utils 2 | 3 | A private package that exports test utilities used by the 4 | `@jupiterone/integration-sdk-*` packages. 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/.gitignore: -------------------------------------------------------------------------------- 1 | !.env 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceArrayEntityClasses/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceArrayEntityClasses/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceArrayEntityClasses/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceArrayEntityClasses/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_group', 11 | _class: ['Group', 'Other'], 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchGroupsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceCustomDocLoc/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceCustomDocLoc/custom-docs/custom-jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceCustomDocLoc/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceCustomDocLoc/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_group', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchGroupsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateEntityTypes/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateEntityTypes/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateEntityTypes/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateEntityTypes/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_group', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchGroupsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateEntityTypes/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_group', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchGroupsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateRelationshipTypes/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateRelationshipTypes/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateRelationshipTypes/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateRelationshipTypes/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchAccountsStep: Step = { 6 | id: 'fetch-accounts', 7 | name: 'Fetch Accounts', 8 | entities: [], 9 | relationships: [ 10 | { 11 | _type: 'the_root_has_my_account', 12 | _class: RelationshipClass.HAS, 13 | sourceType: 'the_root', 14 | targetType: 'my_account', 15 | }, 16 | ], 17 | executionHandler: noop, 18 | }; 19 | 20 | export default fetchAccountsStep; 21 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceDuplicateRelationshipTypes/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchAccountsStep: Step = { 6 | id: 'fetch-groups', 7 | name: 'Fetch Groups', 8 | entities: [], 9 | relationships: [ 10 | { 11 | _type: 'the_root_has_my_account', 12 | _class: RelationshipClass.HAS, 13 | sourceType: 'the_root', 14 | targetType: 'my_account', 15 | }, 16 | ], 17 | executionHandler: noop, 18 | }; 19 | 20 | export default fetchAccountsStep; 21 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceEntitiesAlphabetize/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceEntitiesAlphabetize/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceEntitiesAlphabetize/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchDataSteps from './steps/fetchData'; 2 | import { 3 | IntegrationInvocationConfig, 4 | IntegrationInstanceConfig, 5 | } from '@jupiterone/integration-sdk-core'; 6 | 7 | export const invocationConfig: IntegrationInvocationConfig = 8 | { 9 | instanceConfigFields: {}, 10 | integrationSteps: [fetchDataSteps], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceEntitiesAlphabetize/src/steps/fetchData.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchDataSteps: Step = { 5 | id: 'fetch-data', 6 | name: 'Fetch Data', 7 | entities: [ 8 | { 9 | resourceName: 'The User 2', 10 | _type: 'my_user_2', 11 | _class: 'User', 12 | }, 13 | { 14 | resourceName: 'The Group', 15 | _type: 'my_group', 16 | _class: 'Group', 17 | }, 18 | { 19 | resourceName: 'The Group 2', 20 | _type: 'my_group_2', 21 | _class: 'Group', 22 | }, 23 | { 24 | resourceName: 'The User', 25 | _type: 'my_user', 26 | _class: 'User', 27 | }, 28 | ], 29 | relationships: [], 30 | executionHandler: noop, 31 | }; 32 | 33 | export default fetchDataSteps; 34 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntities/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntities/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntities/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchAccounts], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntities/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchAccountsStep: Step = { 6 | id: 'fetch-accounts', 7 | name: 'Fetch Accounts', 8 | entities: [], 9 | relationships: [ 10 | { 11 | _type: 'the_root_has_my_account', 12 | _class: RelationshipClass.HAS, 13 | sourceType: 'the_root', 14 | targetType: 'my_account', 15 | }, 16 | ], 17 | executionHandler: noop, 18 | }; 19 | 20 | export default fetchAccountsStep; 21 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntitiesNoRelationships/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntitiesNoRelationships/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntitiesNoRelationships/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceNoEntitiesNoRelationships/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [], 8 | relationships: [], 9 | executionHandler: noop, 10 | }; 11 | 12 | export default fetchGroupsStep; 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceRelationshipsAlphabetize/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceRelationshipsAlphabetize/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceRelationshipsAlphabetize/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccountsStep from './steps/fetchAccounts'; 2 | import { 3 | IntegrationInvocationConfig, 4 | IntegrationInstanceConfig, 5 | } from '@jupiterone/integration-sdk-core'; 6 | 7 | export const invocationConfig: IntegrationInvocationConfig = 8 | { 9 | instanceConfigFields: {}, 10 | integrationSteps: [fetchAccountsStep], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchGroups from './steps/fetchGroups'; 3 | import fetchUsers from './steps/fetchUsers'; 4 | 5 | export const invocationConfig = { 6 | instanceConfigFields: {}, 7 | integrationSteps: [fetchAccounts, fetchGroups, fetchUsers], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchAccountsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Account', 10 | _type: 'my_account', 11 | _class: 'Account', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchAccountsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_groups', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | dependsOn: ['fetch-accounts'], 16 | executionHandler: noop, 17 | }; 18 | 19 | export default fetchGroupsStep; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithDependentStepsNoRelationships/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithMappedRelationships/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithMappedRelationships/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithMappedRelationships/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithMappedRelationships/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { 3 | StepExecutionContext, 4 | Step, 5 | RelationshipDirection, 6 | } from '@jupiterone/integration-sdk-core'; 7 | import { RelationshipClass } from '@jupiterone/data-model'; 8 | 9 | const fetchGroupsStep: Step = { 10 | id: 'fetch-groups', 11 | name: 'Fetch Groups', 12 | entities: [ 13 | { 14 | resourceName: 'The Group', 15 | _type: 'my_group', 16 | _class: 'Group', 17 | }, 18 | ], 19 | relationships: [], 20 | mappedRelationships: [ 21 | { 22 | _type: 'my_group_has_user', 23 | sourceType: 'my_group', 24 | _class: RelationshipClass.HAS, 25 | targetType: 'your_user', // this is the target ("placeholder") entity 26 | direction: RelationshipDirection.FORWARD, 27 | }, 28 | ], 29 | executionHandler: noop, 30 | }; 31 | 32 | export default fetchGroupsStep; 33 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithRelationships/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithRelationships/docs/jupiterone.md: -------------------------------------------------------------------------------- 1 | # Integration with JupiterOne 2 | 3 | ## Setup 4 | 5 | In this section, please provide details about how to set up the integration with 6 | JupiterOne. This may require provisioning some resources on the provider's side 7 | (perhaps a role, app, or api key) and passing information over to JupiterOne. 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithRelationships/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsInstanceWithRelationships/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchGroupsStep: Step = { 6 | id: 'fetch-groups', 7 | name: 'Fetch Groups', 8 | entities: [ 9 | { 10 | resourceName: 'The Group', 11 | _type: 'my_group', 12 | _class: 'Group', 13 | }, 14 | { 15 | resourceName: 'The User', 16 | _type: 'my_user', 17 | _class: 'User', 18 | }, 19 | ], 20 | relationships: [ 21 | { 22 | _class: RelationshipClass.HAS, 23 | _type: 'my_group_has_user', 24 | sourceType: 'my_group', 25 | targetType: 'my_user', 26 | }, 27 | ], 28 | executionHandler: noop, 29 | }; 30 | 31 | export default fetchGroupsStep; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithExistingGeneratedDocs/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithExistingGeneratedDocs/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithExistingGeneratedDocs/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchGroupsStep: Step = { 6 | id: 'fetch-groups', 7 | name: 'Fetch Groups', 8 | entities: [ 9 | { 10 | resourceName: 'The Group', 11 | _type: 'my_group', 12 | _class: 'Group', 13 | }, 14 | { 15 | resourceName: 'The User', 16 | _type: 'my_user', 17 | _class: 'User', 18 | }, 19 | ], 20 | relationships: [ 21 | { 22 | _class: RelationshipClass.HAS, 23 | _type: 'my_group_has_user', 24 | sourceType: 'my_group', 25 | targetType: 'my_user', 26 | }, 27 | ], 28 | executionHandler: noop, 29 | }; 30 | 31 | export default fetchGroupsStep; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithoutExistingDoc/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithoutExistingDoc/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchGroups from './steps/fetchGroups'; 2 | 3 | export const invocationConfig = { 4 | instanceConfigFields: {}, 5 | integrationSteps: [fetchGroups], 6 | }; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/docsWithoutExistingDoc/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | import { RelationshipClass } from '@jupiterone/data-model'; 4 | 5 | const fetchGroupsStep: Step = { 6 | id: 'fetch-groups', 7 | name: 'Fetch Groups', 8 | entities: [ 9 | { 10 | resourceName: 'The Group', 11 | _type: 'my_group', 12 | _class: 'Group', 13 | }, 14 | { 15 | resourceName: 'The User', 16 | _type: 'my_user', 17 | _class: 'User', 18 | }, 19 | ], 20 | relationships: [ 21 | { 22 | _class: RelationshipClass.HAS, 23 | _type: 'my_group_has_user', 24 | sourceType: 'my_group', 25 | targetType: 'my_user', 26 | }, 27 | ], 28 | executionHandler: noop, 29 | }; 30 | 31 | export default fetchGroupsStep; 32 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/generate-integration-graph-schema_all-graph-data-types-dist/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | !dist/ 3 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/generate-integration-graph-schema_all-graph-data-types/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceConfigWithoutEnv/src/index.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | 3 | // this fixture helps ensure that the 4 | // invocation config is read correctly 5 | export default { 6 | instanceConfigFields: require('./instanceConfigFields'), 7 | validateInvocation: noop, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceConfigWithoutEnv/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myBooleanConfig": { 3 | "type": "boolean" 4 | }, 5 | "myStringConfig": { 6 | "type": "string" 7 | }, 8 | "myTypelessConfig": {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | .j1-integration-cache -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/.j1-integration-cache/graph/fetch-accounts/entities/test-account.json: -------------------------------------------------------------------------------- 1 | { 2 | "entities": [ 3 | { 4 | "name": "Test Account", 5 | "_type": "test_account", 6 | "_class": [ 7 | "Account" 8 | ], 9 | "_key": "test", 10 | "createdOn": 1642628988458 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | 'fetch-groups': { 10 | disabled: false, 11 | }, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchGroups from './steps/fetchGroups'; 3 | import fetchUsers from './steps/fetchUsers'; 4 | 5 | import validateInvocation from './validateInvocation'; 6 | import getStepStartStates from './getStepStartStates'; 7 | 8 | export const invocationConfig = { 9 | instanceConfigFields: { 10 | myConfig: { 11 | mask: true, 12 | type: 'boolean', 13 | }, 14 | }, 15 | integrationSteps: [fetchAccounts, fetchGroups, fetchUsers], 16 | validateInvocation, 17 | getStepStartStates, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchAccountsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Account', 10 | _type: 'my_account', 11 | _class: 'Account', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchAccountsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_groups', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | dependsOn: ['fetch-accounts'], 16 | executionHandler: noop, 17 | }; 18 | 19 | export default fetchGroupsStep; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentCachedSteps/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | 'fetch-groups': { 10 | disabled: false, 11 | }, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchGroups from './steps/fetchGroups'; 3 | import fetchUsers from './steps/fetchUsers'; 4 | 5 | import validateInvocation from './validateInvocation'; 6 | import getStepStartStates from './getStepStartStates'; 7 | 8 | export const invocationConfig = { 9 | instanceConfigFields: { 10 | myConfig: { 11 | mask: true, 12 | type: 'boolean', 13 | }, 14 | }, 15 | integrationSteps: [fetchAccounts, fetchGroups, fetchUsers], 16 | validateInvocation, 17 | getStepStartStates, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchAccountsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Account', 10 | _type: 'my_account', 11 | _class: 'Account', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchAccountsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/steps/fetchGroups.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchGroupsStep: Step = { 5 | id: 'fetch-groups', 6 | name: 'Fetch Groups', 7 | entities: [ 8 | { 9 | resourceName: 'The Group', 10 | _type: 'my_groups', 11 | _class: 'Group', 12 | }, 13 | ], 14 | relationships: [], 15 | dependsOn: ['fetch-accounts'], 16 | executionHandler: noop, 17 | }; 18 | 19 | export default fetchGroupsStep; 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithDependentSteps/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-users': { 4 | disabled: false, 5 | }, 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchUsers from './steps/fetchUsers'; 2 | 3 | import validateInvocation from './validateInvocation'; 4 | import getStepStartStates from './getStepStartStates'; 5 | 6 | export const invocationConfig = { 7 | instanceConfigFields: { 8 | myConfig: { 9 | mask: true, 10 | type: 'boolean', 11 | }, 12 | }, 13 | integrationSteps: [fetchUsers], 14 | validateInvocation, 15 | getStepStartStates, 16 | }; 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/instanceWithNonValidatingSteps/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/getStepStartStates.js: -------------------------------------------------------------------------------- 1 | module.exports = function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/index.js: -------------------------------------------------------------------------------- 1 | const fetchGroups = require('./steps/fetchGroups'); 2 | const fetchUsers = require('./steps/fetchUsers'); 3 | 4 | const validateInvocation = require('./validateInvocation'); 5 | const getStepStartStates = require('./getStepStartStates'); 6 | 7 | exports.invocationConfig = { 8 | instanceConfigFields: { 9 | myConfig: { 10 | mask: true, 11 | type: 'boolean', 12 | }, 13 | }, 14 | integrationSteps: [fetchUsers, fetchGroups], 15 | validateInvocation, 16 | getStepStartStates, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/steps/fetchAccounts.js: -------------------------------------------------------------------------------- 1 | const noop = require('lodash/noop'); 2 | 3 | module.exports = { 4 | id: 'fetch-accounts', 5 | name: 'Fetch Accounts', 6 | entities: [ 7 | { 8 | resourceName: 'The Account', 9 | _type: 'my_account', 10 | _class: 'Account', 11 | }, 12 | ], 13 | relationships: [], 14 | executionHandler: noop, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/steps/fetchUsers.js: -------------------------------------------------------------------------------- 1 | const noop = require('lodash/noop'); 2 | 3 | module.exports = { 4 | id: 'fetch-users', 5 | name: 'Fetch Users', 6 | entities: [ 7 | { 8 | resourceName: 'The User', 9 | _type: 'my_user', 10 | _class: 'User', 11 | }, 12 | ], 13 | relationships: [], 14 | executionHandler: noop, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/javaScriptProject/src/validateInvocation.js: -------------------------------------------------------------------------------- 1 | module.exports = function validateInvocation() { 2 | return 'loaded'; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/entities-1.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/entities-1.json -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/entities-2.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/entities-2.json -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/relationship-1.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/relationship-1.json -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/relationship-2.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/graph/relationship-2.json -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization-compressed/.j1-integration/summary.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "partialDatasets": { 4 | "types": ["partial_type"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization/.j1-integration/graph/entities-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "entities": [ 3 | { 4 | "_key": "entity-1", 5 | "_type": "test", 6 | "_class": "Resource" 7 | }, 8 | { 9 | "_key": "entity-2", 10 | "_type": "test", 11 | "_class": "Resource" 12 | }, 13 | { 14 | "_key": "entity-3", 15 | "_type": "test", 16 | "_class": "Resource" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization/.j1-integration/graph/entities-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "entities": [ 3 | { 4 | "_key": "entity-4", 5 | "_type": "test", 6 | "_class": "Resource" 7 | }, 8 | { 9 | "_key": "entity-5", 10 | "_type": "test", 11 | "_class": "Resource" 12 | }, 13 | { 14 | "_key": "entity-6", 15 | "_type": "test", 16 | "_class": "Resource" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization/.j1-integration/graph/relationship-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "relationships": [ 3 | { 4 | "_key": "relationship-1", 5 | "_class": "HAS", 6 | "_fromEntityKey": "test-1", 7 | "_toEntityKey": "test-2" 8 | }, 9 | { 10 | "_key": "relationship-2", 11 | "_class": "HAS", 12 | "_fromEntityKey": "test-3", 13 | "_toEntityKey": "test-4" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization/.j1-integration/graph/relationship-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "relationships": [ 3 | { 4 | "_key": "relationship-3", 5 | "_class": "HAS", 6 | "_fromEntityKey": "test-5", 7 | "_toEntityKey": "test-6" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/synchronization/.j1-integration/summary.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "partialDatasets": { 4 | "types": ["partial_type"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchUsers from './steps/fetchUsers'; 3 | 4 | import validateInvocation from './validateInvocation'; 5 | import getStepStartStates from './getStepStartStates'; 6 | 7 | export const invocationConfig = { 8 | instanceConfigFields: { 9 | myConfig: { 10 | mask: true, 11 | type: 'boolean', 12 | }, 13 | }, 14 | integrationSteps: [fetchAccounts, fetchUsers], 15 | validateInvocation, 16 | getStepStartStates, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptIntegrationProject/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchUsers from './steps/fetchUsers'; 3 | 4 | import validateInvocation from './validateInvocation'; 5 | import getStepStartStates from './getStepStartStates'; 6 | 7 | export const invocationConfig = { 8 | instanceConfigFields: { 9 | myConfig: { 10 | mask: true, 11 | type: 'boolean', 12 | }, 13 | }, 14 | integrationSteps: [fetchAccounts, fetchUsers], 15 | validateInvocation, 16 | getStepStartStates, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchAccountsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Account', 10 | _type: 'my_account', 11 | _class: 'Account', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchAccountsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptProject/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/.env: -------------------------------------------------------------------------------- 1 | MY_CONFIG=false 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/custom-integration/.gitignore: -------------------------------------------------------------------------------- 1 | index.html -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/custom-integration/graph/entity/entities/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "entities": [ 3 | { 4 | "id": "1", 5 | "_class": "entity", 6 | "_key": "entity:1", 7 | "_type": "entity", 8 | "displayName": "Entity Name" 9 | }, 10 | { 11 | "id": "2", 12 | "_class": "entity", 13 | "_key": "entity:2", 14 | "_type": "entity", 15 | "displayName": "Entity Name" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/custom-integration/graph/entity_has_entity/relationships/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "relationships": [ 3 | { 4 | "_key": "entity:1|has|entity:2", 5 | "_type": "entity_has_entity", 6 | "_class": "HAS", 7 | "_fromEntityKey": "entity:1", 8 | "_toEntityKey": "entity:2", 9 | "displayName": "HAS" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/getStepStartStates.ts: -------------------------------------------------------------------------------- 1 | export default function getStepStartStates() { 2 | return { 3 | 'fetch-accounts': { 4 | disabled: false, 5 | }, 6 | 'fetch-users': { 7 | disabled: false, 8 | }, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccounts from './steps/fetchAccounts'; 2 | import fetchUsers from './steps/fetchUsers'; 3 | 4 | import validateInvocation from './validateInvocation'; 5 | 6 | export const invocationConfig = { 7 | instanceConfigFields: { 8 | myConfig: { 9 | mask: true, 10 | type: 'boolean', 11 | }, 12 | }, 13 | integrationSteps: [fetchAccounts, fetchUsers], 14 | validateInvocation, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/instanceConfigFields.json: -------------------------------------------------------------------------------- 1 | { 2 | "myConfig": { 3 | "mask": true, 4 | "type": "boolean" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/steps/fetchAccounts.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchAccountsStep: Step = { 5 | id: 'fetch-accounts', 6 | name: 'Fetch Accounts', 7 | entities: [ 8 | { 9 | resourceName: 'The Account', 10 | _type: 'my_account', 11 | _class: 'Account', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchAccountsStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/typeScriptVisualizeProject/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | export default function validateInvocation() { 2 | return 'loaded'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/validationFailure/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchUsers from './steps/fetchUsers'; 2 | import validateInvocation from './validateInvocation'; 3 | 4 | export const invocationConfig = { 5 | integrationSteps: [fetchUsers], 6 | validateInvocation, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/validationFailure/src/steps/fetchUsers.ts: -------------------------------------------------------------------------------- 1 | import noop from 'lodash/noop'; 2 | import { StepExecutionContext, Step } from '@jupiterone/integration-sdk-core'; 3 | 4 | const fetchUsersStep: Step = { 5 | id: 'fetch-users', 6 | name: 'Fetch Users', 7 | entities: [ 8 | { 9 | resourceName: 'The User', 10 | _type: 'my_user', 11 | _class: 'User', 12 | }, 13 | ], 14 | relationships: [], 15 | executionHandler: noop, 16 | }; 17 | 18 | export default fetchUsersStep; 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/validationFailure/src/validateInvocation.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationValidationError } from '@jupiterone/integration-sdk-core'; 2 | 3 | export default function validateInvocation() { 4 | throw new IntegrationValidationError('Failed to access provider api'); 5 | } 6 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/visualizeTypesWithEntitiesAndRelationships/.gitignore: -------------------------------------------------------------------------------- 1 | .j1-integration 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/__fixtures__/visualizeTypesWithEntitiesAndRelationships/src/index.ts: -------------------------------------------------------------------------------- 1 | import fetchAccountsStep from './steps/fetchAccounts'; 2 | import { 3 | IntegrationInvocationConfig, 4 | IntegrationInstanceConfig, 5 | } from '@jupiterone/integration-sdk-core'; 6 | 7 | export const invocationConfig: IntegrationInvocationConfig = 8 | { 9 | instanceConfigFields: {}, 10 | integrationSteps: [fetchAccountsStep], 11 | }; 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jupiterone/integration-sdk-private-test-utils", 3 | "private": true, 4 | "version": "17.0.0", 5 | "description": "The SDK for developing JupiterOne integrations", 6 | "main": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "repository": "git@github.com:JupiterOne/sdk.git", 9 | "author": "JupiterOne ", 10 | "license": "MPL-2.0", 11 | "engines": { 12 | "node": ">=18.0.0 <21.x" 13 | }, 14 | "scripts": { 15 | "build:dist": "tsc -p tsconfig.json --declaration" 16 | }, 17 | "dependencies": { 18 | "@jupiterone/integration-sdk-core": "^17.0.0", 19 | "lodash": "^4.17.15" 20 | }, 21 | "devDependencies": { 22 | "@types/lodash": "^4.14.149" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './loadProjectStructure'; 2 | export * from './toUnixPath'; 3 | export * from './graphObjectStore'; 4 | export * from './graphObject'; 5 | export * from './util'; 6 | export { getMockIntegrationStep } from './step'; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/src/loadProjectStructure.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | export function getProjectDirectoryPath(fixtureName: string) { 4 | return path.resolve(__dirname, '../__fixtures__', fixtureName); 5 | } 6 | 7 | export function loadProjectStructure(fixtureName: string) { 8 | jest 9 | .spyOn(process, 'cwd') 10 | .mockReturnValue(getProjectDirectoryPath(fixtureName)); 11 | } 12 | 13 | export function restoreProjectStructure() { 14 | const maybeCwdMock = process.cwd; 15 | if (jest.isMockFunction(maybeCwdMock)) { 16 | maybeCwdMock.mockRestore(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/src/step.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationStep } from '@jupiterone/integration-sdk-core'; 2 | 3 | function getMockIntegrationStep( 4 | config?: Partial, 5 | ): IntegrationStep { 6 | return { 7 | id: 'id', 8 | name: 'name', 9 | entities: [], 10 | relationships: [], 11 | executionHandler: () => undefined, 12 | ...config, 13 | }; 14 | } 15 | 16 | export { getMockIntegrationStep }; 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/src/toUnixPath.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Utility for testing against the memfs vol.toJSON() result 3 | * on windows. 4 | */ 5 | export function toUnixPath(path: string) { 6 | const driveStrippedPath = path.replace(/^([A-Z]|[a-z]):\\/, '/'); 7 | return driveStrippedPath.replace(/\\/g, '/'); 8 | } 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/src/util.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number) { 2 | return new Promise((resolve) => { 3 | setTimeout(() => resolve(undefined), ms); 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /packages/integration-sdk-private-test-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["__fixtures__", "**/dist/**/*"], 8 | "references": [{ "path": "../integration-sdk-core" }] 9 | } 10 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/README.md: -------------------------------------------------------------------------------- 1 | # @jupiterone/integration-sdk-core 2 | 3 | _NOTE:_ This project is currently under development and the API interface is not 4 | stable. Use at your own risk. 5 | 6 | This package contains the runtime code required for executing an integration. 7 | 8 | ## Installation 9 | 10 | ``` 11 | npm install @jupiterone/integration-sdk-runtime 12 | 13 | # or 14 | 15 | yarn add @jupiterone/integration-sdk-runtime 16 | ``` 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/__mocks__/fs.ts: -------------------------------------------------------------------------------- 1 | // some dependencies depend on the sync fs apis, 2 | // just expose everything 3 | export * from 'memfs'; 4 | 5 | // needed for loading the j1 data model 6 | export const readdirSync = jest.requireActual('fs').readdirSync; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/__mocks__/graceful-fs.ts: -------------------------------------------------------------------------------- 1 | // HACK: to get around an issue with graceful-fs attempting to patch 2 | // fs twice in recording tests, replace the implementation 3 | // with our own fs mock 4 | export * from 'fs'; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | setupFilesAfterEnv: ['jest-extended/all', './jest.setup.ts'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/jest.setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | 3 | jest.mock('bunyan', () => { 4 | const Logger = jest.requireActual('bunyan'); 5 | 6 | const LOG_LEVELS = ['trace', 'debug', 'info', 'fatal', 'warn', 'error']; 7 | for (const logLevel of LOG_LEVELS) { 8 | jest.spyOn(Logger.prototype, logLevel); 9 | } 10 | 11 | function MockLogger(options: any) { 12 | const ringbuffer = new Logger.RingBuffer({ limit: 100 }); 13 | options.streams = [ 14 | { 15 | level: 'trace', 16 | type: 'raw', 17 | stream: ringbuffer, 18 | }, 19 | ]; 20 | return new Logger(options); 21 | } 22 | 23 | MockLogger.createLogger = function (options: any) { 24 | return new (MockLogger as any)(options); 25 | }; 26 | 27 | MockLogger.stdSerializers = Logger.stdSerializers; 28 | 29 | return MockLogger; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/__tests__/index.test.ts: -------------------------------------------------------------------------------- 1 | import { FileSystemGraphObjectStore } from '../index'; 2 | 3 | describe('#storage', () => { 4 | test('should expose FileSystemGraphObjectStore', () => { 5 | expect(FileSystemGraphObjectStore).not.toEqual(undefined); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/api/error.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationError } from '@jupiterone/integration-sdk-core'; 2 | 3 | export class IntegrationApiKeyRequiredError extends IntegrationError { 4 | constructor() { 5 | super({ 6 | code: 'JUPITERONE_API_KEY_ENVIRONMENT_VARIABLE_NOT_SET', 7 | message: 'The JUPITERONE_API_KEY environment variable must be set', 8 | }); 9 | } 10 | } 11 | 12 | export class IntegrationAccountRequiredError extends IntegrationError { 13 | constructor() { 14 | super({ 15 | code: 'JUPITERONE_ACCOUNT_ENVIRONMENT_VARIABLE_NOT_SET', 16 | message: 'The JUPITERONE_ACCOUNT environment variable must be set', 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/execution/__tests__/getMaskedFields.test.ts: -------------------------------------------------------------------------------- 1 | import { getMaskedFields } from '../utils/getMaskedFields'; 2 | import { createInstanceConfiguration } from './utils/createIntegrationConfig'; 3 | 4 | test('getMaskedFields', () => { 5 | const invocationConfig = { 6 | integrationSteps: [], 7 | instanceConfigFields: { 8 | a: { 9 | mask: true, 10 | }, 11 | b: { 12 | mask: false, 13 | }, 14 | c: {}, 15 | d: { 16 | mask: true, 17 | }, 18 | }, 19 | }; 20 | const testConfig = createInstanceConfiguration({ 21 | invocationConfig, 22 | }).invocationConfig; 23 | expect(getMaskedFields(testConfig)).toEqual(['a', 'd']); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/execution/utils/getMaskedFields.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IntegrationInstanceConfig, 3 | IntegrationInvocationConfig, 4 | } from '@jupiterone/integration-sdk-core'; 5 | import { keys, pickBy } from 'lodash'; 6 | 7 | export function getMaskedFields< 8 | TIntegrationConfig extends 9 | IntegrationInstanceConfig = IntegrationInstanceConfig, 10 | >(config: IntegrationInvocationConfig) { 11 | return keys(pickBy(config.instanceConfigFields, (val) => val.mask)); 12 | } 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/execution/utils/processDeclaredTypesDiff.ts: -------------------------------------------------------------------------------- 1 | import { ExecuteIntegrationResult } from '../executeIntegration'; 2 | import { IntegrationStepResult } from '@jupiterone/integration-sdk-core'; 3 | 4 | type StepIteratee = ( 5 | step: IntegrationStepResult, 6 | undeclaredTypes: string[], 7 | ) => void; 8 | 9 | /** 10 | * Determines which step results have undeclared types, 11 | * passing the diff results to the provided stepIteratee. 12 | * @param results 13 | * @param stepIteratee 14 | */ 15 | export function processDeclaredTypesDiff( 16 | results: ExecuteIntegrationResult, 17 | stepIteratee: StepIteratee, 18 | ) { 19 | results.integrationStepResults.forEach((step) => { 20 | const { declaredTypes, encounteredTypes } = step; 21 | 22 | const declaredTypeSet = new Set(declaredTypes); 23 | const undeclaredTypes = encounteredTypes.filter( 24 | (type) => !declaredTypeSet.has(type), 25 | ); 26 | 27 | stepIteratee(step, undeclaredTypes); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/execution/utils/seperateStepsByDependencyGraph.ts: -------------------------------------------------------------------------------- 1 | import { Step } from '@jupiterone/integration-sdk-core'; 2 | 3 | export const DEFAULT_DEPENDENCY_GRAPH_IDENTIFIER = '__defaultDependencyGraph'; 4 | 5 | export function seperateStepsByDependencyGraph[]>( 6 | integrationSteps: T, 7 | ): { [k: string]: T } { 8 | return integrationSteps.reduce((stepsByGraphId, step) => { 9 | const graphId = 10 | step.dependencyGraphId ?? DEFAULT_DEPENDENCY_GRAPH_IDENTIFIER; 11 | stepsByGraphId[graphId]?.push 12 | ? stepsByGraphId[graphId].push(step) 13 | : (stepsByGraphId[graphId] = [step]); 14 | return stepsByGraphId; 15 | }, {}); 16 | } 17 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/execution/utils/trimStringValues.ts: -------------------------------------------------------------------------------- 1 | import { cloneDeep, isObject, isString } from 'lodash'; 2 | 3 | export function trimStringValues( 4 | object: T, 5 | fieldsToSkip: string[] = [], 6 | ): T { 7 | const trimmed = cloneDeep(object); 8 | Object.keys(trimmed).forEach((key: keyof T) => { 9 | const val = trimmed[key]; 10 | if (isString(val) && !fieldsToSkip.includes(key as string)) { 11 | trimmed[key] = val.trim(); 12 | } else if (isObject(val)) { 13 | trimmed[key] = trimStringValues(val, fieldsToSkip); 14 | } 15 | }); 16 | return trimmed; 17 | } 18 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './api'; 2 | export * from './execution'; 3 | export * from './synchronization'; 4 | export * from './fileSystem'; 5 | export * from './logger'; 6 | export * from './metrics'; 7 | export * from './storage'; 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/logger/registerEventHandlers.test.ts: -------------------------------------------------------------------------------- 1 | import { registerEventHandlers } from './registerEventHandlers'; 2 | 3 | test('registerEventHandlers registers a handler for uncaughtException', () => { 4 | const noopCallback = (err, event) => { 5 | return; 6 | }; 7 | 8 | const uncaughtExceptionCount = process.listeners('uncaughtException').length; 9 | registerEventHandlers(noopCallback); 10 | 11 | expect(process.listeners('uncaughtException').length).toBe( 12 | uncaughtExceptionCount + 1, 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/storage/FileSystemGraphObjectStore/index.ts: -------------------------------------------------------------------------------- 1 | export * from './FileSystemGraphObjectStore'; 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/storage/index.ts: -------------------------------------------------------------------------------- 1 | export { GraphObjectStore } from '@jupiterone/integration-sdk-core'; 2 | export * from './FileSystemGraphObjectStore'; 3 | export * from './memory'; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/storage/types.ts: -------------------------------------------------------------------------------- 1 | import { Entity, Relationship } from '@jupiterone/integration-sdk-core'; 2 | 3 | export interface FlushedEntityData { 4 | entities: Entity[]; 5 | } 6 | 7 | export interface FlushedRelationshipData { 8 | relationships: Relationship[]; 9 | } 10 | 11 | export type FlushedGraphObjectData = FlushedEntityData & 12 | FlushedRelationshipData; 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/synchronization/types.ts: -------------------------------------------------------------------------------- 1 | export interface SynchronizationApiErrorResponse { 2 | error?: { 3 | code?: string; 4 | message: string; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/src/synchronization/util.ts: -------------------------------------------------------------------------------- 1 | import { promisify } from 'util'; 2 | import { gzip } from 'zlib'; 3 | 4 | const gz = promisify(gzip); 5 | export async function gzipData(data: object) { 6 | return await gz(JSON.stringify(data)); 7 | } 8 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/test/mocks/mockWriteJsonToPath.ts: -------------------------------------------------------------------------------- 1 | // Prevent tests from creating ./.j1-integration directory 2 | import * as fileSystem from '../../src/fileSystem'; 3 | // eslint-disable-next-line @typescript-eslint/no-empty-function 4 | fileSystem['writeJsonToPath' as any] = () => {}; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/test/util/expect.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | export function expect(result) { 3 | return { 4 | toBe: (expected) => { 5 | if (result != expected) { 6 | console.error('Result does not match expected:\n\tResult:'); 7 | console.error(result); 8 | console.error('\tExpected:'); 9 | console.error(expected); 10 | process.exit(1); 11 | } 12 | }, 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/test/util/request.ts: -------------------------------------------------------------------------------- 1 | import { AxiosRequestConfig } from 'axios'; 2 | import { RequestHeaders } from '../../src'; 3 | 4 | export function getExpectedRequestHeaders() { 5 | const expectedRequestConfig: AxiosRequestConfig = { 6 | headers: { 7 | [RequestHeaders.CorrelationId]: expect.any(String), 8 | }, 9 | }; 10 | 11 | return expectedRequestConfig; 12 | } 13 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "exclude": [ 7 | "**/test/*", 8 | "jest.setup.ts", 9 | "jest.config.js", 10 | "**/dist/**/*", 11 | "**/*.test.ts", 12 | "**/__tests__/**/*.ts", 13 | "**/__mocks__/**/*.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [ 8 | { "path": "../integration-sdk-core" }, 9 | { "path": "../integration-sdk-private-test-utils" } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/__mocks__/fs.ts: -------------------------------------------------------------------------------- 1 | // some dependencies depend on the sync fs apis, 2 | // just expose everything 3 | export * from 'memfs'; 4 | 5 | // needed for loading the j1 data model 6 | export const readdirSync = jest.requireActual('fs').readdirSync; 7 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/__mocks__/graceful-fs.ts: -------------------------------------------------------------------------------- 1 | // HACK: to get around an issue with graceful-fs attempting to patch 2 | // fs twice in recording tests, replace the implementation 3 | // with our own fs mock 4 | export * from 'fs'; 5 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../babel.config'); 2 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('../../jest.config.base'), 3 | }; 4 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/src/config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IntegrationInstanceConfig, 3 | IntegrationInvocationConfig, 4 | } from '@jupiterone/integration-sdk-core'; 5 | 6 | export interface StepTestConfig< 7 | TInvocationConfig extends 8 | IntegrationInvocationConfig = IntegrationInvocationConfig, 9 | TInstanceConfig extends IntegrationInstanceConfig = IntegrationInstanceConfig, 10 | > { 11 | stepId: string; 12 | dependencyStepIds?: string[]; 13 | invocationConfig: TInvocationConfig; 14 | instanceConfig: TInstanceConfig; 15 | } 16 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/src/filterGraphObjects.ts: -------------------------------------------------------------------------------- 1 | import { Entity, Relationship } from '@jupiterone/integration-sdk-core'; 2 | 3 | export function filterGraphObjects( 4 | graphObjects: T[], 5 | filter: (graphObject: T) => boolean, 6 | ): { targets: T[]; rest: T[] } { 7 | const targets: T[] = []; 8 | const rest: T[] = []; 9 | 10 | for (const graphObject of graphObjects) { 11 | if (filter(graphObject)) { 12 | targets.push(graphObject); 13 | } else { 14 | rest.push(graphObject); 15 | } 16 | } 17 | return { targets, rest }; 18 | } 19 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './context'; 2 | export * from './config'; 3 | export * from './executeStepWithDependencies'; 4 | export * from './filterGraphObjects'; 5 | export * from './logger'; 6 | export * from './recording'; 7 | export * from './jobState'; 8 | export * from './jest'; 9 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/src/logger.ts: -------------------------------------------------------------------------------- 1 | import { IntegrationLogger } from '@jupiterone/integration-sdk-runtime'; 2 | 3 | import Logger, { RingBuffer } from 'bunyan'; 4 | 5 | export const noopAsync = () => Promise.resolve(); 6 | 7 | export function createMockIntegrationLogger(): IntegrationLogger { 8 | const ringbuffer = new RingBuffer({ limit: 100 }); 9 | 10 | const quietLogger = new Logger({ 11 | name: 'test', 12 | streams: [ 13 | { 14 | level: 'trace', 15 | type: 'raw', 16 | stream: ringbuffer, 17 | }, 18 | ], 19 | }); 20 | 21 | return new IntegrationLogger({ 22 | logger: quietLogger, 23 | errorSet: new Set(), 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": true 5 | }, 6 | "exclude": [ 7 | "jest.config.js", 8 | "**/dist/**/*", 9 | "**/*.test.ts", 10 | "**/__tests__/**/*.ts", 11 | "**/__mocks__/**/*.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/integration-sdk-testing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "exclude": ["**/dist/*"], 7 | "references": [ 8 | { "path": "../integration-sdk-core" }, 9 | { "path": "../integration-sdk-runtime" }, 10 | { "path": "../integration-sdk-private-test-utils" } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-converter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-converter.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-entity-metadata.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-entity-metadata.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-execution-handler-static.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-execution-handler-static.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-execution-handler.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-execution-handler.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-pagination.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-pagination.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-rate-limit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-rate-limit.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-relationship-metadata.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-relationship-metadata.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-request-with-retries.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-request-with-retries.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-spec.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-spec.gif -------------------------------------------------------------------------------- /snippets/integrations/.readme/j1-step.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JupiterOne/sdk/41079915597a42a094eecca8435ae73dddbad703/snippets/integrations/.readme/j1-step.gif -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "exludes": ["jest.config.base.js"], 3 | "compilerOptions": { 4 | "composite": true, 5 | "target": "ES2022", 6 | "lib": ["ES2022", "DOM"], 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "resolveJsonModule": true, 10 | "noUnusedLocals": true, 11 | "pretty": true, 12 | "esModuleInterop": true, 13 | "noImplicitThis": true, 14 | "alwaysStrict": true, 15 | "strictNullChecks": true, 16 | "strictFunctionTypes": true, 17 | "allowJs": false 18 | } 19 | } 20 | --------------------------------------------------------------------------------