@jeffusion/bungee-types 4.2.0 → 4.3.0

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.
Files changed (2) hide show
  1. package/dist/types.d.ts +42 -11
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -81,22 +81,28 @@ export interface Endpoint extends ModificationRules {
81
81
  description?: string;
82
82
  condition?: string;
83
83
  }
84
- export interface StickySessionConfig {
85
- enabled: boolean;
86
- key_expression?: string;
87
- }
88
84
  export interface RouteTimeoutsConfig {
89
- connect_ms?: number;
90
85
  request_ms?: number;
91
86
  }
87
+ /**
88
+ * Service-level transport timeouts.
89
+ * Describes how to connect to and exchange data with this pool of upstreams.
90
+ * Route-level request deadline (RouteTimeoutsConfig.request_ms) is unaffected.
91
+ */
92
+ export interface ServiceTimeoutsConfig {
93
+ connect_ms?: number;
94
+ send_ms?: number;
95
+ read_ms?: number;
96
+ }
92
97
  export interface FailoverPassiveHealthConfig {
93
98
  consecutive_failures?: number;
94
99
  healthy_successes?: number;
95
100
  auto_disable_threshold?: number;
96
- auto_enable_on_active_health_check?: boolean;
97
101
  }
98
102
  export interface FailoverRecoveryConfig {
99
- probe_interval_ms?: number;
103
+ /** UNHEALTHY 重新允许尝试的退避基准间隔(实际退避 = base × 2^recovery_attempt_count + 20% jitter) */
104
+ backoff_base_ms?: number;
105
+ /** HALF_OPEN/UNHEALTHY 状态下请求的超时切片 */
100
106
  probe_timeout_ms?: number;
101
107
  }
102
108
  export interface FailoverSlowStartConfig {
@@ -104,7 +110,11 @@ export interface FailoverSlowStartConfig {
104
110
  duration_ms?: number;
105
111
  initial_weight_factor?: number;
106
112
  }
107
- export interface FailoverHealthCheckConfig {
113
+ /**
114
+ * Service-level active health check configuration.
115
+ * Independent subsystem — no longer nested under FailoverConfig.
116
+ */
117
+ export interface ServiceHealthCheckConfig {
108
118
  enabled: boolean;
109
119
  interval_ms?: number;
110
120
  timeout_ms?: number;
@@ -117,22 +127,43 @@ export interface FailoverHealthCheckConfig {
117
127
  content_type?: string;
118
128
  headers?: Record<string, string>;
119
129
  query?: Record<string, string>;
130
+ /** 主动健康检查恢复后自动 re-enable 被 auto_disable 的 upstream */
131
+ auto_enable_on_active_health_check?: boolean;
132
+ }
133
+ export interface HashPolicyConfig {
134
+ /** 直接读 header 名作为 hash 输入(简单场景) */
135
+ header?: string;
136
+ /** 表达式返回值作为 hash 输入(可 access headers/body/url/method/env 全 context) */
137
+ expression?: string;
138
+ }
139
+ export interface LoadBalancingConfig {
140
+ policy: 'weighted_random' | 'round_robin' | 'least_requests' | 'consistent_hash';
141
+ /** 仅 policy='consistent_hash' 时有意义 */
142
+ hash_policy?: HashPolicyConfig;
120
143
  }
121
144
  export interface Service {
122
145
  name: string;
123
146
  endpoints: Endpoint[];
124
147
  plugins?: Array<PluginConfig | string>;
125
- health_check?: FailoverHealthCheckConfig;
148
+ health_check?: ServiceHealthCheckConfig;
126
149
  failover?: FailoverConfig;
127
- sticky_session?: StickySessionConfig;
150
+ load_balancing?: LoadBalancingConfig;
151
+ timeouts?: ServiceTimeoutsConfig;
128
152
  }
129
153
  export interface FailoverConfig {
130
154
  enabled: boolean;
131
155
  retry_on?: number | string | (number | string)[];
156
+ /**
157
+ * 响应内容触发关键字列表(与 retry_on 为 OR 关系)。
158
+ * 任一关键字在响应体中出现即触发 failover(大小写敏感子串匹配)。
159
+ *
160
+ * 流式:first-peek 首 4KB / 首个 SSE event;非流式:完整 body(1MB 上限)。
161
+ * 中段(5KB 后)错误无配置层方案。
162
+ */
163
+ retry_on_response?: string[];
132
164
  passive_health?: FailoverPassiveHealthConfig;
133
165
  recovery?: FailoverRecoveryConfig;
134
166
  slow_start?: FailoverSlowStartConfig;
135
- health_check?: FailoverHealthCheckConfig;
136
167
  }
137
168
  export interface RateLimitConfig {
138
169
  enabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffusion/bungee-types",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "TypeScript type definitions for Bungee",
5
5
  "main": "./dist/index.d.ts",
6
6
  "types": "./dist/index.d.ts",