yapi-apifox-to-typescript 4.1.3 → 4.2.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/CHANGELOG.md +47 -0
- package/lib/cjs/ApifoxToYApiData.js +393 -265
- package/lib/cjs/Generator.js +24 -11
- package/lib/esm/ApifoxToYApiData.js +392 -265
- package/lib/esm/Generator.js +24 -11
- package/lib/esm/index.d.ts +26 -0
- package/package.json +1 -1
package/lib/esm/Generator.js
CHANGED
|
@@ -251,31 +251,44 @@ export var Generator = /*#__PURE__*/function () {
|
|
|
251
251
|
apifoxInstance = null;
|
|
252
252
|
|
|
253
253
|
if (!(serverConfig.serverType === 'apifox')) {
|
|
254
|
-
_context8.next =
|
|
254
|
+
_context8.next = 10;
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
if (projectConfig.projectId) {
|
|
259
|
+
_context8.next = 4;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
throw new Error('projectId is required when serverType is apifox');
|
|
264
|
+
|
|
265
|
+
case 4:
|
|
258
266
|
apifoxInstance = new ApifoxToYApiData({
|
|
259
267
|
token: projectConfig.token,
|
|
260
|
-
|
|
268
|
+
projectId: projectConfig.projectId,
|
|
269
|
+
categories: projectConfig.categories,
|
|
270
|
+
serverUrl: serverConfig.serverUrl,
|
|
271
|
+
addFoldersToTags: projectConfig.addFoldersToTags,
|
|
272
|
+
oasVersion: projectConfig.oasVersion,
|
|
273
|
+
exportFormat: projectConfig.exportFormat
|
|
261
274
|
});
|
|
262
|
-
_context8.next =
|
|
275
|
+
_context8.next = 7;
|
|
263
276
|
return apifoxInstance.getProjectInfo();
|
|
264
277
|
|
|
265
|
-
case
|
|
278
|
+
case 7:
|
|
266
279
|
projectInfo = _context8.sent;
|
|
267
|
-
_context8.next =
|
|
280
|
+
_context8.next = 13;
|
|
268
281
|
break;
|
|
269
282
|
|
|
270
|
-
case
|
|
271
|
-
_context8.next =
|
|
283
|
+
case 10:
|
|
284
|
+
_context8.next = 12;
|
|
272
285
|
return _this3.fetchProjectInfo(_extends({}, serverConfig, projectConfig));
|
|
273
286
|
|
|
274
|
-
case
|
|
287
|
+
case 12:
|
|
275
288
|
projectInfo = _context8.sent;
|
|
276
289
|
|
|
277
|
-
case
|
|
278
|
-
_context8.next =
|
|
290
|
+
case 13:
|
|
291
|
+
_context8.next = 15;
|
|
279
292
|
return Promise.all(projectConfig.categories.map( /*#__PURE__*/function () {
|
|
280
293
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(categoryConfig, categoryIndex) {
|
|
281
294
|
var categoryIds, codes, _iterator, _step, _outputFileList$group, groupedCodes;
|
|
@@ -463,7 +476,7 @@ export var Generator = /*#__PURE__*/function () {
|
|
|
463
476
|
};
|
|
464
477
|
}()));
|
|
465
478
|
|
|
466
|
-
case
|
|
479
|
+
case 15:
|
|
467
480
|
case "end":
|
|
468
481
|
return _context8.stop();
|
|
469
482
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -489,6 +489,32 @@ export declare interface ProjectConfig extends SharedConfig {
|
|
|
489
489
|
* @example 'e02a47122259d0c1973a9ff81cabb30685d64abc72f39edaa1ac6b6a792a647d'
|
|
490
490
|
*/
|
|
491
491
|
token: string | string[];
|
|
492
|
+
/**
|
|
493
|
+
* 项目ID(Apifox专用)。
|
|
494
|
+
*
|
|
495
|
+
* 获取方式:打开项目 --> 项目设置 --> 基本信息 --> 项目ID。
|
|
496
|
+
*
|
|
497
|
+
* @example 5590448
|
|
498
|
+
*/
|
|
499
|
+
projectId?: number;
|
|
500
|
+
/**
|
|
501
|
+
* 是否将文件夹添加为标签(Apifox专用)。
|
|
502
|
+
*
|
|
503
|
+
* @default true
|
|
504
|
+
*/
|
|
505
|
+
addFoldersToTags?: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* OpenAPI 版本(Apifox专用)。
|
|
508
|
+
*
|
|
509
|
+
* @default '3.0'
|
|
510
|
+
*/
|
|
511
|
+
oasVersion?: string;
|
|
512
|
+
/**
|
|
513
|
+
* 导出格式(Apifox专用)。
|
|
514
|
+
*
|
|
515
|
+
* @default 'JSON'
|
|
516
|
+
*/
|
|
517
|
+
exportFormat?: 'JSON' | 'YAML';
|
|
492
518
|
/**
|
|
493
519
|
* 分类列表。
|
|
494
520
|
*/
|