diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c4b38e..b70212a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,21 +1,19 @@ name: Build -on: [push, pull_request] +on: + pull_request: + push: + branches: + - main jobs: test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - node-version: [14.x] - os: [ubuntu-latest] - + runs-on: ubuntu-latest steps: - id: setup-node name: Setup Node uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 14.x - name: Check out code repository source code uses: actions/checkout@v2 @@ -31,45 +29,23 @@ jobs: # Publishing is done in a separate job to allow # for all matrix builds to complete. - release: + BuildRelease: needs: test runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - strategy: - fail-fast: false - matrix: - node-version: [14.x] - os: [ubuntu-latest] - + if: github.ref == 'refs/heads/main' + name: Checkout Code steps: - name: Setup Node uses: actions/setup-node@v1 with: node-version: 14.x - - name: Check out repo uses: actions/checkout@v2 with: fetch-depth: 2 - - # Fetch tags and describe the commit before the merge commit - # to see if it's a version publish - - name: Fetch tags - run: | - git fetch --tags - if git describe --exact-match --match "v*.*.*" HEAD^2 - then - echo "Found version commit tag. Publishing." - echo "publish=true" >> $GITHUB_ENV - else - echo "Version commit tag not found. Not publishing." - fi - - - name: Publish - if: env.publish == 'true' - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - run: | - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc - yarn - npm publish + token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }} + - name: Build and Release + uses: jupiterone/action-npm-build-release@v1 + with: + npm_auth_token: ${{ secrets.NPM_AUTH_TOKEN }} + gh_token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cae1ca8..f974f6b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,15 +9,15 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] - + branches: ['main'] + jobs: analyze: name: Analyze @@ -30,41 +30,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 \ No newline at end of file + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.prettierignore b/.prettierignore index 5d77b76..151b26b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ dist coverage/ .j1-integration +.j1-integration-cache +.gitleaks.yml \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ee7ea1a..6386fd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to ## [Unreleased] +### Changed + +- Updated `package.json` file (`main`, `types` and `files` section). +- Updated `build.yaml` file to latest patterns. +- Ran prettier. +- Added `questions.yaml` file. + ## 2.0.1 - 2023-01-27 ### Fixed diff --git a/README.md b/README.md index cc6cb89..86a22e4 100644 --- a/README.md +++ b/README.md @@ -66,17 +66,17 @@ src/ ``` Each of the files listed above contribute to creating an -[integration configuration](https://github.com/JupiterOne/integration-sdk/blob/master/docs/development.md#the-integration-framework). +[integration configuration](https://github.com/JupiterOne/integration-sdk/blob/main/docs/development.md#the-integration-framework). Additional files can be placed under `src` and referenced from each of the integration files. The template project hosted -[here](https://github.com/JupiterOne/integration-sdk/tree/master/template) +[here](https://github.com/JupiterOne/integration-sdk/tree/main/template) provides a simple example of how an integration can be setup. ## Development Docs Please reference the `@jupiterone/integration-sdk` -[development documentation](https://github.com/JupiterOne/integration-sdk/blob/master/docs/development.md) +[development documentation](https://github.com/JupiterOne/integration-sdk/blob/main/docs/development.md) for more information on how to build integrations. diff --git a/package.json b/package.json index d499652..78208ed 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "version": "2.0.0", "description": "A graph conversion tool for https://snipeitapp.com/", "license": "MPL-2.0", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "src/index.js", + "types": "src/index.d.ts", "files": [ - "dist" + "src", + "jupiterone" ], "publishConfig": { "access": "public" @@ -14,15 +15,21 @@ "scripts": { "start": "j1-integration collect", "graph": "j1-integration visualize", + "graph:types": "j1-integration visualize-types", + "graph:spec": "j1-integration visualize-types --project-path docs/spec --output-file ./.j1-integration/types-graph/index.spec.html", + "graph:dependencies": "j1-integration visualize-dependencies", + "validate:questions:dry": "j1-integration validate-question-file --dry-run", + "validate:questions": "j1-integration validate-question-file -a $MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k $MANAGED_QUESTIONS_JUPITERONE_API_KEY", "lint": "eslint . --cache --fix --ext .ts,.tsx", - "format": "prettier --write '**/*.{ts,js,json,css,md,yml}'", + "format": "prettier --write '**/*.{ts,js,json,css,md,yml,yaml}'", + "format:check": "prettier --check '**/*.{ts,js,json,css,md,yml,yaml}'", "type-check": "tsc --skipLibCheck", "test": "jest", - "test:ci": "yarn lint && yarn type-check && yarn test", - "prebuild": "yarn test:ci", - "prepush": "yarn lint && yarn type-check && yarn test", - "build": "tsc -p tsconfig.dist.json --declaration --skipLibCheck", - "prepack": "yarn build" + "test:env": "LOAD_ENV=1 yarn test", + "test:ci": "yarn format:check && yarn lint && yarn type-check && yarn test", + "build": "tsc -p tsconfig.dist.json --declaration && cp README.md dist/README.md && cp -r jupiterone/ dist/jupiterone/", + "prepush": "yarn format:check && yarn lint && yarn type-check && jest --changedSince main", + "postversion": "cp package.json ./dist/package.json" }, "dependencies": { "@lifeomic/attempt": "^3.0.0", @@ -31,14 +38,14 @@ "node-fetch": "^2.6.0" }, "devDependencies": { - "@jupiterone/integration-sdk-core": "^8.28.0", - "@jupiterone/integration-sdk-dev-tools": "^8.28.0", - "@jupiterone/integration-sdk-testing": "^8.28.0", + "@jupiterone/integration-sdk-core": "^8.30.2", + "@jupiterone/integration-sdk-dev-tools": "^8.30.2", + "@jupiterone/integration-sdk-testing": "^8.30.2", "@types/node": "^18.8.3", "jest-fetch-mock": "^3.0.3", "type-fest": "^0.20.2" }, "peerDependencies": { - "@jupiterone/integration-sdk-core": "^8.28.0" + "@jupiterone/integration-sdk-core": "^8.30.2" } } diff --git a/tsconfig.dist.json b/tsconfig.dist.json index 61bcf3f..828c269 100644 --- a/tsconfig.dist.json +++ b/tsconfig.dist.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", - "include": ["src"], + "include": ["src", "package.json"], "exclude": [ "dist", "**/*.test.ts", diff --git a/yarn.lock b/yarn.lock index 7783f2d..5aeb8ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -835,20 +835,20 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@jupiterone/data-model@^0.51.0": - version "0.51.0" - resolved "https://registry.yarnpkg.com/@jupiterone/data-model/-/data-model-0.51.0.tgz#6defff71e6be3a08012733ed487f6232561a7750" - integrity sha512-NtV6pzYis0WPxLt793GPeNqLKUwBshx1LANUISd+n5q9V3EooVafThgy/0GoJ233R9GQVHQpIWRkJZuiLJUuhg== +"@jupiterone/data-model@^0.52.0": + version "0.52.0" + resolved "https://registry.yarnpkg.com/@jupiterone/data-model/-/data-model-0.52.0.tgz#4a0c10e4b1344ebb613c165ad2fe768fee52591b" + integrity sha512-5t615vsP4guiJoBX2YYXCNTBgNXnxCpiSgGtCNDkpgvlT2osfTLnOvgJ5yoqS/ZqI9trZbqe0kFqhrQr59iFjw== dependencies: ajv "^8.0.0" ajv-formats "^2.0.0" -"@jupiterone/integration-sdk-cli@^8.28.0": - version "8.28.0" - resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-cli/-/integration-sdk-cli-8.28.0.tgz#445b4415bfdb0454a6965ac0563df2788f6ea9c2" - integrity sha512-cGHkP2FS5tRxE5jTctcxxOvtLt5bW6YiRvIVbvho5INBdFOWIr+PP0lEO8D+5Yq/FE3tsyZmAaEk2MLHCbSTaw== +"@jupiterone/integration-sdk-cli@^8.30.2": + version "8.30.2" + resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-cli/-/integration-sdk-cli-8.30.2.tgz#d9d6fad430485d584cd21e2fe27e55cc967686ef" + integrity sha512-51kh64s+esivrOaqYZGmKogkaf6AL4JOsjZLKtvFTE+AdDDfKQWC1MgN1AkVF7Slq7vya85MHwRqaQIRXk5fjg== dependencies: - "@jupiterone/integration-sdk-runtime" "^8.28.0" + "@jupiterone/integration-sdk-runtime" "^8.30.2" chalk "^4" commander "^9.4.0" fs-extra "^10.1.0" @@ -862,22 +862,22 @@ upath "^1.2.0" vis "^4.21.0-EOL" -"@jupiterone/integration-sdk-core@^8.28.0": - version "8.28.0" - resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-core/-/integration-sdk-core-8.28.0.tgz#3621b3f78f4823c64d0faca8077cbfe493326e28" - integrity sha512-i7ncpaEGHC0Btpt12K4pge0MyhRERNgE+EcNjSmxi2Gp2A8C7Rwoj806TujLeHJViCgJl5ZN75bAHiXMXZxZiA== +"@jupiterone/integration-sdk-core@^8.30.2": + version "8.30.2" + resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-core/-/integration-sdk-core-8.30.2.tgz#0f3ef302b12c64656fe105e4e6ce5fe5dbb7383b" + integrity sha512-E6kY3CwBP2DtShKSkEBZMXfPdPdvsNIstKzX21XsaGrshprj4vdfklfeektm/DI8lluHUj8XVKrfr3oQbLKRTQ== dependencies: - "@jupiterone/data-model" "^0.51.0" + "@jupiterone/data-model" "^0.52.0" lodash "^4.17.21" uuid "^8.3.2" -"@jupiterone/integration-sdk-dev-tools@^8.28.0": - version "8.28.0" - resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-dev-tools/-/integration-sdk-dev-tools-8.28.0.tgz#458577c9b308978c36bec2268275824e39d87a15" - integrity sha512-xyVZIfVyuyHPMgEm9xnJssJPrDkkD6p986+vxKzNLI5Iw23WgRmvcBfZZQcnprtEiTsBmJtMWfegByvX6DI95w== +"@jupiterone/integration-sdk-dev-tools@^8.30.2": + version "8.30.2" + resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-dev-tools/-/integration-sdk-dev-tools-8.30.2.tgz#22b49a4a222977d500d4f23c75f846c15445f943" + integrity sha512-lwCrzTir1TixLPDNtoET6WB9Lw6N6z6hM5KUcBdzvbu9o35Yxp4umvBL4xS2ZRLo15/TUus28G/jNBy2l232Og== dependencies: - "@jupiterone/integration-sdk-cli" "^8.28.0" - "@jupiterone/integration-sdk-testing" "^8.28.0" + "@jupiterone/integration-sdk-cli" "^8.30.2" + "@jupiterone/integration-sdk-testing" "^8.30.2" "@types/jest" "^27.1.0" "@types/node" "^14.0.5" "@typescript-eslint/eslint-plugin" "^4.22.0" @@ -893,12 +893,12 @@ ts-node "^9.1.1" typescript "^4.2.4" -"@jupiterone/integration-sdk-runtime@^8.28.0": - version "8.28.0" - resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-runtime/-/integration-sdk-runtime-8.28.0.tgz#01709b224e98724a5b447f60f74c98ee6023a9c3" - integrity sha512-Yxz2Q/sTXDycisWbN78sZqCpiUwl3UZwukSJFUHo0NuUFp9366Rp07Nnbd/RVnqx9sw3pKskV+0LxId7u3Ytpw== +"@jupiterone/integration-sdk-runtime@^8.30.2": + version "8.30.2" + resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-runtime/-/integration-sdk-runtime-8.30.2.tgz#479c4a09b82ebb37a9675a66657871c4d66c1438" + integrity sha512-hY/Z5qxqCr6/mqqlD1iTBC8699fDcdPCC2iW2BEZ5x8SrDENQyfXfjax4s7n040ah6nnGty1Ssx/TkA/lQnmaw== dependencies: - "@jupiterone/integration-sdk-core" "^8.28.0" + "@jupiterone/integration-sdk-core" "^8.30.2" "@lifeomic/alpha" "^1.4.0" "@lifeomic/attempt" "^3.0.3" async-sema "^3.1.0" @@ -916,13 +916,13 @@ rimraf "^3.0.2" uuid "^7.0.3" -"@jupiterone/integration-sdk-testing@^8.28.0": - version "8.28.0" - resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-testing/-/integration-sdk-testing-8.28.0.tgz#6cfdb97b5a878b98e8533055893b9ee1bcad6fff" - integrity sha512-/y0QbYQzk1BvjEAIPeL97RLIxzGiMhPVRqUhFKDZ9nD1gugGKH/3ImCieW4YG7e8wL/ED9S1mQHslFB+aQVskg== +"@jupiterone/integration-sdk-testing@^8.30.2": + version "8.30.2" + resolved "https://registry.yarnpkg.com/@jupiterone/integration-sdk-testing/-/integration-sdk-testing-8.30.2.tgz#312c010b1759cdd3a71fb0dc26aa77ff77e11e9d" + integrity sha512-6ukj7LD5eed2UDk/H638M0FysmXoxhQx2xwjC9HqFs/ctrrbU2qpNGDiE5iCblpP3n/0Q9fC/90VqE3c9VDeaw== dependencies: - "@jupiterone/integration-sdk-core" "^8.28.0" - "@jupiterone/integration-sdk-runtime" "^8.28.0" + "@jupiterone/integration-sdk-core" "^8.30.2" + "@jupiterone/integration-sdk-runtime" "^8.30.2" "@pollyjs/adapter-node-http" "^6.0.5" "@pollyjs/core" "^6.0.5" "@pollyjs/persister-fs" "^6.0.5"