diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 770fa7e836..769a5f7a3d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,35 +3,86 @@ name: Push to Docker Hub on: [workflow_dispatch] jobs: - docker: + + backend-image: + name: Build backend image runs-on: ubuntu-latest + steps: - - name: Checkout + - + name: โ˜๏ธ Checkout source uses: actions/checkout@v2 - - name: Set up QEMU + name: ๐Ÿ”ง Set up QEMU uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx + name: ๐Ÿ”ง Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub + name: ๐Ÿ‹ Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + # - + # name: ๐Ÿ“ฆ Build backend and export to Docker + # uses: docker/build-push-action@v3 + # with: + # load: true + # context: backend + # tags: infisical/backend:test + # - + # name: ๐Ÿงช Test backend image + # run: | + # docker run --rm infisical/backend:test - - name: Build and push backend + name: ๐Ÿ“ฆ Build backend and push uses: docker/build-push-action@v3 with: push: true context: backend - tags: infisical/backend:test + tags: infisical/backend:latest + platforms: linux/amd64,linux/arm64 + + + frontend-image: + name: Build frontend image + runs-on: ubuntu-latest + + steps: + - + name: โ˜๏ธ Checkout source + uses: actions/checkout@v2 + - + name: ๐Ÿ”ง Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: ๐Ÿ”ง Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: ๐Ÿ‹ Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + # - + # name: ๐Ÿ“ฆ Build frontend and export to Docker + # uses: docker/build-push-action@v3 + # with: + # load: true + # context: frontend + # tags: infisical/frontend:test + # build-args: | + # POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} + # - + # name: ๐Ÿงช Test frontend image + # run: | + # docker run --rm infisical/frontend:test - - name: Build and push frontend + name: ๐Ÿ“ฆ Build frontend and push uses: docker/build-push-action@v3 with: push: true - file: frontend/Dockerfile.dev context: frontend - tags: infisical/frontend:test + tags: infisical/frontend:latest + platforms: linux/amd64,linux/arm64 diff --git a/README.md b/README.md index 1b2d43c5f6..eadd4723fb 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,9 @@ We are currently working hard to make Infisical more extensive. Need any integra Whether it's big or small, we love contributions โค๏ธ Check out our guide to see how to [get started](https://infisical.com/docs/contributing/overview). -Not sure where to get started? [Book a free, non-pressure pairing sessions with one of our teammates](mailto:tony@infisical.com?subject=Pairing%20session&body=I'd%20like%20to%20do%20a%20pairing%20session!)! +Not sure where to get started? You can: +- [Book a free, non-pressure pairing sessions with one of our teammates](mailto:tony@infisical.com?subject=Pairing%20session&body=I'd%20like%20to%20do%20a%20pairing%20session!)! +- Join our Slack, and ask us any questions there. ## ๐Ÿ’š Community & Support diff --git a/backend/package-lock.json b/backend/package-lock.json index 7e42688ef7..19a42c3a10 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@sentry/node": "^7.14.0", - "@sentry/tracing": "^7.14.0", + "@sentry/tracing": "^7.19.0", "@types/crypto-js": "^4.1.1", "axios": "^1.1.3", "bigint-conversion": "^2.2.2", @@ -19,13 +19,13 @@ "crypto-js": "^4.1.1", "dotenv": "^16.0.1", "express": "^4.18.1", - "express-rate-limit": "^6.5.1", + "express-rate-limit": "^6.7.0", "express-validator": "^6.14.2", "handlebars": "^4.7.7", "helmet": "^5.1.1", "jsonwebtoken": "^8.5.1", "jsrp": "^0.2.4", - "mongoose": "^6.7.1", + "mongoose": "^6.7.2", "nodemailer": "^6.8.0", "posthog-node": "^2.1.0", "query-string": "^7.1.1", @@ -33,7 +33,7 @@ "stripe": "^10.7.0", "tweetnacl": "^1.0.3", "tweetnacl-util": "^0.15.1", - "typescript": "^4.8.4" + "typescript": "^4.9.3" }, "devDependencies": { "@posthog/plugin-scaffold": "^1.3.4", @@ -2608,13 +2608,13 @@ } }, "node_modules/@sentry/node": { - "version": "7.17.4", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.4.tgz", - "integrity": "sha512-cR+Gsir9c/tzFWxvk4zXkMQy6tNRHEYixHrb88XIjZVYDqDS9l2/bKs5nJusdmaUeLtmPp5Et2o7RJyS7gvKTQ==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.19.0.tgz", + "integrity": "sha512-yG7Tx32WqOkEHVotFLrumCcT9qlaSDTkFNZ+yLSvZXx74ifsE781DzBA9W7K7bBdYO3op+p2YdsOKzf3nPpAyQ==", "dependencies": { - "@sentry/core": "7.17.4", - "@sentry/types": "7.17.4", - "@sentry/utils": "7.17.4", + "@sentry/core": "7.19.0", + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", @@ -2624,14 +2624,80 @@ "node": ">=8" } }, + "node_modules/@sentry/node/node_modules/@sentry/core": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.19.0.tgz", + "integrity": "sha512-YF9cTBcAnO4R44092BJi5Wa2/EO02xn2ziCtmNgAVTN2LD31a/YVGxGBt/FDr4Y6yeuVehaqijVVvtpSmXrGJw==", + "dependencies": { + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node/node_modules/@sentry/types": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.19.0.tgz", + "integrity": "sha512-oGRAT6lfzoKrxO1mvxiSj0XHxWPd6Gd1wpPGuu6iJo03xgWDS+MIlD1h2unqL4N5fAzLjzmbC2D2lUw50Kn2pA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node/node_modules/@sentry/utils": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.19.0.tgz", + "integrity": "sha512-2L6lq+c9Ol2uiRxQDdcgoapmHJp24MhMN0gIkn2alSfMJ+ls6bGXzQHx6JAIdoOiwFQXRZHKL9ecfAc8O+vItA==", + "dependencies": { + "@sentry/types": "7.19.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@sentry/tracing": { - "version": "7.17.4", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.4.tgz", - "integrity": "sha512-9Fz6DI16ddnd970mlB5MiCNRSmSXp4SVZ1Yv3L22oS3kQeNxjBTE+htYNwJzSPrQp9aL/LqTYwlnrCy24u9XQA==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.19.0.tgz", + "integrity": "sha512-SWY17M3TsgBePaGowUcSqBwaT0TJQzuNexVnLojuU0k6F57L9hubvP9zaoosoCfARXQ/3NypAFWnlJyf570rFQ==", "dependencies": { - "@sentry/core": "7.17.4", - "@sentry/types": "7.17.4", - "@sentry/utils": "7.17.4", + "@sentry/core": "7.19.0", + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/tracing/node_modules/@sentry/core": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.19.0.tgz", + "integrity": "sha512-YF9cTBcAnO4R44092BJi5Wa2/EO02xn2ziCtmNgAVTN2LD31a/YVGxGBt/FDr4Y6yeuVehaqijVVvtpSmXrGJw==", + "dependencies": { + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/tracing/node_modules/@sentry/types": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.19.0.tgz", + "integrity": "sha512-oGRAT6lfzoKrxO1mvxiSj0XHxWPd6Gd1wpPGuu6iJo03xgWDS+MIlD1h2unqL4N5fAzLjzmbC2D2lUw50Kn2pA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/tracing/node_modules/@sentry/utils": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.19.0.tgz", + "integrity": "sha512-2L6lq+c9Ol2uiRxQDdcgoapmHJp24MhMN0gIkn2alSfMJ+ls6bGXzQHx6JAIdoOiwFQXRZHKL9ecfAc8O+vItA==", + "dependencies": { + "@sentry/types": "7.19.0", "tslib": "^1.9.3" }, "engines": { @@ -4517,9 +4583,9 @@ } }, "node_modules/express-rate-limit": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.6.0.tgz", - "integrity": "sha512-HFN2+4ZGdkQOS8Qli4z6knmJFnw6lZed67o6b7RGplWeb1Z0s8VXaj3dUgPIdm9hrhZXTRpCTHXA0/2Eqex0vA==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.7.0.tgz", + "integrity": "sha512-vhwIdRoqcYB/72TK3tRZI+0ttS8Ytrk24GfmsxDXK9o9IhHNO5bXRiXQSExPQ4GbaE5tvIS7j1SGrxsuWs+sGA==", "engines": { "node": ">= 12.9.0" }, @@ -6452,9 +6518,9 @@ } }, "node_modules/mongoose": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.7.1.tgz", - "integrity": "sha512-qbagtqSyvIhUz4EWzXC00EA0DJHFrQwlzTlNGX5DjiESoJiPKqkEga1k9hviFKRFgBna+OlW54mkdi+0+AqxCw==", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.7.2.tgz", + "integrity": "sha512-lrP2V5U1qhaf+z33fiIn7aYAZZ1fVDly+TkFRjTujNBF/FIHESATj2RbgAOSlWqv32fsZXkXejXzeVfjbv35Ow==", "dependencies": { "bson": "^4.7.0", "kareem": "2.4.1", @@ -10508,9 +10574,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -13058,28 +13124,80 @@ } }, "@sentry/node": { - "version": "7.17.4", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.4.tgz", - "integrity": "sha512-cR+Gsir9c/tzFWxvk4zXkMQy6tNRHEYixHrb88XIjZVYDqDS9l2/bKs5nJusdmaUeLtmPp5Et2o7RJyS7gvKTQ==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.19.0.tgz", + "integrity": "sha512-yG7Tx32WqOkEHVotFLrumCcT9qlaSDTkFNZ+yLSvZXx74ifsE781DzBA9W7K7bBdYO3op+p2YdsOKzf3nPpAyQ==", "requires": { - "@sentry/core": "7.17.4", - "@sentry/types": "7.17.4", - "@sentry/utils": "7.17.4", + "@sentry/core": "7.19.0", + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", "tslib": "^1.9.3" + }, + "dependencies": { + "@sentry/core": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.19.0.tgz", + "integrity": "sha512-YF9cTBcAnO4R44092BJi5Wa2/EO02xn2ziCtmNgAVTN2LD31a/YVGxGBt/FDr4Y6yeuVehaqijVVvtpSmXrGJw==", + "requires": { + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.19.0.tgz", + "integrity": "sha512-oGRAT6lfzoKrxO1mvxiSj0XHxWPd6Gd1wpPGuu6iJo03xgWDS+MIlD1h2unqL4N5fAzLjzmbC2D2lUw50Kn2pA==" + }, + "@sentry/utils": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.19.0.tgz", + "integrity": "sha512-2L6lq+c9Ol2uiRxQDdcgoapmHJp24MhMN0gIkn2alSfMJ+ls6bGXzQHx6JAIdoOiwFQXRZHKL9ecfAc8O+vItA==", + "requires": { + "@sentry/types": "7.19.0", + "tslib": "^1.9.3" + } + } } }, "@sentry/tracing": { - "version": "7.17.4", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.4.tgz", - "integrity": "sha512-9Fz6DI16ddnd970mlB5MiCNRSmSXp4SVZ1Yv3L22oS3kQeNxjBTE+htYNwJzSPrQp9aL/LqTYwlnrCy24u9XQA==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.19.0.tgz", + "integrity": "sha512-SWY17M3TsgBePaGowUcSqBwaT0TJQzuNexVnLojuU0k6F57L9hubvP9zaoosoCfARXQ/3NypAFWnlJyf570rFQ==", "requires": { - "@sentry/core": "7.17.4", - "@sentry/types": "7.17.4", - "@sentry/utils": "7.17.4", + "@sentry/core": "7.19.0", + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", "tslib": "^1.9.3" + }, + "dependencies": { + "@sentry/core": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.19.0.tgz", + "integrity": "sha512-YF9cTBcAnO4R44092BJi5Wa2/EO02xn2ziCtmNgAVTN2LD31a/YVGxGBt/FDr4Y6yeuVehaqijVVvtpSmXrGJw==", + "requires": { + "@sentry/types": "7.19.0", + "@sentry/utils": "7.19.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.19.0.tgz", + "integrity": "sha512-oGRAT6lfzoKrxO1mvxiSj0XHxWPd6Gd1wpPGuu6iJo03xgWDS+MIlD1h2unqL4N5fAzLjzmbC2D2lUw50Kn2pA==" + }, + "@sentry/utils": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.19.0.tgz", + "integrity": "sha512-2L6lq+c9Ol2uiRxQDdcgoapmHJp24MhMN0gIkn2alSfMJ+ls6bGXzQHx6JAIdoOiwFQXRZHKL9ecfAc8O+vItA==", + "requires": { + "@sentry/types": "7.19.0", + "tslib": "^1.9.3" + } + } } }, "@sentry/types": { @@ -14523,9 +14641,9 @@ } }, "express-rate-limit": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.6.0.tgz", - "integrity": "sha512-HFN2+4ZGdkQOS8Qli4z6knmJFnw6lZed67o6b7RGplWeb1Z0s8VXaj3dUgPIdm9hrhZXTRpCTHXA0/2Eqex0vA==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.7.0.tgz", + "integrity": "sha512-vhwIdRoqcYB/72TK3tRZI+0ttS8Ytrk24GfmsxDXK9o9IhHNO5bXRiXQSExPQ4GbaE5tvIS7j1SGrxsuWs+sGA==", "requires": {} }, "express-validator": { @@ -15964,9 +16082,9 @@ } }, "mongoose": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.7.1.tgz", - "integrity": "sha512-qbagtqSyvIhUz4EWzXC00EA0DJHFrQwlzTlNGX5DjiESoJiPKqkEga1k9hviFKRFgBna+OlW54mkdi+0+AqxCw==", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.7.2.tgz", + "integrity": "sha512-lrP2V5U1qhaf+z33fiIn7aYAZZ1fVDly+TkFRjTujNBF/FIHESATj2RbgAOSlWqv32fsZXkXejXzeVfjbv35Ow==", "requires": { "bson": "^4.7.0", "kareem": "2.4.1", @@ -18825,9 +18943,9 @@ } }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==" + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==" }, "uglify-js": { "version": "3.17.4", diff --git a/backend/package.json b/backend/package.json index 2bd296d9c2..73cf9311f4 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,7 +1,7 @@ { "dependencies": { "@sentry/node": "^7.14.0", - "@sentry/tracing": "^7.14.0", + "@sentry/tracing": "^7.19.0", "@types/crypto-js": "^4.1.1", "axios": "^1.1.3", "bigint-conversion": "^2.2.2", @@ -10,13 +10,13 @@ "crypto-js": "^4.1.1", "dotenv": "^16.0.1", "express": "^4.18.1", - "express-rate-limit": "^6.5.1", + "express-rate-limit": "^6.7.0", "express-validator": "^6.14.2", "handlebars": "^4.7.7", "helmet": "^5.1.1", "jsonwebtoken": "^8.5.1", "jsrp": "^0.2.4", - "mongoose": "^6.7.1", + "mongoose": "^6.7.2", "nodemailer": "^6.8.0", "posthog-node": "^2.1.0", "query-string": "^7.1.1", @@ -24,7 +24,7 @@ "stripe": "^10.7.0", "tweetnacl": "^1.0.3", "tweetnacl-util": "^0.15.1", - "typescript": "^4.8.4" + "typescript": "^4.9.3" }, "name": "infisical-api", "version": "1.0.0", diff --git a/cli/packages/cmd/export.go b/cli/packages/cmd/export.go new file mode 100644 index 0000000000..a0d89301f1 --- /dev/null +++ b/cli/packages/cmd/export.go @@ -0,0 +1,140 @@ +/* +Copyright ยฉ 2022 NAME HERE +*/ +package cmd + +import ( + "encoding/csv" + "encoding/json" + "fmt" + "strings" + + "github.com/Infisical/infisical-merge/packages/models" + "github.com/Infisical/infisical-merge/packages/util" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +const ( + FormatDotenv string = "dotenv" + FormatJson string = "json" + FormatCSV string = "csv" +) + +// exportCmd represents the export command +var exportCmd = &cobra.Command{ + Use: "export", + Short: "Used to export environment variables to a file", + DisableFlagsInUseLine: true, + Example: "infisical export --env=prod --format=json > secrets.json", + Args: cobra.NoArgs, + PreRun: toggleDebug, + Run: func(cmd *cobra.Command, args []string) { + envName, err := cmd.Flags().GetString("env") + if err != nil { + log.Errorln("Unable to parse the environment flag") + log.Debugln(err) + return + } + + shouldExpandSecrets, err := cmd.Flags().GetBool("expand") + if err != nil { + log.Errorln("Unable to parse the substitute flag") + log.Debugln(err) + return + } + + projectId, err := cmd.Flags().GetString("projectId") + if err != nil { + log.Errorln("Unable to parse the project id flag") + log.Debugln(err) + return + } + + format, err := cmd.Flags().GetString("format") + if err != nil { + log.Errorln("Unable to parse the format flag") + log.Debugln(err) + return + } + + envsFromApi, err := util.GetAllEnvironmentVariables(projectId, envName) + if err != nil { + log.Errorln("Something went wrong when pulling secrets using your Infisical token. Double check the token, project id or environment name (dev, prod, ect.)") + log.Debugln(err) + return + } + + var output string + if shouldExpandSecrets { + substitutions := util.SubstituteSecrets(envsFromApi) + output, err = formatEnvs(substitutions, format) + if err != nil { + log.Errorln(err) + return + } + } else { + output, err = formatEnvs(envsFromApi, format) + if err != nil { + log.Errorln(err) + return + } + } + fmt.Print(output) + }, +} + +func init() { + rootCmd.AddCommand(exportCmd) + exportCmd.Flags().StringP("env", "e", "dev", "Set the environment (dev, prod, etc.) from which your secrets should be pulled from") + exportCmd.Flags().String("projectId", "", "The project ID from which your secrets should be pulled from") + exportCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets") + exportCmd.Flags().StringP("format", "f", "dotenv", "Set the format of the output file (dotenv, json, csv)") +} + +// Format according to the format flag +func formatEnvs(envs []models.SingleEnvironmentVariable, format string) (string, error) { + switch strings.ToLower(format) { + case FormatDotenv: + return formatAsDotEnv(envs), nil + case FormatJson: + return formatAsJson(envs), nil + case FormatCSV: + return formatAsCSV(envs), nil + default: + return "", fmt.Errorf("invalid format flag: %s", format) + } +} + +// Format environment variables as a CSV file +func formatAsCSV(envs []models.SingleEnvironmentVariable) string { + csvString := &strings.Builder{} + writer := csv.NewWriter(csvString) + writer.Write([]string{"Key", "Value"}) + for _, env := range envs { + writer.Write([]string{env.Key, env.Value}) + } + writer.Flush() + return csvString.String() +} + +// Format environment variables as a dotenv file +func formatAsDotEnv(envs []models.SingleEnvironmentVariable) string { + var dotenv string + for _, env := range envs { + dotenv += fmt.Sprintf("%s='%s'\n", env.Key, env.Value) + } + return dotenv +} + +// Format environment variables as a JSON file +func formatAsJson(envs []models.SingleEnvironmentVariable) string { + // Dump as a json array + json, err := json.Marshal(envs) + if err != nil { + log.Errorln("Unable to marshal environment variables to JSON") + log.Debugln(err) + return "" + } + return string(json) +} diff --git a/cli/packages/cmd/run.go b/cli/packages/cmd/run.go index 6b44fa5481..75365dead9 100644 --- a/cli/packages/cmd/run.go +++ b/cli/packages/cmd/run.go @@ -47,46 +47,11 @@ var runCmd = &cobra.Command{ return } - var envsFromApi []models.SingleEnvironmentVariable - infisicalToken := os.Getenv(util.INFISICAL_TOKEN_NAME) - if infisicalToken == "" { - hasUserLoggedInbefore, loggedInUserEmail, err := util.IsUserLoggedIn() - if err != nil { - log.Info("Unexpected issue occurred while checking login status. To see more details, add flag --debug") - log.Debugln(err) - return - } - - if !hasUserLoggedInbefore { - log.Infoln("No logged in user. To login, please run command [infisical login]") - return - } - - userCreds, err := util.GetUserCredsFromKeyRing(loggedInUserEmail) - if err != nil { - log.Infoln("Unable to get user creds from key ring") - log.Debug(err) - return - } - - if !util.WorkspaceConfigFileExists() { - log.Infoln("Your project is not connected to a project yet. Run command [infisical init]") - return - } - - envsFromApi, err = util.GetSecretsFromAPIUsingCurrentLoggedInUser(envName, userCreds) - if err != nil { - log.Errorln("Something went wrong when pulling secrets using your logged in credentials. If the issue persists, double check your project id/try logging in again.") - log.Debugln(err) - return - } - } else { - envsFromApi, err = util.GetSecretsFromAPIUsingInfisicalToken(infisicalToken, envName, projectId) - if err != nil { - log.Errorln("Something went wrong when pulling secrets using your Infisical token. Double check the token, project id or environment name (dev, prod, ect.)") - log.Debugln(err) - return - } + envsFromApi, err := util.GetAllEnvironmentVariables(projectId, envName) + if err != nil { + log.Errorln("Something went wrong when pulling secrets using your Infisical token. Double check the token, project id or environment name (dev, prod, ect.)") + log.Debugln(err) + return } if shouldExpandSecrets { diff --git a/cli/packages/models/error.go b/cli/packages/models/error.go index 28e48d54d2..f6d58cb5a2 100644 --- a/cli/packages/models/error.go +++ b/cli/packages/models/error.go @@ -5,10 +5,13 @@ import log "github.com/sirupsen/logrus" // Custom error type so that we can give helpful messages in CLI type Error struct { Err error - DebugMessage string FriendlyMessage string } func (e *Error) printFriendlyMessage() { log.Infoln(e.FriendlyMessage) } + +func (e *Error) printDebuError() { + log.Debugln(e.Err) +} diff --git a/cli/packages/util/secrets.go b/cli/packages/util/secrets.go index 5cf76d48ef..de5095d75d 100644 --- a/cli/packages/util/secrets.go +++ b/cli/packages/util/secrets.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "errors" "fmt" + "os" "regexp" "strings" @@ -184,6 +185,52 @@ func GetSecretsFromAPIUsingInfisicalToken(infisicalToken string, envName string, return listOfEnv, nil } +func GetAllEnvironmentVariables(projectId string, envName string) ([]models.SingleEnvironmentVariable, error) { + var envsFromApi []models.SingleEnvironmentVariable + infisicalToken := os.Getenv(INFISICAL_TOKEN_NAME) + if infisicalToken == "" { + hasUserLoggedInbefore, loggedInUserEmail, err := IsUserLoggedIn() + if err != nil { + log.Info("Unexpected issue occurred while checking login status. To see more details, add flag --debug") + log.Debugln(err) + return envsFromApi, err + } + + if !hasUserLoggedInbefore { + log.Infoln("No logged in user. To login, please run command [infisical login]") + return envsFromApi, fmt.Errorf("user not logged in") + } + + userCreds, err := GetUserCredsFromKeyRing(loggedInUserEmail) + if err != nil { + log.Infoln("Unable to get user creds from key ring") + log.Debug(err) + return envsFromApi, err + } + + if !WorkspaceConfigFileExists() { + log.Infoln("Your project is not connected to a project yet. Run command [infisical init]") + return envsFromApi, fmt.Errorf("project not initialized") + } + + envsFromApi, err = GetSecretsFromAPIUsingCurrentLoggedInUser(envName, userCreds) + if err != nil { + log.Errorln("Something went wrong when pulling secrets using your logged in credentials. If the issue persists, double check your project id/try logging in again.") + log.Debugln(err) + return envsFromApi, err + } + } else { + envsFromApi, err := GetSecretsFromAPIUsingInfisicalToken(infisicalToken, envName, projectId) + if err != nil { + log.Errorln("Something went wrong when pulling secrets using your Infisical token. Double check the token, project id or environment name (dev, prod, ect.)") + log.Debugln(err) + return envsFromApi, err + } + } + + return envsFromApi, nil +} + func GetWorkSpacesFromAPI(userCreds models.UserCredentials) (workspaces []models.Workspace, err error) { // create http client httpClient := resty.New(). diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 6eabfe4d96..949a96c7d6 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -23,7 +23,6 @@ services: build: context: ./backend dockerfile: Dockerfile - image: infisical/backend volumes: - ./backend/src:/app/src - ./backend/nodemon.json:/app/nodemon.json @@ -43,7 +42,6 @@ services: build: context: ./frontend dockerfile: Dockerfile.dev - image: infisical/frontend volumes: - ./frontend/pages:/app/pages - ./frontend/public:/app/public @@ -52,12 +50,8 @@ services: env_file: .env environment: - NEXT_PUBLIC_ENV=development - - NEXT_PUBLIC_WEBSITE_URL=${SITE_URL} - - NEXT_PUBLIC_POSTHOG_HOST=${POSTHOG_HOST} - - NEXT_PUBLIC_POSTHOG_API_KEY=${POSTHOG_PROJECT_API_KEY} - NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO} - NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER} - - NEXT_PUBLIC_TELEMETRY_ENABLED=${TELEMETRY_ENABLED} networks: - infisical-dev @@ -78,6 +72,8 @@ services: container_name: infisical-dev-mongo-express image: mongo-express restart: always + depends_on: + - mongo env_file: .env environment: - ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_USERNAME} @@ -93,4 +89,4 @@ volumes: driver: local networks: - infisical-dev: \ No newline at end of file + infisical-dev: diff --git a/docker-compose.yml b/docker-compose.yml index 3204f92574..cc92e14063 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,14 +17,10 @@ services: - infisical backend: - platform: linux/amd64 container_name: infisical-backend restart: unless-stopped depends_on: - mongo - build: - context: ./backend - dockerfile: Dockerfile image: infisical/backend command: npm run start env_file: .env @@ -34,24 +30,17 @@ services: - infisical frontend: - platform: linux/amd64 container_name: infisical-frontend restart: unless-stopped depends_on: - backend - build: - context: ./frontend - dockerfile: Dockerfile.prod image: infisical/frontend env_file: .env environment: - - NEXT_PUBLIC_ENV=production - - NEXT_PUBLIC_WEBSITE_URL=${SITE_URL} - - NEXT_PUBLIC_POSTHOG_HOST=${POSTHOG_HOST} - - NEXT_PUBLIC_POSTHOG_API_KEY=${POSTHOG_PROJECT_API_KEY} + # - NEXT_PUBLIC_POSTHOG_API_KEY=${POSTHOG_PROJECT_API_KEY} + - INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED} - NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO} - NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER} - - NEXT_PUBLIC_TELEMETRY_ENABLED=${TELEMETRY_ENABLED} networks: - infisical @@ -73,4 +62,4 @@ volumes: driver: local networks: - infisical: \ No newline at end of file + infisical: diff --git a/docs/cli/export.mdx b/docs/cli/export.mdx new file mode 100644 index 0000000000..10a77612e1 --- /dev/null +++ b/docs/cli/export.mdx @@ -0,0 +1,33 @@ +--- +title: "infisical export" +--- + +```bash +infisical export [options] +``` + +## Description + +Export environment variables from the platform into a file format. + +## Options + +| Option | Description | Default value | +| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` | +| `--projectId` | Used to determine from which infisical project your secrets will be exported from (only required if injecting via the service token method). | `None` | +| `--expand` | Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) | `true` | +| `--format` | Format of the output file. Accepted values: `dotenv`, `csv` and `json` | `dotenv` | + +## Examples + +```bash +# Export variables to a .env file +infisical export > .env + +# Export variables to a CSV file +infisical export --format=csv > secrets.csv + +# Export variables to a JSON file +infisical export --format=json > secrets.json +``` diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx index bea36da324..a55efbebc6 100644 --- a/docs/self-hosting/configuration/envars.mdx +++ b/docs/self-hosting/configuration/envars.mdx @@ -9,24 +9,24 @@ Configuring Infisical requires setting some environment variables. There is a fi | Variable | Description | Default Value | | ---------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------- | -| `PRIVATE_KEY` | โ—๏ธ NaCl-generated server secret key | `None` | -| `PUBLIC_KEY` | โ—๏ธ NaCl-generated server public key | `None` | -| `ENCRYPTION_KEY` | โ—๏ธ Strong hex encryption key | `None` | -| `JWT_SIGNUP_SECRET` | โ—๏ธJWT token secret | `None` | -| `JWT_REFRESH_SECRET` | โ—๏ธ JWT token secret | `None` | -| `JWT_AUTH_SECRET` | โ—๏ธ JWT token secret | `None` | +| `PRIVATE_KEY` | โ—๏ธ NaCl-generated server secret key | `None` | +| `PUBLIC_KEY` | โ—๏ธ NaCl-generated server public key | `None` | +| `ENCRYPTION_KEY` | โ—๏ธ Strong hex encryption key | `None` | +| `JWT_SIGNUP_SECRET` | โ—๏ธ JWT token secret | `None` | +| `JWT_REFRESH_SECRET` | โ—๏ธ JWT token secret | `None` | +| `JWT_AUTH_SECRET` | โ—๏ธ JWT token secret | `None` | | `JWT_SIGNUP_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `15m` | | `JWT_REFRESH_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `90d` | | `JWT_AUTH_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `10d` | | `EMAIL_TOKEN_LIFETIME` | Email OTP/magic-link lifetime expressed in seconds | `86400` | -| `MONGO_URL` | โ—๏ธ MongoDB instance connection string either to container instance or MongoDB Cloud | `None` | +| `MONGO_URL` | โ—๏ธ MongoDB instance connection string either to container instance or MongoDB Cloud | `None` | | `MONGO_USERNAME` | MongoDB username if using container | `None` | | `MONGO_PASSWORD` | MongoDB password if using container | `None` | -| `SITE_URL` | โ—๏ธ Site URL - should be an absolute URL including the protocol (e.g. `https://app.infisical.com`) | `None` | -| `SMT_HOST` | Whether the user joined the community | `smtp.gmail.com` | -| `SMTP_NAME` | Hostname to connect to for establishing SMTP connections (e.g. `Team`) | `None` | -| `SMTP_USERNAME` | โ—๏ธ Credential to connect to host (e.g. `team@infisical.com`) | `None` | -| `SMTP_PASSWORD` | โ—๏ธ Credential to connect to host | `None` | +| `SITE_URL` | โ—๏ธ Site URL - should be an absolute URL including the protocol (e.g. `https://app.infisical.com`) | `None` | +| `SMTP_HOST` | Hostname to connect to for establishing SMTP connections | `smtp.gmail.com` | +| `SMTP_NAME` | Name label to be used in From field (e.g. `Team`) | `None` | +| `SMTP_USERNAME` | โ—๏ธ Credential to connect to host (e.g. `team@infisical.com`) | `None` | +| `SMTP_PASSWORD` | โ—๏ธ Credential to connect to host | `None` | | `TELEMETRY_ENABLED` | `true` or `false`. [More](../overview). | `true` | | `OAUTH_CLIENT_SECRET_HEROKU` | OAuth client secret for Heroku integration | `None` | | `OAUTH_TOKEN_URL_HEROKU` | OAuth token URL for Heroku integration | `None` | diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000000..5e59c68aad --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,64 @@ +ARG POSTHOG_HOST=https://app.posthog.com +ARG POSTHOG_API_KEY=posthog-api-key + +FROM node:16-alpine AS deps +# Install dependencies only when needed. Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +# RUN apk add --no-cache libc6-compat +WORKDIR /app + +# Copy over dependency files +COPY package.json package-lock.json next.config.js ./ + +# Install dependencies +RUN npm ci --only-production + + +# Rebuild the source code only when needed +FROM node:16-alpine AS builder +WORKDIR /app + +# Copy dependencies +COPY --from=deps /app/node_modules ./node_modules +# Copy all files +COPY . . + +ENV NODE_ENV production +ENV NEXT_PUBLIC_ENV production +ARG POSTHOG_HOST +ENV NEXT_PUBLIC_POSTHOG_HOST $POSTHOG_HOST +ARG POSTHOG_API_KEY +ENV NEXT_PUBLIC_POSTHOG_API_KEY $POSTHOG_API_KEY + +# Build +RUN npm run build + + +# Production image +FROM node:16-alpine AS runner +WORKDIR /app + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +RUN mkdir -p /app/.next/cache/images && chown nextjs:nodejs /app/.next/cache/images +VOLUME /app/.next/cache/images + +ARG POSTHOG_API_KEY +ENV NEXT_PUBLIC_POSTHOG_API_KEY=$POSTHOG_API_KEY \ + BAKED_NEXT_PUBLIC_POSTHOG_API_KEY=$POSTHOG_API_KEY + +COPY --chown=nextjs:nodejs --chmod=555 scripts ./scripts +COPY --from=builder /app/public ./public +RUN chown nextjs:nodejs ./public/data +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 +ENV NEXT_TELEMETRY_DISABLED 1 + + +CMD ["/app/scripts/start.sh"] diff --git a/frontend/components/analytics/posthog.js b/frontend/components/analytics/posthog.js index c8d51ad1b6..44ee4fdb39 100644 --- a/frontend/components/analytics/posthog.js +++ b/frontend/components/analytics/posthog.js @@ -4,12 +4,11 @@ import { ENV, POSTHOG_API_KEY, POSTHOG_HOST, - TELEMETRY_ENABLED, } from "../utilities/config"; export const initPostHog = () => { if (typeof window !== "undefined") { - if (ENV == "production" && TELEMETRY_ENABLED) { + if (ENV == "production" && TELEMETRY_CAPTURING_ENABLED) { // eslint-disable-line posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_HOST, }); diff --git a/frontend/components/utilities/attemptLogin.js b/frontend/components/utilities/attemptLogin.js index 7a8cbf96fb..33c08b6987 100644 --- a/frontend/components/utilities/attemptLogin.js +++ b/frontend/components/utilities/attemptLogin.js @@ -4,11 +4,10 @@ import login2 from "~/pages/api/auth/Login2"; import getOrganizations from "~/pages/api/organization/getOrgs"; import getOrganizationUserProjects from "~/pages/api/organization/GetOrgUserProjects"; -import { initPostHog } from "../analytics/posthog"; import pushKeys from "./secrets/pushKeys"; -import { ENV } from "./config"; import { saveTokenToLocalStorage } from "./saveTokenToLocalStorage"; import SecurityClient from "./SecurityClient"; +import Telemetry from "./telemetry/Telemetry"; const nacl = require("tweetnacl"); nacl.util = require("tweetnacl-util"); @@ -33,6 +32,8 @@ const attemptLogin = async ( isLogin ) => { try { + const telemetry = new Telemetry().getInstance(); + client.init( { username: email, @@ -125,16 +126,9 @@ const attemptLogin = async ( env: "Development", }); } - try { - if (email) { - if (ENV == "production") { - const posthog = initPostHog(); - posthog.identify(email); - posthog.capture("User Logged In"); - } - } - } catch (error) { - console.log("posthog", error); + if (email) { + telemetry.identify(email); + telemetry.capture("User Logged In"); } if (isLogin) { diff --git a/frontend/components/utilities/config/index.ts b/frontend/components/utilities/config/index.ts index 62549725ca..d0ffed00c0 100644 --- a/frontend/components/utilities/config/index.ts +++ b/frontend/components/utilities/config/index.ts @@ -4,8 +4,6 @@ const POSTHOG_HOST = process.env.NEXT_PUBLIC_POSTHOG_HOST! || "https://app.posthog.com"; const STRIPE_PRODUCT_PRO = process.env.NEXT_PUBLIC_STRIPE_PRODUCT_PRO!; const STRIPE_PRODUCT_STARTER = process.env.NEXT_PUBLIC_STRIPE_PRODUCT_STARTER!; -const TELEMETRY_ENABLED = - process.env.NEXT_PUBLIC_TELEMETRY_ENABLED! !== "false"; export { ENV, @@ -13,5 +11,4 @@ export { POSTHOG_HOST, STRIPE_PRODUCT_PRO, STRIPE_PRODUCT_STARTER, - TELEMETRY_ENABLED, }; diff --git a/frontend/components/utilities/telemetry/Telemetry.js b/frontend/components/utilities/telemetry/Telemetry.js new file mode 100644 index 0000000000..92bdc078e1 --- /dev/null +++ b/frontend/components/utilities/telemetry/Telemetry.js @@ -0,0 +1,44 @@ +/* eslint-disable */ +import { initPostHog } from "~/components/analytics/posthog"; +import { ENV } from "~/components/utilities/config"; + +class Capturer { + constructor() { + this.api = initPostHog(); + } + + capture(item) { + if (ENV == "production" && TELEMETRY_CAPTURING_ENABLED) { + try { + api.capture(item); + } catch (error) { + console.error("PostHog", error); + } + } + } + + identify(id) { + if (ENV == "production" && TELEMETRY_CAPTURING_ENABLED) { + try { + api.identify(id); + } catch (error) { + console.error("PostHog", error); + } + } + } + +} + +class Telemetry { + constructor() { + if (!Telemetry.instance) { + Telemetry.instance = new Capturer(); + } + } + + getInstance() { + return Telemetry.instance; + } +} + +module.exports = Telemetry; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7a8ed67026..0c87e9fdab 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -64,6 +64,32 @@ "typescript": "^4.9.3" } }, + "node_modules/@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@ampproject/remapping/node_modules/@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "peer": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -75,12 +101,83 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/compat-data": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.5.tgz", + "integrity": "sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g==", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.5.tgz", + "integrity": "sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==", + "peer": true, + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "peer": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "peer": true + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "peer": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.5.tgz", + "integrity": "sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==", "dependencies": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.20.5", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" }, @@ -99,6 +196,33 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz", + "integrity": "sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==", + "peer": true, + "dependencies": { + "@babel/compat-data": "^7.20.0", + "@babel/helper-validator-option": "^7.18.6", + "browserslist": "^4.21.3", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "peer": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-environment-visitor": { "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", @@ -141,6 +265,25 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz", + "integrity": "sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==", + "peer": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-plugin-utils": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", @@ -149,6 +292,18 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-simple-access": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "peer": true, + "dependencies": { + "@babel/types": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", @@ -161,17 +316,40 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", + "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.6.tgz", + "integrity": "sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==", + "peer": true, + "dependencies": { + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5" + }, "engines": { "node": ">=6.9.0" } @@ -190,9 +368,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", - "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.5.tgz", + "integrity": "sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==", "bin": { "parser": "bin/babel-parser.js" }, @@ -252,18 +430,18 @@ } }, "node_modules/@babel/traverse": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", - "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.5.tgz", + "integrity": "sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==", "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", + "@babel/generator": "^7.20.5", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.1", - "@babel/types": "^7.19.0", + "@babel/parser": "^7.20.5", + "@babel/types": "^7.20.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -293,12 +471,12 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/@babel/types": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", - "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.5.tgz", + "integrity": "sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==", "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" }, "engines": { @@ -1882,7 +2060,6 @@ "version": "4.21.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", - "dev": true, "funding": [ { "type": "opencollective", @@ -2472,8 +2649,7 @@ "node_modules/electron-to-chromium": { "version": "1.4.206", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz", - "integrity": "sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==", - "dev": true + "integrity": "sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==" }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -2595,7 +2771,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, "engines": { "node": ">=6" } @@ -3496,6 +3671,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/get-intrinsic": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", @@ -4226,6 +4410,18 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "peer": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/jsonp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/jsonp/-/jsonp-0.2.1.tgz", @@ -5126,8 +5322,7 @@ "node_modules/node-releases": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", - "dev": true + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -7003,7 +7198,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", - "dev": true, "funding": [ { "type": "opencollective", @@ -7209,6 +7403,28 @@ } }, "dependencies": { + "@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "peer": true, + "requires": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "peer": true, + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, "@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -7217,12 +7433,64 @@ "@babel/highlight": "^7.18.6" } }, + "@babel/compat-data": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.5.tgz", + "integrity": "sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g==", + "peer": true + }, + "@babel/core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.5.tgz", + "integrity": "sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==", + "peer": true, + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.1", + "semver": "^6.3.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "peer": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "peer": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "peer": true + } + } + }, "@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.5.tgz", + "integrity": "sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==", "requires": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.20.5", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" } @@ -7235,6 +7503,26 @@ "@babel/types": "^7.18.6" } }, + "@babel/helper-compilation-targets": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz", + "integrity": "sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==", + "peer": true, + "requires": { + "@babel/compat-data": "^7.20.0", + "@babel/helper-validator-option": "^7.18.6", + "browserslist": "^4.21.3", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "peer": true + } + } + }, "@babel/helper-environment-visitor": { "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", @@ -7265,11 +7553,36 @@ "@babel/types": "^7.18.6" } }, + "@babel/helper-module-transforms": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz", + "integrity": "sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==", + "peer": true, + "requires": { + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2" + } + }, "@babel/helper-plugin-utils": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==" }, + "@babel/helper-simple-access": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "peer": true, + "requires": { + "@babel/types": "^7.20.2" + } + }, "@babel/helper-split-export-declaration": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", @@ -7279,14 +7592,31 @@ } }, "@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==" + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==" }, "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" + }, + "@babel/helper-validator-option": { "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==" + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", + "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "peer": true + }, + "@babel/helpers": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.6.tgz", + "integrity": "sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==", + "peer": true, + "requires": { + "@babel/template": "^7.18.10", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5" + } }, "@babel/highlight": { "version": "7.18.6", @@ -7299,9 +7629,9 @@ } }, "@babel/parser": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", - "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==" + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.5.tgz", + "integrity": "sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==" }, "@babel/plugin-syntax-jsx": { "version": "7.18.6", @@ -7340,18 +7670,18 @@ } }, "@babel/traverse": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", - "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.5.tgz", + "integrity": "sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==", "requires": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", + "@babel/generator": "^7.20.5", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.1", - "@babel/types": "^7.19.0", + "@babel/parser": "^7.20.5", + "@babel/types": "^7.20.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -7372,12 +7702,12 @@ } }, "@babel/types": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", - "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.5.tgz", + "integrity": "sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==", "requires": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" } }, @@ -8495,7 +8825,6 @@ "version": "4.21.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", - "dev": true, "requires": { "caniuse-lite": "^1.0.30001370", "electron-to-chromium": "^1.4.202", @@ -8944,8 +9273,7 @@ "electron-to-chromium": { "version": "1.4.206", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz", - "integrity": "sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==", - "dev": true + "integrity": "sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==" }, "emoji-regex": { "version": "9.2.2", @@ -9046,8 +9374,7 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, "escape-string-regexp": { "version": "1.0.5", @@ -9706,6 +10033,12 @@ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "peer": true + }, "get-intrinsic": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", @@ -10220,6 +10553,12 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "peer": true + }, "jsonp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/jsonp/-/jsonp-0.2.1.tgz", @@ -10805,8 +11144,7 @@ "node-releases": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", - "dev": true + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" }, "normalize-path": { "version": "3.0.0", @@ -12124,7 +12462,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz", "integrity": "sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q==", - "dev": true, "requires": { "escalade": "^3.1.1", "picocolors": "^1.0.0" diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js index 907bbc9413..f9f7b32151 100644 --- a/frontend/pages/_app.js +++ b/frontend/pages/_app.js @@ -2,12 +2,11 @@ import { useEffect } from "react"; import { useRouter } from "next/router"; import { config } from "@fortawesome/fontawesome-svg-core"; -import { initPostHog } from "~/components/analytics/posthog"; import Layout from "~/components/basic/layout"; import NotificationProvider from "~/components/context/Notifications/NotificationProvider"; import RouteGuard from "~/components/RouteGuard"; import { publicPaths } from "~/const"; -import { ENV } from "~/utilities/config"; +import Telemetry from "~/utilities/telemetry/Telemetry"; import "@fortawesome/fontawesome-svg-core/styles.css"; import "../styles/globals.css"; @@ -16,17 +15,14 @@ config.autoAddCss = false; const App = ({ Component, pageProps, ...appProps }) => { const router = useRouter(); - const posthog = initPostHog(); useEffect(() => { // Init for auto capturing - const posthog = initPostHog(); + const telemetry = new Telemetry().getInstance(); const handleRouteChange = () => { if (typeof window !== "undefined") { - if (ENV == "production") { - posthog.capture("$pageview"); - } + telemetry.capture("$pageview"); } }; diff --git a/frontend/scripts/replace-variable.sh b/frontend/scripts/replace-variable.sh new file mode 100644 index 0000000000..f03bff93c9 --- /dev/null +++ b/frontend/scripts/replace-variable.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +ORIGINAL=$1 +REPLACEMENT=$2 + +if [ "${ORIGINAL}" = "${REPLACEMENT}" ]; then + echo "Environment variable replacement is the same, skipping.." + exit 0 +fi + +echo "Replacing pre-baked value.." + +find /app/public /app/.next -type f -name "*.js" | +while read file; do + sed -i "s|$ORIGINAL|$REPLACEMENT|g" "$file" +done diff --git a/frontend/scripts/set-telemetry.sh b/frontend/scripts/set-telemetry.sh new file mode 100644 index 0000000000..594f4d1966 --- /dev/null +++ b/frontend/scripts/set-telemetry.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +VALUE=$1 + +find /app/public /app/.next -type f -name "*.js" | +while read file; do + sed -i "s|TELEMETRY_CAPTURING_ENABLED|$VALUE|g" "$file" +done diff --git a/frontend/scripts/start.sh b/frontend/scripts/start.sh new file mode 100644 index 0000000000..05a1f219af --- /dev/null +++ b/frontend/scripts/start.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +scripts/replace-variable.sh "$BAKED_NEXT_PUBLIC_POSTHOG_API_KEY" "$NEXT_PUBLIC_POSTHOG_API_KEY" + +if [ "$INFISICAL_TELEMETRY_ENABLED" != "false" ]; then + echo "Telemetry is enabled" + scripts/set-telemetry.sh true +else + echo "Client opted out of telemetry" + scripts/set-telemetry.sh false +fi + + +node server.js