@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.
package/dist/index.d.cts CHANGED
@@ -382,6 +382,6 @@ interface FastDiscoveryOptions {
382
382
  }
383
383
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
384
384
 
385
- declare const VERSION = "0.17.0";
385
+ declare const VERSION = "0.17.1";
386
386
 
387
387
  export { type ChainModuleRendererOptions, CodegenError, type CodegenManifest, ConfigError, DriftGuardError, type EntryPoint, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, type WatchOptions, type Watcher, acquireLock, buildMocksFile, buildOpenApiSpec, createChainModuleRenderer, defineConfig, discoverContractsFast, emitApi, emitForms, emitMocks, emitOpenApi, emitRoutes, extractSchemaFromDto, generate, loadConfig, renderTsType, resolveConfig, schemaModuleToJsonSchema, schemaNodeToJsonSchema, toObjectKey, typeNameFor, watch };
package/dist/index.d.ts CHANGED
@@ -382,6 +382,6 @@ interface FastDiscoveryOptions {
382
382
  }
383
383
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
384
384
 
385
- declare const VERSION = "0.17.0";
385
+ declare const VERSION = "0.17.1";
386
386
 
387
387
  export { type ChainModuleRendererOptions, CodegenError, type CodegenManifest, ConfigError, DriftGuardError, type EntryPoint, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, type WatchOptions, type Watcher, acquireLock, buildMocksFile, buildOpenApiSpec, createChainModuleRenderer, defineConfig, discoverContractsFast, emitApi, emitForms, emitMocks, emitOpenApi, emitRoutes, extractSchemaFromDto, generate, loadConfig, renderTsType, resolveConfig, schemaModuleToJsonSchema, schemaNodeToJsonSchema, toObjectKey, typeNameFor, watch };
package/dist/index.js CHANGED
@@ -4192,6 +4192,19 @@ function resolveParamClass(method, decoratorName, sourceFile, project) {
4192
4192
 
4193
4193
  // src/discovery/heritage.ts
4194
4194
  import { Node as Node7, Project as Project3 } from "ts-morph";
4195
+ function resolveHeritageCall(node) {
4196
+ if (!node) return void 0;
4197
+ const expr = unwrapExpression(node);
4198
+ if (Node7.isCallExpression(expr)) return expr;
4199
+ if (!Node7.isIdentifier(expr)) return void 0;
4200
+ const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
4201
+ (n) => n !== void 0 && Node7.isVariableDeclaration(n)
4202
+ );
4203
+ const init = decl?.getInitializer();
4204
+ if (!init) return void 0;
4205
+ const unwrapped = unwrapExpression(init);
4206
+ return Node7.isCallExpression(unwrapped) ? unwrapped : void 0;
4207
+ }
4195
4208
  function unwrapExpression(node) {
4196
4209
  let current = node;
4197
4210
  while (Node7.isAsExpression(current) || Node7.isSatisfiesExpression(current) || Node7.isParenthesizedExpression(current) || Node7.isTypeAssertion(current)) {
@@ -4219,8 +4232,8 @@ function resolveReturnedClass(factoryDecl) {
4219
4232
  return void 0;
4220
4233
  }
4221
4234
  function resolveInheritedMethods(cls) {
4222
- const expr = cls.getExtends()?.getExpression();
4223
- if (!expr || !Node7.isCallExpression(expr)) return void 0;
4235
+ const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
4236
+ if (!expr) return void 0;
4224
4237
  const callee = expr.getExpression();
4225
4238
  if (!Node7.isIdentifier(callee)) return void 0;
4226
4239
  const factoryDecl = callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => Node7.isFunctionDeclaration(n));
@@ -4775,9 +4788,11 @@ function extractFromSourceFile(sourceFile, project) {
4775
4788
  factoryFilePath: inherited.factoryFilePath,
4776
4789
  classArgs: inherited.classArgs
4777
4790
  } : void 0;
4791
+ const ownMethods = cls.getMethods();
4792
+ const ownNames = new Set(ownMethods.map((m) => m.getName()));
4778
4793
  const methods = [
4779
- ...cls.getMethods().map((method) => ({ method })),
4780
- ...(inherited?.methods ?? []).map((method) => ({ method, mixin: mixinBinding }))
4794
+ ...ownMethods.map((method) => ({ method, mixin: mixinBinding })),
4795
+ ...(inherited?.methods ?? []).filter((method) => !ownNames.has(method.getName())).map((method) => ({ method, mixin: mixinBinding }))
4781
4796
  ];
4782
4797
  for (const { method, mixin } of methods) {
4783
4798
  const verb = resolveVerb(method);
@@ -5086,7 +5101,7 @@ function createChainModuleRenderer(opts) {
5086
5101
  }
5087
5102
 
5088
5103
  // src/index.ts
5089
- var VERSION = "0.17.0";
5104
+ var VERSION = "0.17.1";
5090
5105
  export {
5091
5106
  CodegenError,
5092
5107
  ConfigError,