@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/nest/index.cjs
CHANGED
|
@@ -2292,7 +2292,7 @@ var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
|
2292
2292
|
var import_ts_morph10 = require("ts-morph");
|
|
2293
2293
|
|
|
2294
2294
|
// src/discovery/dto-type-resolver.ts
|
|
2295
|
-
var
|
|
2295
|
+
var import_ts_morph8 = require("ts-morph");
|
|
2296
2296
|
|
|
2297
2297
|
// src/discovery/dto-to-ir.ts
|
|
2298
2298
|
var import_ts_morph4 = require("ts-morph");
|
|
@@ -3048,7 +3048,7 @@ function inSchemaFromDecorator(decorator) {
|
|
|
3048
3048
|
}
|
|
3049
3049
|
|
|
3050
3050
|
// src/discovery/filter-for.ts
|
|
3051
|
-
var
|
|
3051
|
+
var import_ts_morph7 = require("ts-morph");
|
|
3052
3052
|
|
|
3053
3053
|
// src/discovery/filter-field-types.ts
|
|
3054
3054
|
var import_ts_morph5 = require("ts-morph");
|
|
@@ -3267,15 +3267,161 @@ function toFilterFieldType(name, r) {
|
|
|
3267
3267
|
return ft;
|
|
3268
3268
|
}
|
|
3269
3269
|
|
|
3270
|
+
// src/discovery/heritage.ts
|
|
3271
|
+
var import_ts_morph6 = require("ts-morph");
|
|
3272
|
+
function resolveHeritageCall(node) {
|
|
3273
|
+
if (!node) return void 0;
|
|
3274
|
+
const expr = unwrapExpression(node);
|
|
3275
|
+
if (import_ts_morph6.Node.isCallExpression(expr)) return expr;
|
|
3276
|
+
if (!import_ts_morph6.Node.isIdentifier(expr)) return void 0;
|
|
3277
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
|
|
3278
|
+
(n) => n !== void 0 && import_ts_morph6.Node.isVariableDeclaration(n)
|
|
3279
|
+
);
|
|
3280
|
+
const init = decl?.getInitializer();
|
|
3281
|
+
if (!init) return void 0;
|
|
3282
|
+
const unwrapped = unwrapExpression(init);
|
|
3283
|
+
return import_ts_morph6.Node.isCallExpression(unwrapped) ? unwrapped : void 0;
|
|
3284
|
+
}
|
|
3285
|
+
function unwrapExpression(node) {
|
|
3286
|
+
let current = node;
|
|
3287
|
+
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)) {
|
|
3288
|
+
current = current.getExpression();
|
|
3289
|
+
}
|
|
3290
|
+
return current;
|
|
3291
|
+
}
|
|
3292
|
+
function resolveReturnedClass(factoryDecl) {
|
|
3293
|
+
const body = factoryDecl.getBody();
|
|
3294
|
+
if (!body) return void 0;
|
|
3295
|
+
const returns = body.getDescendants().filter((n) => import_ts_morph6.Node.isReturnStatement(n));
|
|
3296
|
+
for (const ret of returns) {
|
|
3297
|
+
const expr = ret.getExpression();
|
|
3298
|
+
if (!expr) continue;
|
|
3299
|
+
const inner = unwrapExpression(expr);
|
|
3300
|
+
if (import_ts_morph6.Node.isClassExpression(inner)) {
|
|
3301
|
+
return inner;
|
|
3302
|
+
}
|
|
3303
|
+
if (import_ts_morph6.Node.isIdentifier(inner)) {
|
|
3304
|
+
const name = inner.getText();
|
|
3305
|
+
const decl = body.getDescendants().find((n) => import_ts_morph6.Node.isClassDeclaration(n) && n.getName() === name);
|
|
3306
|
+
if (decl) return decl;
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
return void 0;
|
|
3310
|
+
}
|
|
3311
|
+
function resolveFactoryDeclaration(call) {
|
|
3312
|
+
const callee = call.getExpression();
|
|
3313
|
+
if (!import_ts_morph6.Node.isIdentifier(callee)) return void 0;
|
|
3314
|
+
return callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph6.Node.isFunctionDeclaration(n));
|
|
3315
|
+
}
|
|
3316
|
+
function resolveFactoryStaticClass(node) {
|
|
3317
|
+
if (!import_ts_morph6.Node.isPropertyAccessExpression(node)) return void 0;
|
|
3318
|
+
const call = resolveHeritageCall(node.getExpression());
|
|
3319
|
+
if (!call) return void 0;
|
|
3320
|
+
const factoryDecl = resolveFactoryDeclaration(call);
|
|
3321
|
+
if (!factoryDecl) return void 0;
|
|
3322
|
+
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
3323
|
+
if (!returnedClass) return void 0;
|
|
3324
|
+
const staticProp = returnedClass.getStaticProperties().find((p) => p.getName() === node.getName());
|
|
3325
|
+
if (!staticProp || !import_ts_morph6.Node.isPropertyDeclaration(staticProp)) return void 0;
|
|
3326
|
+
const init = staticProp.getInitializer();
|
|
3327
|
+
if (!init) return void 0;
|
|
3328
|
+
const inner = unwrapExpression(init);
|
|
3329
|
+
if (import_ts_morph6.Node.isClassExpression(inner)) return inner;
|
|
3330
|
+
if (!import_ts_morph6.Node.isIdentifier(inner)) return void 0;
|
|
3331
|
+
return inner.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph6.Node.isClassDeclaration(n));
|
|
3332
|
+
}
|
|
3333
|
+
function resolveInheritedMethods(cls) {
|
|
3334
|
+
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
3335
|
+
if (!expr) return void 0;
|
|
3336
|
+
const callee = expr.getExpression();
|
|
3337
|
+
if (!import_ts_morph6.Node.isIdentifier(callee)) return void 0;
|
|
3338
|
+
const factoryDecl = resolveFactoryDeclaration(expr);
|
|
3339
|
+
if (!factoryDecl) return void 0;
|
|
3340
|
+
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
3341
|
+
if (!returnedClass) return void 0;
|
|
3342
|
+
const classArgs = [];
|
|
3343
|
+
const namedClassArgs = {};
|
|
3344
|
+
for (const arg of expr.getArguments()) {
|
|
3345
|
+
const positional = resolveClassReference(arg);
|
|
3346
|
+
if (positional) {
|
|
3347
|
+
classArgs.push(positional);
|
|
3348
|
+
continue;
|
|
3349
|
+
}
|
|
3350
|
+
if (!import_ts_morph6.Node.isObjectLiteralExpression(arg)) continue;
|
|
3351
|
+
for (const prop of arg.getProperties()) {
|
|
3352
|
+
const named = resolvePropertyClassReference(prop);
|
|
3353
|
+
if (!named) continue;
|
|
3354
|
+
namedClassArgs[named.key] ??= named.ref;
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
return {
|
|
3358
|
+
methods: returnedClass.getMethods(),
|
|
3359
|
+
factoryName: callee.getText(),
|
|
3360
|
+
factoryFilePath: factoryDecl.getSourceFile().getFilePath(),
|
|
3361
|
+
classArgs,
|
|
3362
|
+
namedClassArgs
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
3365
|
+
function resolveClassReference(node) {
|
|
3366
|
+
const expr = unwrapExpression(node);
|
|
3367
|
+
if (!import_ts_morph6.Node.isIdentifier(expr)) return void 0;
|
|
3368
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph6.Node.isClassDeclaration(n));
|
|
3369
|
+
if (!decl) return void 0;
|
|
3370
|
+
return {
|
|
3371
|
+
name: decl.getName() ?? expr.getText(),
|
|
3372
|
+
filePath: decl.getSourceFile().getFilePath()
|
|
3373
|
+
};
|
|
3374
|
+
}
|
|
3375
|
+
function resolvePropertyClassReference(prop) {
|
|
3376
|
+
if (import_ts_morph6.Node.isShorthandPropertyAssignment(prop)) {
|
|
3377
|
+
const ref2 = resolveClassReference(prop.getNameNode());
|
|
3378
|
+
return ref2 ? { key: prop.getName(), ref: ref2 } : void 0;
|
|
3379
|
+
}
|
|
3380
|
+
if (!import_ts_morph6.Node.isPropertyAssignment(prop)) return void 0;
|
|
3381
|
+
const init = prop.getInitializer();
|
|
3382
|
+
if (!init) return void 0;
|
|
3383
|
+
const ref = resolveClassReference(init);
|
|
3384
|
+
if (!ref) return void 0;
|
|
3385
|
+
const nameNode = prop.getNameNode();
|
|
3386
|
+
const key = import_ts_morph6.Node.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : prop.getName();
|
|
3387
|
+
return { key, ref };
|
|
3388
|
+
}
|
|
3389
|
+
var mixinTypeProject;
|
|
3390
|
+
function getMixinTypeProject() {
|
|
3391
|
+
mixinTypeProject ??= new import_ts_morph6.Project({
|
|
3392
|
+
skipAddingFilesFromTsConfig: true,
|
|
3393
|
+
compilerOptions: { strict: true }
|
|
3394
|
+
});
|
|
3395
|
+
return mixinTypeProject;
|
|
3396
|
+
}
|
|
3397
|
+
function clearMixinTypeProject() {
|
|
3398
|
+
mixinTypeProject = void 0;
|
|
3399
|
+
}
|
|
3400
|
+
function resolveInstantiatedReturnType(cls, methodName) {
|
|
3401
|
+
const filePath = cls.getSourceFile().getFilePath();
|
|
3402
|
+
const className = cls.getName();
|
|
3403
|
+
if (!className) return void 0;
|
|
3404
|
+
const project = getMixinTypeProject();
|
|
3405
|
+
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
|
|
3406
|
+
const typedCls = sourceFile?.getClass(className);
|
|
3407
|
+
if (!typedCls) return void 0;
|
|
3408
|
+
const prop = typedCls.getType().getProperty(methodName);
|
|
3409
|
+
if (!prop) return void 0;
|
|
3410
|
+
const returnType = prop.getTypeAtLocation(typedCls).getCallSignatures()[0]?.getReturnType();
|
|
3411
|
+
if (!returnType) return void 0;
|
|
3412
|
+
const unwrapped = returnType.getSymbol()?.getName() === "Promise" ? returnType.getTypeArguments()[0] ?? returnType : returnType;
|
|
3413
|
+
return unwrapped.getText(typedCls);
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3270
3416
|
// src/discovery/filter-for.ts
|
|
3271
3417
|
function resolveMixinEntityClass(mixin, project) {
|
|
3272
|
-
const entityArg = mixin?.classArgs[0];
|
|
3418
|
+
const entityArg = mixin?.namedClassArgs?.entity ?? mixin?.classArgs[0];
|
|
3273
3419
|
if (!entityArg) return void 0;
|
|
3274
3420
|
const file = project.getSourceFile(entityArg.filePath) ?? project.addSourceFileAtPathIfExists(entityArg.filePath);
|
|
3275
3421
|
return file?.getClass(entityArg.name);
|
|
3276
3422
|
}
|
|
3277
3423
|
function classifyFilterForHint(typeInit) {
|
|
3278
|
-
if (
|
|
3424
|
+
if (import_ts_morph7.Node.isStringLiteral(typeInit)) {
|
|
3279
3425
|
switch (typeInit.getLiteralValue()) {
|
|
3280
3426
|
case "string":
|
|
3281
3427
|
return { kind: "string" };
|
|
@@ -3289,10 +3435,10 @@ function classifyFilterForHint(typeInit) {
|
|
|
3289
3435
|
return null;
|
|
3290
3436
|
}
|
|
3291
3437
|
}
|
|
3292
|
-
if (
|
|
3438
|
+
if (import_ts_morph7.Node.isArrayLiteralExpression(typeInit)) {
|
|
3293
3439
|
const values = [];
|
|
3294
3440
|
for (const el of typeInit.getElements()) {
|
|
3295
|
-
if (!
|
|
3441
|
+
if (!import_ts_morph7.Node.isStringLiteral(el)) return null;
|
|
3296
3442
|
values.push(el.getLiteralValue());
|
|
3297
3443
|
}
|
|
3298
3444
|
if (values.length === 0) return null;
|
|
@@ -3327,11 +3473,11 @@ function extractFilterForHints(classDecl, project) {
|
|
|
3327
3473
|
if (!filterForDec) continue;
|
|
3328
3474
|
const args = filterForDec.getArguments();
|
|
3329
3475
|
const keyArg = args[0];
|
|
3330
|
-
const inputKey = keyArg &&
|
|
3476
|
+
const inputKey = keyArg && import_ts_morph7.Node.isStringLiteral(keyArg) ? keyArg.getLiteralValue() : method.getName();
|
|
3331
3477
|
const optsArg = args[1];
|
|
3332
|
-
if (optsArg &&
|
|
3478
|
+
if (optsArg && import_ts_morph7.Node.isObjectLiteralExpression(optsArg)) {
|
|
3333
3479
|
const typeProp = optsArg.getProperty("type");
|
|
3334
|
-
if (typeProp &&
|
|
3480
|
+
if (typeProp && import_ts_morph7.Node.isPropertyAssignment(typeProp)) {
|
|
3335
3481
|
const typeInit = typeProp.getInitializer();
|
|
3336
3482
|
if (typeInit) {
|
|
3337
3483
|
const classified = classifyFilterForHint(typeInit);
|
|
@@ -3356,21 +3502,23 @@ function extractApplyFilterInfo(method, sourceFile, project, mixin) {
|
|
|
3356
3502
|
const args = filterDecorator.getArguments();
|
|
3357
3503
|
if (args.length === 0) continue;
|
|
3358
3504
|
const filterClassArg = args[0];
|
|
3359
|
-
if (!filterClassArg
|
|
3505
|
+
if (!filterClassArg) continue;
|
|
3506
|
+
const factoryStaticClass = resolveFactoryStaticClass(filterClassArg);
|
|
3507
|
+
if (!factoryStaticClass && !import_ts_morph7.Node.isIdentifier(filterClassArg)) continue;
|
|
3360
3508
|
let source = "query";
|
|
3361
3509
|
const optionsArg = args[1];
|
|
3362
|
-
if (optionsArg &&
|
|
3510
|
+
if (optionsArg && import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) {
|
|
3363
3511
|
const sourceProp = optionsArg.getProperty("source");
|
|
3364
|
-
if (sourceProp &&
|
|
3512
|
+
if (sourceProp && import_ts_morph7.Node.isPropertyAssignment(sourceProp)) {
|
|
3365
3513
|
const init = sourceProp.getInitializer();
|
|
3366
|
-
if (init &&
|
|
3514
|
+
if (init && import_ts_morph7.Node.isStringLiteral(init) && init.getLiteralValue() === "body") {
|
|
3367
3515
|
source = "body";
|
|
3368
3516
|
}
|
|
3369
3517
|
}
|
|
3370
3518
|
}
|
|
3371
3519
|
const filterClassName = filterClassArg.getText();
|
|
3372
|
-
const resolved = findType(filterClassName, declFile, project);
|
|
3373
|
-
const classDecl = resolved?.kind === "class" ? resolved.decl : resolveLocalClassDeclaration(filterClassArg);
|
|
3520
|
+
const resolved = factoryStaticClass ? void 0 : findType(filterClassName, declFile, project);
|
|
3521
|
+
const classDecl = factoryStaticClass ?? (resolved?.kind === "class" ? resolved.decl : resolveLocalClassDeclaration(filterClassArg));
|
|
3374
3522
|
if (classDecl) {
|
|
3375
3523
|
let fieldTypes = extractClassPropertyTypes(classDecl, project);
|
|
3376
3524
|
if (fieldTypes.length === 0) {
|
|
@@ -3426,22 +3574,22 @@ function resolveRelationEntity(prop, sourceFile, project) {
|
|
|
3426
3574
|
const args = dec.getArguments();
|
|
3427
3575
|
if (args.length === 0) continue;
|
|
3428
3576
|
const arg = args[0];
|
|
3429
|
-
if (
|
|
3577
|
+
if (import_ts_morph7.Node.isObjectLiteralExpression(arg)) {
|
|
3430
3578
|
const entityProp = arg.getProperty("entity");
|
|
3431
|
-
if (entityProp &&
|
|
3579
|
+
if (entityProp && import_ts_morph7.Node.isPropertyAssignment(entityProp)) {
|
|
3432
3580
|
const init = entityProp.getInitializer();
|
|
3433
|
-
if (init &&
|
|
3581
|
+
if (init && import_ts_morph7.Node.isArrowFunction(init)) {
|
|
3434
3582
|
const body = init.getBody();
|
|
3435
|
-
if (
|
|
3583
|
+
if (import_ts_morph7.Node.isIdentifier(body)) {
|
|
3436
3584
|
const resolved = findType(body.getText(), prop.getSourceFile(), project);
|
|
3437
3585
|
if (resolved?.kind === "class") return resolved.decl;
|
|
3438
3586
|
}
|
|
3439
3587
|
}
|
|
3440
3588
|
}
|
|
3441
3589
|
}
|
|
3442
|
-
if (
|
|
3590
|
+
if (import_ts_morph7.Node.isArrowFunction(arg)) {
|
|
3443
3591
|
const body = arg.getBody();
|
|
3444
|
-
if (
|
|
3592
|
+
if (import_ts_morph7.Node.isIdentifier(body)) {
|
|
3445
3593
|
const resolved = findType(body.getText(), prop.getSourceFile(), project);
|
|
3446
3594
|
if (resolved?.kind === "class") return resolved.decl;
|
|
3447
3595
|
}
|
|
@@ -3460,15 +3608,15 @@ function extractClassPropertyTypes(classDecl, project) {
|
|
|
3460
3608
|
return fields;
|
|
3461
3609
|
}
|
|
3462
3610
|
function resolveLocalClassDeclaration(identifier) {
|
|
3463
|
-
if (!
|
|
3464
|
-
return identifier.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 &&
|
|
3611
|
+
if (!import_ts_morph7.Node.isIdentifier(identifier)) return void 0;
|
|
3612
|
+
return identifier.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && import_ts_morph7.Node.isClassDeclaration(n));
|
|
3465
3613
|
}
|
|
3466
3614
|
function resolveDeclaredEntity(optionsArg, filterClass, project) {
|
|
3467
|
-
if (!
|
|
3615
|
+
if (!import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) return void 0;
|
|
3468
3616
|
const entityProp = optionsArg.getProperty("entity");
|
|
3469
|
-
if (!entityProp || !
|
|
3617
|
+
if (!entityProp || !import_ts_morph7.Node.isPropertyAssignment(entityProp)) return void 0;
|
|
3470
3618
|
const entityInit = entityProp.getInitializer();
|
|
3471
|
-
if (!entityInit || !
|
|
3619
|
+
if (!entityInit || !import_ts_morph7.Node.isIdentifier(entityInit)) return void 0;
|
|
3472
3620
|
const resolved = findType(entityInit.getText(), filterClass.getSourceFile(), project);
|
|
3473
3621
|
if (!resolved || resolved.kind !== "class") return void 0;
|
|
3474
3622
|
return resolved.decl;
|
|
@@ -3479,7 +3627,7 @@ function extractFilterableEntityFields(filterClass, project, entityOverride) {
|
|
|
3479
3627
|
const args = filterableDecorator.getArguments();
|
|
3480
3628
|
if (args.length === 0) return [];
|
|
3481
3629
|
const optionsArg = args[0];
|
|
3482
|
-
if (!
|
|
3630
|
+
if (!import_ts_morph7.Node.isObjectLiteralExpression(optionsArg)) return [];
|
|
3483
3631
|
const entityDecl = entityOverride ?? resolveDeclaredEntity(optionsArg, filterClass, project);
|
|
3484
3632
|
if (!entityDecl) return [];
|
|
3485
3633
|
const fields = collectEntityFields(
|
|
@@ -3492,17 +3640,17 @@ function extractFilterableEntityFields(filterClass, project, entityOverride) {
|
|
|
3492
3640
|
const relationsDecorator = filterClass.getDecorators().find((d) => d.getName() === "Relations");
|
|
3493
3641
|
if (relationsDecorator) {
|
|
3494
3642
|
const relArgs = relationsDecorator.getArguments();
|
|
3495
|
-
if (relArgs.length > 0 &&
|
|
3643
|
+
if (relArgs.length > 0 && import_ts_morph7.Node.isObjectLiteralExpression(relArgs[0])) {
|
|
3496
3644
|
for (const relProp of relArgs[0].getProperties()) {
|
|
3497
|
-
if (!
|
|
3645
|
+
if (!import_ts_morph7.Node.isPropertyAssignment(relProp)) continue;
|
|
3498
3646
|
const relInit = relProp.getInitializer();
|
|
3499
|
-
if (!relInit || !
|
|
3647
|
+
if (!relInit || !import_ts_morph7.Node.isObjectLiteralExpression(relInit)) continue;
|
|
3500
3648
|
const keysProp = relInit.getProperty("keys");
|
|
3501
|
-
if (!keysProp || !
|
|
3649
|
+
if (!keysProp || !import_ts_morph7.Node.isPropertyAssignment(keysProp)) continue;
|
|
3502
3650
|
const keysInit = keysProp.getInitializer();
|
|
3503
|
-
if (!keysInit || !
|
|
3651
|
+
if (!keysInit || !import_ts_morph7.Node.isArrayLiteralExpression(keysInit)) continue;
|
|
3504
3652
|
for (const el of keysInit.getElements()) {
|
|
3505
|
-
if (
|
|
3653
|
+
if (import_ts_morph7.Node.isStringLiteral(el)) {
|
|
3506
3654
|
fields.push(toFilterFieldType(el.getLiteralValue(), { kind: "unknown" }));
|
|
3507
3655
|
}
|
|
3508
3656
|
}
|
|
@@ -3543,22 +3691,22 @@ var PASSTHROUGH_UTILITY = /* @__PURE__ */ new Set([
|
|
|
3543
3691
|
]);
|
|
3544
3692
|
function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /* @__PURE__ */ new Map()) {
|
|
3545
3693
|
if (depth <= 0) return "unknown";
|
|
3546
|
-
if (
|
|
3694
|
+
if (import_ts_morph8.Node.isArrayTypeNode(typeNode)) {
|
|
3547
3695
|
const elementType = typeNode.getElementTypeNode();
|
|
3548
3696
|
return `Array<${resolveTypeNodeToString(elementType, sourceFile, project, depth, subst)}>`;
|
|
3549
3697
|
}
|
|
3550
|
-
if (
|
|
3698
|
+
if (import_ts_morph8.Node.isUnionTypeNode(typeNode)) {
|
|
3551
3699
|
return typeNode.getTypeNodes().map((t) => resolveTypeNodeToString(t, sourceFile, project, depth, subst)).join(" | ");
|
|
3552
3700
|
}
|
|
3553
|
-
if (
|
|
3701
|
+
if (import_ts_morph8.Node.isIntersectionTypeNode(typeNode)) {
|
|
3554
3702
|
return typeNode.getTypeNodes().map((t) => resolveTypeNodeToString(t, sourceFile, project, depth, subst)).join(" & ");
|
|
3555
3703
|
}
|
|
3556
|
-
if (
|
|
3704
|
+
if (import_ts_morph8.Node.isParenthesizedTypeNode(typeNode)) {
|
|
3557
3705
|
return `(${resolveTypeNodeToString(typeNode.getTypeNode(), sourceFile, project, depth, subst)})`;
|
|
3558
3706
|
}
|
|
3559
|
-
if (
|
|
3707
|
+
if (import_ts_morph8.Node.isTypeReference(typeNode)) {
|
|
3560
3708
|
const typeName = typeNode.getTypeName();
|
|
3561
|
-
const name =
|
|
3709
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : typeNode.getText();
|
|
3562
3710
|
const bound = subst.get(name);
|
|
3563
3711
|
if (bound !== void 0) return bound;
|
|
3564
3712
|
if (name === "string" || name === "number" || name === "boolean") return name;
|
|
@@ -3581,10 +3729,10 @@ function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /
|
|
|
3581
3729
|
dbg("unresolvable type:", name, "in", sourceFile.getFilePath());
|
|
3582
3730
|
return "unknown";
|
|
3583
3731
|
}
|
|
3584
|
-
if (
|
|
3732
|
+
if (import_ts_morph8.Node.isTypeLiteral(typeNode)) {
|
|
3585
3733
|
const members = [];
|
|
3586
3734
|
for (const member of typeNode.getMembers()) {
|
|
3587
|
-
if (
|
|
3735
|
+
if (import_ts_morph8.Node.isPropertySignature(member)) {
|
|
3588
3736
|
const memberTypeNode = member.getTypeNode();
|
|
3589
3737
|
const memberType = memberTypeNode ? resolveTypeNodeToString(memberTypeNode, sourceFile, project, depth, subst) : "unknown";
|
|
3590
3738
|
members.push(`${member.getName()}${member.hasQuestionToken() ? "?" : ""}: ${memberType}`);
|
|
@@ -3595,11 +3743,11 @@ function resolveTypeNodeToString(typeNode, sourceFile, project, depth, subst = /
|
|
|
3595
3743
|
return members.length > 0 ? `{ ${members.join("; ")} }` : "{}";
|
|
3596
3744
|
}
|
|
3597
3745
|
const kind = typeNode.getKind();
|
|
3598
|
-
if (kind ===
|
|
3599
|
-
if (kind ===
|
|
3600
|
-
if (kind ===
|
|
3601
|
-
if (kind ===
|
|
3602
|
-
if (kind ===
|
|
3746
|
+
if (kind === import_ts_morph8.SyntaxKind.StringKeyword) return "string";
|
|
3747
|
+
if (kind === import_ts_morph8.SyntaxKind.NumberKeyword) return "number";
|
|
3748
|
+
if (kind === import_ts_morph8.SyntaxKind.BooleanKeyword) return "boolean";
|
|
3749
|
+
if (kind === import_ts_morph8.SyntaxKind.UnknownKeyword) return "unknown";
|
|
3750
|
+
if (kind === import_ts_morph8.SyntaxKind.AnyKeyword) return "unknown";
|
|
3603
3751
|
return typeNode.getText();
|
|
3604
3752
|
}
|
|
3605
3753
|
function unwrapFirstTypeArg(typeNode, sourceFile, project, depth, mode, subst = /* @__PURE__ */ new Map()) {
|
|
@@ -3684,7 +3832,7 @@ function extractQueryType(method, sourceFile, project) {
|
|
|
3684
3832
|
if (!queryDecorator) continue;
|
|
3685
3833
|
const queryArgs = queryDecorator.getArguments();
|
|
3686
3834
|
const nameArg = queryArgs[0];
|
|
3687
|
-
if (!nameArg || !
|
|
3835
|
+
if (!nameArg || !import_ts_morph8.Node.isStringLiteral(nameArg)) continue;
|
|
3688
3836
|
const queryName = nameArg.getLiteralValue();
|
|
3689
3837
|
const typeNode = param.getTypeNode();
|
|
3690
3838
|
const queryType = typeNode ? resolveTypeNodeToString(typeNode, sourceFile, project, 3) : "string";
|
|
@@ -3695,8 +3843,8 @@ function extractQueryType(method, sourceFile, project) {
|
|
|
3695
3843
|
function isParamOptional(param) {
|
|
3696
3844
|
if (param.hasQuestionToken() || param.hasInitializer()) return true;
|
|
3697
3845
|
const typeNode = param.getTypeNode();
|
|
3698
|
-
if (typeNode &&
|
|
3699
|
-
return typeNode.getTypeNodes().some((t) => t.getKind() ===
|
|
3846
|
+
if (typeNode && import_ts_morph8.Node.isUnionTypeNode(typeNode)) {
|
|
3847
|
+
return typeNode.getTypeNodes().some((t) => t.getKind() === import_ts_morph8.SyntaxKind.UndefinedKeyword);
|
|
3700
3848
|
}
|
|
3701
3849
|
return false;
|
|
3702
3850
|
}
|
|
@@ -3708,7 +3856,7 @@ function extractParamsType(method, sourceFile, project) {
|
|
|
3708
3856
|
const paramArgs = paramDecorator.getArguments();
|
|
3709
3857
|
if (paramArgs.length === 0) continue;
|
|
3710
3858
|
const nameArg = paramArgs[0];
|
|
3711
|
-
if (!
|
|
3859
|
+
if (!import_ts_morph8.Node.isStringLiteral(nameArg)) continue;
|
|
3712
3860
|
const paramName = nameArg.getLiteralValue();
|
|
3713
3861
|
const typeNode = param.getTypeNode();
|
|
3714
3862
|
const paramType = typeNode ? resolveTypeNodeToString(typeNode, sourceFile, project, 3) : "string";
|
|
@@ -3729,28 +3877,28 @@ function extractUploadedFiles(method) {
|
|
|
3729
3877
|
for (const decorator of method.getDecorators()) {
|
|
3730
3878
|
if (decorator.getName() !== "UseInterceptors") continue;
|
|
3731
3879
|
for (const arg of decorator.getArguments()) {
|
|
3732
|
-
if (!
|
|
3880
|
+
if (!import_ts_morph8.Node.isCallExpression(arg)) continue;
|
|
3733
3881
|
const interceptor = arg.getExpression().getText();
|
|
3734
3882
|
const callArgs = arg.getArguments();
|
|
3735
3883
|
const firstArg2 = callArgs[0];
|
|
3736
3884
|
if (interceptor === "FileInterceptor") {
|
|
3737
|
-
if (firstArg2 &&
|
|
3885
|
+
if (firstArg2 && import_ts_morph8.Node.isStringLiteral(firstArg2)) {
|
|
3738
3886
|
entries.push(`${firstArg2.getLiteralValue()}: ${FILE}`);
|
|
3739
3887
|
multipart = true;
|
|
3740
3888
|
}
|
|
3741
3889
|
} else if (interceptor === "FilesInterceptor") {
|
|
3742
|
-
if (firstArg2 &&
|
|
3890
|
+
if (firstArg2 && import_ts_morph8.Node.isStringLiteral(firstArg2)) {
|
|
3743
3891
|
entries.push(`${firstArg2.getLiteralValue()}: Array<${FILE}>`);
|
|
3744
3892
|
multipart = true;
|
|
3745
3893
|
}
|
|
3746
3894
|
} else if (interceptor === "FileFieldsInterceptor") {
|
|
3747
|
-
if (firstArg2 &&
|
|
3895
|
+
if (firstArg2 && import_ts_morph8.Node.isArrayLiteralExpression(firstArg2)) {
|
|
3748
3896
|
for (const el of firstArg2.getElements()) {
|
|
3749
|
-
if (!
|
|
3897
|
+
if (!import_ts_morph8.Node.isObjectLiteralExpression(el)) continue;
|
|
3750
3898
|
const nameProp = el.getProperty("name");
|
|
3751
|
-
if (nameProp &&
|
|
3899
|
+
if (nameProp && import_ts_morph8.Node.isPropertyAssignment(nameProp)) {
|
|
3752
3900
|
const init = nameProp.getInitializer();
|
|
3753
|
-
if (init &&
|
|
3901
|
+
if (init && import_ts_morph8.Node.isStringLiteral(init)) {
|
|
3754
3902
|
entries.push(`${init.getLiteralValue()}: Array<${FILE}>`);
|
|
3755
3903
|
}
|
|
3756
3904
|
}
|
|
@@ -3770,13 +3918,13 @@ function extractResponseType(method, sourceFile, project) {
|
|
|
3770
3918
|
if (apiResponseDecorator) {
|
|
3771
3919
|
const args = apiResponseDecorator.getArguments();
|
|
3772
3920
|
const optsArg = args[0];
|
|
3773
|
-
if (optsArg &&
|
|
3921
|
+
if (optsArg && import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) {
|
|
3774
3922
|
for (const prop of optsArg.getProperties()) {
|
|
3775
|
-
if (!
|
|
3923
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
3776
3924
|
if (prop.getName() !== "type") continue;
|
|
3777
3925
|
const val = prop.getInitializer();
|
|
3778
3926
|
if (!val) continue;
|
|
3779
|
-
if (
|
|
3927
|
+
if (import_ts_morph8.Node.isArrayLiteralExpression(val)) {
|
|
3780
3928
|
const elements = val.getElements();
|
|
3781
3929
|
const firstEl = elements[0];
|
|
3782
3930
|
if (elements.length > 0 && firstEl !== void 0) {
|
|
@@ -3797,24 +3945,24 @@ function extractResponseType(method, sourceFile, project) {
|
|
|
3797
3945
|
}
|
|
3798
3946
|
function apiResponseStatus(decorator) {
|
|
3799
3947
|
const optsArg = decorator.getArguments()[0];
|
|
3800
|
-
if (!optsArg || !
|
|
3948
|
+
if (!optsArg || !import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) return null;
|
|
3801
3949
|
for (const prop of optsArg.getProperties()) {
|
|
3802
|
-
if (!
|
|
3950
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
3803
3951
|
if (prop.getName() !== "status") continue;
|
|
3804
3952
|
const val = prop.getInitializer();
|
|
3805
|
-
if (val &&
|
|
3953
|
+
if (val && import_ts_morph8.Node.isNumericLiteral(val)) return Number(val.getLiteralValue());
|
|
3806
3954
|
}
|
|
3807
3955
|
return null;
|
|
3808
3956
|
}
|
|
3809
3957
|
function apiResponseTypeNode(decorator) {
|
|
3810
3958
|
const optsArg = decorator.getArguments()[0];
|
|
3811
|
-
if (!optsArg || !
|
|
3959
|
+
if (!optsArg || !import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) return null;
|
|
3812
3960
|
for (const prop of optsArg.getProperties()) {
|
|
3813
|
-
if (!
|
|
3961
|
+
if (!import_ts_morph8.Node.isPropertyAssignment(prop)) continue;
|
|
3814
3962
|
if (prop.getName() !== "type") continue;
|
|
3815
3963
|
const val = prop.getInitializer();
|
|
3816
3964
|
if (!val) return null;
|
|
3817
|
-
if (
|
|
3965
|
+
if (import_ts_morph8.Node.isArrayLiteralExpression(val)) {
|
|
3818
3966
|
const first = val.getElements()[0];
|
|
3819
3967
|
return first ? { node: first, isArray: true } : null;
|
|
3820
3968
|
}
|
|
@@ -3832,7 +3980,7 @@ function extractErrorType(method, sourceFile, project) {
|
|
|
3832
3980
|
const inner = resolveIdentifierToClassType(typeInfo.node, sourceFile, project, 3);
|
|
3833
3981
|
const type = typeInfo.isArray ? `Array<${inner}>` : inner;
|
|
3834
3982
|
let ref = null;
|
|
3835
|
-
if (
|
|
3983
|
+
if (import_ts_morph8.Node.isIdentifier(typeInfo.node)) {
|
|
3836
3984
|
const name = typeInfo.node.getText();
|
|
3837
3985
|
const localDecl = sourceFile.getInterface(name) || sourceFile.getClass(name) || sourceFile.getTypeAlias(name);
|
|
3838
3986
|
if (localDecl?.isExported()) {
|
|
@@ -3849,7 +3997,7 @@ function extractErrorType(method, sourceFile, project) {
|
|
|
3849
3997
|
return null;
|
|
3850
3998
|
}
|
|
3851
3999
|
function resolveIdentifierToClassType(node, sourceFile, project, depth) {
|
|
3852
|
-
if (!
|
|
4000
|
+
if (!import_ts_morph8.Node.isIdentifier(node)) return "unknown";
|
|
3853
4001
|
const name = node.getText();
|
|
3854
4002
|
const resolved = findType(name, sourceFile, project);
|
|
3855
4003
|
if (resolved) {
|
|
@@ -3869,9 +4017,9 @@ var STREAM_ENVELOPES = /* @__PURE__ */ new Set(["MessageEvent", "MessageEventLik
|
|
|
3869
4017
|
var BINARY_RESPONSE_TYPES = /* @__PURE__ */ new Set(["StreamableFile", "Buffer"]);
|
|
3870
4018
|
function detectBinaryResponse(method) {
|
|
3871
4019
|
const node = unwrapNamedContainer(method.getReturnTypeNode(), /* @__PURE__ */ new Set(["Promise"]));
|
|
3872
|
-
if (!node || !
|
|
4020
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return false;
|
|
3873
4021
|
const typeName = node.getTypeName();
|
|
3874
|
-
const name =
|
|
4022
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
3875
4023
|
return BINARY_RESPONSE_TYPES.has(name);
|
|
3876
4024
|
}
|
|
3877
4025
|
function detectStreamElement(method) {
|
|
@@ -3886,9 +4034,9 @@ function detectStreamElement(method) {
|
|
|
3886
4034
|
return null;
|
|
3887
4035
|
}
|
|
3888
4036
|
function streamContainerElement(node) {
|
|
3889
|
-
if (!node || !
|
|
4037
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return null;
|
|
3890
4038
|
const typeName = node.getTypeName();
|
|
3891
|
-
const name =
|
|
4039
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
3892
4040
|
if (STREAM_CONTAINERS.has(name) || STREAM_CONTAINERS_GENERATOR.has(name)) {
|
|
3893
4041
|
return node.getTypeArguments()[0] ?? null;
|
|
3894
4042
|
}
|
|
@@ -3898,9 +4046,9 @@ function hasAsQueryDecorator(method) {
|
|
|
3898
4046
|
return method.getDecorators().some((d) => d.getName() === "AsQuery");
|
|
3899
4047
|
}
|
|
3900
4048
|
function unwrapNamedContainer(node, names) {
|
|
3901
|
-
if (!node || !
|
|
4049
|
+
if (!node || !import_ts_morph8.Node.isTypeReference(node)) return node;
|
|
3902
4050
|
const typeName = node.getTypeName();
|
|
3903
|
-
const name =
|
|
4051
|
+
const name = import_ts_morph8.Node.isIdentifier(typeName) ? typeName.getText() : "";
|
|
3904
4052
|
if (names.has(name)) {
|
|
3905
4053
|
return node.getTypeArguments()[0] ?? node;
|
|
3906
4054
|
}
|
|
@@ -3946,11 +4094,11 @@ function extractDtoContract(method, sourceFile, project, mixin) {
|
|
|
3946
4094
|
if (apiResp) {
|
|
3947
4095
|
const args = apiResp.getArguments();
|
|
3948
4096
|
const optsArg = args[0];
|
|
3949
|
-
if (optsArg &&
|
|
4097
|
+
if (optsArg && import_ts_morph8.Node.isObjectLiteralExpression(optsArg)) {
|
|
3950
4098
|
for (const prop of optsArg.getProperties()) {
|
|
3951
|
-
if (
|
|
4099
|
+
if (import_ts_morph8.Node.isPropertyAssignment(prop) && prop.getName() === "type") {
|
|
3952
4100
|
const val = prop.getInitializer();
|
|
3953
|
-
if (val &&
|
|
4101
|
+
if (val && import_ts_morph8.Node.isIdentifier(val)) {
|
|
3954
4102
|
const name = val.getText();
|
|
3955
4103
|
const localDecl = sourceFile.getInterface(name) || sourceFile.getClass(name) || sourceFile.getTypeAlias(name);
|
|
3956
4104
|
if (localDecl?.isExported()) {
|
|
@@ -4018,101 +4166,6 @@ function resolveParamClass(method, decoratorName, sourceFile, project) {
|
|
|
4018
4166
|
return null;
|
|
4019
4167
|
}
|
|
4020
4168
|
|
|
4021
|
-
// src/discovery/heritage.ts
|
|
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
|
-
}
|
|
4036
|
-
function unwrapExpression(node) {
|
|
4037
|
-
let current = node;
|
|
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)) {
|
|
4039
|
-
current = current.getExpression();
|
|
4040
|
-
}
|
|
4041
|
-
return current;
|
|
4042
|
-
}
|
|
4043
|
-
function resolveReturnedClass(factoryDecl) {
|
|
4044
|
-
const body = factoryDecl.getBody();
|
|
4045
|
-
if (!body) return void 0;
|
|
4046
|
-
const returns = body.getDescendants().filter((n) => import_ts_morph8.Node.isReturnStatement(n));
|
|
4047
|
-
for (const ret of returns) {
|
|
4048
|
-
const expr = ret.getExpression();
|
|
4049
|
-
if (!expr) continue;
|
|
4050
|
-
const inner = unwrapExpression(expr);
|
|
4051
|
-
if (import_ts_morph8.Node.isClassExpression(inner)) {
|
|
4052
|
-
return inner;
|
|
4053
|
-
}
|
|
4054
|
-
if (import_ts_morph8.Node.isIdentifier(inner)) {
|
|
4055
|
-
const name = inner.getText();
|
|
4056
|
-
const decl = body.getDescendants().find((n) => import_ts_morph8.Node.isClassDeclaration(n) && n.getName() === name);
|
|
4057
|
-
if (decl) return decl;
|
|
4058
|
-
}
|
|
4059
|
-
}
|
|
4060
|
-
return void 0;
|
|
4061
|
-
}
|
|
4062
|
-
function resolveInheritedMethods(cls) {
|
|
4063
|
-
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
4064
|
-
if (!expr) return void 0;
|
|
4065
|
-
const callee = expr.getExpression();
|
|
4066
|
-
if (!import_ts_morph8.Node.isIdentifier(callee)) return void 0;
|
|
4067
|
-
const factoryDecl = callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph8.Node.isFunctionDeclaration(n));
|
|
4068
|
-
if (!factoryDecl) return void 0;
|
|
4069
|
-
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
4070
|
-
if (!returnedClass) return void 0;
|
|
4071
|
-
const classArgs = [];
|
|
4072
|
-
for (const arg of expr.getArguments()) {
|
|
4073
|
-
if (!import_ts_morph8.Node.isIdentifier(arg)) continue;
|
|
4074
|
-
const decl = arg.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => import_ts_morph8.Node.isClassDeclaration(n));
|
|
4075
|
-
if (decl) {
|
|
4076
|
-
classArgs.push({
|
|
4077
|
-
name: decl.getName() ?? arg.getText(),
|
|
4078
|
-
filePath: decl.getSourceFile().getFilePath()
|
|
4079
|
-
});
|
|
4080
|
-
}
|
|
4081
|
-
}
|
|
4082
|
-
return {
|
|
4083
|
-
methods: returnedClass.getMethods(),
|
|
4084
|
-
factoryName: callee.getText(),
|
|
4085
|
-
factoryFilePath: factoryDecl.getSourceFile().getFilePath(),
|
|
4086
|
-
classArgs
|
|
4087
|
-
};
|
|
4088
|
-
}
|
|
4089
|
-
var mixinTypeProject;
|
|
4090
|
-
function getMixinTypeProject() {
|
|
4091
|
-
mixinTypeProject ??= new import_ts_morph8.Project({
|
|
4092
|
-
skipAddingFilesFromTsConfig: true,
|
|
4093
|
-
compilerOptions: { strict: true }
|
|
4094
|
-
});
|
|
4095
|
-
return mixinTypeProject;
|
|
4096
|
-
}
|
|
4097
|
-
function clearMixinTypeProject() {
|
|
4098
|
-
mixinTypeProject = void 0;
|
|
4099
|
-
}
|
|
4100
|
-
function resolveInstantiatedReturnType(cls, methodName) {
|
|
4101
|
-
const filePath = cls.getSourceFile().getFilePath();
|
|
4102
|
-
const className = cls.getName();
|
|
4103
|
-
if (!className) return void 0;
|
|
4104
|
-
const project = getMixinTypeProject();
|
|
4105
|
-
const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
|
|
4106
|
-
const typedCls = sourceFile?.getClass(className);
|
|
4107
|
-
if (!typedCls) return void 0;
|
|
4108
|
-
const prop = typedCls.getType().getProperty(methodName);
|
|
4109
|
-
if (!prop) return void 0;
|
|
4110
|
-
const returnType = prop.getTypeAtLocation(typedCls).getCallSignatures()[0]?.getReturnType();
|
|
4111
|
-
if (!returnType) return void 0;
|
|
4112
|
-
const unwrapped = returnType.getSymbol()?.getName() === "Promise" ? returnType.getTypeArguments()[0] ?? returnType : returnType;
|
|
4113
|
-
return unwrapped.getText(typedCls);
|
|
4114
|
-
}
|
|
4115
|
-
|
|
4116
4169
|
// src/discovery/zod-ast-to-ts.ts
|
|
4117
4170
|
var import_ts_morph9 = require("ts-morph");
|
|
4118
4171
|
function zodAstToTs(node) {
|
|
@@ -4595,7 +4648,8 @@ function extractFromSourceFile(sourceFile, project) {
|
|
|
4595
4648
|
const mixinBinding = inherited ? {
|
|
4596
4649
|
factoryName: inherited.factoryName,
|
|
4597
4650
|
factoryFilePath: inherited.factoryFilePath,
|
|
4598
|
-
classArgs: inherited.classArgs
|
|
4651
|
+
classArgs: inherited.classArgs,
|
|
4652
|
+
namedClassArgs: inherited.namedClassArgs
|
|
4599
4653
|
} : void 0;
|
|
4600
4654
|
const ownMethods = cls.getMethods();
|
|
4601
4655
|
const ownNames = new Set(ownMethods.map((m) => m.getName()));
|
|
@@ -4827,7 +4881,7 @@ async function watch(config, onChange, options = {}) {
|
|
|
4827
4881
|
}
|
|
4828
4882
|
|
|
4829
4883
|
// src/index.ts
|
|
4830
|
-
var VERSION = "0.
|
|
4884
|
+
var VERSION = "0.18.0";
|
|
4831
4885
|
|
|
4832
4886
|
// src/generate-manifest.ts
|
|
4833
4887
|
var MANIFEST_FILE = ".codegen-manifest.json";
|