yapi-apifox-to-typescript 4.2.2 → 5.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/lib/cjs/ApifoxToYApiData.js +312 -576
- package/lib/cjs/Generator.js +513 -1171
- package/lib/cjs/SwaggerToYApiServer.js +125 -336
- package/lib/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/lib/cjs/cli.js +171 -280
- package/lib/cjs/helpers.js +125 -209
- package/lib/cjs/index.js +15 -19
- package/lib/cjs/mini-ut.js +220 -0
- package/lib/cjs/swaggerJsonToYApiData.js +268 -482
- package/lib/cjs/types.js +93 -93
- package/lib/cjs/utils.js +364 -769
- package/lib/esm/ApifoxToYApiData.d.ts +49 -0
- package/lib/esm/ApifoxToYApiData.js +310 -560
- package/lib/esm/Generator.d.ts +53 -0
- package/lib/esm/Generator.js +509 -1146
- package/lib/esm/SwaggerToYApiServer.d.ts +23 -0
- package/lib/esm/SwaggerToYApiServer.js +119 -317
- package/lib/esm/_virtual/_rolldown/runtime.js +7 -0
- package/lib/esm/cli.d.ts +4 -0
- package/lib/esm/cli.js +162 -251
- package/lib/esm/helpers.d.ts +49 -0
- package/lib/esm/helpers.js +125 -198
- package/lib/esm/index.d.ts +2 -897
- package/lib/esm/index.js +3 -2
- package/lib/esm/mini-ut.d.ts +105 -0
- package/lib/esm/mini-ut.js +198 -0
- package/lib/esm/swaggerJsonToYApiData.d.ts +6 -0
- package/lib/esm/swaggerJsonToYApiData.js +265 -469
- package/lib/esm/types.d.ts +695 -0
- package/lib/esm/types.js +87 -73
- package/lib/esm/utils.d.ts +95 -0
- package/lib/esm/utils.js +350 -720
- package/package.json +49 -59
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CategoryList, Config, Interface, InterfaceList, Project, SyntheticalConfig } from './types';
|
|
2
|
+
interface OutputFileList {
|
|
3
|
+
[outputFilePath: string]: {
|
|
4
|
+
syntheticalConfig: SyntheticalConfig;
|
|
5
|
+
content: string[];
|
|
6
|
+
requestFunctionFilePath: string;
|
|
7
|
+
requestHookMakerFilePath: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare class Generator {
|
|
11
|
+
private options;
|
|
12
|
+
/** 配置 */
|
|
13
|
+
private config;
|
|
14
|
+
private disposes;
|
|
15
|
+
/**
|
|
16
|
+
* splitByModule 模式下,记录需要写 barrel 文件的原始输出路径(绝对路径)。
|
|
17
|
+
* key = outputFilePath 原址, value = true 表示该路径需要写 barrel。
|
|
18
|
+
*/
|
|
19
|
+
private barrelOutputMap;
|
|
20
|
+
constructor(config: Config, options?: {
|
|
21
|
+
cwd: string;
|
|
22
|
+
});
|
|
23
|
+
prepare(): Promise<void>;
|
|
24
|
+
generate(): Promise<OutputFileList>;
|
|
25
|
+
write(outputFileList: OutputFileList): Promise<void>;
|
|
26
|
+
tsc(file: string): Promise<void>;
|
|
27
|
+
fetchApi<T = any>(url: string, query: Record<string, any>): Promise<T>;
|
|
28
|
+
fetchProject: ({ serverUrl, token }: SyntheticalConfig) => Promise<Project>;
|
|
29
|
+
fetchExport: ({ serverUrl, token }: SyntheticalConfig) => Promise<import('./types').Category[]>;
|
|
30
|
+
/** 获取分类的接口列表 */
|
|
31
|
+
fetchInterfaceList({ serverUrl, token, id, }: SyntheticalConfig): Promise<InterfaceList>;
|
|
32
|
+
/** 获取项目信息 */
|
|
33
|
+
fetchProjectInfo(syntheticalConfig: SyntheticalConfig): Promise<{
|
|
34
|
+
cats: CategoryList;
|
|
35
|
+
getMockUrl: () => string;
|
|
36
|
+
getDevUrl: (devEnvName: string) => string;
|
|
37
|
+
getProdUrl: (prodEnvName: string) => string;
|
|
38
|
+
_id: number;
|
|
39
|
+
_url: string;
|
|
40
|
+
name: string;
|
|
41
|
+
desc: string;
|
|
42
|
+
basepath: string;
|
|
43
|
+
tag: string[];
|
|
44
|
+
env: Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
domain: string;
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
/** 生成接口代码 */
|
|
50
|
+
generateInterfaceCode(syntheticalConfig: SyntheticalConfig, interfaceInfo: Interface, categoryUID: string): Promise<string>;
|
|
51
|
+
destroy(): Promise<any[]>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|