@dudousxd/nestjs-codegen 0.24.0 → 0.25.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.
@@ -1282,6 +1282,32 @@ function resolveFactoryStaticClass(node) {
1282
1282
  if (!import_ts_morph4.Node.isIdentifier(inner)) return void 0;
1283
1283
  return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph4.Node.isClassDeclaration(n));
1284
1284
  }
1285
+ function resolveBaseClass(cls) {
1286
+ const heritage = cls.getExtends()?.getExpression();
1287
+ if (!heritage) return void 0;
1288
+ const call = resolveHeritageCall(heritage);
1289
+ if (call) {
1290
+ const factoryDecl = resolveFactoryDeclaration(call);
1291
+ return factoryDecl ? resolveReturnedClass(factoryDecl) : void 0;
1292
+ }
1293
+ const expr = unwrapExpression(heritage);
1294
+ if (!import_ts_morph4.Node.isIdentifier(expr)) return void 0;
1295
+ return expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph4.Node.isClassDeclaration(n));
1296
+ }
1297
+ function collectMethodsThroughChain(returnedClass) {
1298
+ const byName = /* @__PURE__ */ new Map();
1299
+ const seen = /* @__PURE__ */ new Set();
1300
+ let current = returnedClass;
1301
+ while (current && !seen.has(current)) {
1302
+ seen.add(current);
1303
+ for (const method of current.getMethods()) {
1304
+ const name = method.getName();
1305
+ if (!byName.has(name)) byName.set(name, method);
1306
+ }
1307
+ current = resolveBaseClass(current);
1308
+ }
1309
+ return [...byName.values()];
1310
+ }
1285
1311
  function resolveInheritedMethods(cls) {
1286
1312
  const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
1287
1313
  if (!expr) return void 0;
@@ -1321,7 +1347,7 @@ function resolveInheritedMethods(cls) {
1321
1347
  }
1322
1348
  }
1323
1349
  return {
1324
- methods: returnedClass.getMethods(),
1350
+ methods: collectMethodsThroughChain(returnedClass),
1325
1351
  // The DECLARATION's name, not the call-site text: consumers look the factory
1326
1352
  // back up by name inside `factoryFilePath`, which a qualified
1327
1353
  // `tables.createTableController` would never match. For a bare identifier
@@ -2675,7 +2701,7 @@ function extractDtoRoute(args) {
2675
2701
  const methodName = method.getName();
2676
2702
  const classAs = readAsDecorator(cls, `class ${className}`);
2677
2703
  const methodAs = readAsDecorator(method, `${className}.${methodName}`);
2678
- const dtoContract = extractDtoContract(method, sourceFile, project, mixin, cls);
2704
+ const dtoContract = extractDtoContract(method, method.getSourceFile(), project, mixin, cls);
2679
2705
  const mixinResponse = mixin ? resolveInstantiatedReturnType(cls, methodName) : void 0;
2680
2706
  return buildRoute({
2681
2707
  className,
@@ -5059,7 +5085,7 @@ async function watch(config, onChange, options = {}) {
5059
5085
  }
5060
5086
 
5061
5087
  // src/index.ts
5062
- var VERSION = "0.24.0";
5088
+ var VERSION = "0.25.0";
5063
5089
 
5064
5090
  // src/generate-manifest.ts
5065
5091
  var MANIFEST_FILE = ".codegen-manifest.json";