@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.
@@ -1259,6 +1259,32 @@ function resolveFactoryStaticClass(node) {
1259
1259
  if (!Node4.isIdentifier(inner)) return void 0;
1260
1260
  return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && Node4.isClassDeclaration(n));
1261
1261
  }
1262
+ function resolveBaseClass(cls) {
1263
+ const heritage = cls.getExtends()?.getExpression();
1264
+ if (!heritage) return void 0;
1265
+ const call = resolveHeritageCall(heritage);
1266
+ if (call) {
1267
+ const factoryDecl = resolveFactoryDeclaration(call);
1268
+ return factoryDecl ? resolveReturnedClass(factoryDecl) : void 0;
1269
+ }
1270
+ const expr = unwrapExpression(heritage);
1271
+ if (!Node4.isIdentifier(expr)) return void 0;
1272
+ return expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && Node4.isClassDeclaration(n));
1273
+ }
1274
+ function collectMethodsThroughChain(returnedClass) {
1275
+ const byName = /* @__PURE__ */ new Map();
1276
+ const seen = /* @__PURE__ */ new Set();
1277
+ let current = returnedClass;
1278
+ while (current && !seen.has(current)) {
1279
+ seen.add(current);
1280
+ for (const method of current.getMethods()) {
1281
+ const name = method.getName();
1282
+ if (!byName.has(name)) byName.set(name, method);
1283
+ }
1284
+ current = resolveBaseClass(current);
1285
+ }
1286
+ return [...byName.values()];
1287
+ }
1262
1288
  function resolveInheritedMethods(cls) {
1263
1289
  const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
1264
1290
  if (!expr) return void 0;
@@ -1298,7 +1324,7 @@ function resolveInheritedMethods(cls) {
1298
1324
  }
1299
1325
  }
1300
1326
  return {
1301
- methods: returnedClass.getMethods(),
1327
+ methods: collectMethodsThroughChain(returnedClass),
1302
1328
  // The DECLARATION's name, not the call-site text: consumers look the factory
1303
1329
  // back up by name inside `factoryFilePath`, which a qualified
1304
1330
  // `tables.createTableController` would never match. For a bare identifier
@@ -2652,7 +2678,7 @@ function extractDtoRoute(args) {
2652
2678
  const methodName = method.getName();
2653
2679
  const classAs = readAsDecorator(cls, `class ${className}`);
2654
2680
  const methodAs = readAsDecorator(method, `${className}.${methodName}`);
2655
- const dtoContract = extractDtoContract(method, sourceFile, project, mixin, cls);
2681
+ const dtoContract = extractDtoContract(method, method.getSourceFile(), project, mixin, cls);
2656
2682
  const mixinResponse = mixin ? resolveInstantiatedReturnType(cls, methodName) : void 0;
2657
2683
  return buildRoute({
2658
2684
  className,
@@ -5036,7 +5062,7 @@ async function watch(config, onChange, options = {}) {
5036
5062
  }
5037
5063
 
5038
5064
  // src/index.ts
5039
- var VERSION = "0.24.0";
5065
+ var VERSION = "0.25.0";
5040
5066
 
5041
5067
  // src/generate-manifest.ts
5042
5068
  var MANIFEST_FILE = ".codegen-manifest.json";