midway-fatcms 0.0.16 → 0.0.17
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/config.default.js +5 -3
- package/dist/configuration.d.ts +0 -3
- package/dist/configuration.js +0 -19
- package/dist/controller/gateway/ProxyApiGatewayController.d.ts +0 -2
- package/dist/controller/gateway/ProxyApiGatewayController.js +0 -18
- package/dist/controller/helpers.controller.d.ts +4 -5
- package/dist/controller/helpers.controller.js +56 -14
- package/dist/controller/manage/AccountRoleManageApi.js +3 -5
- package/dist/controller/manage/AnyApiMangeApi.js +4 -3
- package/dist/controller/manage/AppMangeApi.js +3 -4
- package/dist/controller/manage/AppPageMangeApi.js +4 -3
- package/dist/controller/manage/CrudMethodsMangeApi.js +3 -4
- package/dist/controller/manage/DataDictManageApi.js +6 -7
- package/dist/controller/manage/DeployManageApi.js +4 -5
- package/dist/controller/manage/FlowConfigManageApi.js +3 -5
- package/dist/controller/manage/MenuManageApi.js +3 -4
- package/dist/controller/manage/ProxyApiMangeApi.js +3 -4
- package/dist/controller/manage/SysConfigMangeApi.js +3 -3
- package/dist/controller/manage/SystemInfoManageApi.js +3 -1
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +27 -4
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +5 -8
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +25 -42
- package/dist/libs/crud-pro/utils/CrudMonitor.d.ts +0 -9
- package/dist/libs/crud-pro/utils/CrudMonitor.js +0 -21
- package/dist/libs/crud-pro/utils/pool/SqlServerUtils.js +26 -0
- package/dist/middleware/cacherefresh.middleware.d.ts +3 -46
- package/dist/middleware/cacherefresh.middleware.js +9 -67
- package/dist/models/CacheRefreshCategory.d.ts +1 -18
- package/dist/models/CacheRefreshCategory.js +0 -17
- package/dist/models/SystemEntities.d.ts +2 -0
- package/dist/models/bizmodels.d.ts +0 -8
- package/dist/models/bizmodels.js +0 -8
- package/dist/schedule/scheduleNames.d.ts +2 -0
- package/dist/schedule/scheduleNames.js +3 -1
- package/dist/service/SysAppService.d.ts +2 -5
- package/dist/service/SysAppService.js +15 -69
- package/dist/service/SysConfigService.d.ts +1 -6
- package/dist/service/SysConfigService.js +7 -46
- package/dist/service/SysDictDataService.d.ts +2 -5
- package/dist/service/SysDictDataService.js +13 -59
- package/dist/service/SysMenuService.d.ts +1 -4
- package/dist/service/SysMenuService.js +6 -42
- package/dist/service/WorkbenchService.d.ts +1 -5
- package/dist/service/WorkbenchService.js +10 -61
- package/dist/service/anyapi/AnyApiService.d.ts +1 -1
- package/dist/service/anyapi/AnyApiService.js +6 -16
- package/dist/service/base/bizmemcache/BizMemCacheService.d.ts +16 -0
- package/dist/service/base/bizmemcache/BizMemCacheService.js +239 -0
- package/dist/service/base/bizmemcache/BizMemCacheStore.d.ts +34 -0
- package/dist/service/base/bizmemcache/BizMemCacheStore.js +118 -0
- package/dist/service/base/bizmemcache/BizMemCacheTypes.d.ts +60 -0
- package/dist/service/base/bizmemcache/BizMemCacheTypes.js +18 -0
- package/dist/service/base/cache-refresh/CacheRefreshHub.d.ts +0 -22
- package/dist/service/base/cache-refresh/CacheRefreshHub.js +0 -22
- package/dist/service/base/cache-refresh/CacheRefreshHubScheduleService.d.ts +0 -6
- package/dist/service/base/cache-refresh/CacheRefreshHubScheduleService.js +0 -6
- package/dist/service/curd/CurdMixByDictService.d.ts +0 -4
- package/dist/service/curd/CurdMixByDictService.js +9 -55
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +0 -5
- package/dist/service/curd/CurdMixBySysConfigService.js +9 -54
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +0 -1
- package/dist/service/curd/CurdMixByWorkbenchService.js +9 -36
- package/dist/service/curd/CurdProService.d.ts +0 -1
- package/dist/service/curd/CurdProService.js +0 -4
- package/dist/service/proxyapi/ProxyApiLoadService.d.ts +3 -8
- package/dist/service/proxyapi/ProxyApiLoadService.js +40 -68
- package/dist/service/proxyapi/ProxyApiService.d.ts +2 -0
- package/dist/service/proxyapi/ProxyApiService.js +32 -9
- package/dist/service/proxyapi/RouteTrie.d.ts +1 -7
- package/dist/service/proxyapi/RouteTrie.js +1 -17
- package/package.json +1 -1
- package/src/config/config.default.ts +4 -2
- package/src/configuration.ts +0 -23
- package/src/controller/gateway/ProxyApiGatewayController.ts +1 -9
- package/src/controller/helpers.controller.ts +66 -15
- package/src/controller/manage/AccountRoleManageApi.ts +3 -5
- package/src/controller/manage/AnyApiMangeApi.ts +4 -3
- package/src/controller/manage/AppMangeApi.ts +4 -5
- package/src/controller/manage/AppPageMangeApi.ts +4 -3
- package/src/controller/manage/CrudMethodsMangeApi.ts +4 -5
- package/src/controller/manage/DataDictManageApi.ts +7 -8
- package/src/controller/manage/DeployManageApi.ts +2 -3
- package/src/controller/manage/FlowConfigManageApi.ts +3 -5
- package/src/controller/manage/MenuManageApi.ts +4 -5
- package/src/controller/manage/ProxyApiMangeApi.ts +4 -5
- package/src/controller/manage/SysConfigMangeApi.ts +5 -5
- package/src/controller/manage/SystemInfoManageApi.ts +3 -1
- package/src/controller/manage/WorkbenchMangeApi.ts +4 -5
- package/src/index.ts +3 -0
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +26 -4
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +25 -43
- package/src/libs/crud-pro/utils/CrudMonitor.ts +0 -23
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +31 -0
- package/src/middleware/cacherefresh.middleware.ts +10 -71
- package/src/models/CacheRefreshCategory.ts +0 -17
- package/src/models/SystemEntities.ts +2 -0
- package/src/models/bizmodels.ts +0 -8
- package/src/schedule/scheduleNames.ts +5 -3
- package/src/service/SysAppService.ts +13 -66
- package/src/service/SysConfigService.ts +6 -39
- package/src/service/SysDictDataService.ts +11 -56
- package/src/service/SysMenuService.ts +4 -37
- package/src/service/WorkbenchService.ts +10 -68
- package/src/service/anyapi/AnyApiService.ts +5 -17
- package/src/service/base/bizmemcache/BizMemCacheService.ts +288 -0
- package/src/service/base/bizmemcache/BizMemCacheStore.ts +158 -0
- package/src/service/base/bizmemcache/BizMemCacheTypes.ts +76 -0
- package/src/service/base/cache-refresh/CacheRefreshHub.ts +0 -22
- package/src/service/base/cache-refresh/CacheRefreshHubScheduleService.ts +0 -6
- package/src/service/curd/CurdMixByDictService.ts +10 -61
- package/src/service/curd/CurdMixBySysConfigService.ts +9 -62
- package/src/service/curd/CurdMixByWorkbenchService.ts +7 -32
- package/src/service/curd/CurdProService.ts +0 -6
- package/src/service/proxyapi/ProxyApiLoadService.ts +39 -77
- package/src/service/proxyapi/ProxyApiService.ts +45 -9
- package/src/service/proxyapi/RouteTrie.ts +1 -18
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
2
|
import * as _ from 'lodash';
|
|
4
3
|
import { BaseService } from '../base/BaseService';
|
|
5
|
-
import {
|
|
4
|
+
import { RouteTrie } from './RouteTrie';
|
|
6
5
|
import { RouteHandler } from './RouteHandler';
|
|
7
|
-
import { CurdProService } from '../curd/CurdProService';
|
|
8
|
-
import { SystemTables } from '../../models/SystemTables';
|
|
9
|
-
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
10
6
|
import { IProxyApiEntity, IUpstreamInfo } from '../../models/SystemEntities';
|
|
11
7
|
import { isEntityOK, parseJsonObject } from '../../libs/utils/functions';
|
|
12
8
|
import { BALANCE_STRATEGY } from './ProxyApiUtils';
|
|
13
9
|
import { WeightedRandom } from './WeightedRandom';
|
|
14
10
|
import { WeightedRoundRobin } from './WeightedRoundRobin';
|
|
11
|
+
import { bizMemCacheStore } from '@/service/base/bizmemcache/BizMemCacheStore';
|
|
15
12
|
import { WorkbenchService } from '../WorkbenchService';
|
|
16
13
|
import { CommonException } from '../../libs/crud-pro/exceptions';
|
|
17
|
-
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
18
14
|
|
|
19
15
|
function toUpstreamInfo(config_content: any): IUpstreamInfo {
|
|
20
16
|
const obj = parseJsonObject(config_content);
|
|
@@ -56,55 +52,46 @@ function toUpstreamInfo(config_content: any): IUpstreamInfo {
|
|
|
56
52
|
*/
|
|
57
53
|
@Provide()
|
|
58
54
|
export class ProxyApiLoadService extends BaseService {
|
|
59
|
-
@Inject()
|
|
60
|
-
protected ctx: Context;
|
|
61
|
-
|
|
62
|
-
@Inject()
|
|
63
|
-
private curdProService: CurdProService;
|
|
64
55
|
|
|
65
56
|
@Inject()
|
|
66
57
|
private workbenchService: WorkbenchService;
|
|
67
58
|
|
|
68
59
|
/**
|
|
69
|
-
*
|
|
70
|
-
* 先构建全新的 RouteTrie,完成后原子替换,避免重建期间路由不可用
|
|
71
|
-
* @param workbench_code
|
|
60
|
+
* 获取站点路由树;routeTrieMap 为空或缺失时懒重建
|
|
72
61
|
*/
|
|
73
|
-
public
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
public getRouteTrie(workbench_code: string): RouteTrie {
|
|
63
|
+
const cacheObj = bizMemCacheStore.getSysProxyApi();
|
|
64
|
+
if (cacheObj?.routeTrieMap?.[workbench_code]) {
|
|
65
|
+
return cacheObj.routeTrieMap[workbench_code];
|
|
66
|
+
}
|
|
67
|
+
return this.buildRouteTrie(workbench_code);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private buildRouteTrie(workbench_code: string): RouteTrie {
|
|
71
|
+
const upstreamMap = this.buildUpstreamMap();
|
|
72
|
+
const routeTrie = new RouteTrie();
|
|
73
|
+
const entities = this.loadProxyApiEntity(workbench_code, upstreamMap);
|
|
77
74
|
for (let i = 0; i < entities.length; i++) {
|
|
78
75
|
const entity = entities[i];
|
|
79
76
|
if (entity.status === 1) {
|
|
80
77
|
const path_prefix2 = '/' + entity.upstream_code + entity.path_prefix;
|
|
81
|
-
|
|
78
|
+
routeTrie.addRoute(path_prefix2, new RouteHandler(entity));
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const cacheObj = bizMemCacheStore.getSysProxyApi();
|
|
82
|
+
if (cacheObj) {
|
|
83
|
+
if (!cacheObj.routeTrieMap) {
|
|
84
|
+
cacheObj.routeTrieMap = {};
|
|
85
|
+
}
|
|
86
|
+
cacheObj.routeTrieMap[workbench_code] = routeTrie;
|
|
87
|
+
}
|
|
88
|
+
return routeTrie;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
private
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
// biz_tag={'upstream'}
|
|
92
|
-
const res = await this.curdProService.executeCrudByCfg(
|
|
93
|
-
{
|
|
94
|
-
condition: {
|
|
95
|
-
biz_tag: 'upstream',
|
|
96
|
-
deleted_at: 0,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
sqlTable: SystemTables.sys_configs,
|
|
101
|
-
sqlDatabase: SystemDbName,
|
|
102
|
-
sqlDbType: SystemDbType,
|
|
103
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
104
|
-
}
|
|
105
|
-
);
|
|
91
|
+
private buildUpstreamMap(): Record<string, IUpstreamInfo> {
|
|
92
|
+
const sysConfigList = bizMemCacheStore.getSysConfig()?.sysConfigList || [];
|
|
93
|
+
const rows = sysConfigList.filter((row) => row.biz_tag === 'upstream');
|
|
106
94
|
const upstreamMap: Record<string, IUpstreamInfo> = {};
|
|
107
|
-
const rows = res.getResRows() as any[];
|
|
108
95
|
for (let i = 0; i < rows.length; i++) {
|
|
109
96
|
const row = rows[i];
|
|
110
97
|
const { config_code, config_content } = row || {};
|
|
@@ -113,37 +100,24 @@ export class ProxyApiLoadService extends BaseService {
|
|
|
113
100
|
return upstreamMap;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
|
-
private
|
|
117
|
-
const
|
|
103
|
+
private loadProxyApiEntity(workbench_code: string, upstreamMap: Record<string, IUpstreamInfo>): IProxyApiEntity[] {
|
|
104
|
+
const rows0 = bizMemCacheStore.getSysProxyApi()?.sysProxyApiList || [];
|
|
105
|
+
const rows: IProxyApiEntity[] = [];
|
|
118
106
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
condition: {},
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
sqlTable: SystemTables.sys_proxyapi,
|
|
125
|
-
sqlDatabase: SystemDbName,
|
|
126
|
-
sqlDbType: SystemDbType,
|
|
127
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const rows0 = res.getResRows() as IProxyApiEntity[];
|
|
132
|
-
|
|
133
|
-
const rows = rows0.filter(s => {
|
|
107
|
+
for (let i = 0; i < rows0.length; i++) {
|
|
108
|
+
const s = rows0[i];
|
|
134
109
|
if (!isEntityOK(s)) {
|
|
135
|
-
|
|
110
|
+
continue;
|
|
136
111
|
}
|
|
137
112
|
if (!s.workbench_code_array) {
|
|
138
113
|
throw new CommonException('IS_SUPPORT_CURRENT_WORKBENCH', '未配置支持的站点字段');
|
|
139
114
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.addUpstreamInfo(row, upstream_code, upstreamMap);
|
|
115
|
+
if (!this.workbenchService.isMatchWorkbenchCode(s.workbench_code_array, workbench_code)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const row = JSON.parse(JSON.stringify(s)) as IProxyApiEntity;
|
|
119
|
+
this.addUpstreamInfo(row, row.upstream_code, upstreamMap);
|
|
120
|
+
rows.push(row);
|
|
147
121
|
}
|
|
148
122
|
return rows;
|
|
149
123
|
}
|
|
@@ -159,16 +133,4 @@ export class ProxyApiLoadService extends BaseService {
|
|
|
159
133
|
row.weightedRandom = new WeightedRandom(upstreamInfo.targetList || []);
|
|
160
134
|
row.weightedRoundRobin = new WeightedRoundRobin(upstreamInfo.targetList || []);
|
|
161
135
|
}
|
|
162
|
-
|
|
163
|
-
public async refreshRouteTrie(): Promise<any> {
|
|
164
|
-
const workbenchList = await this.workbenchService.getAllWorkbenchInfoList();
|
|
165
|
-
for (let i = 0; i < workbenchList.length; i++) {
|
|
166
|
-
const workbenchInfo = workbenchList[i];
|
|
167
|
-
try {
|
|
168
|
-
await this.buildRouteTrie(workbenchInfo.workbench_code);
|
|
169
|
-
} catch (e) {
|
|
170
|
-
this.logError('ProxyApiLoadService_runBySchedule', e);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
136
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
|
-
import { getRouteTrie } from './RouteTrie';
|
|
5
4
|
import { RouteHandler } from './RouteHandler';
|
|
6
5
|
import { Exceptions } from '@/libs/crud-pro/exceptions';
|
|
7
6
|
import { BizException } from '@/models/devops';
|
|
@@ -15,6 +14,7 @@ import { WeightedRoundRobin } from './WeightedRoundRobin';
|
|
|
15
14
|
import { ProxyApiLoadService } from './ProxyApiLoadService';
|
|
16
15
|
import { API_BASE_TYPE, ApiBaseService } from '../base/ApiBaseService';
|
|
17
16
|
import { toBase64 } from '@/libs/utils/base64';
|
|
17
|
+
import { parseJsonObject } from '@/libs/utils/functions';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* 接口代理
|
|
@@ -36,7 +36,7 @@ export class ProxyApiService extends ApiBaseService {
|
|
|
36
36
|
* @param upstream_path : 形如/[upstream_code]/[api_path]
|
|
37
37
|
*/
|
|
38
38
|
public async handleProxyRequest(current_workbench_code: string, upstream_path: string) {
|
|
39
|
-
const routeTrie = getRouteTrie(current_workbench_code);
|
|
39
|
+
const routeTrie = this.proxyApiLoadService.getRouteTrie(current_workbench_code);
|
|
40
40
|
const ss = routeTrie.findLongestMatch(upstream_path);
|
|
41
41
|
if (!ss) {
|
|
42
42
|
throw new BizException('路径没有匹配到', Exceptions.CFG_NOT_FOUND);
|
|
@@ -78,19 +78,16 @@ export class ProxyApiService extends ApiBaseService {
|
|
|
78
78
|
const response_type: ResponseType = 'stream';
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
const headers =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
81
|
+
const headers = this.buildRequestHeaders(targetUrl.host, proxyApiEntity);
|
|
82
|
+
|
|
83
|
+
const requestBody = this.buildRequestBody(ctx.request.body, proxyApiEntity);
|
|
85
84
|
|
|
86
|
-
delete headers['content-length'];
|
|
87
85
|
|
|
88
|
-
this.setRequestHeaders(headers, proxyApiEntity);
|
|
89
86
|
|
|
90
87
|
const axiosParams = {
|
|
91
88
|
method: ctx.method,
|
|
92
89
|
url: targetUrl.toString(),
|
|
93
|
-
data:
|
|
90
|
+
data: requestBody,
|
|
94
91
|
headers: headers,
|
|
95
92
|
responseType: response_type,
|
|
96
93
|
timeout: Number(proxyApiEntity.timeout_ms) || 5 * 60 * 1000,
|
|
@@ -242,6 +239,21 @@ export class ProxyApiService extends ApiBaseService {
|
|
|
242
239
|
return ss ? ss.origin : null;
|
|
243
240
|
}
|
|
244
241
|
|
|
242
|
+
private buildRequestHeaders(targetHost: string, proxyApiEntity: IProxyApiEntity): any {
|
|
243
|
+
const ctx = this.ctx;
|
|
244
|
+
const headers = {
|
|
245
|
+
...ctx.headers,
|
|
246
|
+
host: targetHost, // 设置正确的 host
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
delete headers['content-length'];
|
|
250
|
+
|
|
251
|
+
this.setRequestHeaders(headers, proxyApiEntity);
|
|
252
|
+
|
|
253
|
+
return headers;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
|
|
245
257
|
private setRequestHeaders(headers: any, proxyApiEntity: IProxyApiEntity) {
|
|
246
258
|
const ctx = this.ctx;
|
|
247
259
|
|
|
@@ -269,6 +281,30 @@ export class ProxyApiService extends ApiBaseService {
|
|
|
269
281
|
if (proxyApiEntity.change_origin && proxyApiEntity.change_origin.length > 0) {
|
|
270
282
|
headers.origin = proxyApiEntity.change_origin;
|
|
271
283
|
}
|
|
284
|
+
|
|
285
|
+
// 强制设置自定义Header
|
|
286
|
+
const custom_header = parseJsonObject(proxyApiEntity.custom_header);
|
|
287
|
+
if (custom_header && typeof custom_header === 'object' && Object.keys(custom_header).length > 0) {
|
|
288
|
+
Object.assign(headers, custom_header);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
private buildRequestBody(requestBody: any, proxyApiEntity: IProxyApiEntity): any {
|
|
296
|
+
|
|
297
|
+
// 强制设置自定义body
|
|
298
|
+
const custom_body = parseJsonObject(proxyApiEntity.custom_body);
|
|
299
|
+
if (custom_body && typeof custom_body === 'object' && Object.keys(custom_body).length > 0) {
|
|
300
|
+
if (requestBody && typeof requestBody === 'object') {
|
|
301
|
+
Object.assign(requestBody, custom_body);
|
|
302
|
+
return requestBody;
|
|
303
|
+
}
|
|
304
|
+
return custom_body;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return requestBody;
|
|
272
308
|
}
|
|
273
309
|
|
|
274
310
|
private buildUserContextHeader(proxyApiEntity: IProxyApiEntity): string {
|
|
@@ -63,21 +63,4 @@ class RouteTrie {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function getRouteTrie(domainCode: string): RouteTrie {
|
|
69
|
-
if (!ROUTE_TRIE_MANAGER[domainCode]) {
|
|
70
|
-
ROUTE_TRIE_MANAGER[domainCode] = new RouteTrie();
|
|
71
|
-
}
|
|
72
|
-
return ROUTE_TRIE_MANAGER[domainCode];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 原子替换指定 domainCode 的 RouteTrie
|
|
77
|
-
* 用于重建路由时先构建新树再整体替换,避免清空后重建期间路由不可用
|
|
78
|
-
*/
|
|
79
|
-
function setRouteTrie(domainCode: string, routeTrie: RouteTrie): void {
|
|
80
|
-
ROUTE_TRIE_MANAGER[domainCode] = routeTrie;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export { RouteTrie, getRouteTrie, setRouteTrie };
|
|
66
|
+
export { RouteTrie };
|