proxy-api-mcp 1.0.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/.env.example +57 -0
- package/README.md +443 -0
- package/api-tools.json.example +226 -0
- package/dist/examples/env-in-json-usage.d.ts +43 -0
- package/dist/examples/env-in-json-usage.d.ts.map +1 -0
- package/dist/examples/env-in-json-usage.js +242 -0
- package/dist/examples/env-in-json-usage.js.map +1 -0
- package/dist/examples/env-usage.d.ts +7 -0
- package/dist/examples/env-usage.d.ts.map +1 -0
- package/dist/examples/env-usage.js +108 -0
- package/dist/examples/env-usage.js.map +1 -0
- package/dist/examples/preprocessor-usage.d.ts +14 -0
- package/dist/examples/preprocessor-usage.d.ts.map +1 -0
- package/dist/examples/preprocessor-usage.js +196 -0
- package/dist/examples/preprocessor-usage.js.map +1 -0
- package/dist/src/config/env.d.ts +97 -0
- package/dist/src/config/env.d.ts.map +1 -0
- package/dist/src/config/env.js +228 -0
- package/dist/src/config/env.js.map +1 -0
- package/dist/src/core/registry.d.ts +59 -0
- package/dist/src/core/registry.d.ts.map +1 -0
- package/dist/src/core/registry.js +126 -0
- package/dist/src/core/registry.js.map +1 -0
- package/dist/src/core/router.d.ts +34 -0
- package/dist/src/core/router.d.ts.map +1 -0
- package/dist/src/core/router.js +108 -0
- package/dist/src/core/router.js.map +1 -0
- package/dist/src/core/server.d.ts +55 -0
- package/dist/src/core/server.d.ts.map +1 -0
- package/dist/src/core/server.js +159 -0
- package/dist/src/core/server.js.map +1 -0
- package/dist/src/core/session.d.ts +70 -0
- package/dist/src/core/session.d.ts.map +1 -0
- package/dist/src/core/session.js +171 -0
- package/dist/src/core/session.js.map +1 -0
- package/dist/src/core/transports/http.d.ts +16 -0
- package/dist/src/core/transports/http.d.ts.map +1 -0
- package/dist/src/core/transports/http.js +169 -0
- package/dist/src/core/transports/http.js.map +1 -0
- package/dist/src/core/transports/stdio.d.ts +9 -0
- package/dist/src/core/transports/stdio.d.ts.map +1 -0
- package/dist/src/core/transports/stdio.js +32 -0
- package/dist/src/core/transports/stdio.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +22 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/server.d.ts +6 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +121 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/api/builder.d.ts +34 -0
- package/dist/src/tools/api/builder.d.ts.map +1 -0
- package/dist/src/tools/api/builder.js +196 -0
- package/dist/src/tools/api/builder.js.map +1 -0
- package/dist/src/tools/api/executor.d.ts +57 -0
- package/dist/src/tools/api/executor.d.ts.map +1 -0
- package/dist/src/tools/api/executor.js +317 -0
- package/dist/src/tools/api/executor.js.map +1 -0
- package/dist/src/tools/api/index.d.ts +12 -0
- package/dist/src/tools/api/index.d.ts.map +1 -0
- package/dist/src/tools/api/index.js +12 -0
- package/dist/src/tools/api/index.js.map +1 -0
- package/dist/src/tools/api/json/kingdee/kingdee_caiwukuaiji_chunaguanli.json +879 -0
- package/dist/src/tools/api/json/kingdee/kingdee_caiwukuaiji_yingfukuanguanli.json +1673 -0
- package/dist/src/tools/api/json/kingdee/kingdee_caiwukuaiji_yingshoukuanguanli.json +1081 -0
- package/dist/src/tools/api/json/kingdee/kingdee_caiwukuaiji_zongzhang.json +976 -0
- package/dist/src/tools/api/json/kingdee/kingdee_chengbenguanli_biaozhunchengbenfenxi.json +1 -0
- package/dist/src/tools/api/json/kingdee/kingdee_chengbenguanli_chanpinchengbenhesuan.json +1 -0
- package/dist/src/tools/api/json/kingdee/kingdee_chengbenguanli_cunhuohesuan.json +1858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_gongyinglianguanli_caigouguanli.json +1 -0
- package/dist/src/tools/api/json/kingdee/kingdee_gongyinglianguanli_gongyingshangguanli.json +616 -0
- package/dist/src/tools/api/json/kingdee/kingdee_gongyinglianguanli_kucunguanli.json +858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_gongyinglianguanli_xiaoshouguanli.json +858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_gongyinglianguanli_zuzhijianjiesuan.json +858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_jichuguanli_jichuziliao.json +867 -0
- package/dist/src/tools/api/json/kingdee/kingdee_jichuguanli_xiaoxipingtai.json +374 -0
- package/dist/src/tools/api/json/kingdee/kingdee_shengchanzhizao_chejianguanli.json +923 -0
- package/dist/src/tools/api/json/kingdee/kingdee_shengchanzhizao_gongchengshujuguanli.json +923 -0
- package/dist/src/tools/api/json/kingdee/kingdee_shengchanzhizao_shengchanguanli.json +858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_shuiwuguanli_fapiaoguanli.json +1081 -0
- package/dist/src/tools/api/json/kingdee/kingdee_yuangongfuwu_renrenbaoxiao.json +858 -0
- package/dist/src/tools/api/json/kingdee/kingdee_zichanguanli_gudingzichan.json +1 -0
- package/dist/src/tools/api/json-config-loader.d.ts +28 -0
- package/dist/src/tools/api/json-config-loader.d.ts.map +1 -0
- package/dist/src/tools/api/json-config-loader.js +123 -0
- package/dist/src/tools/api/json-config-loader.js.map +1 -0
- package/dist/src/tools/api/json-config-mapping.d.ts +41 -0
- package/dist/src/tools/api/json-config-mapping.d.ts.map +1 -0
- package/dist/src/tools/api/json-config-mapping.js +138 -0
- package/dist/src/tools/api/json-config-mapping.js.map +1 -0
- package/dist/src/tools/api/loader.d.ts +38 -0
- package/dist/src/tools/api/loader.d.ts.map +1 -0
- package/dist/src/tools/api/loader.js +240 -0
- package/dist/src/tools/api/loader.js.map +1 -0
- package/dist/src/tools/api/preprocessor.d.ts +39 -0
- package/dist/src/tools/api/preprocessor.d.ts.map +1 -0
- package/dist/src/tools/api/preprocessor.js +64 -0
- package/dist/src/tools/api/preprocessor.js.map +1 -0
- package/dist/src/tools/api/preprocessors/example.d.ts +59 -0
- package/dist/src/tools/api/preprocessors/example.d.ts.map +1 -0
- package/dist/src/tools/api/preprocessors/example.js +133 -0
- package/dist/src/tools/api/preprocessors/example.js.map +1 -0
- package/dist/src/tools/api/preprocessors/index.d.ts +10 -0
- package/dist/src/tools/api/preprocessors/index.d.ts.map +1 -0
- package/dist/src/tools/api/preprocessors/index.js +29 -0
- package/dist/src/tools/api/preprocessors/index.js.map +1 -0
- package/dist/src/tools/api/preprocessors/kingdee.d.ts +24 -0
- package/dist/src/tools/api/preprocessors/kingdee.d.ts.map +1 -0
- package/dist/src/tools/api/preprocessors/kingdee.js +149 -0
- package/dist/src/tools/api/preprocessors/kingdee.js.map +1 -0
- package/dist/src/tools/api/types.d.ts +174 -0
- package/dist/src/tools/api/types.d.ts.map +1 -0
- package/dist/src/tools/api/types.js +5 -0
- package/dist/src/tools/api/types.js.map +1 -0
- package/dist/src/tools/examples/echo.d.ts +6 -0
- package/dist/src/tools/examples/echo.d.ts.map +1 -0
- package/dist/src/tools/examples/echo.js +61 -0
- package/dist/src/tools/examples/echo.js.map +1 -0
- package/dist/src/tools/types.d.ts +104 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +15 -0
- package/dist/src/tools/types.js.map +1 -0
- package/dist/src/tools/validator.d.ts +27 -0
- package/dist/src/tools/validator.d.ts.map +1 -0
- package/dist/src/tools/validator.js +133 -0
- package/dist/src/tools/validator.js.map +1 -0
- package/dist/src/utils/cache.d.ts +14 -0
- package/dist/src/utils/cache.d.ts.map +1 -0
- package/dist/src/utils/cache.js +42 -0
- package/dist/src/utils/cache.js.map +1 -0
- package/dist/src/utils/env-replacer.d.ts +86 -0
- package/dist/src/utils/env-replacer.d.ts.map +1 -0
- package/dist/src/utils/env-replacer.js +196 -0
- package/dist/src/utils/env-replacer.js.map +1 -0
- package/dist/src/utils/errors.d.ts +102 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +164 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/logger.d.ts +77 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +155 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API 工具加载器 - 从 JSON 文件加载 API 工具配置
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'fs/promises';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { ApiToolBuilder } from './builder.js';
|
|
7
|
+
import { logger } from '../../utils/logger.js';
|
|
8
|
+
import { replaceEnvVariables, validateEnvVariables } from '../../utils/env-replacer.js';
|
|
9
|
+
/**
|
|
10
|
+
* API 工具加载器类
|
|
11
|
+
*/
|
|
12
|
+
export class ApiToolLoader {
|
|
13
|
+
/**
|
|
14
|
+
* 从 JSON 文件加载 API 工具配置
|
|
15
|
+
*/
|
|
16
|
+
static async loadFromFile(filePath) {
|
|
17
|
+
try {
|
|
18
|
+
logger.info(`Loading API tools from: ${filePath}`);
|
|
19
|
+
// 读取文件内容
|
|
20
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
21
|
+
let configFile = JSON.parse(content);
|
|
22
|
+
// 验证并替换环境变量
|
|
23
|
+
const validation = validateEnvVariables(configFile);
|
|
24
|
+
if (!validation.valid) {
|
|
25
|
+
logger.warn(`Missing required environment variables in ${filePath}: ${validation.missing.join(', ')}`);
|
|
26
|
+
}
|
|
27
|
+
// 替换环境变量
|
|
28
|
+
logger.debug('Replacing environment variables in API tools config');
|
|
29
|
+
configFile = replaceEnvVariables(configFile, {
|
|
30
|
+
path: filePath
|
|
31
|
+
});
|
|
32
|
+
// 验证配置文件格式
|
|
33
|
+
this.validateConfigFile(configFile);
|
|
34
|
+
// 应用全局配置
|
|
35
|
+
const apiConfigs = this.applyGlobalConfig(configFile);
|
|
36
|
+
// 验证和构建工具
|
|
37
|
+
const tools = [];
|
|
38
|
+
const errors = [];
|
|
39
|
+
for (const apiConfig of apiConfigs) {
|
|
40
|
+
// 验证配置
|
|
41
|
+
const validation = ApiToolBuilder.validate(apiConfig);
|
|
42
|
+
if (!validation.valid) {
|
|
43
|
+
errors.push({
|
|
44
|
+
name: apiConfig.name,
|
|
45
|
+
errors: validation.errors,
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// 构建工具
|
|
50
|
+
try {
|
|
51
|
+
const tool = ApiToolBuilder.build(apiConfig);
|
|
52
|
+
tools.push(tool);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
56
|
+
logger.error(`Failed to build API tool: ${apiConfig.name}`, {
|
|
57
|
+
error: errorMessage,
|
|
58
|
+
});
|
|
59
|
+
errors.push({
|
|
60
|
+
name: apiConfig.name,
|
|
61
|
+
errors: [errorMessage],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// 报告结果
|
|
66
|
+
logger.info(`Loaded ${tools.length} API tools from ${filePath}`, {
|
|
67
|
+
successful: tools.length,
|
|
68
|
+
failed: errors.length,
|
|
69
|
+
});
|
|
70
|
+
if (errors.length > 0) {
|
|
71
|
+
logger.warn('Some API tools failed to load:', { errors });
|
|
72
|
+
}
|
|
73
|
+
return tools;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
77
|
+
logger.error(`Failed to load API tools from ${filePath}`, {
|
|
78
|
+
error: errorMessage,
|
|
79
|
+
});
|
|
80
|
+
throw new Error(`Failed to load API tools: ${errorMessage}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 从多个文件加载 API 工具配置
|
|
85
|
+
*/
|
|
86
|
+
static async loadFromFiles(filePaths) {
|
|
87
|
+
const allTools = [];
|
|
88
|
+
for (const filePath of filePaths) {
|
|
89
|
+
try {
|
|
90
|
+
const tools = await this.loadFromFile(filePath);
|
|
91
|
+
allTools.push(...tools);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
logger.error(`Skipping file ${filePath} due to error`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return allTools;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 从目录加载所有 JSON 配置文件
|
|
101
|
+
*/
|
|
102
|
+
static async loadFromDirectory(dirPath) {
|
|
103
|
+
try {
|
|
104
|
+
logger.info(`Loading API tools from directory: ${dirPath}`);
|
|
105
|
+
const files = await fs.readdir(dirPath);
|
|
106
|
+
const jsonFiles = files
|
|
107
|
+
.filter(file => file.endsWith('.json'))
|
|
108
|
+
.map(file => path.join(dirPath, file));
|
|
109
|
+
if (jsonFiles.length === 0) {
|
|
110
|
+
logger.warn(`No JSON files found in directory: ${dirPath}`);
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
return this.loadFromFiles(jsonFiles);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
117
|
+
logger.error(`Failed to load API tools from directory ${dirPath}`, {
|
|
118
|
+
error: errorMessage,
|
|
119
|
+
});
|
|
120
|
+
throw new Error(`Failed to load API tools from directory: ${errorMessage}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 从 JSON 字符串加载配置
|
|
125
|
+
*/
|
|
126
|
+
static loadFromJson(jsonString) {
|
|
127
|
+
try {
|
|
128
|
+
let configFile = JSON.parse(jsonString);
|
|
129
|
+
this.validateConfigFile(configFile);
|
|
130
|
+
// 验证并替换环境变量
|
|
131
|
+
const validation = validateEnvVariables(configFile);
|
|
132
|
+
if (!validation.valid) {
|
|
133
|
+
logger.warn(`Missing required environment variables: ${validation.missing.join(', ')}`);
|
|
134
|
+
}
|
|
135
|
+
// 替换环境变量
|
|
136
|
+
configFile = replaceEnvVariables(configFile);
|
|
137
|
+
const apiConfigs = this.applyGlobalConfig(configFile);
|
|
138
|
+
return ApiToolBuilder.buildBatch(apiConfigs);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
142
|
+
logger.error('Failed to load API tools from JSON string', {
|
|
143
|
+
error: errorMessage,
|
|
144
|
+
});
|
|
145
|
+
throw new Error(`Failed to load API tools from JSON: ${errorMessage}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 验证配置文件格式
|
|
150
|
+
*/
|
|
151
|
+
static validateConfigFile(configFile) {
|
|
152
|
+
if (!configFile.version) {
|
|
153
|
+
throw new Error('Config file version is required');
|
|
154
|
+
}
|
|
155
|
+
if (!configFile.tools || !Array.isArray(configFile.tools)) {
|
|
156
|
+
throw new Error('Config file must contain a tools array');
|
|
157
|
+
}
|
|
158
|
+
if (configFile.tools.length === 0) {
|
|
159
|
+
logger.warn('Config file contains no tools');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 应用全局配置到各个工具
|
|
164
|
+
*/
|
|
165
|
+
static applyGlobalConfig(configFile) {
|
|
166
|
+
const globals = configFile.globals || {};
|
|
167
|
+
return configFile.tools.map(tool => {
|
|
168
|
+
const mergedTool = { ...tool };
|
|
169
|
+
// 应用全局 baseUrl
|
|
170
|
+
if (!mergedTool.baseUrl && globals.baseUrl) {
|
|
171
|
+
mergedTool.baseUrl = globals.baseUrl;
|
|
172
|
+
}
|
|
173
|
+
// 应用全局 timeout
|
|
174
|
+
if (!mergedTool.timeout && globals.timeout) {
|
|
175
|
+
mergedTool.timeout = globals.timeout;
|
|
176
|
+
}
|
|
177
|
+
// 合并全局 headers
|
|
178
|
+
if (globals.headers) {
|
|
179
|
+
mergedTool.headers = {
|
|
180
|
+
...globals.headers,
|
|
181
|
+
...mergedTool.headers,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// 应用全局认证配置
|
|
185
|
+
if (!mergedTool.auth && globals.auth) {
|
|
186
|
+
mergedTool.auth = globals.auth;
|
|
187
|
+
}
|
|
188
|
+
return mergedTool;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 监听配置文件变化并自动重新加载
|
|
193
|
+
*/
|
|
194
|
+
static watch(filePath, callback) {
|
|
195
|
+
let watcher = null;
|
|
196
|
+
let reloadTimeout = null;
|
|
197
|
+
const reload = async () => {
|
|
198
|
+
try {
|
|
199
|
+
const tools = await this.loadFromFile(filePath);
|
|
200
|
+
callback(tools);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
logger.error('Failed to reload API tools', {
|
|
204
|
+
error: error instanceof Error ? error.message : String(error),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
void (async () => {
|
|
209
|
+
try {
|
|
210
|
+
watcher = fs.watch(filePath);
|
|
211
|
+
for await (const event of watcher) {
|
|
212
|
+
if (event.eventType === 'change') {
|
|
213
|
+
// 防抖处理,避免频繁重载
|
|
214
|
+
if (reloadTimeout) {
|
|
215
|
+
clearTimeout(reloadTimeout);
|
|
216
|
+
}
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
218
|
+
reloadTimeout = setTimeout(reload, 1000);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
logger.error('Failed to watch API tools config file', {
|
|
224
|
+
error: error instanceof Error ? error.message : String(error),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
})();
|
|
228
|
+
// 返回取消监听的函数
|
|
229
|
+
return () => {
|
|
230
|
+
if (reloadTimeout) {
|
|
231
|
+
clearTimeout(reloadTimeout);
|
|
232
|
+
}
|
|
233
|
+
if (watcher) {
|
|
234
|
+
// watcher is an AsyncIterator, cannot be closed directly
|
|
235
|
+
// Use a different approach for cleanup if needed
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//# sourceMapp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AK,CAAC,QAAQ,CAAC,CAAC;gBAE7B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;oBAClC,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;wBACjC,cAAc;wBACd,IAAI,aAAa,EAAE,CAAC;4BAClB,YAAY,CAAC,aAAa,CAAC,CAAC;wBAC9B,CAAC;wBACD,kEAAkE;wBAClE,aAAa,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;oBAC3C,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE;oBACpD,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;QAEL,YAAY;QACZ,OAAO,GAAG,EAAE;YACV,IAAI,aAAa,EAAE,CAAC;gBAClB,YAAY,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;YACD,IAAI,OAAO,EAAE,CAAC;gBACZ,yDAAyD;gBACzD,iDAAiD;YACnD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 请求预处理器注册表
|
|
3
|
+
*/
|
|
4
|
+
import { type RequestPreprocessor } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* 预处理器注册表
|
|
7
|
+
*/
|
|
8
|
+
export declare class PreprocessorRegistry {
|
|
9
|
+
private static preprocessors;
|
|
10
|
+
/**
|
|
11
|
+
* 注册预处理器
|
|
12
|
+
*/
|
|
13
|
+
static register(preprocessor: RequestPreprocessor): void;
|
|
14
|
+
/**
|
|
15
|
+
* 批量注册预处理器
|
|
16
|
+
*/
|
|
17
|
+
static registerMany(preprocessors: RequestPreprocessor[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* 获取预处理器
|
|
20
|
+
*/
|
|
21
|
+
static get(name: string): RequestPreprocessor | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 检查预处理器是否存在
|
|
24
|
+
*/
|
|
25
|
+
static has(name: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 注销预处理器
|
|
28
|
+
*/
|
|
29
|
+
static unregister(name: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 获取所有已注册的预处理器名称
|
|
32
|
+
*/
|
|
33
|
+
static getAll(): string[];
|
|
34
|
+
/**
|
|
35
|
+
* 清空所有预处理器
|
|
36
|
+
*/
|
|
37
|
+
static clear(): void;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=preprocessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preprocessor.d.ts","sourceRoot":"","sources":["../../../../src/tools/api/preprocessor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,aAAa,CAA0C;IAEtE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;IASxD;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,mBAAmB,EAAE,GAAG,IAAI;IAM/D;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIzD;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAQxC;;OAEG;IACH,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE;IAIzB;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 请求预处理器注册表
|
|
3
|
+
*/
|
|
4
|
+
import { logger } from '../../utils/logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* 预处理器注册表
|
|
7
|
+
*/
|
|
8
|
+
export class PreprocessorRegistry {
|
|
9
|
+
static preprocessors = new Map();
|
|
10
|
+
/**
|
|
11
|
+
* 注册预处理器
|
|
12
|
+
*/
|
|
13
|
+
static register(preprocessor) {
|
|
14
|
+
if (this.preprocessors.has(preprocessor.name)) {
|
|
15
|
+
logger.warn(`Preprocessor ${preprocessor.name} is already registered, overwriting`);
|
|
16
|
+
}
|
|
17
|
+
this.preprocessors.set(preprocessor.name, preprocessor);
|
|
18
|
+
logger.debug(`Registered preprocessor: ${preprocessor.name}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 批量注册预处理器
|
|
22
|
+
*/
|
|
23
|
+
static registerMany(preprocessors) {
|
|
24
|
+
for (const preprocessor of preprocessors) {
|
|
25
|
+
this.register(preprocessor);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 获取预处理器
|
|
30
|
+
*/
|
|
31
|
+
static get(name) {
|
|
32
|
+
return this.preprocessors.get(name);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 检查预处理器是否存在
|
|
36
|
+
*/
|
|
37
|
+
static has(name) {
|
|
38
|
+
return this.preprocessors.has(name);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 注销预处理器
|
|
42
|
+
*/
|
|
43
|
+
static unregister(name) {
|
|
44
|
+
const result = this.preprocessors.delete(name);
|
|
45
|
+
if (result) {
|
|
46
|
+
logger.debug(`Unregistered preprocessor: ${name}`);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 获取所有已注册的预处理器名称
|
|
52
|
+
*/
|
|
53
|
+
static getAll() {
|
|
54
|
+
return Array.from(this.preprocessors.keys());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 清空所有预处理器
|
|
58
|
+
*/
|
|
59
|
+
static clear() {
|
|
60
|
+
this.preprocessors.clear();
|
|
61
|
+
logger.debug('Cleared all preprocessors');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=preprocessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preprocessor.js","sourceRoot":"","sources":["../../../../src/tools/api/preprocessor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAC,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEtE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAiC;QAC/C,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC,gBAAgB,YAAY,CAAC,IAAI,qCAAqC,CAAC,CAAC;QACtF,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,4BAA4B,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,aAAoC;QACtD,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAY;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK;QACV,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 示例预处理器
|
|
3
|
+
* 演示如何创建自定义预处理器
|
|
4
|
+
*/
|
|
5
|
+
import { type RequestPreprocessor, type RequestData, type RequestPreprocessContext } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* 添加时间戳预处理器
|
|
8
|
+
* 在所有请求中添加时间戳查询参数和请求头
|
|
9
|
+
*/
|
|
10
|
+
export declare class AddTimestampPreprocessor implements RequestPreprocessor {
|
|
11
|
+
readonly name = "add_timestamp";
|
|
12
|
+
preprocess(requestData: RequestData, _context: RequestPreprocessContext): RequestData;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 认证令牌预处理器
|
|
16
|
+
* 从环境变量或配置中读取令牌并添加到请求头
|
|
17
|
+
*/
|
|
18
|
+
export declare class AuthTokenPreprocessor implements RequestPreprocessor {
|
|
19
|
+
private token?;
|
|
20
|
+
readonly name = "auth_token";
|
|
21
|
+
constructor(token?: string | undefined);
|
|
22
|
+
preprocess(requestData: RequestData, _context: RequestPreprocessContext): RequestData;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* URL 参数编码预处理器
|
|
26
|
+
* 对URL中的路径参数进行特殊编码处理
|
|
27
|
+
*/
|
|
28
|
+
export declare class UrlEncodePreprocessor implements RequestPreprocessor {
|
|
29
|
+
readonly name = "url_encode";
|
|
30
|
+
preprocess(requestData: RequestData, _context: RequestPreprocessContext): RequestData;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 请求日志预处理器
|
|
34
|
+
* 记录详细的请求信息用于调试
|
|
35
|
+
*/
|
|
36
|
+
export declare class RequestLoggerPreprocessor implements RequestPreprocessor {
|
|
37
|
+
readonly name = "request_logger";
|
|
38
|
+
preprocess(requestData: RequestData, context: RequestPreprocessContext): RequestData;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 动态基础URL预处理器
|
|
42
|
+
* 根据环境或参数动态修改URL
|
|
43
|
+
*/
|
|
44
|
+
export declare class DynamicBaseUrlPreprocessor implements RequestPreprocessor {
|
|
45
|
+
private urlMapping;
|
|
46
|
+
readonly name = "dynamic_base_url";
|
|
47
|
+
constructor(urlMapping: Record<string, string>);
|
|
48
|
+
preprocess(requestData: RequestData, context: RequestPreprocessContext): RequestData;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 异步预处理器示例
|
|
52
|
+
* 演示如何执行异步操作(如从数据库获取令牌)
|
|
53
|
+
*/
|
|
54
|
+
export declare class AsyncTokenFetcherPreprocessor implements RequestPreprocessor {
|
|
55
|
+
readonly name = "async_token_fetcher";
|
|
56
|
+
preprocess(requestData: RequestData, _context: RequestPreprocessContext): Promise<RequestData>;
|
|
57
|
+
private fetchTokenAsync;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../../../../src/tools/api/preprocessors/example.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC9B,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,mBAAmB;IAClE,QAAQ,CAAC,IAAI,mBAAmB;IAEhC,UAAU,CACR,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,wBAAwB,GACjC,WAAW;CAaf;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,mBAAmB;IAGnD,OAAO,CAAC,KAAK,CAAC;IAF1B,QAAQ,CAAC,IAAI,gBAAgB;gBAET,KAAK,CAAC,EAAE,MAAM,YAAA;IAKlC,UAAU,CACR,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,wBAAwB,GACjC,WAAW;CAUf;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,mBAAmB;IAC/D,QAAQ,CAAC,IAAI,gBAAgB;IAE7B,UAAU,CACR,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,wBAAwB,GACjC,WAAW;CAmBf;AAED;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IACnE,QAAQ,CAAC,IAAI,oBAAoB;IAEjC,UAAU,CACR,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,wBAAwB,GAChC,WAAW;CAaf;AAED;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAGxD,OAAO,CAAC,UAAU;IAF9B,QAAQ,CAAC,IAAI,sBAAsB;gBAEf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEtD,UAAU,CACR,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,wBAAwB,GAChC,WAAW;CAaf;AAED;;;GAGG;AACH,qBAAa,6BAA8B,YAAW,mBAAmB;IACvE,QAAQ,CAAC,IAAI,yBAAyB;IAEhC,UAAU,CACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAAC,WAAW,CAAC;YAYT,eAAe;CAQ9B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 示例预处理器
|
|
3
|
+
* 演示如何创建自定义预处理器
|
|
4
|
+
*/
|
|
5
|
+
import { logger } from '../../../utils/logger.js';
|
|
6
|
+
/**
|
|
7
|
+
* 添加时间戳预处理器
|
|
8
|
+
* 在所有请求中添加时间戳查询参数和请求头
|
|
9
|
+
*/
|
|
10
|
+
export class AddTimestampPreprocessor {
|
|
11
|
+
name = 'add_timestamp';
|
|
12
|
+
preprocess(requestData, _context) {
|
|
13
|
+
const timestamp = Date.now().toString();
|
|
14
|
+
// 添加时间戳到查询参数
|
|
15
|
+
requestData.query.timestamp = timestamp;
|
|
16
|
+
// 添加时间戳到请求头
|
|
17
|
+
requestData.headers['X-Request-Time'] = timestamp;
|
|
18
|
+
logger.debug(`Added timestamp ${timestamp} to request`);
|
|
19
|
+
return requestData;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 认证令牌预处理器
|
|
24
|
+
* 从环境变量或配置中读取令牌并添加到请求头
|
|
25
|
+
*/
|
|
26
|
+
export class AuthTokenPreprocessor {
|
|
27
|
+
token;
|
|
28
|
+
name = 'auth_token';
|
|
29
|
+
constructor(token) {
|
|
30
|
+
this.token = token;
|
|
31
|
+
// 如果没有提供 token,尝试从环境变量读取
|
|
32
|
+
this.token = token || process.env.API_AUTH_TOKEN;
|
|
33
|
+
}
|
|
34
|
+
preprocess(requestData, _context) {
|
|
35
|
+
if (this.token) {
|
|
36
|
+
requestData.headers['Authorization'] = `Bearer ${this.token}`;
|
|
37
|
+
logger.debug('Added auth token to request headers');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
logger.warn('Auth token preprocessor: No token available');
|
|
41
|
+
}
|
|
42
|
+
return requestData;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* URL 参数编码预处理器
|
|
47
|
+
* 对URL中的路径参数进行特殊编码处理
|
|
48
|
+
*/
|
|
49
|
+
export class UrlEncodePreprocessor {
|
|
50
|
+
name = 'url_encode';
|
|
51
|
+
preprocess(requestData, _context) {
|
|
52
|
+
// 对路径参数进行 URL 编码
|
|
53
|
+
for (const [key, value] of Object.entries(requestData.pathParams)) {
|
|
54
|
+
if (typeof value === 'string') {
|
|
55
|
+
requestData.pathParams[key] = encodeURIComponent(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// 对查询参数中的字符串值进行编码
|
|
59
|
+
for (const [key, value] of Object.entries(requestData.query)) {
|
|
60
|
+
if (typeof value === 'string') {
|
|
61
|
+
requestData.query[key] = encodeURIComponent(value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
logger.debug('Applied URL encoding to path and query parameters');
|
|
65
|
+
return requestData;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 请求日志预处理器
|
|
70
|
+
* 记录详细的请求信息用于调试
|
|
71
|
+
*/
|
|
72
|
+
export class RequestLoggerPreprocessor {
|
|
73
|
+
name = 'request_logger';
|
|
74
|
+
preprocess(requestData, context) {
|
|
75
|
+
logger.info('Request preprocessing:', {
|
|
76
|
+
tool: context.toolName,
|
|
77
|
+
url: requestData.url,
|
|
78
|
+
query: requestData.query,
|
|
79
|
+
headers: requestData.headers,
|
|
80
|
+
pathParams: requestData.pathParams,
|
|
81
|
+
hasBody: !!requestData.body,
|
|
82
|
+
args: context.args,
|
|
83
|
+
});
|
|
84
|
+
return requestData;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 动态基础URL预处理器
|
|
89
|
+
* 根据环境或参数动态修改URL
|
|
90
|
+
*/
|
|
91
|
+
export class DynamicBaseUrlPreprocessor {
|
|
92
|
+
urlMapping;
|
|
93
|
+
name = 'dynamic_base_url';
|
|
94
|
+
constructor(urlMapping) {
|
|
95
|
+
this.urlMapping = urlMapping;
|
|
96
|
+
}
|
|
97
|
+
preprocess(requestData, context) {
|
|
98
|
+
// 从参数中获取环境标识
|
|
99
|
+
const env = context.args.environment;
|
|
100
|
+
if (env && this.urlMapping[env]) {
|
|
101
|
+
// 修改URL(这里假设URL是相对路径,实际使用时需要配合baseUrl)
|
|
102
|
+
logger.debug(`Switching to ${env} environment: ${this.urlMapping[env]}`);
|
|
103
|
+
// 这里可以修改 baseUrl,但由于 RequestData 中没有 baseUrl
|
|
104
|
+
// 实际应用中可能需要在配置中处理或添加额外字段
|
|
105
|
+
}
|
|
106
|
+
return requestData;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 异步预处理器示例
|
|
111
|
+
* 演示如何执行异步操作(如从数据库获取令牌)
|
|
112
|
+
*/
|
|
113
|
+
export class AsyncTokenFetcherPreprocessor {
|
|
114
|
+
name = 'async_token_fetcher';
|
|
115
|
+
async preprocess(requestData, _context) {
|
|
116
|
+
// 模拟异步获取令牌
|
|
117
|
+
const token = await this.fetchTokenAsync();
|
|
118
|
+
if (token) {
|
|
119
|
+
requestData.headers['X-Dynamic-Token'] = token;
|
|
120
|
+
logger.debug('Added dynamically fetched token to request');
|
|
121
|
+
}
|
|
122
|
+
return requestData;
|
|
123
|
+
}
|
|
124
|
+
async fetchTokenAsync() {
|
|
125
|
+
// 模拟异步操作
|
|
126
|
+
return new Promise((resolve) => {
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
resolve(`dynamic-token-${Date.now()}`);
|
|
129
|
+
}, 10);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":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,4BAA4B,IAAI,IAAI,CAoBnD;AAGD,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预处理器使用示例
|
|
3
|
+
*/
|
|
4
|
+
import { PreprocessorRegistry } from '../preprocessor.js';
|
|
5
|
+
import { AddTimestampPreprocessor, AuthTokenPreprocessor, RequestLoggerPreprocessor, UrlEncodePreprocessor, } from './example.js';
|
|
6
|
+
/**
|
|
7
|
+
* 注册所有预处理器
|
|
8
|
+
* 在应用启动时调用此函数
|
|
9
|
+
*/
|
|
10
|
+
export function registerDefaultPreprocessors() {
|
|
11
|
+
// 注册时间戳预处理器
|
|
12
|
+
PreprocessorRegistry.register(new AddTimestampPreprocessor());
|
|
13
|
+
// 注册认证令牌预处理器
|
|
14
|
+
PreprocessorRegistry.register(new AuthTokenPreprocessor());
|
|
15
|
+
// 注册请求日志预处理器
|
|
16
|
+
PreprocessorRegistry.register(new RequestLoggerPreprocessor());
|
|
17
|
+
// 注册URL编码预处理器
|
|
18
|
+
PreprocessorRegistry.register(new UrlEncodePreprocessor());
|
|
19
|
+
// 也可以使用批量注册
|
|
20
|
+
// PreprocessorRegistry.registerMany([
|
|
21
|
+
// new AddTimestampPreprocessor(),
|
|
22
|
+
// new AuthTokenPreprocessor(),
|
|
23
|
+
// new RequestLoggerPreprocessor(),
|
|
24
|
+
// new UrlEncodePreprocessor(),
|
|
25
|
+
// ]);
|
|
26
|
+
}
|
|
27
|
+
// 导出示例预处理器
|
|
28
|
+
export * from './example.js';
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tools/api/preprocessors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,UAAU,4BAA4B;IAC1C,YAAY;IACZ,oBAAoB,CAAC,QAAQ,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;IAE9D,aAAa;IACb,oBAAoB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAE3D,aAAa;IACb,oBAAoB,CAAC,QAAQ,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC;IAE/D,cAAc;IACd,oBAAoB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAE3D,YAAY;IACZ,sCAAsC;IACtC,oCAAoC;IACpC,iCAAiC;IACjC,qCAAqC;IACrC,iCAAiC;IACjC,MAAM;AACR,CAAC;AAED,WAAW;AACX,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type RequestPreprocessor, type RequestData } from '../types';
|
|
2
|
+
import { CACHE } from "../../../utils/cache";
|
|
3
|
+
/**
|
|
4
|
+
* 金蝶云token
|
|
5
|
+
*/
|
|
6
|
+
export interface KingdeeToken {
|
|
7
|
+
"SessionId": string;
|
|
8
|
+
"KDSVCSessionId": string;
|
|
9
|
+
}
|
|
10
|
+
export declare class KingdeeAsyncFetchTokenPreprocessor implements RequestPreprocessor {
|
|
11
|
+
readonly name = "kingdee_Preprocessor";
|
|
12
|
+
cache: CACHE<KingdeeToken>;
|
|
13
|
+
readonly domain: string;
|
|
14
|
+
readonly appId: string;
|
|
15
|
+
readonly username: string;
|
|
16
|
+
readonly algorithm: string;
|
|
17
|
+
readonly secret: string;
|
|
18
|
+
readonly lcid: string;
|
|
19
|
+
readonly acctId: string;
|
|
20
|
+
constructor();
|
|
21
|
+
preprocess(requestData: RequestData): Promise<RequestData>;
|
|
22
|
+
getToken(): Promise<KingdeeToken | null>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=kingdee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kingdee.d.ts","sourceRoot":"","sources":["../../../../../src/tools/api/preprocessors/kingdee.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAK5C;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAA;CAE3B;AACD,qBAAa,kCAAmC,YAAW,mBAAmB;IAC1E,QAAQ,CAAC,IAAI,0BAA0B;IACvC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA6B;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAA6B;IACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAA+B;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAgC;IAC1D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA6B;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAA2B;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA8B;;IAI/C,UAAU,CACZ,WAAW,EAAE,WAAW,GACzB,OAAO,CAAC,WAAW,CAAC;IAiGjB,QAAQ,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAiDjD"}
|