@dudousxd/nestjs-codegen 0.17.1 → 0.18.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.
- package/CHANGELOG.md +48 -0
- package/dist/cli/main.cjs +228 -174
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +222 -168
- package/dist/cli/main.js.map +1 -1
- package/dist/extension/index.d.cts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/{index-DCF9QSPY.d.cts → index-Dyf4ttwU.d.cts} +24 -1
- package/dist/{index-DCF9QSPY.d.ts → index-Dyf4ttwU.d.ts} +24 -1
- package/dist/index.cjs +228 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +222 -168
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +228 -174
- 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 +222 -168
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2510,7 +2510,7 @@ var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
|
2510
2510
|
var import_ts_morph10 = require("ts-morph");
|
|
2511
2511
|
|
|
2512
2512
|
// src/discovery/dto-type-resolver.ts
|
|
2513
|
-
var
|
|
2513
|
+
var import_ts_morph8 = require("ts-morph");
|
|
2514
2514
|
|
|
2515
2515
|
// src/discovery/dto-to-ir.ts
|
|
2516
2516
|
var import_ts_morph4 = require("ts-morph");
|
|
@@ -3266,7 +3266,7 @@ function inSchemaFromDecorator(decorator) {
|
|
|
3266
3266
|
}
|
|
3267
3267
|
|
|
3268
3268
|
// src/discovery/filter-for.ts
|
|
3269
|
-
var
|
|
3269
|
+
var import_ts_morph7 = require("ts-morph");
|
|
3270
3270
|
|
|
3271
3271
|
// src/discovery/filter-field-types.ts
|
|
3272
3272
|
var import_ts_morph5 = require("ts-morph");
|
|
@@ -3485,15 +3485,161 @@ function toFilterFieldType(name, r) {
|
|
|
3485
3485
|
return ft;
|
|
3486
3486
|
}
|
|
3487
3487
|
|
|
3488
|
+
// src/discovery/heritage.ts
|
|
3489
|
+
var import_ts_morph6 = require("ts-morph");
|
|
3490
|
+
function resolveHeritageCall(node) {
|
|
3491
|
+
if (!node) return void 0;
|
|
3492
|
+
const expr = unwrapExpression(node);
|
|
3493
|
+
if (import_ts_morph6.Node.isCallExpression(expr)) return expr;
|
|
3494
|
+
if (!import_ts_morph6.Node.isIdentifier(expr)) return void 0;
|
|
3495
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
|
|
3496
|
+
(n) => n !== void 0 && import_ts_morph6.Node.isVariableDeclaration(n)
|
|
3497
|
+
);
|
|
3498
|
+
const init = decl?.getInitializer();
|
|
3499
|
+
if (!init) return void 0;
|
|
3500
|
+
const unwrapped = unwrapExpression(init);
|
|
3501
|
+
return import_ts_morph6.Node.isCallExpression(unwrapped) ? unwrapped : void 0;
|
|
3502
|
+
}
|
|
3503
|
+
function unwrapExpression(node) {
|
|
3504
|
+
let current = node;
|
|
3505
|
+
while (import_ts_morph6.Node.isAsExpression(current) || import_ts_morph6.Node.isSatisfiesExpression(current) || import_ts_morph6.Node.isParenthesizedExpression(current) || import_ts_morph6.Node.isTypeAssertion(current)) {
|
|
3506
|
+
current = current.getExpression();
|
|
3507
|
+
}
|
|
3508
|
+
return current;
|
|
3509
|
+
}
|
|
3510
|
+
function resolveReturnedClass(factoryDecl) {
|
|
3511
|
+
const body = factoryDecl.getBody();
|
|
3512
|
+
if (!body) return void 0;
|
|
3513
|
+
const returns = body.getDescendants().filter((n) => import_ts_morph6.Node.isReturnStatement(n));
|
|
3514
|
+
for (const ret of returns) {
|
|
3515
|
+
const expr = ret.getExpression();
|
|
3516
|
+
if (!expr) continue;
|
|
3517
|
+
const inner = unwrapExpression(expr);
|
|
3518
|
+
if (import_ts_morph6.Node.isClassExpression(inner)) {
|
|
3519
|
+
return inner;
|
|
3520
|
+
}
|
|
3521
|
+
if (import_ts_morph6.Node.isIdentifier(inner)) {
|
|
3522
|
+
const name = inner.getText();
|
|
3523
|
+
const decl = body.getDescendants().find((n) => import_ts_morph6.Node.isClassDeclaration(n) && n.getName() === name);
|
|
3524
|
+
if (decl) return decl;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return void 0;
|
|
3528
|
+
}
|
|
3529
|
+
function resolveFactoryDeclaration(call) {
|
|
3530
|
+
const callee = call.getExpression();
|
|
3531
|
+
if (!import_ts_morph6.Node.isIdentifier(callee)) return void 0;
|
|
3532
|
+
return callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph6.Node.isFunctionDeclaration(n));
|
|
3533
|
+
}
|
|
3534
|
+
function resolveFactoryStaticClass(node) {
|
|
3535
|
+
if (!import_ts_morph6.Node.isPropertyAccessExpression(node)) return void 0;
|
|
3536
|
+
const call = resolveHeritageCall(node.getExpression());
|
|
3537
|
+
if (!call) return void 0;
|
|
3538
|
+
const factoryDecl = resolveFactoryDeclaration(call);
|
|
3539
|
+
if (!factoryDecl) return void 0;
|
|
3540
|
+
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
3541
|
+
if (!returnedClass) return void 0;
|
|
3542
|
+
const staticProp = returnedClass.getStaticProperties().find((p) => p.getName() === node.getName());
|
|
3543
|
+
if (!staticProp || !import_ts_morph6.Node.isPropertyDeclaration(staticProp)) return void 0;
|
|
3544
|
+
const init = staticProp.getInitializer();
|
|
3545
|
+
if (!init) return void 0;
|
|
3546
|
+
const inner = unwrapExpression(init);
|
|
3547
|
+
if (import_ts_morph6.Node.isClassExpression(inner)) return inner;
|
|
3548
|
+
if (!import_ts_morph6.Node.isIdentifier(inner)) return void 0;
|
|
3549
|
+
return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph6.Node.isClassDeclaration(n));
|
|
3550
|
+
}
|
|
3551
|
+
function resolveInheritedMethods(cls) {
|
|
3552
|
+
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
3553
|
+
if (!expr) return void 0;
|
|
3554
|
+
const callee = expr.getExpression();
|
|
3555
|
+
if (!import_ts_morph6.Node.isIdentifier(callee)) return void 0;
|
|
3556
|
+
const factoryDecl = resolveFactoryDeclaration(expr);
|
|
3557
|
+
if (!factoryDecl) return void 0;
|
|
3558
|
+
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
3559
|
+
if (!returnedClass) return void 0;
|
|
3560
|
+
const classArgs = [];
|
|
3561
|
+
const namedClassArgs = {};
|
|
3562
|
+
for (const arg of expr.getArguments()) {
|
|
3563
|
+
const positional = resolveClassReference(arg);
|
|
3564
|
+
if (positional) {
|
|
3565
|
+
classArgs.push(positional);
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
if (!import_ts_morph6.Node.isObjectLiteralExpression(arg)) continue;
|
|
3569
|
+
for (const prop of arg.getProperties()) {
|
|
3570
|
+
const named = resolvePropertyClassReference(prop);
|
|
3571
|
+
if (!named) continue;
|
|
3572
|
+
namedClassArgs[named.key] ??= named.ref;
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
return {
|
|
3576
|
+
methods: returnedClass.getMethods(),
|
|
3577
|
+
factoryName: callee.getText(),
|
|
3578
|
+
factoryFilePath: factoryDecl.getSourceFile().getFilePath(),
|
|
3579
|
+
classArgs,
|
|
3580
|
+
namedClassArgs
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
function resolveClassReference(node) {
|
|
3584
|
+
const expr = unwrapExpression(node);
|
|
3585
|
+
if (!import_ts_morph6.Node.isIdentifier(expr)) return void 0;
|
|
3586
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph6.Node.isClassDeclaration(n));
|
|
3587
|
+
if (!decl) return void 0;
|
|
3588
|
+
return {
|
|
3589
|
+
name: decl.getName() ?? expr.getText(),
|
|
3590
|
+
filePath: decl.getSourceFile().getFilePath()
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
function resolvePropertyClassReference(prop) {
|
|
3594
|
+
if (import_ts_morph6.Node.isShorthandPropertyAssignment(prop)) {
|
|
3595
|
+
const ref2 = resolveClassReference(prop.getNameNode());
|
|
3596
|
+
return ref2 ? { key: prop.getName(), ref: ref2 } : void 0;
|
|
3597
|
+
}
|
|
3598
|
+
if (!import_ts_morph6.Node.isPropertyAssignment(prop)) return void 0;
|
|
3599
|
+
const init = prop.getInitializer();
|
|
3600
|
+
if (!init) return void 0;
|
|
3601
|
+
const ref = resolveClassReference(init);
|
|
3602
|
+
if (!ref) return void 0;
|
|
3603
|
+
const nameNode = prop.getNameNode();
|
|
3604
|
+
const key = import_ts_morph6.Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : prop.getName();
|
|
3605
|
+
return { key, ref };
|
|
3606
|
+
}
|
|
3607
|
+
var mixinTypeProject;
|
|
3608
|
+
function getMixinTypeProject() {
|
|
3609
|
+
mixinTypeProject ??= new import_ts_morph6.Project({
|
|
3610
|
+
skipAddingFilesFromTsConfig: true,
|
|
3611
|
+
compilerOptions: { strict: true }
|
|
3612
|
+
});
|
|
3613
|
+
return mixinTypeProject;
|
|
3614
|
+
}
|
|
3615
|
+
function clearMixinTypeProject() {
|
|
3616
|
+
mixinTypeProject = void 0;
|
|
3617
|
+
}
|
|
3618
|
+
function resolveInstantiatedReturnType(cls, methodName) {
|
|
3619
|
+
const filePath = cls.getSourceFile().getFilePath();
|
|
3620
|
+
const className = cls.getName();
|
|
3621
|
+
if (!className) return void 0;
|
|
3622
|
+
const project = getMixinTypeProject();
|
|
3623
|
+
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
|
|
3624
|
+
const typedCls = sourceFile?.getClass(className);
|
|
3625
|
+
if (!typedCls) return void 0;
|
|
3626
|
+
const prop = typedCls.getType().getProperty(methodName);
|
|
3627
|
+
if (!prop) return void 0;
|
|
3628
|
+
const returnType = prop.getTypeAtLocation(typedCls).getCallSignatures()[0]?.getReturnType();
|
|
3629
|
+
if (!returnType) return void 0;
|
|
3630
|
+
const unwrapped = returnType.getSymbol()?.getName() === "Promise" ? returnType.getTypeArguments()[0] ?? returnType : returnType;
|
|
3631
|
+
return unwrapped.getText(typedCls);
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3488
3634
|
// src/discovery/filter-for.ts
|
|
3489
3635
|
function resolveMixinEntityClass(mixin, project) {
|
|
3490
|
-
const entityArg = mixin?.classArgs[0];
|
|
3636
|
+
const entityArg = mixin?.namedClassArgs?.entity ?? mixin?.classArgs[0];
|
|
3491
3637
|
if (!entityArg) return void 0;
|
|
3492
3638
|
const file = project.getSourceFile(entityArg.filePath) ?? project.addSourceFileAtPathIfExists(entityArg.filePath);
|
|
3493
3639
|
return file?.getClass(entityArg.name);
|
|
3494
3640
|
}
|
|
3495
3641
|
function classifyFilterForHint(typeInit) {
|
|
3496
|
-
if (
|
|
3642
|
+
if (import_ts_morph7.Node.isStringLiteral(typeInit)) {
|
|
3497
3643
|
switch (typeInit.getLiteralValue()) {
|
|
3498
3644
|
case "string":
|
|
3499
3645
|
return { kind: "string" };
|
|
@@ -3507,10 +3653,10 @@ function classifyFilterForHint(typeInit) {
|
|
|
3507
3653
|
return null;
|
|
3508
3654
|
}
|
|
3509
3655
|
}
|
|
3510
|
-
if (
|
|
3656
|
+
if (import_ts_morph7.Node.isArrayLiteralExpression(typeInit)) {
|
|
3511
3657
|
const values = [];
|
|
3512
3658
|
for (const el of typeInit.getElements()) {
|
|
3513
|
-
if (!
|
|
3659
|
+
if (!import_ts_morph7.Node.isStringLiteral(el)) return null;
|
|
3514
3660
|
values.push(el.getLiteralValue());
|
|
3515
3661
|
}
|
|
3516
3662
|
if (values.length === 0) return null;
|
|
@@ -3545,11 +3691,11 @@ function extractFilterForHints(classDecl, project) {
|
|
|
3545
3691
|
if (!filterForDec) continue;
|
|
3546
3692
|
const args = filterForDec.getArguments();
|
|
3547
3693
|
const keyArg = args[0];
|
|
3548
|
-
const inputKey = keyArg &&
|
|
3694
|
+
const inputKey = keyArg && import_ts_morph7.Node.isStringLiteral(keyArg) ? keyArg.getLiteralValue() : method.getName();
|
|
3549
3695
|
const optsArg = args[1];
|
|
3550
|
-
if (optsArg &&
|
|
3696
|
+
if (optsArg && import_ts_morph7.Node.isObjectLiteralExpression(optsArg)) {
|
|
3551
3697
|
const typeProp = optsArg.getProperty("type");
|
|
3552
|
-
if (typeProp &&
|
|
3698
|
+
if (typeProp && import_ts_morph7.Node.isPropertyAssignment(typeProp)) {
|
|
3553
3699
|
const typeInit = typeProp.getInitializer();
|
|
3554
3700
|
if (typeInit) {
|
|
3555
3701
|
const classified = classifyFilterForHint(typeInit);
|
|
@@ -3574,21 +3720,23 @@ function extractApplyFilterInfo(method, sourceFile, project, mixin) {
|
|
|
3574
3720
|
const args = filterDecorator.getArguments();
|
|
3575
3721
|
if (args.length === 0) continue;
|
|
3576
3722
|
const filterClassArg = args[0];
|
|
3577
|
-
if (!filterClassArg
|
|
3723
|
+
if (!filterClassArg) continue;
|
|
3724
|
+
const factoryStaticClass = resolveFactoryStaticClass(filterClassArg);
|
|
3725
|
+
if (!factoryStaticClass && !import_ts_morph7.Node.isIdentifier(filterClassArg)) continue;
|
|
3578
3726
|
let source = "query";
|
|
3579
3727
|
const optionsArg = args[1];
|
|
3580
|
-
if (optionsArg &&
|
|
3728
|
+
if (optionsArg && import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) {
|
|
3581
3729
|
const sourceProp = optionsArg.getProperty("source");
|
|
3582
|
-
if (sourceProp &&
|
|
3730
|
+
if (sourceProp && import_ts_morph7.Node.isPropertyAssignment(sourceProp)) {
|
|
3583
3731
|
const init = sourceProp.getInitializer();
|
|
3584
|
-
if (init &&
|
|
3732
|
+
if (init && import_ts_morph7.Node.isStringLiteral(init) && init.getLiteralValue() === "body") {
|
|
3585
3733
|
source = "body";
|
|
3586
3734
|
}
|
|
3587
3735
|
}
|
|
3588
3736
|
}
|
|
3589
3737
|
const filterClassName = filterClassArg.getText();
|
|
3590
|
-
const resolved = findType(filterClassName, declFile, project);
|
|
3591
|
-
const classDecl = resolved?.kind === "class" ? resolved.decl : resolveLocalClassDeclaration(filterClassArg);
|
|
3738
|
+
const resolved = factoryStaticClass ? void 0 : findType(filterClassName, declFile, project);
|
|
3739
|
+
const classDecl = factoryStaticClass ?? (resolved?.kind === "class" ? resolved.decl : resolveLocalClassDeclaration(filterClassArg));
|
|
3592
3740
|
if (classDecl) {
|
|
3593
3741
|
let fieldTypes = extractClassPropertyTypes(classDecl, project);
|
|
3594
3742
|
if (fieldTypes.length === 0) {
|
|
@@ -3644,22 +3792,22 @@ function resolveRelationEntity(prop, sourceFile, project) {
|
|
|
3644
3792
|
const args = dec.getArguments();
|
|
3645
3793
|
if (args.length === 0) continue;
|
|
3646
3794
|
const arg = args[0];
|
|
3647
|
-
if (
|
|
3795
|
+
if (import_ts_morph7.Node.isObjectLiteralExpression(arg)) {
|
|
3648
3796
|
const entityProp = arg.getProperty("entity");
|
|
3649
|
-
if (entityProp &&
|
|
3797
|
+
if (entityProp && import_ts_morph7.Node.isPropertyAssignment(entityProp)) {
|
|
3650
3798
|
const init = entityProp.getInitializer();
|
|
3651
|
-
if (init &&
|
|
3799
|
+
if (init && import_ts_morph7.Node.isArrowFunction(init)) {
|
|
3652
3800
|
const body = init.getBody();
|
|
3653
|
-
if (
|
|
3801
|
+
if (import_ts_morph7.Node.isIdentifier(body)) {
|
|
3654
3802
|
const resolved = findType(body.getText(), prop.getSourceFile(), project);
|
|
3655
3803
|
if (resolved?.kind === "class") return resolved.decl;
|
|
3656
3804
|
}
|
|
3657
3805
|
}
|
|
3658
3806
|
}
|
|
3659
3807
|
}
|
|
3660
|
-
if (
|
|
3808
|
+
if (import_ts_morph7.Node.isArrowFunction(arg)) {
|
|
3661
3809
|
const body = arg.getBody();
|
|
3662
|
-
if (
|
|
3810
|
+
if (import_ts_morph7.Node.isIdentifier(body)) {
|
|
3663
3811
|
const resolved = findType(body.getText(), prop.getSourceFile(), project);
|
|
3664
3812
|
if (resolved?.kind === "class") return resolved.decl;
|
|
3665
3813
|
}
|
|
@@ -3678,15 +3826,15 @@ function extractClassPropertyTypes(classDecl, project) {
|
|
|
3678
3826
|
return fields;
|
|
3679
3827
|
}
|
|
3680
3828
|
function resolveLocalClassDeclaration(identifier) {
|
|
3681
|
-
if (!
|
|
3682
|
-
return identifier.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 &&
|
|
3829
|
+
if (!import_ts_morph7.Node.isIdentifier(identifier)) return void 0;
|
|
3830
|
+
return identifier.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph7.Node.isClassDeclaration(n));
|
|
3683
3831
|
}
|
|
3684
3832
|
function resolveDeclaredEntity(optionsArg, filterClass, project) {
|
|
3685
|
-
if (!
|
|
3833
|
+
if (!import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) return void 0;
|
|
3686
3834
|
const entityProp = optionsArg.getProperty("entity");
|
|
3687
|
-
if (!entityProp || !
|
|
3835
|
+
if (!entityProp || !import_ts_morph7.Node.isPropertyAssignment(entityProp)) return void 0;
|
|
3688
3836
|
const entityInit = entityProp.getInitializer();
|
|
3689
|
-
if (!entityInit || !
|
|
3837
|
+
if (!entityInit || !import_ts_morph7.Node.isIdentifier(entityInit)) return void 0;
|
|
3690
3838
|
const resolved = findType(entityInit.getText(), filterClass.getSourceFile(), project);
|
|
3691
3839
|
if (!resolved || resolved.kind !== "class") return void 0;
|
|
3692
3840
|
return resolved.decl;
|
|
@@ -3697,7 +3845,7 @@ function extractFilterableEntityFields(filterClass, project, entityOverride) {
|
|
|
3697
3845
|
const args = filterableDecorator.getArguments();
|
|
3698
3846
|
if (args.length === 0) return [];
|
|
3699
3847
|
const optionsArg = args[0];
|
|
3700
|
-
if (!
|
|
3848
|
+
if (!import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) return [];
|
|
3701
3849
|
const entityDecl = entityOverride ?? resolveDeclaredEntity(optionsArg, filterClass, project);
|
|
3702
3850
|
if (!entityDecl) return [];
|
|
3703
3851
|
const fields = collectEntityFields(
|
|
@@ -3710,17 +3858,17 @@ function extractFilterableEntityFields(filterClass, project, entityOverride) {
|
|
|
3710
3858
|
const relationsDecorator = filterClass.getDecorators().find((d) => d.getName() === "Relations");
|
|
3711
3859
|
if (relationsDecorator) {
|
|
3712
3860
|
const relArgs = relationsDecorator.getArguments();
|
|
3713
|
-
if (relArgs.length > 0 &&
|
|
3861
|
+
if (relArgs.length > 0 && import_ts_morph7.Node.isObjectLiteralExpression(relArgs[0])) {
|
|
3714
3862
|
for (const relProp of relArgs[0].getProperties()) {
|
|
3715
|
-
if (!
|
|
3863
|
+
if (!import_ts_morph7.Node.isPropertyAssignment(relProp)) continue;
|
|
3716
3864
|
const relInit = relProp.getInitializer();
|
|
3717
|
-
if (!relInit || !
|
|
3865
|
+
if (!relInit || !import_ts_morph7.Node.isObjectLiteralExpression(relInit)) continue;
|
|
3718
3866
|
const keysProp = relInit.getProperty("keys");
|
|
3719
|
-
if (!keysProp || !
|
|
3867
|
+
if (!keysProp || !import_ts_morph7.Node.isPropertyAssignment(keysProp)) continue;
|
|
3720
3868
|
const keysInit = keysProp.getInitializer();
|
|
3721
|
-
if (!keysInit || !
|
|
3869
|
+
if (!keysInit || !import_ts_morph7.Node.isArrayLiteralExpression(keysInit)) continue;
|
|
3722
3870
|
for (const el of keysInit.getElements()) {
|
|
3723
|
-
if (
|
|
3871
|
+
if (import_ts_morph7.Node.isStringLiteral(el)) {
|
|
3724
3872
|
fields.push(toFilterFieldType(el.getLiteralValue(), { kind: "unknown" }));
|
|
3725
3873
|
}
|
|
3726
3874
|
}
|
|
@@ -3761,22 +3909,22 @@ var PASSTHROUGH_UTILITY = /* @__PURE__ */ new Set([
|
|
|
3761
3909
|
]);
|
|
3762
3910
|
function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /* @__PURE__ */ new Map()) {
|
|
3763
3911
|
if (depth <= 0) return "unknown";
|
|
3764
|
-
if (
|
|
3912
|
+
if (import_ts_morph8.Node.isArrayTypeNode(typeNode)) {
|
|
3765
3913
|
const elementType = typeNode.getElementTypeNode();
|
|
3766
3914
|
return `Array<${resolveTypeNodeToString(elementType, sourceFile, project, depth, subst)}>`;
|
|
3767
3915
|
}
|
|
3768
|
-
if (
|
|
3916
|
+
if (import_ts_morph8.Node.isUnionTypeNode(typeNode)) {
|
|
3769
3917
|
return typeNode.getTypeNodes().map((t) => resolveTypeNodeToString(t, sourceFile, project, depth, subst)).join(" | ");
|
|
3770
3918
|
}
|
|
3771
|
-
if (
|
|
3919
|
+
if (import_ts_morph8.Node.isIntersectionTypeNode(typeNode)) {
|
|
3772
3920
|
return typeNode.getTypeNodes().map((t) => resolveTypeNodeToString(t, sourceFile, project, depth, subst)).join(" & ");
|
|
3773
3921
|
}
|
|
3774
|
-
if (
|
|
3922
|
+
if (import_ts_morph8.Node.isParenthesizedTypeNode(typeNode)) {
|
|
3775
3923
|
return `(${resolveTypeNodeToString(typeNode.getTypeNode(), sourceFile, project, depth, subst)})`;
|
|
3776
3924
|
}
|
|
3777
|
-
if (
|
|
3925
|
+
if (import_ts_morph8.Node.isTypeReference(typeNode)) {
|
|
3778
3926
|
const typeName = typeNode.getTypeName();
|
|
3779
|
-
const name =
|
|
3927
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : typeNode.getText();
|
|
3780
3928
|
const bound = subst.get(name);
|
|
3781
3929
|
if (bound !== void 0) return bound;
|
|
3782
3930
|
if (name === "string" || name === "number" || name === "boolean") return name;
|
|
@@ -3799,10 +3947,10 @@ function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /
|
|
|
3799
3947
|
dbg("unresolvable type:", name, "in", sourceFile.getFilePath());
|
|
3800
3948
|
return "unknown";
|
|
3801
3949
|
}
|
|
3802
|
-
if (
|
|
3950
|
+
if (import_ts_morph8.Node.isTypeLiteral(typeNode)) {
|
|
3803
3951
|
const members = [];
|
|
3804
3952
|
for (const member of typeNode.getMembers()) {
|
|
3805
|
-
if (
|
|
3953
|
+
if (import_ts_morph8.Node.isPropertySignature(member)) {
|
|
3806
3954
|
const memberTypeNode = member.getTypeNode();
|
|
3807
3955
|
const memberType = memberTypeNode ? resolveTypeNodeToString(memberTypeNode, sourceFile, project, depth, subst) : "unknown";
|
|
3808
3956
|
members.push(`${member.getName()}${member.hasQuestionToken() ? "?" : ""}: ${memberType}`);
|
|
@@ -3813,11 +3961,11 @@ function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /
|
|
|
3813
3961
|
return members.length > 0 ? `{ ${members.join("; ")} }` : "{}";
|
|
3814
3962
|
}
|
|
3815
3963
|
const kind = typeNode.getKind();
|
|
3816
|
-
if (kind ===
|
|
3817
|
-
if (kind ===
|
|
3818
|
-
if (kind ===
|
|
3819
|
-
if (kind ===
|
|
3820
|
-
if (kind ===
|
|
3964
|
+
if (kind === import_ts_morph8.SyntaxKind.StringKeyword) return "string";
|
|
3965
|
+
if (kind === import_ts_morph8.SyntaxKind.NumberKeyword) return "number";
|
|
3966
|
+
if (kind === import_ts_morph8.SyntaxKind.BooleanKeyword) return "boolean";
|
|
3967
|
+
if (kind === import_ts_morph8.SyntaxKind.UnknownKeyword) return "unknown";
|
|
3968
|
+
if (kind === import_ts_morph8.SyntaxKind.AnyKeyword) return "unknown";
|
|
3821
3969
|
return typeNode.getText();
|
|
3822
3970
|
}
|
|
3823
3971
|
function unwrapFirstTypeArg(typeNode, sourceFile, project, depth, mode, subst = /* @__PURE__ */ new Map()) {
|
|
@@ -3902,7 +4050,7 @@ function extractQueryType(method, sourceFile, project) {
|
|
|
3902
4050
|
if (!queryDecorator) continue;
|
|
3903
4051
|
const queryArgs = queryDecorator.getArguments();
|
|
3904
4052
|
const nameArg = queryArgs[0];
|
|
3905
|
-
if (!nameArg || !
|
|
4053
|
+
if (!nameArg || !import_ts_morph8.Node.isStringLiteral(nameArg)) continue;
|
|
3906
4054
|
const queryName = nameArg.getLiteralValue();
|
|
3907
4055
|
const typeNode = param.getTypeNode();
|
|
3908
4056
|
const queryType = typeNode ? resolveTypeNodeToString(typeNode, sourceFile, project, 3) : "string";
|
|
@@ -3913,8 +4061,8 @@ function extractQueryType(method, sourceFile, project) {
|
|
|
3913
4061
|
function isParamOptional(param) {
|
|
3914
4062
|
if (param.hasQuestionToken() || param.hasInitializer()) return true;
|
|
3915
4063
|
const typeNode = param.getTypeNode();
|
|
3916
|
-
if (typeNode &&
|
|
3917
|
-
return typeNode.getTypeNodes().some((t) => t.getKind() ===
|
|
4064
|
+
if (typeNode && import_ts_morph8.Node.isUnionTypeNode(typeNode)) {
|
|
4065
|
+
return typeNode.getTypeNodes().some((t) => t.getKind() === import_ts_morph8.SyntaxKind.UndefinedKeyword);
|
|
3918
4066
|
}
|
|
3919
4067
|
return false;
|
|
3920
4068
|
}
|
|
@@ -3926,7 +4074,7 @@ function extractParamsType(method, sourceFile, project) {
|
|
|
3926
4074
|
const paramArgs = paramDecorator.getArguments();
|
|
3927
4075
|
if (paramArgs.length === 0) continue;
|
|
3928
4076
|
const nameArg = paramArgs[0];
|
|
3929
|
-
if (!
|
|
4077
|
+
if (!import_ts_morph8.Node.isStringLiteral(nameArg)) continue;
|
|
3930
4078
|
const paramName = nameArg.getLiteralValue();
|
|
3931
4079
|
const typeNode = param.getTypeNode();
|
|
3932
4080
|
const paramType = typeNode ? resolveTypeNodeToString(typeNode, sourceFile, project, 3) : "string";
|
|
@@ -3947,28 +4095,28 @@ function extractUploadedFiles(method) {
|
|
|
3947
4095
|
for (const decorator of method.getDecorators()) {
|
|
3948
4096
|
if (decorator.getName() !== "UseInterceptors") continue;
|
|
3949
4097
|
for (const arg of decorator.getArguments()) {
|
|
3950
|
-
if (!
|
|
4098
|
+
if (!import_ts_morph8.Node.isCallExpression(arg)) continue;
|
|
3951
4099
|
const interceptor = arg.getExpression().getText();
|
|
3952
4100
|
const callArgs = arg.getArguments();
|
|
3953
4101
|
const firstArg2 = callArgs[0];
|
|
3954
4102
|
if (interceptor === "FileInterceptor") {
|
|
3955
|
-
if (firstArg2 &&
|
|
4103
|
+
if (firstArg2 && import_ts_morph8.Node.isStringLiteral(firstArg2)) {
|
|
3956
4104
|
entries.push(`${firstArg2.getLiteralValue()}: ${FILE}`);
|
|
3957
4105
|
multipart = true;
|
|
3958
4106
|
}
|
|
3959
4107
|
} else if (interceptor === "FilesInterceptor") {
|
|
3960
|
-
if (firstArg2 &&
|
|
4108
|
+
if (firstArg2 && import_ts_morph8.Node.isStringLiteral(firstArg2)) {
|
|
3961
4109
|
entries.push(`${firstArg2.getLiteralValue()}: Array<${FILE}>`);
|
|
3962
4110
|
multipart = true;
|
|
3963
4111
|
}
|
|
3964
4112
|
} else if (interceptor === "FileFieldsInterceptor") {
|
|
3965
|
-
if (firstArg2 &&
|
|
4113
|
+
if (firstArg2 && import_ts_morph8.Node.isArrayLiteralExpression(firstArg2)) {
|
|
3966
4114
|
for (const el of firstArg2.getElements()) {
|
|
3967
|
-
if (!
|
|
4115
|
+
if (!import_ts_morph8.Node.isObjectLiteralExpression(el)) continue;
|
|
3968
4116
|
const nameProp = el.getProperty("name");
|
|
3969
|
-
if (nameProp &&
|
|
4117
|
+
if (nameProp && import_ts_morph8.Node.isPropertyAssignment(nameProp)) {
|
|
3970
4118
|
const init = nameProp.getInitializer();
|
|
3971
|
-
if (init &&
|
|
4119
|
+
if (init && import_ts_morph8.Node.isStringLiteral(init)) {
|
|
3972
4120
|
entries.push(`${init.getLiteralValue()}: Array<${FILE}>`);
|
|
3973
4121
|
}
|
|
3974
4122
|
}
|
|
@@ -3988,13 +4136,13 @@ function extractResponseType(method, sourceFile, project) {
|
|
|
3988
4136
|
if (apiResponseDecorator) {
|
|
3989
4137
|
const args = apiResponseDecorator.getArguments();
|
|
3990
4138
|
const optsArg = args[0];
|
|
3991
|
-
if (optsArg &&
|
|
4139
|
+
if (optsArg && import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) {
|
|
3992
4140
|
for (const prop of optsArg.getProperties()) {
|
|
3993
|
-
if (!
|
|
4141
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
3994
4142
|
if (prop.getName() !== "type") continue;
|
|
3995
4143
|
const val = prop.getInitializer();
|
|
3996
4144
|
if (!val) continue;
|
|
3997
|
-
if (
|
|
4145
|
+
if (import_ts_morph8.Node.isArrayLiteralExpression(val)) {
|
|
3998
4146
|
const elements = val.getElements();
|
|
3999
4147
|
const firstEl = elements[0];
|
|
4000
4148
|
if (elements.length > 0 && firstEl !== void 0) {
|
|
@@ -4015,24 +4163,24 @@ function extractResponseType(method, sourceFile, project) {
|
|
|
4015
4163
|
}
|
|
4016
4164
|
function apiResponseStatus(decorator) {
|
|
4017
4165
|
const optsArg = decorator.getArguments()[0];
|
|
4018
|
-
if (!optsArg || !
|
|
4166
|
+
if (!optsArg || !import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) return null;
|
|
4019
4167
|
for (const prop of optsArg.getProperties()) {
|
|
4020
|
-
if (!
|
|
4168
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
4021
4169
|
if (prop.getName() !== "status") continue;
|
|
4022
4170
|
const val = prop.getInitializer();
|
|
4023
|
-
if (val &&
|
|
4171
|
+
if (val && import_ts_morph8.Node.isNumericLiteral(val)) return Number(val.getLiteralValue());
|
|
4024
4172
|
}
|
|
4025
4173
|
return null;
|
|
4026
4174
|
}
|
|
4027
4175
|
function apiResponseTypeNode(decorator) {
|
|
4028
4176
|
const optsArg = decorator.getArguments()[0];
|
|
4029
|
-
if (!optsArg || !
|
|
4177
|
+
if (!optsArg || !import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) return null;
|
|
4030
4178
|
for (const prop of optsArg.getProperties()) {
|
|
4031
|
-
if (!
|
|
4179
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
4032
4180
|
if (prop.getName() !== "type") continue;
|
|
4033
4181
|
const val = prop.getInitializer();
|
|
4034
4182
|
if (!val) return null;
|
|
4035
|
-
if (
|
|
4183
|
+
if (import_ts_morph8.Node.isArrayLiteralExpression(val)) {
|
|
4036
4184
|
const first = val.getElements()[0];
|
|
4037
4185
|
return first ? { node: first, isArray: true } : null;
|
|
4038
4186
|
}
|
|
@@ -4050,7 +4198,7 @@ function extractErrorType(method, sourceFile, project) {
|
|
|
4050
4198
|
const inner = resolveIdentifierToClassType(typeInfo.node, sourceFile, project, 3);
|
|
4051
4199
|
const type = typeInfo.isArray ? `Array<${inner}>` : inner;
|
|
4052
4200
|
let ref = null;
|
|
4053
|
-
if (
|
|
4201
|
+
if (import_ts_morph8.Node.isIdentifier(typeInfo.node)) {
|
|
4054
4202
|
const name = typeInfo.node.getText();
|
|
4055
4203
|
const localDecl = sourceFile.getInterface(name) || sourceFile.getClass(name) || sourceFile.getTypeAlias(name);
|
|
4056
4204
|
if (localDecl?.isExported()) {
|
|
@@ -4067,7 +4215,7 @@ function extractErrorType(method, sourceFile, project) {
|
|
|
4067
4215
|
return null;
|
|
4068
4216
|
}
|
|
4069
4217
|
function resolveIdentifierToClassType(node, sourceFile, project, depth) {
|
|
4070
|
-
if (!
|
|
4218
|
+
if (!import_ts_morph8.Node.isIdentifier(node)) return "unknown";
|
|
4071
4219
|
const name = node.getText();
|
|
4072
4220
|
const resolved = findType(name, sourceFile, project);
|
|
4073
4221
|
if (resolved) {
|
|
@@ -4087,9 +4235,9 @@ var STREAM_ENVELOPES = /* @__PURE__ */ new Set(["MessageEvent", "MessageEventLik
|
|
|
4087
4235
|
var BINARY_RESPONSE_TYPES = /* @__PURE__ */ new Set(["StreamableFile", "Buffer"]);
|
|
4088
4236
|
function detectBinaryResponse(method) {
|
|
4089
4237
|
const node = unwrapNamedContainer(method.getReturnTypeNode(), /* @__PURE__ */ new Set(["Promise"]));
|
|
4090
|
-
if (!node || !
|
|
4238
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return false;
|
|
4091
4239
|
const typeName = node.getTypeName();
|
|
4092
|
-
const name =
|
|
4240
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
4093
4241
|
return BINARY_RESPONSE_TYPES.has(name);
|
|
4094
4242
|
}
|
|
4095
4243
|
function detectStreamElement(method) {
|
|
@@ -4104,9 +4252,9 @@ function detectStreamElement(method) {
|
|
|
4104
4252
|
return null;
|
|
4105
4253
|
}
|
|
4106
4254
|
function streamContainerElement(node) {
|
|
4107
|
-
if (!node || !
|
|
4255
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return null;
|
|
4108
4256
|
const typeName = node.getTypeName();
|
|
4109
|
-
const name =
|
|
4257
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
4110
4258
|
if (STREAM_CONTAINERS.has(name) || STREAM_CONTAINERS_GENERATOR.has(name)) {
|
|
4111
4259
|
return node.getTypeArguments()[0] ?? null;
|
|
4112
4260
|
}
|
|
@@ -4116,9 +4264,9 @@ function hasAsQueryDecorator(method) {
|
|
|
4116
4264
|
return method.getDecorators().some((d) => d.getName() === "AsQuery");
|
|
4117
4265
|
}
|
|
4118
4266
|
function unwrapNamedContainer(node, names) {
|
|
4119
|
-
if (!node || !
|
|
4267
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return node;
|
|
4120
4268
|
const typeName = node.getTypeName();
|
|
4121
|
-
const name =
|
|
4269
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
4122
4270
|
if (names.has(name)) {
|
|
4123
4271
|
return node.getTypeArguments()[0] ?? node;
|
|
4124
4272
|
}
|
|
@@ -4164,11 +4312,11 @@ function extractDtoContract(method, sourceFile, project, mixin) {
|
|
|
4164
4312
|
if (apiResp) {
|
|
4165
4313
|
const args = apiResp.getArguments();
|
|
4166
4314
|
const optsArg = args[0];
|
|
4167
|
-
if (optsArg &&
|
|
4315
|
+
if (optsArg && import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) {
|
|
4168
4316
|
for (const prop of optsArg.getProperties()) {
|
|
4169
|
-
if (
|
|
4317
|
+
if (import_ts_morph8.Node.isPropertyAssignment(prop) && prop.getName() === "type") {
|
|
4170
4318
|
const val = prop.getInitializer();
|
|
4171
|
-
if (val &&
|
|
4319
|
+
if (val && import_ts_morph8.Node.isIdentifier(val)) {
|
|
4172
4320
|
const name = val.getText();
|
|
4173
4321
|
const localDecl = sourceFile.getInterface(name) || sourceFile.getClass(name) || sourceFile.getTypeAlias(name);
|
|
4174
4322
|
if (localDecl?.isExported()) {
|
|
@@ -4236,101 +4384,6 @@ function resolveParamClass(method, decoratorName, sourceFile, project) {
|
|
|
4236
4384
|
return null;
|
|
4237
4385
|
}
|
|
4238
4386
|
|
|
4239
|
-
// src/discovery/heritage.ts
|
|
4240
|
-
var import_ts_morph8 = require("ts-morph");
|
|
4241
|
-
function resolveHeritageCall(node) {
|
|
4242
|
-
if (!node) return void 0;
|
|
4243
|
-
const expr = unwrapExpression(node);
|
|
4244
|
-
if (import_ts_morph8.Node.isCallExpression(expr)) return expr;
|
|
4245
|
-
if (!import_ts_morph8.Node.isIdentifier(expr)) return void 0;
|
|
4246
|
-
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
|
|
4247
|
-
(n) => n !== void 0 && import_ts_morph8.Node.isVariableDeclaration(n)
|
|
4248
|
-
);
|
|
4249
|
-
const init = decl?.getInitializer();
|
|
4250
|
-
if (!init) return void 0;
|
|
4251
|
-
const unwrapped = unwrapExpression(init);
|
|
4252
|
-
return import_ts_morph8.Node.isCallExpression(unwrapped) ? unwrapped : void 0;
|
|
4253
|
-
}
|
|
4254
|
-
function unwrapExpression(node) {
|
|
4255
|
-
let current = node;
|
|
4256
|
-
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)) {
|
|
4257
|
-
current = current.getExpression();
|
|
4258
|
-
}
|
|
4259
|
-
return current;
|
|
4260
|
-
}
|
|
4261
|
-
function resolveReturnedClass(factoryDecl) {
|
|
4262
|
-
const body = factoryDecl.getBody();
|
|
4263
|
-
if (!body) return void 0;
|
|
4264
|
-
const returns = body.getDescendants().filter((n) => import_ts_morph8.Node.isReturnStatement(n));
|
|
4265
|
-
for (const ret of returns) {
|
|
4266
|
-
const expr = ret.getExpression();
|
|
4267
|
-
if (!expr) continue;
|
|
4268
|
-
const inner = unwrapExpression(expr);
|
|
4269
|
-
if (import_ts_morph8.Node.isClassExpression(inner)) {
|
|
4270
|
-
return inner;
|
|
4271
|
-
}
|
|
4272
|
-
if (import_ts_morph8.Node.isIdentifier(inner)) {
|
|
4273
|
-
const name = inner.getText();
|
|
4274
|
-
const decl = body.getDescendants().find((n) => import_ts_morph8.Node.isClassDeclaration(n) && n.getName() === name);
|
|
4275
|
-
if (decl) return decl;
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4278
|
-
return void 0;
|
|
4279
|
-
}
|
|
4280
|
-
function resolveInheritedMethods(cls) {
|
|
4281
|
-
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
4282
|
-
if (!expr) return void 0;
|
|
4283
|
-
const callee = expr.getExpression();
|
|
4284
|
-
if (!import_ts_morph8.Node.isIdentifier(callee)) return void 0;
|
|
4285
|
-
const factoryDecl = callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph8.Node.isFunctionDeclaration(n));
|
|
4286
|
-
if (!factoryDecl) return void 0;
|
|
4287
|
-
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
4288
|
-
if (!returnedClass) return void 0;
|
|
4289
|
-
const classArgs = [];
|
|
4290
|
-
for (const arg of expr.getArguments()) {
|
|
4291
|
-
if (!import_ts_morph8.Node.isIdentifier(arg)) continue;
|
|
4292
|
-
const decl = arg.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph8.Node.isClassDeclaration(n));
|
|
4293
|
-
if (decl) {
|
|
4294
|
-
classArgs.push({
|
|
4295
|
-
name: decl.getName() ?? arg.getText(),
|
|
4296
|
-
filePath: decl.getSourceFile().getFilePath()
|
|
4297
|
-
});
|
|
4298
|
-
}
|
|
4299
|
-
}
|
|
4300
|
-
return {
|
|
4301
|
-
methods: returnedClass.getMethods(),
|
|
4302
|
-
factoryName: callee.getText(),
|
|
4303
|
-
factoryFilePath: factoryDecl.getSourceFile().getFilePath(),
|
|
4304
|
-
classArgs
|
|
4305
|
-
};
|
|
4306
|
-
}
|
|
4307
|
-
var mixinTypeProject;
|
|
4308
|
-
function getMixinTypeProject() {
|
|
4309
|
-
mixinTypeProject ??= new import_ts_morph8.Project({
|
|
4310
|
-
skipAddingFilesFromTsConfig: true,
|
|
4311
|
-
compilerOptions: { strict: true }
|
|
4312
|
-
});
|
|
4313
|
-
return mixinTypeProject;
|
|
4314
|
-
}
|
|
4315
|
-
function clearMixinTypeProject() {
|
|
4316
|
-
mixinTypeProject = void 0;
|
|
4317
|
-
}
|
|
4318
|
-
function resolveInstantiatedReturnType(cls, methodName) {
|
|
4319
|
-
const filePath = cls.getSourceFile().getFilePath();
|
|
4320
|
-
const className = cls.getName();
|
|
4321
|
-
if (!className) return void 0;
|
|
4322
|
-
const project = getMixinTypeProject();
|
|
4323
|
-
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
|
|
4324
|
-
const typedCls = sourceFile?.getClass(className);
|
|
4325
|
-
if (!typedCls) return void 0;
|
|
4326
|
-
const prop = typedCls.getType().getProperty(methodName);
|
|
4327
|
-
if (!prop) return void 0;
|
|
4328
|
-
const returnType = prop.getTypeAtLocation(typedCls).getCallSignatures()[0]?.getReturnType();
|
|
4329
|
-
if (!returnType) return void 0;
|
|
4330
|
-
const unwrapped = returnType.getSymbol()?.getName() === "Promise" ? returnType.getTypeArguments()[0] ?? returnType : returnType;
|
|
4331
|
-
return unwrapped.getText(typedCls);
|
|
4332
|
-
}
|
|
4333
|
-
|
|
4334
4387
|
// src/discovery/zod-ast-to-ts.ts
|
|
4335
4388
|
var import_ts_morph9 = require("ts-morph");
|
|
4336
4389
|
function zodAstToTs(node) {
|
|
@@ -4832,7 +4885,8 @@ function extractFromSourceFile(sourceFile, project) {
|
|
|
4832
4885
|
const mixinBinding = inherited ? {
|
|
4833
4886
|
factoryName: inherited.factoryName,
|
|
4834
4887
|
factoryFilePath: inherited.factoryFilePath,
|
|
4835
|
-
classArgs: inherited.classArgs
|
|
4888
|
+
classArgs: inherited.classArgs,
|
|
4889
|
+
namedClassArgs: inherited.namedClassArgs
|
|
4836
4890
|
} : void 0;
|
|
4837
4891
|
const ownMethods = cls.getMethods();
|
|
4838
4892
|
const ownNames = new Set(ownMethods.map((m) => m.getName()));
|
|
@@ -5147,7 +5201,7 @@ function createChainModuleRenderer(opts) {
|
|
|
5147
5201
|
}
|
|
5148
5202
|
|
|
5149
5203
|
// src/index.ts
|
|
5150
|
-
var VERSION = "0.
|
|
5204
|
+
var VERSION = "0.18.0";
|
|
5151
5205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5152
5206
|
0 && (module.exports = {
|
|
5153
5207
|
CodegenError,
|