diff --git a/.ci/scripts/run-test-cluster.sh b/.ci/scripts/run-test-cluster.sh index e43c4b89e3..faae394dae 100755 --- a/.ci/scripts/run-test-cluster.sh +++ b/.ci/scripts/run-test-cluster.sh @@ -12,7 +12,7 @@ fi echo "Testing Kuzzle against node v$NODE_VERSION" echo "Installing dependencies..." -npm install --unsafe-perm +npm install if [ "$REBUILD" == "true" ]; then diff --git a/.ci/test-cluster.yml b/.ci/test-cluster.yml index b0b8b9bbf8..78497523d0 100644 --- a/.ci/test-cluster.yml +++ b/.ci/test-cluster.yml @@ -1,10 +1,11 @@ version: '3.4' x-kuzzle-config: &kuzzle-config - image: kuzzleio/core-dev:2 - command: > - sh -c "n $NODE_VERSION && - node ./docker/scripts/start-kuzzle-dev.js --enable-plugins kuzzle-plugin-cluster,functional-test-plugin" + image: kuzzleio/kuzzle-runner:${NODE_VERSION:-16} + command: > + bash -c " + node ./docker/scripts/start-kuzzle-dev.js --enable-plugins kuzzle-plugin-cluster,functional-test-plugin + " volumes: - "..:/var/app" cap_add: diff --git a/.eslintignore b/.eslintignore index 84433bf3bb..e77b44888d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -62,6 +62,7 @@ lib/util/interfaces.js lib/util/mutex.js lib/util/inflector.js lib/util/koncordeCompat.js +lib/util/name-generator.js features/support/application/functional-tests-app.js lib/model/security/token.js lib/core/auth/tokenManager.js @@ -120,4 +121,4 @@ lib/types/errors/ErrorDefinition.js lib/types/errors/ErrorDomains.js lib/util/array.js lib/util/bufferedPassThrough.js -lib/util/dump-collection.js \ No newline at end of file +lib/util/dump-collection.js diff --git a/.eslintrc.json b/.eslintrc.json index 6bea0f6740..13aefee16a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,7 @@ { + "plugins": [ + "no-only-tests" + ], "rules": { "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-ignore": "off", @@ -61,7 +64,8 @@ "brace-style": ["error", "stroustrup"], "space-infix-ops": 2, "space-unary-ops": [2, { "words": true, "nonwords": false, "overrides": { "!": true } }], - "key-spacing": ["error", { "afterColon": true }] + "key-spacing": ["error", { "afterColon": true }], + "no-only-tests/no-only-tests": "error" }, "overrides": [ { diff --git a/.github/actions/cache-node-modules/action.yml b/.github/actions/cache-node-modules/action.yml deleted file mode 100644 index ba590f4952..0000000000 --- a/.github/actions/cache-node-modules/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Cache Node Modules -description: Cache Node Modules - -inputs: - NODE_VERSION: - description: node version - required: true - -runs: - using: "composite" - steps: - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules-1.0.0 - with: - path: node_modules - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }} - - diff --git a/.github/workflows/pull_request.workflow.yml b/.github/workflows/pull_request.workflow.yml deleted file mode 100644 index 65fffaec7e..0000000000 --- a/.github/workflows/pull_request.workflow.yml +++ /dev/null @@ -1,162 +0,0 @@ -name: Pull request checks - -on: [pull_request] - -jobs: - lint: - name: Lint - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ['14.17.0'] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/es-lint - - build-and-run-kuzzle: - needs: [unit-tests] - name: Build and Run ${{ matrix.kuzzle-image }} - Node.js v${{ matrix.node-version }} - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ['14.17.0'] - kuzzle-image: ['kuzzle'] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/build-and-run-kuzzle - with: - KUZZLE_IMAGE: ${{ matrix.kuzzle-image }} - - unit-tests: - name: Unit Tests - Node.js v${{ matrix.node-version }} - needs: [lint] - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/unit-tests - - functional-tests-legacy: - name: Functional Tests Legacy - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: [http, websocket, mqtt] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:legacy:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - functional-tests: - name: Functional Tests - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: [http, websocket] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - error-codes-check: - name: Documentation - Error codes check - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - run: npm install - - name: Test error codes - run: ./.ci/scripts/check-error-codes-documentation.sh - - cluster-monkey-tests: - name: Cluster Monkey Tests - needs: [functional-tests-legacy, functional-tests, build-and-run-kuzzle] - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - name: Cloning Monkey Tester - uses: actions/checkout@v2 - with: - repository: kuzzleio/kuzzle-monkey-tests - path: "kuzzle-monkey-tests" - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/monkey-tests - with: - node-version: ${{ matrix.node-version }} - - doc-dead-links: - name: Check dead-links - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: ./.github/actions/install-packages - - name: Extract references from context - shell: bash - id: extract-refs - run: | - echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)" - echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" - echo "::set-output name=fw-branch::$(if [ $BASE_BRANCH == master ]; then echo master; else echo develop; fi)" - - uses: convictional/trigger-workflow-and-wait@v1.3.0 - with: - owner: kuzzleio - repo: documentation - github_token: ${{ secrets.ACCESS_TOKEN_CI }} - workflow_file_name: dead_links.workflow.yml - ref: ${{ steps.extract-refs.outputs.fw-branch }} - inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ github.head_ref }}", "version": "${{ steps.extract-refs.outputs.version }}"}' diff --git a/.github/workflows/push_dev.workflow.yml b/.github/workflows/push_dev.workflow.yml deleted file mode 100644 index 03b0a5e380..0000000000 --- a/.github/workflows/push_dev.workflow.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Main branches push checks - -on: - push: - branches: - - 2-dev - -jobs: - lint: - name: Lint - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/es-lint - - build-and-run-kuzzle: - needs: [unit-tests] - name: Build and Run ${{ matrix.kuzzle-image }} - Node.js v${{ matrix.node-version }} - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ["14.17.0"] - kuzzle-image: ["kuzzle"] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/build-and-run-kuzzle - with: - KUZZLE_IMAGE: ${{ matrix.kuzzle-image }} - - unit-tests: - name: Unit Tests - Node.js v${{ matrix.node-version }} - needs: [lint] - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/unit-tests - - functional-tests-legacy: - name: Functional Tests Legacy - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: ["http", "websocket", "mqtt"] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:legacy:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - functional-tests: - name: Functional Tests - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: [http, websocket] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - cluster-monkey-tests: - name: Cluster Monkey Tests - needs: [functional-tests-legacy, functional-tests, build-and-run-kuzzle] - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - name: Cloning Monkey Tester - uses: actions/checkout@v2 - with: - repository: kuzzleio/kuzzle-monkey-tests - path: "kuzzle-monkey-tests" - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/monkey-tests - with: - node-version: ${{ matrix.node-version }} - - error-codes-check: - name: Documentation - Error codes check - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - run: npm install - - name: Test error codes - run: ./.ci/scripts/check-error-codes-documentation.sh - - doc-deploy: - name: Deployment Doc to Next - runs-on: ubuntu-18.04 - needs: [cluster-monkey-tests] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: ./.github/actions/install-packages - - name: Extract references from context - shell: bash - id: extract-refs - run: | - echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)" - echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" - echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d/ -f 3)" - - uses: convictional/trigger-workflow-and-wait@v1.3.0 - with: - owner: kuzzleio - repo: documentation - github_token: ${{ secrets.ACCESS_TOKEN_CI }} - workflow_file_name: child_repo.workflow.yml - ref: develop - inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ steps.extract-refs.outputs.branch }}", "version": "${{ steps.extract-refs.outputs.version }}"}' diff --git a/.github/workflows/push_master.workflow.yml b/.github/workflows/push_master.workflow.yml deleted file mode 100644 index 47babeadfb..0000000000 --- a/.github/workflows/push_master.workflow.yml +++ /dev/null @@ -1,200 +0,0 @@ -name: Main branches push checks - -on: - push: - branches: - - master - -jobs: - lint: - name: Lint - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/es-lint - - build-and-run-kuzzle: - needs: [unit-tests] - name: Build and Run ${{ matrix.kuzzle-image }} - Node.js v${{ matrix.node-version }} - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ["14.17.0"] - kuzzle-image: ["kuzzle"] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/build-and-run-kuzzle - with: - KUZZLE_IMAGE: ${{ matrix.kuzzle-image }} - - unit-tests: - name: Unit Tests - Node.js v${{ matrix.node-version }} - needs: [lint] - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/unit-tests - - functional-tests-legacy: - name: Functional Tests Legacy - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: [http, websocket, mqtt] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:legacy:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - functional-tests: - name: Functional Tests - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} - needs: [unit-tests] - strategy: - matrix: - test_set: [http, websocket] - node-version: ["14.17.0", "12.16.3", "12.20.0"] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/functional-tests - with: - test-set: test:functional:${{ matrix.test_set }} - node-version: ${{ matrix.node-version }} - - cluster-monkey-tests: - name: Cluster Monkey Tests - needs: [functional-tests-legacy, functional-tests, build-and-run-kuzzle] - runs-on: ubuntu-18.04 - strategy: - matrix: - node-version: ["14.17.0", "12.16.3", "12.20.0"] - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - name: Cloning Monkey Tester - uses: actions/checkout@v2 - with: - repository: kuzzleio/kuzzle-monkey-tests - path: "kuzzle-monkey-tests" - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - uses: ./.github/actions/cache-node-modules - with: - NODE_VERSION: ${{ matrix.node-version }} - - uses: ./.github/actions/monkey-tests - with: - node-version: ${{ matrix.node-version }} - - error-codes-check: - name: Documentation - Error codes check - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - run: npm install - - name: Test error codes - run: ./.ci/scripts/check-error-codes-documentation.sh - - doc-deploy: - name: Deployment Doc to Prod - runs-on: ubuntu-18.04 - needs: [cluster-monkey-tests] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: ./.github/actions/install-packages - - name: Extract references from context - shell: bash - id: extract-refs - run: | - echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)" - echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" - echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d/ -f 3)" - - uses: convictional/trigger-workflow-and-wait@v1.3.0 - with: - owner: kuzzleio - repo: documentation - github_token: ${{ secrets.ACCESS_TOKEN_CI }} - workflow_file_name: child_repo.workflow.yml - ref: master - inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ steps.extract-refs.outputs.branch }}", "version": "${{ steps.extract-refs.outputs.version }}"}' - - dockerhub-deploy: - name: Build and deploy images to Dockerhub - needs: [functional-tests-legacy, functional-tests] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Get branch name - # Github expose branch name with this format '/ref/branch/branchName' - # So we need to extract the wanted part (branchName) - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - uses: ./.github/actions/dockerhub - with: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - BRANCH: ${{ steps.extract_branch.outputs.branch }} - - npm-deploy: - name: Build and deploy release on NPM.js - needs: [functional-tests-legacy, functional-tests] - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/install-packages - - uses: actions/setup-node@v1 - with: - node-version: "14.x" - registry-url: "https://registry.npmjs.org" - - run: npm install - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/workflow-deployments.yaml b/.github/workflows/workflow-deployments.yaml new file mode 100644 index 0000000000..284668d6b5 --- /dev/null +++ b/.github/workflows/workflow-deployments.yaml @@ -0,0 +1,99 @@ +name: Workflow Deployments + +on: + push: + branches: + - master + +jobs: + # ----------------------------------------------------------------------------- + # Deployments: Documentation, Docker images, NPM package (only on git push) + # ----------------------------------------------------------------------------- + doc-deploy: + name: Documentation - Deploy + runs-on: ubuntu-latest + needs: [cluster-monkey-tests, error-codes-check] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: ./.github/actions/install-packages + - uses: actions/github-script@v4 + id: chose-documentation-framework-version + with: + script: | + return context.ref === 'refs/heads/master' ? 'master' : 'develop' + - name: Extract references from context + shell: bash + id: extract-refs + run: | + echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)" + echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" + echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d/ -f 3)" + - uses: convictional/trigger-workflow-and-wait@v1.3.0 + with: + owner: kuzzleio + repo: documentation + github_token: ${{ secrets.ACCESS_TOKEN_CI }} + workflow_file_name: child_repo.workflow.yml + ref: ${{ steps.chose-documentation-framework-version.outputs.result }} + inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ steps.extract-refs.outputs.branch }}", "version": "${{ steps.extract-refs.outputs.version }}"}' + + dockerhub-deploy: + name: Build and deploy images to Dockerhub + needs: [cluster-monkey-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_LTS_CURRENT_VERSION }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Get current version from package.json + shell: bash + id: get-version + run: | + echo "::set-output name=version::$(jq -r .version package.json)" + echo "::set-output name=major-version::$(jq -r .version package.json | cut -d. -f 1)" + - name: Build TS files + run: | + npm install + npm run build-ts + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/images/kuzzle/Dockerfile + push: true + platforms: ${{ env.DOCKER_PLATFORMS }} + tags: kuzzleio/kuzzle:${{ steps.get-version.outputs.major-version }},kuzzleio/kuzzle:latest,kuzzleio/kuzzle:${{ steps.get-version.outputs.version }} + + npm-deploy: + name: Build and deploy release on NPM.js + needs: [cluster-monkey-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_LTS_ACTIVE_VERSION }} + registry-url: "https://registry.npmjs.org" + - run: npm install + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000000..0f0fc5cf15 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,187 @@ +name: Workflow + +on: + push: + branches: + - master + - 2-dev + pull_request: # This syntax stand for all PRs events + +env: + NODE_LTS_MAINTENANCE_VERSION: "14" + NODE_LTS_ACTIVE_VERSION: "16" + # NODE_LTS_CURRENT_VERSION: "18" # Stand for the latest LTS version + DOCKER_PLATFORMS: "linux/amd64,linux/arm64" + +jobs: + prepare-matrix: + name: Forge Node LTS Matrix + runs-on: ubuntu-latest + steps: + - id: set-matrix + run: | + echo "::set-output name=matrix::{\"node-version\": [\"$NODE_LTS_MAINTENANCE_VERSION\", \"$NODE_LTS_ACTIVE_VERSION\"]}" + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + +# ----------------------------------------------------------------------------- +# Documentation checks: error codes and dead links +# ----------------------------------------------------------------------------- + + doc-dead-links: + name: Documentation - Check Dead Links + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: ./.github/actions/install-packages + - name: Extract references from context + shell: bash + id: extract-refs + run: | + echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)" + echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" + echo "::set-output name=fw-branch::$(if [ $BASE_BRANCH == master ]; then echo master; else echo develop; fi)" + - uses: convictional/trigger-workflow-and-wait@v1.3.0 + with: + owner: kuzzleio + repo: documentation + github_token: ${{ secrets.ACCESS_TOKEN_CI }} + workflow_file_name: dead_links.workflow.yml + ref: ${{ steps.extract-refs.outputs.fw-branch }} + inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ github.head_ref }}", "version": "${{ steps.extract-refs.outputs.version }}"}' + + error-codes-check: + name: Documentation - Error codes check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ env.NODE_LTS_CURRENT_VERSION }}-${{ hashFiles('**/package-lock.json') }} + - run: npm install + - name: Test error codes + run: ./.ci/scripts/check-error-codes-documentation.sh + +# ----------------------------------------------------------------------------- +# Unit Test and Linting +# ----------------------------------------------------------------------------- + + lint: + name: Lint - Node.js LTS ${{ matrix.node-version }} + runs-on: ubuntu-latest + needs: [prepare-matrix] + strategy: + matrix: + node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - uses: ./.github/actions/es-lint + + unit-tests: + name: Unit Tests + needs: [lint, prepare-matrix] + strategy: + matrix: + node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - uses: ./.github/actions/unit-tests + env: + NODE_VERSION: ${{ matrix.node-version }} + +# ----------------------------------------------------------------------------- +# E2E Tests: Functional tests, Monkey tests, Docker image tests +# ----------------------------------------------------------------------------- + + build-and-run-kuzzle: + needs: [unit-tests, prepare-matrix] + name: Build and Run ${{ matrix.kuzzle-image }} + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} + kuzzle-image: ['kuzzle'] + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - uses: ./.github/actions/build-and-run-kuzzle + with: + KUZZLE_IMAGE: ${{ matrix.kuzzle-image }} + + + functional-tests: + name: Functional Tests - ${{ matrix.test_set }} - Node.js v${{ matrix.node-version }} + needs: [unit-tests, prepare-matrix] + strategy: + matrix: + test_set: [http, websocket, "legacy:mqtt", "legacy:http", "legacy:websocket"] + node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - uses: ./.github/actions/functional-tests + with: + test-set: test:functional:${{ matrix.test_set }} + node-version: ${{ matrix.node-version }} + + cluster-monkey-tests: + name: Cluster Monkey Tests + needs: [functional-tests, build-and-run-kuzzle, prepare-matrix] + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/install-packages + - name: Cloning Monkey Tester + uses: actions/checkout@v2 + with: + repository: kuzzleio/kuzzle-monkey-tests + path: "kuzzle-monkey-tests" + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} + - uses: ./.github/actions/monkey-tests + with: + node-version: ${{ matrix.node-version }} diff --git a/.gitignore b/.gitignore index aca12d085f..64dedebf3c 100644 --- a/.gitignore +++ b/.gitignore @@ -78,34 +78,58 @@ upgrade-*.report package/* kuzzle-*.tgz + /index.js +docker/scripts/functional-tests-controller.js +docker/scripts/start-kuzzle-dev.js +features-sdk/support/application/functional-tests-app.js +lib/api/openApiGenerator.js +lib/api/openapi/OpenApiManager.js +lib/api/openapi/components/document/index.js +lib/api/openapi/components/index.js +lib/api/openapi/document/index.js +lib/api/openapi/index.js +lib/api/openapi/openApiGenerator.js +lib/api/openapi/tools.js lib/api/request/*.js -lib/kerror/errors/*.js -lib/kuzzle/kuzzle.js +lib/api/request/index.js +lib/api/request/kuzzle-request.js +lib/api/request/kuzzleRequest.js +lib/api/request/requestContext.js +lib/api/request/requestInput.js +lib/api/request/requestResponse.js +lib/cluster/idCardHandler.js +lib/cluster/state.js +lib/cluster/workers/IDCardRenewer.js +lib/config/default.config.js +lib/core/auth/tokenManager.js lib/core/backend/applicationManager.js lib/core/backend/backend.js lib/core/backend/backendCluster.js lib/core/backend/backendConfig.js lib/core/backend/backendController.js +lib/core/backend/backendErrors.js lib/core/backend/backendHook.js lib/core/backend/backendImport.js +lib/core/backend/backendOpenApi.js lib/core/backend/backendPipe.js lib/core/backend/backendPlugin.js lib/core/backend/backendStorage.js lib/core/backend/backendVault.js -lib/core/backend/internalLogger.js lib/core/backend/index.js -lib/core/shared/sdk/embeddedSdk.js +lib/core/backend/internalLogger.js +lib/core/plugin/pluginContext.js +lib/core/realtime/channel.js +lib/core/realtime/connectionRooms.js +lib/core/realtime/hotelClerk.js +lib/core/realtime/room.js +lib/core/realtime/subscription.js +lib/core/security/profileRepository.js lib/core/shared/KoncordeWrapper.js +lib/core/shared/sdk/embeddedSdk.js +lib/core/shared/sdk/funnelProtocol.js lib/core/storage/indexCache.js -lib/core/plugin/pluginContext.js -lib/cluster/workers/IDCardRenewer.js -lib/api/request/index.js -lib/api/request/kuzzleRequest.js -lib/api/request/kuzzle-request.js -lib/api/request/requestContext.js -lib/api/request/requestInput.js -lib/api/request/requestResponse.js +lib/kerror/errors/*.js lib/kerror/errors/badRequestError.js lib/kerror/errors/externalServiceError.js lib/kerror/errors/forbiddenError.js @@ -122,53 +146,37 @@ lib/kerror/errors/serviceUnavailableError.js lib/kerror/errors/sizeLimitError.js lib/kerror/errors/tooManyRequestsError.js lib/kerror/errors/unauthorizedError.js +lib/kerror/index.js +lib/kuzzle/kuzzle.js +lib/model/security/profile.js +lib/model/security/role.js +lib/model/security/token.js +lib/model/security/user.js lib/types/Controller.js lib/types/ControllerDefinition.js +lib/types/ControllerRights.js lib/types/Deprecation.js lib/types/EventHandler.js +lib/types/Global.d.ts +lib/types/Global.js +lib/types/HttpStream.js lib/types/InternalLogger.js -lib/types/Plugin.js lib/types/Kuzzle.js lib/types/KuzzleDocument.js +lib/types/OpenApiDefinition.js +lib/types/PasswordPolicy.js +lib/types/Plugin.js lib/types/PluginManifest.js +lib/types/Policy.js +lib/types/PolicyRestrictions.js +lib/types/ProfileDefinition.js lib/types/RequestPayload.js lib/types/ResponsePayload.js +lib/types/RoleDefinition.js lib/types/StrategyDefinition.js +lib/types/Target.js lib/types/Token.js lib/types/User.js -lib/types/index.js -lib/types/Global.d.ts -lib/types/Global.js -lib/util/interfaces.js -lib/util/mutex.js -lib/util/inflector.js -lib/util/koncordeCompat.js -features-sdk/support/application/functional-tests-app.js -docker/scripts/functional-tests-controller.js -docker/scripts/start-kuzzle-dev.js -lib/model/security/token.js -lib/core/auth/tokenManager.js -lib/cluster/state.js -lib/core/realtime/hotelClerk.js -lib/types/realtime/RealtimeScope.js -lib/types/realtime/RealtimeUsers.js -lib/core/realtime/channel.js -lib/core/realtime/connectionRooms.js -lib/core/realtime/room.js -lib/core/realtime/subscription.js -lib/types/realtime/RoomList.js -lib/cluster/idCardHandler.js -lib/types/KuzzleDocument.js -lib/core/storage/indexCache.js -lib/api/openApiGenerator.js -lib/api/openapi/document/index.js -lib/api/openapi/tools.js -lib/api/openapi/index.js -lib/util/readYamlFile.js -lib/config/default.config.js -lib/types/PasswordPolicy.js -lib/types/ProfileDefinition.js -lib/types/RoleDefinition.js lib/types/config/DumpConfiguration.js lib/types/config/HttpConfiguration.js lib/types/config/KuzzleConfiguration.js @@ -180,27 +188,20 @@ lib/types/config/ServicesConfiguration.js lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.js lib/types/config/internalCache/InternalCacheRedisConfiguration.js lib/types/config/publicCache/PublicCacheRedisConfiguration.js -lib/api/openapi/OpenApiManager.js -lib/api/openapi/components/document/index.js -lib/api/openapi/components/index.js -lib/api/openapi/openApiGenerator.js -lib/core/backend/backendErrors.js -lib/core/backend/backendOpenApi.js -lib/core/security/profileRepository.js -lib/core/shared/sdk/funnelProtocol.js -lib/kerror/index.js -lib/model/security/profile.js -lib/model/security/role.js -lib/model/security/user.js -lib/types/ControllerRights.js -lib/types/HttpStream.js -lib/types/OpenApiDefinition.js -lib/types/Policy.js -lib/types/PolicyRestrictions.js -lib/types/Target.js lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.js lib/types/errors/ErrorDefinition.js lib/types/errors/ErrorDomains.js +lib/types/index.js +lib/types/realtime/RealtimeScope.js +lib/types/realtime/RealtimeUsers.js +lib/types/realtime/RoomList.js lib/util/array.js lib/util/bufferedPassThrough.js -lib/util/dump-collection.js \ No newline at end of file +lib/util/crypto.js +lib/util/dump-collection.js +lib/util/inflector.js +lib/util/interfaces.js +lib/util/koncordeCompat.js +lib/util/mutex.js +lib/util/name-generator.js +lib/util/readYamlFile.js \ No newline at end of file diff --git a/.kuzzlerc.sample b/.kuzzlerc.sample index a29f8e6857..49356a0e3b 100644 --- a/.kuzzlerc.sample +++ b/.kuzzlerc.sample @@ -220,6 +220,14 @@ // The security section contains the configuration for Kuzzle permissions // mechanism "security": { + // [debug] + // Configuration for the Debug Controller + // * native_debug_protocol: + // Allows the Debug Controller to use methods from the Chrome Devtools Protocol, + // see (https://chromedevtools.github.io/devtools-protocol/v8) + "debug": { + "native_debug_protocol": false + }, // [restrictedProfileIds] // The profileIds applied to a user created with the API action // "security:createRestrictedUser" diff --git a/doc/2/api/controllers/debug/add-listener/index.md b/doc/2/api/controllers/debug/add-listener/index.md new file mode 100644 index 0000000000..43cccc736b --- /dev/null +++ b/doc/2/api/controllers/debug/add-listener/index.md @@ -0,0 +1,52 @@ +--- +code: true +type: page +title: addListener +--- + +# addListener + +Allows you to listen specific events from the [Chrome Devtool Protocol](https://chromedevtools.github.io/devtools-protocol/v8) and Debug Modules. You'll receive a notification when an event is emitted. + +--- + +:::warn +This only works using a Websocket connection since notification can only be sent on a persistent connection. +::: + +## Query Syntax + +### Websocket protocol + +```js +{ + "controller": "debug", + "action": "addListener", + "body": { + "event": "" + } +} +``` + +- `event`: event name to listen to. + +::info +If you want to listen to every event emitted you can listen to the event `*`. +::: + +## Response + + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "addListener", + "requestId": "", +} +``` + +## Notifications + +See [Debugger Notifications](/core/2/api/payloads/notifications). \ No newline at end of file diff --git a/doc/2/api/controllers/debug/disable/index.md b/doc/2/api/controllers/debug/disable/index.md new file mode 100644 index 0000000000..d8c8a7f3dc --- /dev/null +++ b/doc/2/api/controllers/debug/disable/index.md @@ -0,0 +1,42 @@ +--- +code: true +type: page +title: disable +--- + +# disable + +Disable the debugger and prevent calls to `debug:post`, `debug:addListener`, `debug:removeListener`. + +--- + +## Query Syntax + +### HTTP + +```http +URL: http://kuzzle:7512/debug/_disable +Method: POST +``` + +### Other protocols + +```js +{ + "controller": "debug", + "action": "disable", +} +``` + +## Response + + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "disable", + "requestId": "", +} +``` diff --git a/doc/2/api/controllers/debug/enable/index.md b/doc/2/api/controllers/debug/enable/index.md new file mode 100644 index 0000000000..db24053098 --- /dev/null +++ b/doc/2/api/controllers/debug/enable/index.md @@ -0,0 +1,42 @@ +--- +code: true +type: page +title: enable +--- + +# enable + +Enables the debugger and allows `debug:post`, `debug:addListener` and `debug:removeListener` to be called. + +--- + +## Query Syntax + +### HTTP + +```http +URL: http://kuzzle:7512/debug/_enable +Method: POST +``` + +### Other protocols + +```js +{ + "controller": "debug", + "action": "enable", +} +``` + +## Response + + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "enable", + "requestId": "", +} +``` diff --git a/doc/2/api/controllers/debug/node-version/index.md b/doc/2/api/controllers/debug/node-version/index.md new file mode 100644 index 0000000000..198b4df1a4 --- /dev/null +++ b/doc/2/api/controllers/debug/node-version/index.md @@ -0,0 +1,44 @@ +--- +code: true +type: page +title: nodeVersion +--- + +# nodeVersion + +Returns the Node.js version currently running Kuzzle. + +--- + +## Query Syntax + +### HTTP + +```http +URL: http://kuzzle:7512/debug/_nodeVersion +Method: GET +``` + +### Other protocols + +```js +{ + "controller": "debug", + "action": "nodeVersion", +} +``` + +## Response + +Returns a string containing the Node.js version: + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "nodeVersion", + "requestId": "", + "result": "" +} +``` diff --git a/doc/2/api/controllers/debug/post/index.md b/doc/2/api/controllers/debug/post/index.md new file mode 100644 index 0000000000..532a0bbbc6 --- /dev/null +++ b/doc/2/api/controllers/debug/post/index.md @@ -0,0 +1,75 @@ +--- +code: true +type: page +title: post +--- + +# post + +Allows you to execute methods from the Debugger using the [Chrome Devtool Protocol](https://chromedevtools.github.io/devtools-protocol/v8) or method from the DebugModules. + +--- + +:::warn +To use the methods from the [Chrome Devtool Protocol](https://chromedevtools.github.io/devtools-protocol/v8) you must enable it in the KuzzleRC at `security.debug.native_debug_protocol`. + +Otherwise you will only be able to use the methods from the DebugModules. +::: + +## Query Syntax + +### HTTP + +```http +URL: http://kuzzle:7512/debug/_post +Method: POST +Body: +``` + +```js +{ + "method": "", + "params": { + // ... + } +} +``` + +### Other protocols + +```js +{ + "controller": "debug", + "action": "post", + "body": { + "method": "", + "params": { + // ... + } + } +} +``` + +## Arguments + +- `method`: method name + +### Optional: + +- `params`: method parameters + +## Response + + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "post", + "requestId": "", + "result": { + // ... + } +} +``` \ No newline at end of file diff --git a/doc/2/api/controllers/debug/remove-listener/index.md b/doc/2/api/controllers/debug/remove-listener/index.md new file mode 100644 index 0000000000..48f75fb6ff --- /dev/null +++ b/doc/2/api/controllers/debug/remove-listener/index.md @@ -0,0 +1,44 @@ +--- +code: true +type: page +title: removeListener +--- + +# removeListener + +Stop listening to a specific event from the Debug Controller. + +--- + +:::warn +This only works using a Websocket connection since notification can only be sent on a persistent connection. +::: + +## Query Syntax + +### Websocket protocol + +```js +{ + "controller": "debug", + "action": "removeListener", + "body": { + "event": "" + } +} +``` + +- `event`: event name to stop listening to. + +## Response + + +```js +{ + "status": 200, + "error": null, + "controller": "debug", + "action": "removeListener", + "requestId": "", +} +``` \ No newline at end of file diff --git a/doc/2/api/errors/error-codes/api/index.md b/doc/2/api/errors/error-codes/api/index.md index a05c6ca9d1..3ceee3db22 100644 --- a/doc/2/api/errors/error-codes/api/index.md +++ b/doc/2/api/errors/error-codes/api/index.md @@ -53,5 +53,6 @@ description: Error codes definitions | api.process.not_enough_nodes
0x0202000b
| [ServiceUnavailableError](/core/2/api/errors/error-codes#serviceunavailableerror)
(503)
| Rejected: this cluster is disabled because there aren't enough nodes connected. | The Kuzzle cluster has not enough nodes available, and no new requests can be processed until new nodes are added | | api.process.unauthorized_origin
0x0202000c
| [UnauthorizedError](/core/2/api/errors/error-codes#unauthorizederror)
(401)
| The origin "%s" is not authorized. | The domain reaching out to Kuzzle is not authorized | | api.process.too_many_logins_requests
0x0202000d
| [TooManyRequestsError](/core/2/api/errors/error-codes#toomanyrequestserror)
(429)
| Rejected: Too many login attempts per second | The request was denied because the maximum ("limits.loginsPerSecond") number of login attempts per second has been exceeded. | +| api.process.forbidden_embedded_sdk_action
0x0202000e
| [PluginImplementationError](/core/2/api/errors/error-codes#pluginimplementationerror)
(500)
| The action %s:%s has been called while it is forbidden in the EmbeddedSDK%s. | A forbidden EmbdeddedSDK action has been called | --- diff --git a/doc/2/api/errors/error-codes/core/index.md b/doc/2/api/errors/error-codes/core/index.md index 1d5c37f128..e2e3835c6b 100644 --- a/doc/2/api/errors/error-codes/core/index.md +++ b/doc/2/api/errors/error-codes/core/index.md @@ -73,3 +73,16 @@ description: Error codes definitions --- + + +### Subdomain: 0x0005: debugger + +| id / code | class / status | message | description | +| --------- | -------------- | --------| ----------- | +| core.debugger.not_enabled
0x00050001
| [PreconditionError](/core/2/api/errors/error-codes#preconditionerror)
(412)
| Debugger is not enabled | The debugger is not enabled | +| core.debugger.monitor_already_running
0x00050002
| [PreconditionError](/core/2/api/errors/error-codes#preconditionerror)
(412)
| The monitoring of "%s" is already running | The monitor is already running | +| core.debugger.monitor_not_running
0x00050003
| [PreconditionError](/core/2/api/errors/error-codes#preconditionerror)
(412)
| The monitoring of "%s" is not running | The monitor is not running | +| core.debugger.native_debug_protocol_usage_denied
0x00050004
| [PreconditionError](/core/2/api/errors/error-codes#preconditionerror)
(412)
| Usage of the native debug protocol is not allowed | Usage of the native debug protocol is not allowed | +| core.debugger.method_not_found
0x00050005
| [PreconditionError](/core/2/api/errors/error-codes#preconditionerror)
(412)
| Debugger method "%s" not found. | Debugger method not found | + +--- diff --git a/doc/2/api/payloads/notifications/index.md b/doc/2/api/payloads/notifications/index.md index 2bb8cd98f6..6e06eda84d 100644 --- a/doc/2/api/payloads/notifications/index.md +++ b/doc/2/api/payloads/notifications/index.md @@ -158,3 +158,34 @@ Other events may be added in the future. "type": "TokenExpired" } ``` + +## Debugger Notification + +Debugger notifications are triggered by the [Debug Controller](/core/2/api/controllers/debug) only when the debugger is enabled. +Those notifications are sent to every connections currently listening to events from the [Debug Controller](/core/2/api/controllers/debug) using +the action [debug:addListener](/core/2/api/controllers/debug/add-listener). + +### Format + +| Property | Type | Description | +|--------------|--------|-------------------------------------------------------------------------------------------------------| +| `event` | string | Name of the event that triggered the notification | +| `result` | object | Notification content | +| `room` | string | Subscription channel identifier. Will always be `kuzzle-debugger-event` | + +### Example + +```js +{ + "room": "kuzzle-debugger-event", + "event": "HeapProfiler.reportHeapSnapshotProgress", + "result": { + "method": "HeapProfiler.reportHeapSnapshotProgress", + "params": { + "done": 238276, + "total": 238276, + "finished": true + } + } +} +``` \ No newline at end of file diff --git a/doc/2/api/payloads/response/index.md b/doc/2/api/payloads/response/index.md index 5563bc3a57..5b36957e22 100644 --- a/doc/2/api/payloads/response/index.md +++ b/doc/2/api/payloads/response/index.md @@ -2,7 +2,7 @@ code: false type: page title: Response -description: Response payload reference +description: Response payload reference order: 200 --- @@ -18,7 +18,6 @@ The Response Payload is a standardized response sent by Kuzzle in JSON format. | `collection` | string | Collection name | | `_id` | string | Document unique identifier | | `error` | [ErrorPayload](/core/2/api/payloads/error) | API error | -| `jwt` | string | Authentication token | | `node` | string | Unique identifier of the node who processed the request | | `result` | any | API action result | | `status` | number | HTTP status code | diff --git a/doc/2/framework/classes/backend/properties/index.md b/doc/2/framework/classes/backend/properties/index.md index b2539fde51..ecf9544080 100644 --- a/doc/2/framework/classes/backend/properties/index.md +++ b/doc/2/framework/classes/backend/properties/index.md @@ -13,15 +13,15 @@ description: Backend class properties This property is an instance of the [BackendCluster](/core/2/framework/classes/backend-cluster) class that allows to interact with cluster nodes. -| Type | Description | -|------------------------------------------------------------------------------|----------------------------| +| Type | Description | +| ---------------------------------------------------------------------- | ----------------------- | |
[BackendCluster](/core/2/framework/classes/backend-cluster)
| BackendCluster instance | ## `commit` | Type | Description | -|-------------------|-----------------------------------| +| ----------------- | --------------------------------- | |
string
| Current GIT commit (if available) | Contains the current GIT commit hash if the application is run from a GIT repository. @@ -33,7 +33,7 @@ The framework will try to go 3 level upper to find a valid GIT repository. This property is an instance of the [BackendConfig](/core/2/framework/classes/backend-config) class that allows to read or set the configuration values. | Type | Description | -|----------------------------------------------------------------------|------------------------| +| -------------------------------------------------------------------- | ---------------------- | |
[BackendConfig](/core/2/framework/classes/backend-config)
| BackendConfig instance | See also the [Configuration](/core/2/guides/advanced/configuration) guide. @@ -43,7 +43,7 @@ See also the [Configuration](/core/2/guides/advanced/configuration) guide. This property is an instance of the [BackendController](/core/2/framework/classes/backend-controller) class that allows to use or register API controllers. | Type | Description | -|------------------------------------------------------------------------------|----------------------------| +| ---------------------------------------------------------------------------- | -------------------------- | |
[BackendController](/core/2/framework/classes/backend-controller)
| BackendController instance | See also the [API Controllers](/core/2/guides/develop-on-kuzzle/api-controllers) guide. @@ -53,7 +53,7 @@ See also the [API Controllers](/core/2/guides/develop-on-kuzzle/api-controllers) This property is an instance of the [BackendHook](/core/2/framework/classes/backend-hook) class that allows to register hooks. | Type | Description | -|------------------------------------------------------------------|----------------------| +| ---------------------------------------------------------------- | -------------------- | |
[BackendHook](/core/2/framework/classes/backend-hook)
| BackendHook instance | See also the [Event System](/core/2/guides/develop-on-kuzzle/event-system#hook) guide. @@ -63,7 +63,7 @@ See also the [Event System](/core/2/guides/develop-on-kuzzle/event-system#hook) This property is an instance of the [BackendImport](/core/2/framework/classes/backend-import) class that allows to import mappings and security configuration. | Type | Description | -|----------------------------------------------------------------------|------------------------| +| -------------------------------------------------------------------- | ---------------------- | |
[BackendImport](/core/2/framework/classes/backend-import)
| BackendImport instance |