open-api-typescript-request-generator 0.0.1

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.
Files changed (71) hide show
  1. package/README.md +26 -0
  2. package/bin/apits-gener +4 -0
  3. package/es/Generator.d.ts +43 -0
  4. package/es/Generator.js +892 -0
  5. package/es/cli.d.ts +19 -0
  6. package/es/cli.js +547 -0
  7. package/es/console.d.ts +48 -0
  8. package/es/console.js +151 -0
  9. package/es/constants.d.ts +22 -0
  10. package/es/constants.js +39 -0
  11. package/es/dependenciesHandler.d.ts +16 -0
  12. package/es/dependenciesHandler.js +270 -0
  13. package/es/genIndex.d.ts +23 -0
  14. package/es/genIndex.js +354 -0
  15. package/es/genRequest.d.ts +3 -0
  16. package/es/genRequest.js +216 -0
  17. package/es/getOutputPath.d.ts +5 -0
  18. package/es/getOutputPath.js +28 -0
  19. package/es/helpers.d.ts +63 -0
  20. package/es/helpers.js +458 -0
  21. package/es/index.d.ts +2 -0
  22. package/es/index.js +34 -0
  23. package/es/requestYapiData.d.ts +157 -0
  24. package/es/requestYapiData.js +1010 -0
  25. package/es/responseDataJsonSchemaHandler.d.ts +11 -0
  26. package/es/responseDataJsonSchemaHandler.js +193 -0
  27. package/es/server/mock.d.ts +1 -0
  28. package/es/server/mock.js +7 -0
  29. package/es/server/swaggerJsonToYApiData.d.ts +10 -0
  30. package/es/server/swaggerJsonToYApiData.js +614 -0
  31. package/es/spinner.d.ts +15 -0
  32. package/es/spinner.js +58 -0
  33. package/es/types.d.ts +736 -0
  34. package/es/types.js +143 -0
  35. package/es/utils.d.ts +97 -0
  36. package/es/utils.js +783 -0
  37. package/lib/Generator.d.ts +43 -0
  38. package/lib/Generator.js +892 -0
  39. package/lib/cli.d.ts +19 -0
  40. package/lib/cli.js +547 -0
  41. package/lib/console.d.ts +48 -0
  42. package/lib/console.js +151 -0
  43. package/lib/constants.d.ts +22 -0
  44. package/lib/constants.js +39 -0
  45. package/lib/dependenciesHandler.d.ts +16 -0
  46. package/lib/dependenciesHandler.js +270 -0
  47. package/lib/genIndex.d.ts +23 -0
  48. package/lib/genIndex.js +354 -0
  49. package/lib/genRequest.d.ts +3 -0
  50. package/lib/genRequest.js +216 -0
  51. package/lib/getOutputPath.d.ts +5 -0
  52. package/lib/getOutputPath.js +28 -0
  53. package/lib/helpers.d.ts +63 -0
  54. package/lib/helpers.js +458 -0
  55. package/lib/index.d.ts +2 -0
  56. package/lib/index.js +34 -0
  57. package/lib/requestYapiData.d.ts +157 -0
  58. package/lib/requestYapiData.js +1010 -0
  59. package/lib/responseDataJsonSchemaHandler.d.ts +11 -0
  60. package/lib/responseDataJsonSchemaHandler.js +193 -0
  61. package/lib/server/mock.d.ts +1 -0
  62. package/lib/server/mock.js +7 -0
  63. package/lib/server/swaggerJsonToYApiData.d.ts +10 -0
  64. package/lib/server/swaggerJsonToYApiData.js +614 -0
  65. package/lib/spinner.d.ts +15 -0
  66. package/lib/spinner.js +58 -0
  67. package/lib/types.d.ts +736 -0
  68. package/lib/types.js +143 -0
  69. package/lib/utils.d.ts +97 -0
  70. package/lib/utils.js +783 -0
  71. package/package.json +106 -0
package/lib/helpers.js ADDED
@@ -0,0 +1,458 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ var __assign = void 0 && (void 0).__assign || function () {
6
+ __assign = Object.assign || function (t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+
10
+ for (var p in s) {
11
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
12
+ }
13
+ }
14
+
15
+ return t;
16
+ };
17
+
18
+ return __assign.apply(this, arguments);
19
+ };
20
+
21
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) {
23
+ return value instanceof P ? value : new P(function (resolve) {
24
+ resolve(value);
25
+ });
26
+ }
27
+
28
+ return new (P || (P = Promise))(function (resolve, reject) {
29
+ function fulfilled(value) {
30
+ try {
31
+ step(generator.next(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ }
36
+
37
+ function rejected(value) {
38
+ try {
39
+ step(generator["throw"](value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ }
44
+
45
+ function step(result) {
46
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
47
+ }
48
+
49
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
50
+ });
51
+ };
52
+
53
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
54
+ var _ = {
55
+ label: 0,
56
+ sent: function sent() {
57
+ if (t[0] & 1) throw t[1];
58
+ return t[1];
59
+ },
60
+ trys: [],
61
+ ops: []
62
+ },
63
+ f,
64
+ y,
65
+ t,
66
+ g;
67
+ return g = {
68
+ next: verb(0),
69
+ "throw": verb(1),
70
+ "return": verb(2)
71
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
72
+ return this;
73
+ }), g;
74
+
75
+ function verb(n) {
76
+ return function (v) {
77
+ return step([n, v]);
78
+ };
79
+ }
80
+
81
+ function step(op) {
82
+ if (f) throw new TypeError("Generator is already executing.");
83
+
84
+ while (_) {
85
+ try {
86
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
87
+ if (y = 0, t) op = [op[0] & 2, t.value];
88
+
89
+ switch (op[0]) {
90
+ case 0:
91
+ case 1:
92
+ t = op;
93
+ break;
94
+
95
+ case 4:
96
+ _.label++;
97
+ return {
98
+ value: op[1],
99
+ done: false
100
+ };
101
+
102
+ case 5:
103
+ _.label++;
104
+ y = op[1];
105
+ op = [0];
106
+ continue;
107
+
108
+ case 7:
109
+ op = _.ops.pop();
110
+
111
+ _.trys.pop();
112
+
113
+ continue;
114
+
115
+ default:
116
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
117
+ _ = 0;
118
+ continue;
119
+ }
120
+
121
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
122
+ _.label = op[1];
123
+ break;
124
+ }
125
+
126
+ if (op[0] === 6 && _.label < t[1]) {
127
+ _.label = t[1];
128
+ t = op;
129
+ break;
130
+ }
131
+
132
+ if (t && _.label < t[2]) {
133
+ _.label = t[2];
134
+
135
+ _.ops.push(op);
136
+
137
+ break;
138
+ }
139
+
140
+ if (t[2]) _.ops.pop();
141
+
142
+ _.trys.pop();
143
+
144
+ continue;
145
+ }
146
+
147
+ op = body.call(thisArg, _);
148
+ } catch (e) {
149
+ op = [6, e];
150
+ y = 0;
151
+ } finally {
152
+ f = t = 0;
153
+ }
154
+ }
155
+
156
+ if (op[0] & 5) throw op[1];
157
+ return {
158
+ value: op[0] ? op[1] : void 0,
159
+ done: true
160
+ };
161
+ }
162
+ };
163
+
164
+ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
165
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
166
+ if (ar || !(i in from)) {
167
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
168
+ ar[i] = from[i];
169
+ }
170
+ }
171
+ return to.concat(ar || Array.prototype.slice.call(from));
172
+ };
173
+
174
+ Object.defineProperty(exports, "__esModule", {
175
+ value: true
176
+ });
177
+ exports.autoAsyncSplitQueue = exports.asyncFnArrayOrderRun = exports.prepare = exports.parseRequestData = exports.FileData = exports.defineConfig = void 0;
178
+ /**
179
+ * 定义配置。
180
+ *
181
+ * @param config 配置
182
+ */
183
+
184
+ function defineConfig(config) {
185
+ var configs = config instanceof Array ? config : [config];
186
+ var final = configs.map(function (item) {
187
+ return __assign({
188
+ serverUrl: '',
189
+ typesOnly: false,
190
+ target: 'typescript',
191
+ prodEnvName: 'local',
192
+ outputFilePath: 'src/api',
193
+ dataKey: 'data',
194
+ jsonSchema: {
195
+ enabled: false
196
+ }
197
+ }, item);
198
+ });
199
+ return final;
200
+ }
201
+
202
+ exports.defineConfig = defineConfig;
203
+
204
+ var FileData =
205
+ /** @class */
206
+ function () {
207
+ /**
208
+ * 文件数据辅助类,统一网页、小程序等平台的文件上传。
209
+ *
210
+ * @param originalFileData 原始文件数据
211
+ * @param options 若使用内部的 getFormData,则选项会被其使用
212
+ */
213
+ function FileData(originalFileData, options) {
214
+ this.originalFileData = originalFileData;
215
+ this.options = options;
216
+ }
217
+ /**
218
+ * 获取原始文件数据。
219
+ *
220
+ * @returns 原始文件数据
221
+ */
222
+
223
+
224
+ FileData.prototype.getOriginalFileData = function () {
225
+ return this.originalFileData;
226
+ };
227
+ /**
228
+ * 获取选项。
229
+ */
230
+
231
+
232
+ FileData.prototype.getOptions = function () {
233
+ return this.options;
234
+ };
235
+
236
+ return FileData;
237
+ }();
238
+
239
+ exports.FileData = FileData;
240
+ /**
241
+ * 解析请求数据,从请求数据中分离出普通数据和文件数据。
242
+ *
243
+ * @param [requestData] 要解析的请求数据
244
+ * @returns 包含普通数据(data)和文件数据(fileData)的对象,data、fileData 为空对象时,表示没有此类数据
245
+ */
246
+
247
+ function parseRequestData(requestData) {
248
+ var result = {
249
+ data: {},
250
+ fileData: {}
251
+ };
252
+ /* istanbul ignore else */
253
+
254
+ if (requestData != null) {
255
+ if (_typeof(requestData) === 'object' && !Array.isArray(requestData)) {
256
+ Object.keys(requestData).forEach(function (key) {
257
+ if (requestData[key] && requestData[key] instanceof FileData) {
258
+ result.fileData[key] = requestData[key].getOriginalFileData();
259
+ } else {
260
+ result.data[key] = requestData[key];
261
+ }
262
+ });
263
+ } else {
264
+ result.data = requestData;
265
+ }
266
+ }
267
+
268
+ return result;
269
+ }
270
+
271
+ exports.parseRequestData = parseRequestData;
272
+ /**
273
+ * 准备要传给请求函数的参数。
274
+ */
275
+
276
+ function prepare(requestConfig, requestData) {
277
+ var requestPath = requestConfig.path;
278
+
279
+ var _a = parseRequestData(requestData),
280
+ data = _a.data,
281
+ fileData = _a.fileData;
282
+
283
+ var dataIsObject = data != null && _typeof(data) === 'object' && !Array.isArray(data);
284
+
285
+ if (dataIsObject) {
286
+ // 替换路径参数
287
+ if (Array.isArray(requestConfig.paramNames) && requestConfig.paramNames.length > 0) {
288
+ Object.keys(data).forEach(function (key) {
289
+ if (requestConfig.paramNames.indexOf(key) >= 0) {
290
+ // ref: https://github.com/YMFE/yapi/blob/master/client/containers/Project/Interface/InterfaceList/InterfaceEditForm.js#L465
291
+ requestPath = requestPath.replace(new RegExp("\\{".concat(key, "\\}"), 'g'), data[key]).replace(new RegExp("/:".concat(key, "(?=/|$)"), 'g'), "/".concat(data[key]));
292
+ delete data[key];
293
+ }
294
+ });
295
+ } // 追加查询参数到路径上
296
+
297
+
298
+ var queryString_1 = '';
299
+
300
+ if (Array.isArray(requestConfig.queryNames) && requestConfig.queryNames.length > 0) {
301
+ Object.keys(data).forEach(function (key) {
302
+ if (requestConfig.queryNames.indexOf(key) >= 0) {
303
+ if (data[key] != null) {
304
+ queryString_1 += "".concat(queryString_1 ? '&' : '').concat(encodeURIComponent(key), "=").concat(encodeURIComponent(data[key]));
305
+ }
306
+
307
+ delete data[key];
308
+ }
309
+ });
310
+ }
311
+
312
+ if (queryString_1) {
313
+ requestPath += "".concat(requestPath.indexOf('?') > -1 ? '&' : '?').concat(queryString_1);
314
+ }
315
+ } // 全部数据
316
+
317
+
318
+ var allData = __assign(__assign({}, dataIsObject ? data : {}), fileData); // 获取表单数据
319
+
320
+
321
+ var getFormData = function getFormData() {
322
+ var useNativeFormData = typeof FormData !== 'undefined';
323
+ var useNodeFormData = !useNativeFormData && // https://github.com/fjc0k/vtils/blob/master/src/utils/inNodeJS.ts
324
+ (typeof global === "undefined" ? "undefined" : _typeof(global)) === 'object' && _typeof(global.process) === 'object' && _typeof(global.process.versions) === 'object' && global.process.versions.node != null;
325
+ var UniFormData = useNativeFormData ? FormData : useNodeFormData ? eval("require('form-data')") : undefined;
326
+
327
+ if (!UniFormData) {
328
+ throw new Error('当前环境不支持 FormData');
329
+ }
330
+
331
+ var formData = new UniFormData();
332
+ Object.keys(data).forEach(function (key) {
333
+ formData.append(key, data[key]);
334
+ });
335
+ Object.keys(fileData).forEach(function (key) {
336
+ var options = requestData[key].getOptions();
337
+ formData.append(key, fileData[key], useNativeFormData ? options === null || options === void 0 ? void 0 : options.filename : options);
338
+ });
339
+ return formData;
340
+ };
341
+
342
+ return __assign(__assign({}, requestConfig), {
343
+ path: requestPath,
344
+ rawData: requestData,
345
+ data: data,
346
+ hasFileData: fileData && Object.keys(fileData).length > 0,
347
+ fileData: fileData,
348
+ allData: allData,
349
+ getFormData: getFormData
350
+ });
351
+ }
352
+
353
+ exports.prepare = prepare;
354
+ /**
355
+ * 顺序执行异步函数队列
356
+ * @param fns
357
+ * @param results
358
+ * @returns
359
+ */
360
+
361
+ var asyncFnArrayOrderRun = function asyncFnArrayOrderRun(fns, results) {
362
+ return __awaiter(void 0, void 0, void 0, function () {
363
+ var res, res1;
364
+ return __generator(this, function (_a) {
365
+ switch (_a.label) {
366
+ case 0:
367
+ if (!fns.length) return [3
368
+ /*break*/
369
+ , 3];
370
+ return [4
371
+ /*yield*/
372
+ , fns[0]()];
373
+
374
+ case 1:
375
+ res = _a.sent();
376
+ return [4
377
+ /*yield*/
378
+ , (0, exports.asyncFnArrayOrderRun)(fns.slice(1), __spreadArray(__spreadArray([], results || [], true), [res], false))];
379
+
380
+ case 2:
381
+ res1 = _a.sent();
382
+ return [2
383
+ /*return*/
384
+ , res1];
385
+
386
+ case 3:
387
+ return [2
388
+ /*return*/
389
+ , results || []];
390
+ }
391
+ });
392
+ });
393
+ };
394
+
395
+ exports.asyncFnArrayOrderRun = asyncFnArrayOrderRun;
396
+ /**
397
+ * 并发请求队列
398
+ * @param fns
399
+ * @param limit
400
+ * @returns
401
+ */
402
+
403
+ var autoAsyncSplitQueue = function autoAsyncSplitQueue(fns, limit) {
404
+ if (limit === void 0) {
405
+ limit = 1000;
406
+ }
407
+
408
+ return __awaiter(void 0, void 0, void 0, function () {
409
+ var len, count, splitArray, result;
410
+ return __generator(this, function (_a) {
411
+ switch (_a.label) {
412
+ case 0:
413
+ len = fns.length;
414
+ count = 0;
415
+ splitArray = [];
416
+
417
+ while (count < len) {
418
+ splitArray.push(fns.slice(count, count + limit));
419
+ count += limit;
420
+ }
421
+
422
+ return [4
423
+ /*yield*/
424
+ , (0, exports.asyncFnArrayOrderRun)(splitArray.map(function (item) {
425
+ return function () {
426
+ return __awaiter(void 0, void 0, void 0, function () {
427
+ var res;
428
+ return __generator(this, function (_a) {
429
+ switch (_a.label) {
430
+ case 0:
431
+ return [4
432
+ /*yield*/
433
+ , Promise.all(item.map(function (i) {
434
+ return i();
435
+ }))];
436
+
437
+ case 1:
438
+ res = _a.sent();
439
+ return [2
440
+ /*return*/
441
+ , res];
442
+ }
443
+ });
444
+ });
445
+ };
446
+ }))];
447
+
448
+ case 1:
449
+ result = _a.sent();
450
+ return [2
451
+ /*return*/
452
+ , result.flat()];
453
+ }
454
+ });
455
+ });
456
+ };
457
+
458
+ exports.autoAsyncSplitQueue = autoAsyncSplitQueue;
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './helpers';
package/lib/index.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return m[k];
12
+ }
13
+ };
14
+ }
15
+
16
+ Object.defineProperty(o, k2, desc);
17
+ } : function (o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ });
21
+
22
+ var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
23
+ for (var p in m) {
24
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
25
+ }
26
+ };
27
+
28
+ Object.defineProperty(exports, "__esModule", {
29
+ value: true
30
+ }); // import './typings'; // 需要手动引入,build才不会报错 找不到module!!!!
31
+
32
+ __exportStar(require("./types"), exports);
33
+
34
+ __exportStar(require("./helpers"), exports);
@@ -0,0 +1,157 @@
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
+ getDevUrl: (devEnvName: string) => string;
96
+ getProdUrl: (prodEnvName: string) => string;
97
+ _id: number;
98
+ name: string;
99
+ desc: string; /** 异常了是否执行 `process.exit()` */
100
+ basepath: string;
101
+ tag: string[];
102
+ env: {
103
+ name: string;
104
+ domain: string;
105
+ }[];
106
+ token?: string;
107
+ cat: Category[];
108
+ components?: object[];
109
+ }>;
110
+ /**
111
+ * 获取项目信息
112
+ * @param config
113
+ * @returns
114
+ */
115
+ export declare const fetchProjectInfo: (config: ApiConfig) => Promise<{
116
+ cats: CategoryList;
117
+ getMockUrl: () => string;
118
+ getDevUrl: (devEnvName: string) => string;
119
+ getProdUrl: (prodEnvName: string) => string;
120
+ _id: number;
121
+ name: string;
122
+ desc: string; /** 异常了是否执行 `process.exit()` */
123
+ basepath: string;
124
+ tag: string[];
125
+ env: {
126
+ name: string;
127
+ domain: string;
128
+ }[];
129
+ token?: string;
130
+ cat: Category[];
131
+ components?: object[];
132
+ }>;
133
+ /**
134
+ * 获取单个接口信息 by id
135
+ */
136
+ export declare const fetchInterfaceById: (id: number, config?: ApiConfig) => Promise<Interface>;
137
+ /**
138
+ * 获取分类下的接口列表信息 by id
139
+ */
140
+ export declare const fetchCatInterfaceById: (catid: number, config?: ApiConfig) => Promise<BaseInterfaceInfo[]>;
141
+ /**
142
+ * 批量获取分类下的详细接口信息
143
+ * @param categoryList
144
+ * @param config
145
+ * @returns
146
+ */
147
+ export declare const getInterfacesByCategoryIds: (categoryIds: number[], config?: ApiConfig) => Promise<Interface[]>;
148
+ /**
149
+ * 获取项目信息和接口
150
+ * @param config
151
+ * @returns
152
+ */
153
+ export declare const getProjectInfoAndInterfaces: (config: ApiConfig) => Promise<{
154
+ projectInfo: Project;
155
+ allInterfaceList: Category[];
156
+ }>;
157
+ export {};