@jeffusion/bungee-types 4.2.0 → 4.4.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.
- package/dist/config-v2.d.ts +68 -0
- package/dist/config-v2.js +1 -0
- package/dist/daemon-control.d.ts +59 -0
- package/dist/daemon-control.js +369 -0
- package/dist/daemon-file.d.ts +84 -0
- package/dist/daemon-file.js +944 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -0
- package/dist/rate-limit.d.ts +3 -0
- package/dist/rate-limit.js +3 -0
- package/dist/types.d.ts +47 -11
- package/dist/types.js +2 -0
- package/package.json +15 -5
package/dist/index.d.ts
CHANGED
package/dist/index.js
ADDED
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
|
-
|
|
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
|
-
|
|
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?:
|
|
148
|
+
health_check?: ServiceHealthCheckConfig;
|
|
126
149
|
failover?: FailoverConfig;
|
|
127
|
-
|
|
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;
|
|
@@ -181,6 +212,8 @@ export interface RetryConfig {
|
|
|
181
212
|
per_retry_timeout_ms?: number;
|
|
182
213
|
}
|
|
183
214
|
export interface RouteConfig extends ModificationRules {
|
|
215
|
+
/** Stable logical route identity, present only in compiled runtime config. */
|
|
216
|
+
id?: string;
|
|
184
217
|
path: string;
|
|
185
218
|
service?: string;
|
|
186
219
|
endpoints?: Endpoint[];
|
|
@@ -210,6 +243,8 @@ export interface LoggingConfig {
|
|
|
210
243
|
* 2. 通过 path 引用(高级):手动指定插件文件路径
|
|
211
244
|
*/
|
|
212
245
|
export interface PluginConfig {
|
|
246
|
+
/** Persisted plugin binding identity, when materialized from V2 configuration. */
|
|
247
|
+
id?: string;
|
|
213
248
|
/**
|
|
214
249
|
* Plugin 名称(唯一标识符)
|
|
215
250
|
* 这是插件的唯一标识,用于引用和管理插件
|
|
@@ -262,3 +297,4 @@ export interface AppConfig {
|
|
|
262
297
|
services?: Service[];
|
|
263
298
|
routes: RouteConfig[];
|
|
264
299
|
}
|
|
300
|
+
export { decodeDaemonMetadataV1, encodeDaemonMetadataV1, parseDaemonMetadataV1, validateDaemonMetadataV1, } from './daemon-control.js';
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee-types",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "TypeScript type definitions for Bungee",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
6
7
|
"types": "./dist/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build": "tsc",
|
|
9
10
|
"prepublishOnly": "bun run build",
|
|
10
|
-
"test": "
|
|
11
|
+
"test": "bun run build && bun test tests/published-runtime.test.ts"
|
|
11
12
|
},
|
|
12
13
|
"exports": {
|
|
13
14
|
".": {
|
|
14
|
-
"types": "./dist/index.d.ts"
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
15
18
|
},
|
|
16
19
|
"./types": {
|
|
17
|
-
"types": "./dist/types.d.ts"
|
|
20
|
+
"types": "./dist/types.d.ts",
|
|
21
|
+
"import": "./dist/types.js",
|
|
22
|
+
"default": "./dist/types.js"
|
|
23
|
+
},
|
|
24
|
+
"./daemon-file": {
|
|
25
|
+
"types": "./dist/daemon-file.d.ts",
|
|
26
|
+
"import": "./dist/daemon-file.js",
|
|
27
|
+
"default": "./dist/daemon-file.js"
|
|
18
28
|
}
|
|
19
29
|
},
|
|
20
30
|
"keywords": [
|