@dudousxd/nestjs-codegen 0.5.1 → 0.5.2
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 +6 -0
- package/dist/cli/main.cjs +8 -17
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +8 -17
- 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-B0mS84Jj.d.cts → index-_qRai4M3.d.cts} +1 -1
- package/dist/{index-B0mS84Jj.d.ts → index-_qRai4M3.d.ts} +1 -1
- package/dist/index.cjs +48 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +45 -17
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +7 -16
- 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 +7 -16
- package/dist/nest/index.js.map +1 -1
- package/package.json +2 -2
package/dist/nest/index.d.cts
CHANGED
package/dist/nest/index.d.ts
CHANGED
package/dist/nest/index.js
CHANGED
|
@@ -558,37 +558,28 @@ function buildProperty(prop, classFile, ctx) {
|
|
|
558
558
|
const typeNode = prop.getTypeNode();
|
|
559
559
|
const typeText = typeNode?.getText() ?? "unknown";
|
|
560
560
|
const isArrayType = !!typeNode && Node2.isArrayTypeNode(typeNode);
|
|
561
|
+
const asField = (child) => applyPresence(
|
|
562
|
+
has("IsArray") || isArrayType ? { kind: "array", element: child } : child,
|
|
563
|
+
decorators
|
|
564
|
+
);
|
|
561
565
|
const discriminator = resolveDiscriminator(dec("Type"));
|
|
562
566
|
if (discriminator) {
|
|
563
567
|
const options = discriminator.subTypes.map(
|
|
564
568
|
(name) => buildNestedReference(name, classFile, ctx)
|
|
565
569
|
);
|
|
566
|
-
|
|
567
|
-
kind: "union",
|
|
568
|
-
options,
|
|
569
|
-
discriminator: discriminator.property
|
|
570
|
-
};
|
|
571
|
-
const wrapArray = has("IsArray") || isArrayType;
|
|
572
|
-
const node2 = wrapArray ? { kind: "array", element: unionNode } : unionNode;
|
|
573
|
-
return applyPresence(node2, decorators);
|
|
570
|
+
return asField({ kind: "union", options, discriminator: discriminator.property });
|
|
574
571
|
}
|
|
575
572
|
const propTypeParam = singularClassName(typeText);
|
|
576
573
|
if (propTypeParam && ctx.typeBindings.has(propTypeParam)) {
|
|
577
574
|
const bound = ctx.typeBindings.get(propTypeParam);
|
|
578
|
-
|
|
579
|
-
const wrapArray = has("IsArray") || isArrayType;
|
|
580
|
-
const node2 = wrapArray ? { kind: "array", element: childNode } : childNode;
|
|
581
|
-
return applyPresence(node2, decorators);
|
|
575
|
+
return asField(buildNestedReference(bound, classFile, ctx));
|
|
582
576
|
}
|
|
583
577
|
const typeRefName = resolveTypeFactoryName(dec("Type"));
|
|
584
578
|
if (has("ValidateNested") || typeRefName) {
|
|
585
579
|
const typeArgs = genericTypeArgNames(typeNode);
|
|
586
580
|
const childName = typeRefName ?? singularClassName(typeText);
|
|
587
581
|
if (childName) {
|
|
588
|
-
|
|
589
|
-
const wrapArray = has("IsArray") || isArrayType;
|
|
590
|
-
const node2 = wrapArray ? { kind: "array", element: childNode } : childNode;
|
|
591
|
-
return applyPresence(node2, decorators);
|
|
582
|
+
return asField(buildNestedReference(childName, classFile, ctx, typeArgs));
|
|
592
583
|
}
|
|
593
584
|
}
|
|
594
585
|
let base = baseFromType(typeText, isArrayType);
|