yapi-apifox-to-typescript 4.1.2 → 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.
@@ -274,31 +274,44 @@ var Generator = /*#__PURE__*/function () {
274
274
  apifoxInstance = null;
275
275
 
276
276
  if (!(serverConfig.serverType === 'apifox')) {
277
- _context8.next = 8;
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
- categories: projectConfig.categories
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 = 5;
298
+ _context8.next = 7;
286
299
  return apifoxInstance.getProjectInfo();
287
300
 
288
- case 5:
301
+ case 7:
289
302
  projectInfo = _context8.sent;
290
- _context8.next = 11;
303
+ _context8.next = 13;
291
304
  break;
292
305
 
293
- case 8:
294
- _context8.next = 10;
306
+ case 10:
307
+ _context8.next = 12;
295
308
  return _this3.fetchProjectInfo((0, _extends2.default)({}, serverConfig, projectConfig));
296
309
 
297
- case 10:
310
+ case 12:
298
311
  projectInfo = _context8.sent;
299
312
 
300
- case 11:
301
- _context8.next = 13;
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 13:
502
+ case 15:
490
503
  case "end":
491
504
  return _context8.stop();
492
505
  }
package/lib/cjs/utils.js CHANGED
@@ -802,6 +802,10 @@ var getFilteredCat = function getFilteredCat(cat, cats, isApifox) {
802
802
  return c._id === id;
803
803
  });
804
804
  });
805
+ } else {
806
+ categoryIds = categoryIds.filter(function (id) {
807
+ return id !== 0;
808
+ });
805
809
  } // 顺序化
806
810
 
807
811