@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.cjs
CHANGED
|
@@ -1685,6 +1685,32 @@ function resolveFactoryStaticClass(node) {
|
|
|
1685
1685
|
if (!import_ts_morph5.Node.isIdentifier(inner)) return void 0;
|
|
1686
1686
|
return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph5.Node.isClassDeclaration(n));
|
|
1687
1687
|
}
|
|
1688
|
+
function resolveBaseClass(cls) {
|
|
1689
|
+
const heritage = cls.getExtends()?.getExpression();
|
|
1690
|
+
if (!heritage) return void 0;
|
|
1691
|
+
const call = resolveHeritageCall(heritage);
|
|
1692
|
+
if (call) {
|
|
1693
|
+
const factoryDecl = resolveFactoryDeclaration(call);
|
|
1694
|
+
return factoryDecl ? resolveReturnedClass(factoryDecl) : void 0;
|
|
1695
|
+
}
|
|
1696
|
+
const expr = unwrapExpression(heritage);
|
|
1697
|
+
if (!import_ts_morph5.Node.isIdentifier(expr)) return void 0;
|
|
1698
|
+
return expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph5.Node.isClassDeclaration(n));
|
|
1699
|
+
}
|
|
1700
|
+
function collectMethodsThroughChain(returnedClass) {
|
|
1701
|
+
const byName = /* @__PURE__ */ new Map();
|
|
1702
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1703
|
+
let current = returnedClass;
|
|
1704
|
+
while (current && !seen.has(current)) {
|
|
1705
|
+
seen.add(current);
|
|
1706
|
+
for (const method of current.getMethods()) {
|
|
1707
|
+
const name = method.getName();
|
|
1708
|
+
if (!byName.has(name)) byName.set(name, method);
|
|
1709
|
+
}
|
|
1710
|
+
current = resolveBaseClass(current);
|
|
1711
|
+
}
|
|
1712
|
+
return [...byName.values()];
|
|
1713
|
+
}
|
|
1688
1714
|
function resolveInheritedMethods(cls) {
|
|
1689
1715
|
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
1690
1716
|
if (!expr) return void 0;
|
|
@@ -1724,7 +1750,7 @@ function resolveInheritedMethods(cls) {
|
|
|
1724
1750
|
}
|
|
1725
1751
|
}
|
|
1726
1752
|
return {
|
|
1727
|
-
methods: returnedClass
|
|
1753
|
+
methods: collectMethodsThroughChain(returnedClass),
|
|
1728
1754
|
// The DECLARATION's name, not the call-site text: consumers look the factory
|
|
1729
1755
|
// back up by name inside `factoryFilePath`, which a qualified
|
|
1730
1756
|
// `tables.createTableController` would never match. For a bare identifier
|
|
@@ -3098,7 +3124,7 @@ function extractDtoRoute(args) {
|
|
|
3098
3124
|
const methodName = method.getName();
|
|
3099
3125
|
const classAs = readAsDecorator(cls, `class ${className}`);
|
|
3100
3126
|
const methodAs = readAsDecorator(method, `${className}.${methodName}`);
|
|
3101
|
-
const dtoContract = extractDtoContract(method,
|
|
3127
|
+
const dtoContract = extractDtoContract(method, method.getSourceFile(), project, mixin, cls);
|
|
3102
3128
|
const mixinResponse = mixin ? resolveInstantiatedReturnType(cls, methodName) : void 0;
|
|
3103
3129
|
return buildRoute({
|
|
3104
3130
|
className,
|
|
@@ -5391,7 +5417,7 @@ function createChainModuleRenderer(opts) {
|
|
|
5391
5417
|
}
|
|
5392
5418
|
|
|
5393
5419
|
// src/index.ts
|
|
5394
|
-
var VERSION = "0.
|
|
5420
|
+
var VERSION = "0.25.1";
|
|
5395
5421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5396
5422
|
0 && (module.exports = {
|
|
5397
5423
|
CodegenError,
|