yapi-to-typescript2 1.0.1 → 1.0.2

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.
@@ -0,0 +1,49 @@
1
+ /// <reference types="lodash" />
2
+ import { CategoryList, Config, Interface, InterfaceList, Project, SyntheticalConfig } from './types';
3
+ interface OutputFileList {
4
+ [outputFilePath: string]: {
5
+ syntheticalConfig: SyntheticalConfig;
6
+ content: string[];
7
+ requestFunctionFilePath: string;
8
+ requestHookMakerFilePath: string;
9
+ };
10
+ }
11
+ export declare class Generator {
12
+ private options;
13
+ /** 配置 */
14
+ private config;
15
+ private disposes;
16
+ constructor(config: Config, options?: {
17
+ cwd: string;
18
+ });
19
+ prepare(): Promise<void>;
20
+ generate(): Promise<OutputFileList>;
21
+ write(outputFileList: OutputFileList): Promise<void[]>;
22
+ tsc(file: string): Promise<void>;
23
+ fetchApi<T = any>(url: string, query: Record<string, any>): Promise<T>;
24
+ fetchProject: (({ serverUrl, token }: SyntheticalConfig) => Promise<Project>) & import("lodash").MemoizedFunction;
25
+ fetchExport: (({ serverUrl, token }: SyntheticalConfig) => Promise<import("./types").Category[]>) & import("lodash").MemoizedFunction;
26
+ /** 获取分类的接口列表 */
27
+ fetchInterfaceList({ serverUrl, token, id, }: SyntheticalConfig): Promise<InterfaceList>;
28
+ /** 获取项目信息 */
29
+ fetchProjectInfo(syntheticalConfig: SyntheticalConfig): Promise<{
30
+ cats: CategoryList;
31
+ getMockUrl: () => string;
32
+ getDevUrl: (devEnvName: string) => string;
33
+ getProdUrl: (prodEnvName: string) => string;
34
+ _id: number;
35
+ _url: string;
36
+ name: string;
37
+ desc: string;
38
+ basepath: string;
39
+ tag: string[];
40
+ env: {
41
+ name: string;
42
+ domain: string;
43
+ }[];
44
+ }>;
45
+ /** 生成接口代码 */
46
+ generateInterfaceCode(syntheticalConfig: SyntheticalConfig, interfaceInfo: Interface, categoryUID: string): Promise<string>;
47
+ destroy(): Promise<any[]>;
48
+ }
49
+ export {};