@dudousxd/nestjs-codegen 0.7.1 → 0.8.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 +6 -0
- package/dist/cli/main.cjs +23 -4
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +23 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +23 -4
- 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 +23 -4
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +22 -3
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.js +22 -3
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -296,6 +296,6 @@ interface FastDiscoveryOptions {
|
|
|
296
296
|
}
|
|
297
297
|
declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
|
|
298
298
|
|
|
299
|
-
declare const VERSION = "0.
|
|
299
|
+
declare const VERSION = "0.8.0";
|
|
300
300
|
|
|
301
301
|
export { type ChainModuleRendererOptions, CodegenError, ConfigError, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, 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
|
@@ -296,6 +296,6 @@ interface FastDiscoveryOptions {
|
|
|
296
296
|
}
|
|
297
297
|
declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
|
|
298
298
|
|
|
299
|
-
declare const VERSION = "0.
|
|
299
|
+
declare const VERSION = "0.8.0";
|
|
300
300
|
|
|
301
301
|
export { type ChainModuleRendererOptions, CodegenError, ConfigError, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, 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
|
@@ -3525,14 +3525,33 @@ function extractQueryType(method, sourceFile, project) {
|
|
|
3525
3525
|
for (const param of method.getParameters()) {
|
|
3526
3526
|
const queryDecorator = param.getDecorators().find((d) => d.getName() === "Query");
|
|
3527
3527
|
if (!queryDecorator) continue;
|
|
3528
|
-
|
|
3529
|
-
if (queryArgs.length > 0) continue;
|
|
3528
|
+
if (queryDecorator.getArguments().length > 0) continue;
|
|
3530
3529
|
const typeNode = param.getTypeNode();
|
|
3531
3530
|
if (typeNode) {
|
|
3532
3531
|
return resolveTypeNodeToString(typeNode, sourceFile, project, 3);
|
|
3533
3532
|
}
|
|
3534
3533
|
}
|
|
3535
|
-
|
|
3534
|
+
const entries = [];
|
|
3535
|
+
for (const param of method.getParameters()) {
|
|
3536
|
+
const queryDecorator = param.getDecorators().find((d) => d.getName() === "Query");
|
|
3537
|
+
if (!queryDecorator) continue;
|
|
3538
|
+
const queryArgs = queryDecorator.getArguments();
|
|
3539
|
+
const nameArg = queryArgs[0];
|
|
3540
|
+
if (!nameArg || !Node6.isStringLiteral(nameArg)) continue;
|
|
3541
|
+
const queryName = nameArg.getLiteralValue();
|
|
3542
|
+
const typeNode = param.getTypeNode();
|
|
3543
|
+
const queryType = typeNode ? resolveTypeNodeToString(typeNode, sourceFile, project, 3) : "string";
|
|
3544
|
+
entries.push(`${queryName}${isParamOptional(param) ? "?" : ""}: ${queryType}`);
|
|
3545
|
+
}
|
|
3546
|
+
return entries.length > 0 ? `{ ${entries.join("; ")} }` : null;
|
|
3547
|
+
}
|
|
3548
|
+
function isParamOptional(param) {
|
|
3549
|
+
if (param.hasQuestionToken() || param.hasInitializer()) return true;
|
|
3550
|
+
const typeNode = param.getTypeNode();
|
|
3551
|
+
if (typeNode && Node6.isUnionTypeNode(typeNode)) {
|
|
3552
|
+
return typeNode.getTypeNodes().some((t) => t.getKind() === SyntaxKind3.UndefinedKeyword);
|
|
3553
|
+
}
|
|
3554
|
+
return false;
|
|
3536
3555
|
}
|
|
3537
3556
|
function extractParamsType(method, sourceFile, project) {
|
|
3538
3557
|
const entries = [];
|
|
@@ -4553,7 +4572,7 @@ function createChainModuleRenderer(opts) {
|
|
|
4553
4572
|
}
|
|
4554
4573
|
|
|
4555
4574
|
// src/index.ts
|
|
4556
|
-
var VERSION = "0.
|
|
4575
|
+
var VERSION = "0.8.0";
|
|
4557
4576
|
export {
|
|
4558
4577
|
CodegenError,
|
|
4559
4578
|
ConfigError,
|