bdy 1.22.97-dev → 1.22.98-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.97-dev",
4
+ "version": "1.22.98-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",
@@ -51,7 +51,9 @@ class Format {
51
51
  static tunnelCircuitBreaker(cb) {
52
52
  if (cb === undefined || cb === null)
53
53
  return 'Not set';
54
- return String(cb);
54
+ // Stored as a fraction, entered and shown as a percentage — otherwise
55
+ // `--circuit-breaker 50` would read back as "0.5".
56
+ return `${Math.round(cb * 1000) / 10}%`;
55
57
  }
56
58
  static tunnelUserAgent(userAgents) {
57
59
  if (!userAgents || !userAgents.length)
@@ -72,14 +72,20 @@ class Input {
72
72
  }
73
73
  return serve;
74
74
  }
75
+ /**
76
+ * The flag takes a percentage (0-100), but everything downstream keeps
77
+ * working in fractions: `TunnelHttpLog` compares the threshold against a
78
+ * failed/total ratio, and `prepareSandboxEndpoint` multiplies by 100 for the
79
+ * REST payload. So convert here and leave both consumers untouched.
80
+ */
75
81
  static circuitBreaker(threshold) {
76
82
  if (threshold === undefined)
77
83
  return null;
78
84
  const n = parseFloat(threshold);
79
- if (isNaN(n) || n < 0 || n > 1) {
85
+ if (isNaN(n) || n < 0 || n > 100) {
80
86
  output_1.default.exitError((0, texts_1.ERR_CB_THRESHOLD_IS_NOT_VALID)(n));
81
87
  }
82
- return n;
88
+ return n / 100;
83
89
  }
84
90
  static sandboxHeaders(headers) {
85
91
  const r = {};
@@ -445,7 +445,7 @@ exports.OPTION_HTTP_LOG = 'Log HTTP requests';
445
445
  exports.OPTION_HTTP_VERIFY = 'Enforce TLS verify';
446
446
  exports.OPTION_HTTP_2 = 'Enforce HTTP/2';
447
447
  exports.OPTION_HTTP_COMPRESSION = 'Turn on HTTP response compression';
448
- exports.OPTION_HTTP_CIRCUIT_BREAKER = 'Turn on circuit breaker. Provide decimal value between 0 to 1';
448
+ exports.OPTION_HTTP_CIRCUIT_BREAKER = 'Turn on circuit breaker. Provide the failure-rate threshold as a percentage between 0 and 100';
449
449
  exports.OPTION_TLS_KEY = 'Path to a TLS key';
450
450
  exports.OPTION_TLS_CERT = 'Path to a TLS PEM certificate';
451
451
  exports.OPTION_TLS_CA = 'Path to a TLS PEM CA certificate for TLS auth';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.97-dev",
4
+ "version": "1.22.98-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",