@dudousxd/nestjs-codegen 0.17.0 → 0.17.1

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.
@@ -4020,6 +4020,19 @@ function resolveParamClass(method, decoratorName, sourceFile, project) {
4020
4020
 
4021
4021
  // src/discovery/heritage.ts
4022
4022
  var import_ts_morph8 = require("ts-morph");
4023
+ function resolveHeritageCall(node) {
4024
+ if (!node) return void 0;
4025
+ const expr = unwrapExpression(node);
4026
+ if (import_ts_morph8.Node.isCallExpression(expr)) return expr;
4027
+ if (!import_ts_morph8.Node.isIdentifier(expr)) return void 0;
4028
+ const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
4029
+ (n) => n !== void 0 && import_ts_morph8.Node.isVariableDeclaration(n)
4030
+ );
4031
+ const init = decl?.getInitializer();
4032
+ if (!init) return void 0;
4033
+ const unwrapped = unwrapExpression(init);
4034
+ return import_ts_morph8.Node.isCallExpression(unwrapped) ? unwrapped : void 0;
4035
+ }
4023
4036
  function unwrapExpression(node) {
4024
4037
  let current = node;
4025
4038
  while (import_ts_morph8.Node.isAsExpression(current) || import_ts_morph8.Node.isSatisfiesExpression(current) || import_ts_morph8.Node.isParenthesizedExpression(current) || import_ts_morph8.Node.isTypeAssertion(current)) {
@@ -4047,8 +4060,8 @@ function resolveReturnedClass(factoryDecl) {
4047
4060
  return void 0;
4048
4061
  }
4049
4062
  function resolveInheritedMethods(cls) {
4050
- const expr = cls.getExtends()?.getExpression();
4051
- if (!expr || !import_ts_morph8.Node.isCallExpression(expr)) return void 0;
4063
+ const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
4064
+ if (!expr) return void 0;
4052
4065
  const callee = expr.getExpression();
4053
4066
  if (!import_ts_morph8.Node.isIdentifier(callee)) return void 0;
4054
4067
  const factoryDecl = callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph8.Node.isFunctionDeclaration(n));
@@ -4584,9 +4597,11 @@ function extractFromSourceFile(sourceFile, project) {
4584
4597
  factoryFilePath: inherited.factoryFilePath,
4585
4598
  classArgs: inherited.classArgs
4586
4599
  } : void 0;
4600
+ const ownMethods = cls.getMethods();
4601
+ const ownNames = new Set(ownMethods.map((m) => m.getName()));
4587
4602
  const methods = [
4588
- ...cls.getMethods().map((method) => ({ method })),
4589
- ...(inherited?.methods ?? []).map((method) => ({ method, mixin: mixinBinding }))
4603
+ ...ownMethods.map((method) => ({ method, mixin: mixinBinding })),
4604
+ ...(inherited?.methods ?? []).filter((method) => !ownNames.has(method.getName())).map((method) => ({ method, mixin: mixinBinding }))
4590
4605
  ];
4591
4606
  for (const { method, mixin } of methods) {
4592
4607
  const verb = resolveVerb(method);
@@ -4812,7 +4827,7 @@ async function watch(config, onChange, options = {}) {
4812
4827
  }
4813
4828
 
4814
4829
  // src/index.ts
4815
- var VERSION = "0.17.0";
4830
+ var VERSION = "0.17.1";
4816
4831
 
4817
4832
  // src/generate-manifest.ts
4818
4833
  var MANIFEST_FILE = ".codegen-manifest.json";