From c431a3cbca00017d60d53a563874c66922d0caf1 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Tue, 5 May 2026 17:02:54 -0700 Subject: [PATCH] fix: circuit breaker silent mode not working for in-mem snapshot --- .github/FUNDING.yml | 1 - .github/workflows/master.yml | 2 +- .github/workflows/sonar.yml | 2 +- .npmrc | 1 + README.md | 1 - package.json | 10 +++++----- src/client.d.ts | 2 +- src/client.js | 6 +++--- src/lib/bypasser/index.js | 5 +---- 9 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 .npmrc diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 21925c3..28caaaa 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,2 @@ -patreon: switcherapi ko_fi: petruki github: [petruki] \ No newline at end of file diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 731925c..e915df5 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -28,7 +28,7 @@ jobs: SWITCHER_API_KEY: ${{ secrets.SWITCHER_API_KEY }} - name: SonarCloud Scan - uses: sonarsource/sonarqube-scan-action@v7.0.0 + uses: sonarsource/sonarqube-scan-action@v8.0.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} if: env.SONAR_TOKEN != '' diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 16636d5..31ec7dd 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -44,7 +44,7 @@ jobs: SWITCHER_API_KEY: ${{ secrets.SWITCHER_API_KEY }} - name: SonarCloud Scan - uses: sonarsource/sonarqube-scan-action@v7.0.0 + uses: sonarsource/sonarqube-scan-action@v8.0.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} if: env.SONAR_TOKEN != '' diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..97b895e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +ignore-scripts=true diff --git a/README.md b/README.md index bf8b659..7a8c4fb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ A JavaScript SDK for Switcher API [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=switcherapi_switcher-client-master&metric=alert_status)](https://sonarcloud.io/dashboard?id=switcherapi_switcher-client-master) [![npm version](https://badge.fury.io/js/switcher-client.svg)](https://badge.fury.io/js/switcher-client) [![install size](https://packagephobia.com/badge?p=switcher-client)](https://packagephobia.com/result?p=switcher-client) -[![Known Vulnerabilities](https://snyk.io/test/github/switcherapi/switcher-client-js/badge.svg?targetFile=package.json)](https://snyk.io/test/github/switcherapi/switcher-client-js?targetFile=package.json) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Slack: Switcher-HQ](https://img.shields.io/badge/slack-@switcher/hq-blue.svg?logo=slack)](https://switcher-hq.slack.com/) diff --git a/package.json b/package.json index 1f046b8..09fe113 100644 --- a/package.json +++ b/package.json @@ -31,19 +31,19 @@ "src/" ], "devDependencies": { - "@typescript-eslint/eslint-plugin": "^8.57.1", - "@typescript-eslint/parser": "^8.57.1", + "@typescript-eslint/eslint-plugin": "^8.59.2", + "@typescript-eslint/parser": "^8.59.2", "c8": "^11.0.0", "chai": "^6.2.2", "env-cmd": "^11.0.0", - "eslint": "^10.1.0", + "eslint": "^10.3.0", "mocha": "^11.7.5", "mocha-sonarqube-reporter": "^1.0.2", - "sinon": "^21.0.3" + "sinon": "^22.0.0" }, "repository": { "type": "git", - "url": "https://github.com/switcherapi/switcher-client-js" + "url": "https://github.com/switcherapi/switcher-client-js.git" }, "publishConfig": { "access": "public" diff --git a/src/client.d.ts b/src/client.d.ts index f09bac1..e894f82 100644 --- a/src/client.d.ts +++ b/src/client.d.ts @@ -115,7 +115,7 @@ export class Client { /** * Enable/Disable test mode. * - * It prevents from watching Snapshots that may hold process + * It prevents subprocess to run during tests such as snapshot watcher */ static testMode(testEnabled?: boolean): void; diff --git a/src/client.js b/src/client.js index d9ac6eb..790d63d 100644 --- a/src/client.js +++ b/src/client.js @@ -45,12 +45,12 @@ export class Client { logger: util.get(options?.logger, DEFAULT_LOGGER) }); + // Initialize Auth + Auth.init(this.#context); + if (options) { Client.#buildOptions(options); } - - // Initialize Auth - Auth.init(this.#context); } static #buildOptions(options) { diff --git a/src/lib/bypasser/index.js b/src/lib/bypasser/index.js index a36ab7f..aa70f30 100644 --- a/src/lib/bypasser/index.js +++ b/src/lib/bypasser/index.js @@ -9,10 +9,7 @@ export default class Bypasser { * @param key */ static assume(key) { - const existentKey = this.searchBypassed(key); - if (existentKey) { - return existentKey; - } + Bypasser.forget(key); const keyBypassed = new Key(key); bypassedKeys.push(keyBypassed);