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/cjs/Generator.js
CHANGED
|
@@ -274,31 +274,44 @@ var Generator = /*#__PURE__*/function () {
|
|
|
274
274
|
apifoxInstance = null;
|
|
275
275
|
|
|
276
276
|
if (!(serverConfig.serverType === 'apifox')) {
|
|
277
|
-
_context8.next =
|
|
277
|
+
_context8.next = 10;
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
if (projectConfig.projectId) {
|
|
282
|
+
_context8.next = 4;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
throw new Error('projectId is required when serverType is apifox');
|
|
287
|
+
|
|
288
|
+
case 4:
|
|
281
289
|
apifoxInstance = new _ApifoxToYApiData.ApifoxToYApiData({
|
|
282
290
|
token: projectConfig.token,
|
|
283
|
-
|
|
291
|
+
projectId: projectConfig.projectId,
|
|
292
|
+
categories: projectConfig.categories,
|
|
293
|
+
serverUrl: serverConfig.serverUrl,
|
|
294
|
+
addFoldersToTags: projectConfig.addFoldersToTags,
|
|
295
|
+
oasVersion: projectConfig.oasVersion,
|
|
296
|
+
exportFormat: projectConfig.exportFormat
|
|
284
297
|
});
|
|
285
|
-
_context8.next =
|
|
298
|
+
_context8.next = 7;
|
|
286
299
|
return apifoxInstance.getProjectInfo();
|
|
287
300
|
|
|
288
|
-
case
|
|
301
|
+
case 7:
|
|
289
302
|
projectInfo = _context8.sent;
|
|
290
|
-
_context8.next =
|
|
303
|
+
_context8.next = 13;
|
|
291
304
|
break;
|
|
292
305
|
|
|
293
|
-
case
|
|
294
|
-
_context8.next =
|
|
306
|
+
case 10:
|
|
307
|
+
_context8.next = 12;
|
|
295
308
|
return _this3.fetchProjectInfo((0, _extends2.default)({}, serverConfig, projectConfig));
|
|
296
309
|
|
|
297
|
-
case
|
|
310
|
+
case 12:
|
|
298
311
|
projectInfo = _context8.sent;
|
|
299
312
|
|
|
300
|
-
case
|
|
301
|
-
_context8.next =
|
|
313
|
+
case 13:
|
|
314
|
+
_context8.next = 15;
|
|
302
315
|
return Promise.all(projectConfig.categories.map( /*#__PURE__*/function () {
|
|
303
316
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(categoryConfig, categoryIndex) {
|
|
304
317
|
var categoryIds, codes, _iterator, _step, _outputFileList$group, groupedCodes;
|
|
@@ -486,7 +499,7 @@ var Generator = /*#__PURE__*/function () {
|
|
|
486
499
|
};
|
|
487
500
|
}()));
|
|
488
501
|
|
|
489
|
-
case
|
|
502
|
+
case 15:
|
|
490
503
|
case "end":
|
|
491
504
|
return _context8.stop();
|
|
492
505
|
}
|