katax-cli 1.1.4 → 1.2.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/dist/commands/add-endpoint.d.ts.map +1 -1
- package/dist/commands/add-endpoint.js +121 -97
- package/dist/commands/add-endpoint.js.map +1 -1
- package/dist/commands/deploy.d.ts +3 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +287 -153
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/generate-crud.d.ts.map +1 -1
- package/dist/commands/generate-crud.js +60 -56
- package/dist/commands/generate-crud.js.map +1 -1
- package/dist/commands/generate-docs.d.ts +8 -0
- package/dist/commands/generate-docs.d.ts.map +1 -0
- package/dist/commands/generate-docs.js +159 -0
- package/dist/commands/generate-docs.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +294 -17
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +83 -69
- package/dist/index.js.map +1 -1
- package/dist/services/openapi-generator.service.d.ts +37 -0
- package/dist/services/openapi-generator.service.d.ts.map +1 -0
- package/dist/services/openapi-generator.service.js +333 -0
- package/dist/services/openapi-generator.service.js.map +1 -0
- package/dist/templates/generators/swagger-template.d.ts +3 -0
- package/dist/templates/generators/swagger-template.d.ts.map +1 -0
- package/dist/templates/generators/swagger-template.js +122 -0
- package/dist/templates/generators/swagger-template.js.map +1 -0
- package/dist/types/index.d.ts +19 -10
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,116 +1,130 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from
|
|
3
|
-
import chalk from
|
|
4
|
-
import { readFileSync } from
|
|
5
|
-
import { fileURLToPath } from
|
|
6
|
-
import { dirname, join } from
|
|
7
|
-
import { initCommand } from
|
|
8
|
-
import { addEndpointCommand } from
|
|
9
|
-
import { generateCrudCommand } from
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { dirname, join } from "path";
|
|
7
|
+
import { initCommand } from "./commands/init.js";
|
|
8
|
+
import { addEndpointCommand } from "./commands/add-endpoint.js";
|
|
9
|
+
import { generateCrudCommand } from "./commands/generate-crud.js";
|
|
10
|
+
import { generateDocsCommand } from "./commands/generate-docs.js";
|
|
11
|
+
import { infoCommand } from "./commands/info.js";
|
|
12
|
+
import { deployInitCommand, deployUpdateCommand, deployRollbackCommand, deployLogsCommand, deployStatusCommand, } from "./commands/deploy.js";
|
|
13
|
+
import { setVerbose, setColorMode } from "./utils/logger.js";
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = dirname(__filename);
|
|
15
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname,
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
16
17
|
const version = packageJson.version;
|
|
17
18
|
const program = new Command();
|
|
18
19
|
program
|
|
19
|
-
.name(
|
|
20
|
-
.description(chalk.blue(
|
|
21
|
-
.version(version,
|
|
20
|
+
.name("katax")
|
|
21
|
+
.description(chalk.blue("🚀 Generate Express APIs with TypeScript and katax-core validation"))
|
|
22
|
+
.version(version, "-v, --version", "Output the current version");
|
|
22
23
|
program
|
|
23
|
-
.command(
|
|
24
|
-
.description(
|
|
25
|
-
.option(
|
|
24
|
+
.command("init [project-name]")
|
|
25
|
+
.description("Initialize a new Express API project with TypeScript")
|
|
26
|
+
.option("-f, --force", "Overwrite existing project")
|
|
26
27
|
.action(initCommand);
|
|
27
28
|
const addCommand = program
|
|
28
|
-
.command(
|
|
29
|
-
.description(
|
|
29
|
+
.command("add")
|
|
30
|
+
.description("Add resources to your project");
|
|
30
31
|
addCommand
|
|
31
|
-
.command(
|
|
32
|
-
.description(
|
|
33
|
-
.option(
|
|
34
|
-
.option(
|
|
32
|
+
.command("endpoint <name>")
|
|
33
|
+
.description("Add a new endpoint with validation")
|
|
34
|
+
.option("-m, --method <method>", "HTTP method (GET, POST, PUT, DELETE)", "POST")
|
|
35
|
+
.option("-p, --path <path>", "Route path")
|
|
35
36
|
.action(addEndpointCommand);
|
|
36
37
|
const generateCommand = program
|
|
37
|
-
.command(
|
|
38
|
-
.aliases([
|
|
39
|
-
.description(
|
|
38
|
+
.command("generate")
|
|
39
|
+
.aliases(["gen", "g"])
|
|
40
|
+
.description("Generate complete resources");
|
|
40
41
|
generateCommand
|
|
41
|
-
.command(
|
|
42
|
-
.description(
|
|
43
|
-
.option(
|
|
42
|
+
.command("crud <resource-name>")
|
|
43
|
+
.description("Generate a complete CRUD resource")
|
|
44
|
+
.option("--no-auth", "Skip authentication middleware")
|
|
44
45
|
.action(generateCrudCommand);
|
|
46
|
+
generateCommand
|
|
47
|
+
.command("docs")
|
|
48
|
+
.description("Generate API documentation (Swagger/OpenAPI)")
|
|
49
|
+
.option("-f, --force", "Force regenerate (overwrite existing)")
|
|
50
|
+
.option("-o, --output <path>", "Output path for OpenAPI spec")
|
|
51
|
+
.action(generateDocsCommand);
|
|
45
52
|
const deployCommand = program
|
|
46
|
-
.command(
|
|
47
|
-
.description(
|
|
53
|
+
.command("deploy")
|
|
54
|
+
.description("Deploy and manage applications with PM2 on Ubuntu VPS");
|
|
48
55
|
deployCommand
|
|
49
|
-
.command(
|
|
50
|
-
.description(
|
|
56
|
+
.command("init")
|
|
57
|
+
.description("Initial deployment - Clone repo and setup PM2")
|
|
51
58
|
.action(deployInitCommand);
|
|
52
59
|
deployCommand
|
|
53
|
-
.command(
|
|
54
|
-
.description(
|
|
55
|
-
.option(
|
|
56
|
-
.option(
|
|
60
|
+
.command("update")
|
|
61
|
+
.description("Update existing deployment - Pull changes and restart")
|
|
62
|
+
.option("-b, --branch <branch>", "Branch to deploy (default: current branch)")
|
|
63
|
+
.option("--hard", "Hard reset - discard all local changes")
|
|
64
|
+
.option("-a, --app-name <name>", "PM2 application name (overrides .katax-deploy.json)")
|
|
57
65
|
.action(deployUpdateCommand);
|
|
58
66
|
deployCommand
|
|
59
|
-
.command(
|
|
60
|
-
.description(
|
|
61
|
-
.option(
|
|
67
|
+
.command("rollback")
|
|
68
|
+
.description("Rollback to previous version")
|
|
69
|
+
.option("-c, --commits <number>", "Number of commits to rollback", "1")
|
|
70
|
+
.option("-a, --app-name <name>", "PM2 application name (overrides .katax-deploy.json)")
|
|
62
71
|
.action(deployRollbackCommand);
|
|
63
72
|
deployCommand
|
|
64
|
-
.command(
|
|
65
|
-
.description(
|
|
66
|
-
.option(
|
|
67
|
-
.option(
|
|
73
|
+
.command("logs")
|
|
74
|
+
.description("View PM2 application logs")
|
|
75
|
+
.option("-l, --lines <number>", "Number of lines to display")
|
|
76
|
+
.option("-f, --follow", "Follow log output")
|
|
77
|
+
.option("-a, --app-name <name>", "PM2 application name (overrides .katax-deploy.json)")
|
|
68
78
|
.action(deployLogsCommand);
|
|
69
79
|
deployCommand
|
|
70
|
-
.command(
|
|
71
|
-
.description(
|
|
80
|
+
.command("status")
|
|
81
|
+
.description("Show PM2 applications status")
|
|
72
82
|
.action(deployStatusCommand);
|
|
73
83
|
program
|
|
74
|
-
.command(
|
|
75
|
-
.aliases([
|
|
76
|
-
.description(
|
|
84
|
+
.command("info")
|
|
85
|
+
.aliases(["status", "ls"])
|
|
86
|
+
.description("Show current project structure and routes")
|
|
77
87
|
.action(infoCommand);
|
|
78
88
|
program
|
|
79
|
-
.option(
|
|
80
|
-
.option(
|
|
81
|
-
program.hook(
|
|
89
|
+
.option("--no-color", "Disable colored output")
|
|
90
|
+
.option("--verbose", "Enable verbose logging");
|
|
91
|
+
program.hook("preAction", (thisCommand) => {
|
|
82
92
|
const opts = thisCommand.optsWithGlobals();
|
|
83
93
|
if (opts.verbose)
|
|
84
94
|
setVerbose(true);
|
|
85
95
|
if (opts.color === false)
|
|
86
96
|
setColorMode(false);
|
|
87
97
|
});
|
|
88
|
-
program.showHelpAfterError(
|
|
98
|
+
program.showHelpAfterError("(add --help for additional information)");
|
|
89
99
|
program.showSuggestionAfterError(true);
|
|
90
|
-
program.addHelpText(
|
|
91
|
-
${chalk.bold(
|
|
92
|
-
${chalk.gray(
|
|
100
|
+
program.addHelpText("after", `
|
|
101
|
+
${chalk.bold("Examples:")}
|
|
102
|
+
${chalk.gray("# Initialize a new API project")}
|
|
93
103
|
$ katax init my-api
|
|
94
104
|
|
|
95
|
-
${chalk.gray(
|
|
105
|
+
${chalk.gray("# Add a single endpoint")}
|
|
96
106
|
$ katax add endpoint users
|
|
97
107
|
|
|
98
|
-
${chalk.gray(
|
|
108
|
+
${chalk.gray("# Generate a complete CRUD resource")}
|
|
99
109
|
$ katax generate crud products
|
|
100
110
|
|
|
101
|
-
${chalk.gray(
|
|
111
|
+
${chalk.gray("# Generate API documentation")}
|
|
112
|
+
$ katax generate docs
|
|
113
|
+
|
|
114
|
+
${chalk.gray("# View project structure")}
|
|
102
115
|
$ katax info
|
|
103
116
|
|
|
104
|
-
${chalk.gray(
|
|
105
|
-
$ katax deploy init
|
|
106
|
-
$ katax deploy update
|
|
107
|
-
$ katax deploy update --hard
|
|
108
|
-
$ katax deploy
|
|
109
|
-
$ katax deploy
|
|
110
|
-
$ katax deploy
|
|
117
|
+
${chalk.gray("# Deploy to Ubuntu VPS with PM2")}
|
|
118
|
+
$ katax deploy init # First time deployment
|
|
119
|
+
$ katax deploy update # Update existing deployment
|
|
120
|
+
$ katax deploy update --hard # Hard reset and update
|
|
121
|
+
$ katax deploy update -a my-api-prod # Specify PM2 app name
|
|
122
|
+
$ katax deploy status # Check PM2 status
|
|
123
|
+
$ katax deploy logs -f # Follow logs
|
|
124
|
+
$ katax deploy rollback # Rollback 1 commit
|
|
111
125
|
|
|
112
|
-
${chalk.bold(
|
|
113
|
-
${chalk.cyan(
|
|
126
|
+
${chalk.bold("Documentation:")}
|
|
127
|
+
${chalk.cyan("https://github.com/LOPIN6FARRIER/katax-cli#readme")}
|
|
114
128
|
`);
|
|
115
129
|
program.parse(process.argv);
|
|
116
130
|
if (!process.argv.slice(2).length) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;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C;;;IAGrC,KAAK,CAAC,IAAI,CAAC,qCAAqC,CAAC;;;IAGjD,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC;;;IAG1C,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC;;;IAGtC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC;;;;;;;;;EAS/C,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC1B,KAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC;CAClE,CACA,CAAC;AAGF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAG5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface OpenAPISpec {
|
|
2
|
+
openapi: string;
|
|
3
|
+
info: {
|
|
4
|
+
title: string;
|
|
5
|
+
version: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
servers: Array<{
|
|
9
|
+
url: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}>;
|
|
12
|
+
paths: Record<string, any>;
|
|
13
|
+
components: {
|
|
14
|
+
schemas: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare class OpenAPIGenerator {
|
|
18
|
+
private projectPath;
|
|
19
|
+
private endpoints;
|
|
20
|
+
private schemas;
|
|
21
|
+
constructor(projectPath: string);
|
|
22
|
+
generate(): Promise<OpenAPISpec>;
|
|
23
|
+
private scanRoutes;
|
|
24
|
+
private scanResourceRoutes;
|
|
25
|
+
private extractEndpointDetails;
|
|
26
|
+
private scanValidators;
|
|
27
|
+
private extractSchemaFromValidator;
|
|
28
|
+
private mapKataxTypeToOpenAPI;
|
|
29
|
+
private buildOpenAPISpec;
|
|
30
|
+
private generateResponses;
|
|
31
|
+
private generateSummary;
|
|
32
|
+
private directoryExists;
|
|
33
|
+
private fileExists;
|
|
34
|
+
private capitalize;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=openapi-generator.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-generator.service.d.ts","sourceRoot":"","sources":["../../src/services/openapi-generator.service.ts"],"names":[],"mappings":"AAcA,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE,KAAK,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC;CACH;AAKD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,OAAO,CAA2B;gBAE9B,WAAW,EAAE,MAAM;IAOzB,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;YAYxB,UAAU;YAsBV,kBAAkB;IA8ChC,OAAO,CAAC,sBAAsB;YAmEhB,cAAc;YAyBd,0BAA0B;IA6CxC,OAAO,CAAC,qBAAqB;IAqC7B,OAAO,CAAC,gBAAgB;IA8CxB,OAAO,CAAC,iBAAiB;IAiGzB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export class OpenAPIGenerator {
|
|
4
|
+
projectPath;
|
|
5
|
+
endpoints = [];
|
|
6
|
+
schemas = {};
|
|
7
|
+
constructor(projectPath) {
|
|
8
|
+
this.projectPath = projectPath;
|
|
9
|
+
}
|
|
10
|
+
async generate() {
|
|
11
|
+
await this.scanRoutes();
|
|
12
|
+
await this.scanValidators();
|
|
13
|
+
return this.buildOpenAPISpec();
|
|
14
|
+
}
|
|
15
|
+
async scanRoutes() {
|
|
16
|
+
const apiPath = path.join(this.projectPath, "src", "api");
|
|
17
|
+
if (!this.directoryExists(apiPath)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const resources = readdirSync(apiPath);
|
|
21
|
+
for (const resource of resources) {
|
|
22
|
+
const resourcePath = path.join(apiPath, resource);
|
|
23
|
+
const stat = statSync(resourcePath);
|
|
24
|
+
if (stat.isDirectory()) {
|
|
25
|
+
await this.scanResourceRoutes(resource, resourcePath);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async scanResourceRoutes(resourceName, resourcePath) {
|
|
30
|
+
const routesFile = path.join(resourcePath, `${resourceName}.routes.ts`);
|
|
31
|
+
if (!this.fileExists(routesFile)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const content = readFileSync(routesFile, "utf-8");
|
|
35
|
+
const routePatterns = [
|
|
36
|
+
{ regex: /router\.get\s*\(\s*['"`]([^'"`]+)['"`]/g, method: "get" },
|
|
37
|
+
{ regex: /router\.post\s*\(\s*['"`]([^'"`]+)['"`]/g, method: "post" },
|
|
38
|
+
{ regex: /router\.put\s*\(\s*['"`]([^'"`]+)['"`]/g, method: "put" },
|
|
39
|
+
{ regex: /router\.patch\s*\(\s*['"`]([^'"`]+)['"`]/g, method: "patch" },
|
|
40
|
+
{ regex: /router\.delete\s*\(\s*['"`]([^'"`]+)['"`]/g, method: "delete" },
|
|
41
|
+
];
|
|
42
|
+
for (const { regex, method } of routePatterns) {
|
|
43
|
+
let match;
|
|
44
|
+
while ((match = regex.exec(content)) !== null) {
|
|
45
|
+
const routePath = match[1];
|
|
46
|
+
const fullPath = `/api/${resourceName}${routePath === "/" ? "" : routePath}`;
|
|
47
|
+
this.endpoints.push({
|
|
48
|
+
path: fullPath,
|
|
49
|
+
method: method.toUpperCase(),
|
|
50
|
+
summary: this.generateSummary(method, resourceName, routePath),
|
|
51
|
+
tags: [resourceName],
|
|
52
|
+
...this.extractEndpointDetails(content, match.index, method, resourceName),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
extractEndpointDetails(content, matchIndex, method, resource) {
|
|
58
|
+
const result = {};
|
|
59
|
+
const beforeRoute = content.substring(Math.max(0, matchIndex - 200), matchIndex);
|
|
60
|
+
const commentMatch = beforeRoute.match(/\/\*\*[\s\S]*?\*\/|\/\/.*$/m);
|
|
61
|
+
if (commentMatch) {
|
|
62
|
+
result.description = commentMatch[0]
|
|
63
|
+
.replace(/\/\*\*|\*\/|\/\/|\*/g, "")
|
|
64
|
+
.trim();
|
|
65
|
+
}
|
|
66
|
+
const afterRoute = content.substring(matchIndex, matchIndex + 300);
|
|
67
|
+
const hasValidation = afterRoute.includes("validate(");
|
|
68
|
+
if (hasValidation) {
|
|
69
|
+
const validatorMatch = afterRoute.match(/validate\s*\(\s*(\w+)Validator/);
|
|
70
|
+
if (validatorMatch) {
|
|
71
|
+
const validatorName = validatorMatch[1];
|
|
72
|
+
result.requestBody = {
|
|
73
|
+
required: true,
|
|
74
|
+
content: {
|
|
75
|
+
"application/json": {
|
|
76
|
+
schema: {
|
|
77
|
+
$ref: `#/components/schemas/${this.capitalize(validatorName)}`,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const pathMatch = content
|
|
85
|
+
.substring(matchIndex, matchIndex + 100)
|
|
86
|
+
.match(/['"`]([^'"`]*:(\w+)[^'"`]*)['"`]/);
|
|
87
|
+
if (pathMatch) {
|
|
88
|
+
const params = pathMatch[0].match(/:(\w+)/g);
|
|
89
|
+
if (params) {
|
|
90
|
+
result.parameters = params.map((p) => ({
|
|
91
|
+
name: p.substring(1),
|
|
92
|
+
in: "path",
|
|
93
|
+
required: true,
|
|
94
|
+
schema: { type: "string" },
|
|
95
|
+
description: `${this.capitalize(p.substring(1))} identifier`,
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
result.responses = this.generateResponses(method);
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
async scanValidators() {
|
|
103
|
+
const apiPath = path.join(this.projectPath, "src", "api");
|
|
104
|
+
if (!this.directoryExists(apiPath)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const resources = readdirSync(apiPath);
|
|
108
|
+
for (const resource of resources) {
|
|
109
|
+
const validatorFile = path.join(apiPath, resource, `${resource}.validator.ts`);
|
|
110
|
+
if (this.fileExists(validatorFile)) {
|
|
111
|
+
await this.extractSchemaFromValidator(resource, validatorFile);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async extractSchemaFromValidator(resource, validatorPath) {
|
|
116
|
+
const content = readFileSync(validatorPath, "utf-8");
|
|
117
|
+
const schemaPattern = /(\w+):\s*k\.(string|number|boolean|object|array)\([^)]*\)/g;
|
|
118
|
+
const properties = {};
|
|
119
|
+
const required = [];
|
|
120
|
+
let match;
|
|
121
|
+
while ((match = schemaPattern.exec(content)) !== null) {
|
|
122
|
+
const [, fieldName, fieldType] = match;
|
|
123
|
+
const fieldContext = content.substring(match.index, content.indexOf("\n", match.index));
|
|
124
|
+
const isOptional = fieldContext.includes(".optional()");
|
|
125
|
+
if (!isOptional) {
|
|
126
|
+
required.push(fieldName);
|
|
127
|
+
}
|
|
128
|
+
properties[fieldName] = this.mapKataxTypeToOpenAPI(fieldType, fieldContext);
|
|
129
|
+
}
|
|
130
|
+
if (Object.keys(properties).length > 0) {
|
|
131
|
+
this.schemas[this.capitalize(resource)] = {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties,
|
|
134
|
+
required: required.length > 0 ? required : undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
mapKataxTypeToOpenAPI(kataxType, context) {
|
|
139
|
+
const baseMapping = {
|
|
140
|
+
string: { type: "string" },
|
|
141
|
+
number: { type: "number" },
|
|
142
|
+
boolean: { type: "boolean" },
|
|
143
|
+
object: { type: "object" },
|
|
144
|
+
array: { type: "array", items: { type: "string" } },
|
|
145
|
+
};
|
|
146
|
+
const result = { ...(baseMapping[kataxType] || { type: "string" }) };
|
|
147
|
+
if (context.includes(".email()")) {
|
|
148
|
+
result.format = "email";
|
|
149
|
+
}
|
|
150
|
+
if (context.includes(".uuid()")) {
|
|
151
|
+
result.format = "uuid";
|
|
152
|
+
}
|
|
153
|
+
if (context.includes(".min(")) {
|
|
154
|
+
const minMatch = context.match(/\.min\((\d+)\)/);
|
|
155
|
+
if (minMatch) {
|
|
156
|
+
result.minimum = parseInt(minMatch[1]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (context.includes(".max(")) {
|
|
160
|
+
const maxMatch = context.match(/\.max\((\d+)\)/);
|
|
161
|
+
if (maxMatch) {
|
|
162
|
+
result.maximum = parseInt(maxMatch[1]);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
buildOpenAPISpec() {
|
|
168
|
+
const paths = {};
|
|
169
|
+
for (const endpoint of this.endpoints) {
|
|
170
|
+
if (!paths[endpoint.path]) {
|
|
171
|
+
paths[endpoint.path] = {};
|
|
172
|
+
}
|
|
173
|
+
paths[endpoint.path][endpoint.method.toLowerCase()] = {
|
|
174
|
+
tags: endpoint.tags,
|
|
175
|
+
summary: endpoint.summary,
|
|
176
|
+
description: endpoint.description,
|
|
177
|
+
parameters: endpoint.parameters,
|
|
178
|
+
requestBody: endpoint.requestBody,
|
|
179
|
+
responses: endpoint.responses,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
openapi: "3.0.0",
|
|
184
|
+
info: {
|
|
185
|
+
title: "API Documentation",
|
|
186
|
+
version: "1.0.0",
|
|
187
|
+
description: "Auto-generated API documentation by Katax CLI",
|
|
188
|
+
},
|
|
189
|
+
servers: [
|
|
190
|
+
{
|
|
191
|
+
url: "http://localhost:3000",
|
|
192
|
+
description: "Development server",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
url: "https://api.example.com",
|
|
196
|
+
description: "Production server",
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
paths,
|
|
200
|
+
components: {
|
|
201
|
+
schemas: this.schemas,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
generateResponses(method) {
|
|
206
|
+
const baseResponses = {
|
|
207
|
+
"400": {
|
|
208
|
+
description: "Bad Request - Invalid input",
|
|
209
|
+
content: {
|
|
210
|
+
"application/json": {
|
|
211
|
+
schema: {
|
|
212
|
+
type: "object",
|
|
213
|
+
properties: {
|
|
214
|
+
success: { type: "boolean", example: false },
|
|
215
|
+
message: { type: "string" },
|
|
216
|
+
errors: { type: "array", items: { type: "string" } },
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
"500": {
|
|
223
|
+
description: "Internal Server Error",
|
|
224
|
+
content: {
|
|
225
|
+
"application/json": {
|
|
226
|
+
schema: {
|
|
227
|
+
type: "object",
|
|
228
|
+
properties: {
|
|
229
|
+
success: { type: "boolean", example: false },
|
|
230
|
+
message: { type: "string", example: "Internal server error" },
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
switch (method.toLowerCase()) {
|
|
238
|
+
case "post":
|
|
239
|
+
return {
|
|
240
|
+
"201": {
|
|
241
|
+
description: "Created successfully",
|
|
242
|
+
content: {
|
|
243
|
+
"application/json": {
|
|
244
|
+
schema: {
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
success: { type: "boolean", example: true },
|
|
248
|
+
data: { type: "object" },
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
...baseResponses,
|
|
255
|
+
};
|
|
256
|
+
case "delete":
|
|
257
|
+
return {
|
|
258
|
+
"200": {
|
|
259
|
+
description: "Deleted successfully",
|
|
260
|
+
content: {
|
|
261
|
+
"application/json": {
|
|
262
|
+
schema: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
success: { type: "boolean", example: true },
|
|
266
|
+
message: { type: "string" },
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
"404": {
|
|
273
|
+
description: "Resource not found",
|
|
274
|
+
},
|
|
275
|
+
...baseResponses,
|
|
276
|
+
};
|
|
277
|
+
default:
|
|
278
|
+
return {
|
|
279
|
+
"200": {
|
|
280
|
+
description: "Successful operation",
|
|
281
|
+
content: {
|
|
282
|
+
"application/json": {
|
|
283
|
+
schema: {
|
|
284
|
+
type: "object",
|
|
285
|
+
properties: {
|
|
286
|
+
success: { type: "boolean", example: true },
|
|
287
|
+
data: { type: "object" },
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
...baseResponses,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
generateSummary(method, resource, path) {
|
|
298
|
+
const hasId = path.includes(":id");
|
|
299
|
+
switch (method.toLowerCase()) {
|
|
300
|
+
case "get":
|
|
301
|
+
return hasId ? `Get ${resource} by ID` : `Get all ${resource}`;
|
|
302
|
+
case "post":
|
|
303
|
+
return `Create new ${resource}`;
|
|
304
|
+
case "put":
|
|
305
|
+
case "patch":
|
|
306
|
+
return `Update ${resource}`;
|
|
307
|
+
case "delete":
|
|
308
|
+
return `Delete ${resource}`;
|
|
309
|
+
default:
|
|
310
|
+
return `${method.toUpperCase()} ${resource}`;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
directoryExists(dir) {
|
|
314
|
+
try {
|
|
315
|
+
return statSync(dir).isDirectory();
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
fileExists(file) {
|
|
322
|
+
try {
|
|
323
|
+
return statSync(file).isFile();
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
capitalize(str) {
|
|
330
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=openapi-generator.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-generator.service.js","sourceRoot":"","sources":["../../src/services/openapi-generator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAiCxB,MAAM,OAAO,gBAAgB;IACnB,WAAW,CAAS;IACpB,SAAS,GAAsB,EAAE,CAAC;IAClC,OAAO,GAAwB,EAAE,CAAC;IAE1C,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAKD,KAAK,CAAC,QAAQ;QAEZ,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAG5B,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAA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