open-api-typescript-request-generator 0.0.1-alpha.2 → 0.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.
- package/README.md +11 -10
- package/es/Generator.js +26 -192
- package/es/cli.d.ts +3 -1
- package/es/cli.js +63 -23
- package/es/constants.d.ts +0 -1
- package/es/constants.js +1 -2
- package/es/genIndex.js +4 -6
- package/es/genRequest.js +4 -10
- package/es/helpers.d.ts +1 -1
- package/es/helpers.js +1 -7
- package/es/responseDataJsonSchemaHandler.js +1 -1
- package/es/types.d.ts +20 -212
- package/es/utils.d.ts +4 -10
- package/es/utils.js +8 -44
- package/lib/Generator.js +26 -192
- package/lib/cli.d.ts +3 -1
- package/lib/cli.js +63 -23
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +1 -2
- package/lib/genIndex.js +4 -6
- package/lib/genRequest.js +4 -10
- package/lib/helpers.d.ts +1 -1
- package/lib/helpers.js +1 -7
- package/lib/responseDataJsonSchemaHandler.js +1 -1
- package/lib/types.d.ts +20 -212
- package/lib/utils.d.ts +4 -10
- package/lib/utils.js +8 -44
- package/package.json +3 -2
- package/es/requestYapiData.d.ts +0 -153
- package/es/requestYapiData.js +0 -978
- package/lib/requestYapiData.d.ts +0 -153
- package/lib/requestYapiData.js +0 -978
package/lib/requestYapiData.d.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取yapi数据
|
|
3
|
-
*/
|
|
4
|
-
import { Options } from 'got';
|
|
5
|
-
import { CategoryList, Category, Project, SyntheticalConfig, Interface, BaseInterfaceInfo } from './types';
|
|
6
|
-
import prompts from 'prompts';
|
|
7
|
-
declare type ApiConfig = SyntheticalConfig & {
|
|
8
|
-
method?: Options['method'];
|
|
9
|
-
/** 异常了是否执行 `process.exit()` */
|
|
10
|
-
errorExit?: boolean;
|
|
11
|
-
};
|
|
12
|
-
declare const inputs: readonly [{
|
|
13
|
-
readonly type: "text";
|
|
14
|
-
readonly name: "email";
|
|
15
|
-
readonly message: "请输入yapi的邮箱账号";
|
|
16
|
-
readonly validate: prompts.PrevCaller<"email", string | boolean>;
|
|
17
|
-
}, {
|
|
18
|
-
readonly type: "password";
|
|
19
|
-
readonly name: "password";
|
|
20
|
-
readonly message: "请输入密码";
|
|
21
|
-
readonly validate: prompts.PrevCaller<"password", string | boolean>;
|
|
22
|
-
}];
|
|
23
|
-
declare type NameValueKey = typeof inputs[number]['name'];
|
|
24
|
-
/**
|
|
25
|
-
* 登录提示框,账号密码录入
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
export declare const loginPrompts: (serverUrl?: string) => Promise<{
|
|
29
|
-
email: string;
|
|
30
|
-
password: string;
|
|
31
|
-
}>;
|
|
32
|
-
export declare type LoginProps = {
|
|
33
|
-
[k in NameValueKey]: string;
|
|
34
|
-
};
|
|
35
|
-
export declare type LoginResponseData = {
|
|
36
|
-
email: string;
|
|
37
|
-
role: string;
|
|
38
|
-
study: boolean;
|
|
39
|
-
type: string;
|
|
40
|
-
uid: number;
|
|
41
|
-
username: string;
|
|
42
|
-
};
|
|
43
|
-
declare type FetchApiData = {
|
|
44
|
-
token?: string;
|
|
45
|
-
[k: string]: any;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param url 请求方法
|
|
50
|
-
* @param query
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
export declare const fetchApi: <T>(path: string, data: FetchApiData, config?: ApiConfig) => Promise<T>;
|
|
54
|
-
/**
|
|
55
|
-
* 获取项目token
|
|
56
|
-
*/
|
|
57
|
-
export declare const fetchToken: (id: number, config?: ApiConfig) => Promise<string>;
|
|
58
|
-
/**
|
|
59
|
-
* 获取项目基本信息 by id
|
|
60
|
-
*/
|
|
61
|
-
export declare const fetchProjectById: (config: ApiConfig) => Promise<Project>;
|
|
62
|
-
/**
|
|
63
|
-
* 获取项目基本信息
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
export declare const fetchProject: (config: ApiConfig) => Promise<Project>;
|
|
67
|
-
/**
|
|
68
|
-
* 通过导出接口获取项目下的所有接口 by id
|
|
69
|
-
*/
|
|
70
|
-
export declare const fetchExportById: (config: ApiConfig) => Promise<Category[]>;
|
|
71
|
-
/**
|
|
72
|
-
* 通过导出接口获取项目下的所有接口
|
|
73
|
-
*/
|
|
74
|
-
export declare const fetchExport: (config: ApiConfig) => Promise<Category[]>;
|
|
75
|
-
/**
|
|
76
|
-
* 获取所有接口 by id
|
|
77
|
-
* @param param0
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
export declare const fetchInterfaceListById: (config: ApiConfig) => Promise<Category[]>;
|
|
81
|
-
/**
|
|
82
|
-
* 获取所有接口
|
|
83
|
-
* @param param0
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
|
-
export declare const fetchInterfaceList: (config: ApiConfig) => Promise<Category[]>;
|
|
87
|
-
/**
|
|
88
|
-
* 获取项目信息 by id
|
|
89
|
-
* @param config
|
|
90
|
-
* @returns
|
|
91
|
-
*/
|
|
92
|
-
export declare const fetchProjectInfoById: (config: ApiConfig) => Promise<{
|
|
93
|
-
cats: CategoryList;
|
|
94
|
-
getMockUrl: () => string;
|
|
95
|
-
_id: number;
|
|
96
|
-
name: string;
|
|
97
|
-
desc: string; /** 异常了是否执行 `process.exit()` */
|
|
98
|
-
basepath: string;
|
|
99
|
-
tag: string[];
|
|
100
|
-
env: {
|
|
101
|
-
name: string;
|
|
102
|
-
domain: string;
|
|
103
|
-
}[];
|
|
104
|
-
token?: string;
|
|
105
|
-
cat: Category[];
|
|
106
|
-
components?: object[];
|
|
107
|
-
}>;
|
|
108
|
-
/**
|
|
109
|
-
* 获取项目信息
|
|
110
|
-
* @param config
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
export declare const fetchProjectInfo: (config: ApiConfig) => Promise<{
|
|
114
|
-
cats: CategoryList;
|
|
115
|
-
getMockUrl: () => string;
|
|
116
|
-
_id: number;
|
|
117
|
-
name: string;
|
|
118
|
-
desc: string; /** 异常了是否执行 `process.exit()` */
|
|
119
|
-
basepath: string;
|
|
120
|
-
tag: string[];
|
|
121
|
-
env: {
|
|
122
|
-
name: string;
|
|
123
|
-
domain: string;
|
|
124
|
-
}[];
|
|
125
|
-
token?: string;
|
|
126
|
-
cat: Category[];
|
|
127
|
-
components?: object[];
|
|
128
|
-
}>;
|
|
129
|
-
/**
|
|
130
|
-
* 获取单个接口信息 by id
|
|
131
|
-
*/
|
|
132
|
-
export declare const fetchInterfaceById: (id: number, config?: ApiConfig) => Promise<Interface>;
|
|
133
|
-
/**
|
|
134
|
-
* 获取分类下的接口列表信息 by id
|
|
135
|
-
*/
|
|
136
|
-
export declare const fetchCatInterfaceById: (catid: number, config?: ApiConfig) => Promise<BaseInterfaceInfo[]>;
|
|
137
|
-
/**
|
|
138
|
-
* 批量获取分类下的详细接口信息
|
|
139
|
-
* @param categoryList
|
|
140
|
-
* @param config
|
|
141
|
-
* @returns
|
|
142
|
-
*/
|
|
143
|
-
export declare const getInterfacesByCategoryIds: (categoryIds: number[], config?: ApiConfig) => Promise<Interface[]>;
|
|
144
|
-
/**
|
|
145
|
-
* 获取项目信息和接口
|
|
146
|
-
* @param config
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
|
-
export declare const getProjectInfoAndInterfaces: (config: ApiConfig) => Promise<{
|
|
150
|
-
projectInfo: Project;
|
|
151
|
-
allInterfaceList: Category[];
|
|
152
|
-
}>;
|
|
153
|
-
export {};
|