@dudousxd/nestjs-codegen 0.24.0 → 0.25.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/CHANGELOG.md +34 -0
- package/dist/cli/main.cjs +29 -3
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +29 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +29 -3
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.d.cts +1 -1
- package/dist/nest/index.d.ts +1 -1
- package/dist/nest/index.js +29 -3
- package/dist/nest/index.js.map +1 -1
- package/package.json +3 -3
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.
|
|
385
|
+
declare const VERSION = "0.25.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.
|
|
385
|
+
declare const VERSION = "0.25.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
|
@@ -1640,6 +1640,32 @@ function resolveFactoryStaticClass(node) {
|
|
|
1640
1640
|
if (!Node5.isIdentifier(inner)) return void 0;
|
|
1641
1641
|
return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && Node5.isClassDeclaration(n));
|
|
1642
1642
|
}
|
|
1643
|
+
function resolveBaseClass(cls) {
|
|
1644
|
+
const heritage = cls.getExtends()?.getExpression();
|
|
1645
|
+
if (!heritage) return void 0;
|
|
1646
|
+
const call = resolveHeritageCall(heritage);
|
|
1647
|
+
if (call) {
|
|
1648
|
+
const factoryDecl = resolveFactoryDeclaration(call);
|
|
1649
|
+
return factoryDecl ? resolveReturnedClass(factoryDecl) : void 0;
|
|
1650
|
+
}
|
|
1651
|
+
const expr = unwrapExpression(heritage);
|
|
1652
|
+
if (!Node5.isIdentifier(expr)) return void 0;
|
|
1653
|
+
return expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && Node5.isClassDeclaration(n));
|
|
1654
|
+
}
|
|
1655
|
+
function collectMethodsThroughChain(returnedClass) {
|
|
1656
|
+
const byName = /* @__PURE__ */ new Map();
|
|
1657
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1658
|
+
let current = returnedClass;
|
|
1659
|
+
while (current && !seen.has(current)) {
|
|
1660
|
+
seen.add(current);
|
|
1661
|
+
for (const method of current.getMethods()) {
|
|
1662
|
+
const name = method.getName();
|
|
1663
|
+
if (!byName.has(name)) byName.set(name, method);
|
|
1664
|
+
}
|
|
1665
|
+
current = resolveBaseClass(current);
|
|
1666
|
+
}
|
|
1667
|
+
return [...byName.values()];
|
|
1668
|
+
}
|
|
1643
1669
|
function resolveInheritedMethods(cls) {
|
|
1644
1670
|
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
1645
1671
|
if (!expr) return void 0;
|
|
@@ -1679,7 +1705,7 @@ function resolveInheritedMethods(cls) {
|
|
|
1679
1705
|
}
|
|
1680
1706
|
}
|
|
1681
1707
|
return {
|
|
1682
|
-
methods: returnedClass
|
|
1708
|
+
methods: collectMethodsThroughChain(returnedClass),
|
|
1683
1709
|
// The DECLARATION's name, not the call-site text: consumers look the factory
|
|
1684
1710
|
// back up by name inside `factoryFilePath`, which a qualified
|
|
1685
1711
|
// `tables.createTableController` would never match. For a bare identifier
|
|
@@ -3053,7 +3079,7 @@ function extractDtoRoute(args) {
|
|
|
3053
3079
|
const methodName = method.getName();
|
|
3054
3080
|
const classAs = readAsDecorator(cls, `class ${className}`);
|
|
3055
3081
|
const methodAs = readAsDecorator(method, `${className}.${methodName}`);
|
|
3056
|
-
const dtoContract = extractDtoContract(method,
|
|
3082
|
+
const dtoContract = extractDtoContract(method, method.getSourceFile(), project, mixin, cls);
|
|
3057
3083
|
const mixinResponse = mixin ? resolveInstantiatedReturnType(cls, methodName) : void 0;
|
|
3058
3084
|
return buildRoute({
|
|
3059
3085
|
className,
|
|
@@ -5346,7 +5372,7 @@ function createChainModuleRenderer(opts) {
|
|
|
5346
5372
|
}
|
|
5347
5373
|
|
|
5348
5374
|
// src/index.ts
|
|
5349
|
-
var VERSION = "0.
|
|
5375
|
+
var VERSION = "0.25.1";
|
|
5350
5376
|
export {
|
|
5351
5377
|
CodegenError,
|
|
5352
5378
|
ConfigError,
|