@autobe/compiler 0.13.0 → 0.14.3
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/lib/interface/AutoBeInterfaceCompiler.js +7 -6
- package/lib/interface/AutoBeInterfaceCompiler.js.map +1 -1
- package/lib/interface/createMigrateApplication.d.ts +3 -0
- package/lib/interface/createMigrateApplication.js +15 -0
- package/lib/interface/createMigrateApplication.js.map +1 -0
- package/lib/raw/AutoBeCompilerRealizeTemplate.js +1 -1
- package/lib/raw/AutoBeCompilerRealizeTemplate.js.map +1 -1
- package/lib/realize/AutoBeRealizeCompiler.d.ts +2 -1
- package/lib/realize/AutoBeRealizeCompiler.js +6 -0
- package/lib/realize/AutoBeRealizeCompiler.js.map +1 -1
- package/lib/realize/writeRealizeControllers.d.ts +2 -0
- package/lib/realize/writeRealizeControllers.js +70 -0
- package/lib/realize/writeRealizeControllers.js.map +1 -0
- package/lib/test/programmers/writeTestFunction.js +1 -2
- package/lib/test/programmers/writeTestFunction.js.map +1 -1
- package/package.json +7 -8
- package/src/interface/AutoBeInterfaceCompiler.ts +8 -7
- package/src/interface/createMigrateApplication.ts +18 -0
- package/src/raw/AutoBeCompilerRealizeTemplate.ts +1 -1
- package/src/realize/AutoBeRealizeCompiler.ts +8 -0
- package/src/realize/writeRealizeControllers.ts +119 -0
- package/src/test/programmers/writeTestFunction.ts +4 -2
- package/lib/interface/transformOpenApi.d.ts +0 -3
- package/lib/interface/transformOpenApi.js +0 -56
- package/lib/interface/transformOpenApi.js.map +0 -1
- package/src/interface/transformOpenApi.ts +0 -54
|
@@ -11,11 +11,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AutoBeInterfaceCompiler = void 0;
|
|
13
13
|
const utils_1 = require("@autobe/utils");
|
|
14
|
-
const migrate_1 = require("@nestia/migrate");
|
|
15
14
|
const AutoBeCompilerInterfaceTemplate_1 = require("../raw/AutoBeCompilerInterfaceTemplate");
|
|
16
15
|
const ArrayUtil_1 = require("../utils/ArrayUtil");
|
|
17
16
|
const FilePrinter_1 = require("../utils/FilePrinter");
|
|
18
|
-
const
|
|
17
|
+
const createMigrateApplication_1 = require("./createMigrateApplication");
|
|
19
18
|
/**
|
|
20
19
|
* Custom Interface compiler that handles API specification and NestJS
|
|
21
20
|
* application generation.
|
|
@@ -42,8 +41,7 @@ const transformOpenApi_1 = require("./transformOpenApi");
|
|
|
42
41
|
class AutoBeInterfaceCompiler {
|
|
43
42
|
write(document) {
|
|
44
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const
|
|
46
|
-
const migrate = new migrate_1.NestiaMigrateApplication(swagger);
|
|
44
|
+
const migrate = (0, createMigrateApplication_1.createMigrateApplication)(document);
|
|
47
45
|
const files = migrate.nest({
|
|
48
46
|
keyword: true,
|
|
49
47
|
simulate: true,
|
|
@@ -62,14 +60,17 @@ class AutoBeInterfaceCompiler {
|
|
|
62
60
|
: value,
|
|
63
61
|
];
|
|
64
62
|
}))),
|
|
65
|
-
[
|
|
63
|
+
[
|
|
64
|
+
"packages/api/swagger.json",
|
|
65
|
+
JSON.stringify(migrate.getData().document(), null, 2),
|
|
66
|
+
],
|
|
66
67
|
...Object.entries(AutoBeCompilerInterfaceTemplate_1.AutoBeCompilerInterfaceTemplate),
|
|
67
68
|
]);
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
transform(document) {
|
|
71
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
return (0,
|
|
73
|
+
return (0, utils_1.transformOpenApiDocument)(document);
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
invert(document) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeInterfaceCompiler.js","sourceRoot":"","sources":["../../src/interface/AutoBeInterfaceCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,
|
|
1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AAO,IAAA,gCAAwB,EAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;KAAA;IAEY,MAAM,CACjB,QAA2B;;YAE3B,OAAO,IAAA,6BAAqB,EAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;KAAA;IAEY,WAAW;;YACtB,OAAO,iEAA+B,CAAC;QACzC,CAAC;KAAA;CACF;AAhDD,0DAgDC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMigrateApplication = void 0;
|
|
4
|
+
const utils_1 = require("@autobe/utils");
|
|
5
|
+
const migrate_1 = require("@nestia/migrate");
|
|
6
|
+
const createMigrateApplication = (document) => {
|
|
7
|
+
const migrate = new migrate_1.NestiaMigrateApplication((0, utils_1.transformOpenApiDocument)(document));
|
|
8
|
+
migrate.getData().routes.forEach((r) => {
|
|
9
|
+
// @todo -> must be optimized
|
|
10
|
+
r.accessor[r.accessor.length - 1] = document.operations.find((o) => o.path === r.path && o.method === r.method).name;
|
|
11
|
+
});
|
|
12
|
+
return migrate;
|
|
13
|
+
};
|
|
14
|
+
exports.createMigrateApplication = createMigrateApplication;
|
|
15
|
+
//# sourceMappingURL=createMigrateApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMigrateApplication.js","sourceRoot":"","sources":["../../src/interface/createMigrateApplication.ts"],"names":[],"mappings":";;;AACA,yCAAyD;AACzD,6CAA2D;AAEpD,MAAM,wBAAwB,GAAG,CACtC,QAAiC,EACP,EAAE;IAC5B,MAAM,OAAO,GAA6B,IAAI,kCAAwB,CACpE,IAAA,gCAAwB,EAAC,QAAQ,CAAC,CACnC,CAAC;IACF,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrC,6BAA6B;QAC7B,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAC1D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CACjD,CAAC,IAAI,CAAC;IACV,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAbW,QAAA,wBAAwB,4BAanC"}
|
|
@@ -7,8 +7,8 @@ exports.AutoBeCompilerRealizeTemplate = {
|
|
|
7
7
|
"package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:prisma && npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:env\": \"ts-node build/env.ts\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:prisma\": \"prisma generate --schema prisma/schema\",\n \"build:swagger\": \"nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && npm run build:env && npm run build:prisma\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^7.1.1\",\n \"@nestia/e2e\": \"^7.1.1\",\n \"@nestia/sdk\": \"^7.1.1\",\n \"@nestjs/cli\": \"^11.0.7\",\n \"@rollup/plugin-terser\": \"^0.4.4\",\n \"@rollup/plugin-typescript\": \"^11.1.6\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/bcryptjs\": \"^3.0.0\",\n \"@types/cli\": \"^0.11.21\",\n \"@types/cli-progress\": \"^3.11.5\",\n \"@types/express\": \"^4.17.21\",\n \"@types/inquirer\": \"^8.2.5\",\n \"@types/jsonwebtoken\": \"^9.0.5\",\n \"@types/node\": \"^18.11.0\",\n \"@types/uuid\": \"^8.3.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.1.0\",\n \"@typescript-eslint/parser\": \"^8.1.0\",\n \"chalk\": \"^4.1.2\",\n \"cli\": \"^1.0.1\",\n \"cli-progress\": \"^3.12.0\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"eslint-plugin-deprecation\": \"^3.0.0\",\n \"express\": \"^4.18.2\",\n \"fastify\": \"^5.4.0\",\n \"nestia\": \"^7.1.1\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.8.3\",\n \"typescript-transform-paths\": \"^3.5.5\",\n \"webpack\": \"^5.89.0\",\n \"webpack-cli\": \"^5.1.4\",\n \"write-file-webpack-plugin\": \"^4.5.1\"\n },\n \"dependencies\": {\n \"@nestia/core\": \"^7.1.1\",\n \"@nestia/fetcher\": \"^7.1.1\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@nestjs/platform-fastify\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"bcryptjs\": \"^3.0.2\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\n \"jsonwebtoken\": \"^9.0.2\",\n \"prisma\": \"^6.11.1\",\n \"serialize-error\": \"^4.1.0\",\n \"tgrid\": \"^1.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.5.0\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test -- --simultaneous 1\"\n }\n}\n",
|
|
8
8
|
"src/MyGlobal.ts": "import { PrismaClient } from \"@prisma/client\";\nimport dotenv from \"dotenv\";\nimport dotenvExpand from \"dotenv-expand\";\nimport { Singleton } from \"tstl\";\nimport typia from \"typia\";\n\n/* eslint-disable */\nexport class MyGlobal {\n public static readonly prisma: PrismaClient = new PrismaClient();\n public static testing: boolean = false;\n public static get env(): MyGlobal.IEnvironments {\n return environments.get();\n }\n}\nexport namespace MyGlobal {\n export interface IEnvironments {\n API_PORT: `${number}`;\n\n /** JWT Secret Key. */\n JWT_SECRET_KEY: string;\n }\n}\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n",
|
|
9
9
|
"src/providers/jwtAuthorize.ts": "import { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n",
|
|
10
|
-
"src/providers/jwtDecode.ts": "export function jwtDecode(token: string): { id: string; type: string } {\n try {\n const base64Url = token.split(\".\")[1];\n if (!base64Url) throw new Error(\"Invalid token format\");\n\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => `%${c.charCodeAt(0).toString(16).padStart(2, \"0\")}`)\n .join(\"\"),\n );\n\n const decoded = JSON.parse(jsonPayload) as unknown;\n\n if (\n typeof decoded === \"object\" &&\n decoded !== null &&\n typeof (decoded as any).id === \"string\" &&\n typeof (decoded as any).type === \"string\"\n ) {\n return {\n id: (decoded as { id: string }).id,\n type: (decoded as { type: string }).type,\n };\n }\n\n throw new Error(\"Invalid token payload\");\n } catch {\n throw new Error(\"Failed to decode JWT token\");\n }\n}\n",
|
|
11
10
|
"src/setup/MySetupWizard.ts": "import cp from \"child_process\";\n\nimport { MyConfiguration } from \"../MyConfiguration\";\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport namespace MySetupWizard {\n export async function schema(): Promise<void> {\n if (MyGlobal.testing === false)\n throw new Error(\n \"Error on SetupWizard.schema(): unable to reset database in non-test mode.\",\n );\n const execute = (type: string) => (argv: string) =>\n cp.execSync(`npx prisma migrate ${type} --schema=prisma/schema ${argv}`, {\n stdio: \"ignore\",\n cwd: MyConfiguration.ROOT,\n });\n execute(\"reset\")(\"--force\");\n execute(\"dev\")(\"--name init\");\n }\n\n export async function seed(): Promise<void> {}\n}\n",
|
|
11
|
+
"src/util/toISOStringSafe.ts": "import { tags } from \"typia\";\n\n/**\n * Transforms a value that is either a Date or a string into an ISO 8601\n * formatted string. If it's already a string, it assumes it's already in ISO\n * format.\n */\nexport function toISOStringSafe(\n value: Date | (string & tags.Format<\"date-time\">),\n): string & tags.Format<\"date-time\"> {\n if (value instanceof Date) {\n return value.toISOString() as string & tags.Format<\"date-time\">;\n }\n return value;\n}\n",
|
|
12
12
|
"test/servant.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport { Driver, WorkerServer } from \"tgrid\";\n\nimport { MyBackend } from \"../src/MyBackend\";\nimport { MyGlobal } from \"../src/MyGlobal\";\nimport { IAutoBeRealizeTestConfig } from \"./autobe/compiler/IAutoBeRealizeTestConfig\";\nimport { IAutoBeRealizeTestListener } from \"./autobe/compiler/IAutoBeRealizeTestListener\";\nimport { IAutoBeRealizeTestOperation } from \"./autobe/compiler/IAutoBeRealizeTestOperation\";\nimport { IAutoBeRealizeTestResult } from \"./autobe/compiler/IAutoBeRealizeTestResult\";\nimport { IAutoBeRealizeTestService } from \"./autobe/compiler/IAutoBeRealizeTestService\";\nimport { TestAutomation } from \"./helpers/TestAutomation\";\n\nclass AutoBeRealizeTestService implements IAutoBeRealizeTestService {\n public constructor(\n private readonly listener: Driver<IAutoBeRealizeTestListener>,\n ) {}\n\n public async execute(\n config: IAutoBeRealizeTestConfig,\n ): Promise<IAutoBeRealizeTestResult> {\n const start: Date = new Date();\n const operations: IAutoBeRealizeTestOperation[] = [];\n await TestAutomation.execute({\n open: async (): Promise<MyBackend> => {\n const backend: MyBackend = new MyBackend();\n await backend.open();\n return backend;\n },\n close: (backend: MyBackend): Promise<void> => backend.close(),\n options: {\n reset: config.reset ?? true,\n simultaneous: config.simultaneous ?? 1,\n },\n onComplete: (exec: DynamicExecutor.IExecution): void => {\n const op: IAutoBeRealizeTestOperation = {\n name: exec.name,\n location: exec.location,\n value: exec.value,\n error: exec.error,\n started_at: exec.started_at,\n completed_at: exec.completed_at,\n };\n this.listener.onOperation(op).catch(() => {});\n operations.push(op);\n },\n onReset: (): void => {\n this.listener.onReset().catch(() => {});\n },\n });\n return {\n reset: config.reset ?? true,\n simultaneous: config.simultaneous ?? 1,\n operations,\n started_at: start.toISOString(),\n completed_at: new Date().toISOString(),\n };\n }\n}\n\nconst main = async (): Promise<void> => {\n const worker: WorkerServer<\n null,\n IAutoBeRealizeTestService,\n IAutoBeRealizeTestListener\n > = new WorkerServer();\n const listener: Driver<IAutoBeRealizeTestListener> = worker.getDriver();\n const service: AutoBeRealizeTestService = new AutoBeRealizeTestService(\n listener,\n );\n\n MyGlobal.testing = true;\n await worker.open(service);\n};\nmain().catch((error) => {\n console.log(error);\n process.exit(-1);\n});\n",
|
|
13
13
|
"test/autobe/compiler/IAutoBeRealizeTestOperation.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\nimport { tags } from \"typia\";\n\n/**\n * Detailed result interface representing the execution outcome of an individual\n * E2E test function during comprehensive backend implementation validation.\n *\n * This interface captures comprehensive information about a single test\n * operation execution, including identification details, execution results,\n * error conditions, and precise timing data. Each operation represents the\n * validation of a specific API endpoint or business scenario through Test\n * agent-generated E2E test functions executed against the fully implemented\n * backend application.\n *\n * The operation result provides granular visibility into test execution\n * outcomes, enabling detailed analysis of implementation quality, business\n * logic compliance, and performance characteristics at the individual test\n * level. This detailed tracking supports comprehensive validation reporting and\n * precise identification of implementation issues when they occur.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestOperation {\n /**\n * Unique identifier name of the executed E2E test function.\n *\n * Specifies the function name that was executed during this test operation,\n * typically corresponding to the Test agent-generated test function\n * identifier. This name provides direct traceability between test results and\n * the specific business scenarios, API endpoints, or validation logic being\n * tested.\n *\n * The test function name serves as the primary identifier for correlating\n * execution results with the original test scenarios, enabling stakeholders\n * to understand which specific functionality was validated and whether the\n * implementation correctly fulfills the intended business requirements and\n * API contracts.\n */\n name: string;\n\n /**\n * File system path location of the executed test function source code.\n *\n * Specifies the relative or absolute path to the test file that contains the\n * executed function within the project structure. This location information\n * enables direct navigation to the test source code for detailed analysis,\n * debugging, result interpretation, or modification purposes.\n *\n * The file location provides essential context for understanding test\n * organization, enables developers to quickly locate and examine the specific\n * test implementation, and supports comprehensive test suite maintenance and\n * documentation activities.\n */\n location: string;\n\n /**\n * Return value or result data produced by the test function execution.\n *\n * Contains the actual value returned by the test function upon completion,\n * regardless of whether execution succeeded or failed. This could include API\n * response objects, validation results, test data, computed values, or any\n * other output that the test function produces as part of its business logic\n * validation or endpoint testing.\n *\n * For successful test executions, this value represents the expected result\n * that demonstrates correct implementation behavior. The return value\n * provides insight into the test execution flow and can be analyzed to verify\n * that API responses match expected formats, business logic produces correct\n * outcomes, and data transformations operate as intended.\n */\n value: unknown;\n\n /**\n * Error information captured during test function execution, if any occurred.\n *\n * Contains detailed error information when the test function encounters\n * exceptions, assertion failures, timeout conditions, or other error states\n * during execution. When null, it indicates that the test completed\n * successfully without encountering any error conditions. When present, the\n * error provides comprehensive diagnostic information for understanding\n * implementation issues or test failures.\n *\n * Error information is crucial for identifying implementation defects, API\n * contract violations, business logic errors, integration failures, or\n * performance issues that prevent the backend application from meeting its\n * requirements. The error details enable developers to pinpoint specific\n * problems and implement necessary corrections to achieve full compliance\n * with validation scenarios.\n */\n error: null | unknown;\n\n /**\n * Precise timestamp when this specific test operation began execution.\n *\n * Records the exact moment when this individual test function started\n * execution, providing the reference point for measuring test duration and\n * understanding the temporal sequence of test operations within the overall\n * validation process. This timestamp enables detailed performance analysis\n * and execution timeline reconstruction.\n *\n * The start timestamp is essential for identifying execution patterns,\n * analyzing test concurrency behavior, measuring individual test performance,\n * and understanding the temporal distribution of test execution within the\n * comprehensive validation suite.\n */\n started_at: string & tags.Format<\"date-time\">;\n\n /**\n * Precise timestamp when this specific test operation finished execution.\n *\n * Records the exact moment when this individual test function completed\n * execution, regardless of whether it succeeded or failed. Combined with the\n * start timestamp, this enables precise calculation of test execution\n * duration and provides completion reference for the overall test timeline.\n *\n * The completion timestamp is valuable for performance analysis of individual\n * test operations, identifying slow-performing test scenarios, understanding\n * test execution efficiency, and maintaining comprehensive audit trails of\n * the validation process. It supports optimization efforts and helps identify\n * potential bottlenecks in either the test implementation or the backend\n * application being validated.\n */\n completed_at: string & tags.Format<\"date-time\">;\n}\n",
|
|
14
14
|
"test/autobe/compiler/IAutoBeRealizeTestConfig.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\n/**\n * Configuration interface defining the essential execution parameters required\n * for comprehensive E2E test suite validation against fully implemented backend\n * applications.\n *\n * This interface encapsulates the core execution settings and control\n * parameters necessary to orchestrate the final validation phase of the AutoBE\n * development pipeline. It provides streamlined configuration options that\n * control test execution behavior, database management, and performance\n * characteristics without requiring direct access to implementation files or\n * database schemas.\n *\n * The configuration assumes that the test execution environment has been\n * pre-configured with all necessary resources including generated\n * implementation files, database schemas, and package dependencies. This\n * interface focuses solely on runtime execution parameters that control how the\n * test suite operates within the prepared environment.\n *\n * This lightweight configuration approach enables flexible test execution\n * across different environments while maintaining clear separation between\n * resource provisioning and execution control, supporting both development and\n * production validation scenarios.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestConfig {\n /**\n * Optional flag indicating whether to perform a complete database reset\n * before test execution.\n *\n * When true, specifies that the test execution should begin with a\n * comprehensive database reset, purging all existing data and reconstructing\n * tables to their initial schema-defined state. When false, test execution\n * proceeds with the current database state, which may contain residual data\n * from previous operations.\n *\n * Database reset is crucial for ensuring test isolation, reproducibility, and\n * deterministic results. Clean state testing eliminates interference from\n * residual data and guarantees that each test execution cycle operates under\n * identical baseline conditions, enabling accurate validation of backend\n * implementation behavior.\n *\n * @default true\n */\n reset?: boolean;\n\n /**\n * Optional specification of the maximum number of test functions to execute\n * concurrently during the test suite run.\n *\n * Defines the concurrent execution limit for E2E test functions to optimize\n * testing performance while maintaining system stability and resource\n * management. This value balances test execution speed with resource\n * consumption and helps prevent system overload during comprehensive\n * validation.\n *\n * Concurrent execution significantly reduces total testing time for large\n * test suites while validating the backend application's ability to handle\n * parallel requests correctly. The simultaneous limit ensures controlled load\n * conditions that provide meaningful performance insights while maintaining\n * test reliability and result accuracy.\n *\n * @default 1\n */\n simultaneous?: number;\n}\n",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeCompilerRealizeTemplate.js","sourceRoot":"","sources":["../../src/raw/AutoBeCompilerRealizeTemplate.ts"],"names":[],"mappings":";;;AAAa,QAAA,6BAA6B,GAA2B;IACnE,YAAY,EAAE,oDAAoD;IAClE,YAAY,EAAE,yJAAyJ;IACvK,cAAc,EAAE,6lJAA6lJ;IAC7mJ,iBAAiB,EAAE,6wBAA6wB;IAChyB,+BAA+B,EAAE,i3BAAi3B;IACl5B,4BAA4B,EAAE,
|
|
1
|
+
{"version":3,"file":"AutoBeCompilerRealizeTemplate.js","sourceRoot":"","sources":["../../src/raw/AutoBeCompilerRealizeTemplate.ts"],"names":[],"mappings":";;;AAAa,QAAA,6BAA6B,GAA2B;IACnE,YAAY,EAAE,oDAAoD;IAClE,YAAY,EAAE,yJAAyJ;IACvK,cAAc,EAAE,6lJAA6lJ;IAC7mJ,iBAAiB,EAAE,6wBAA6wB;IAChyB,+BAA+B,EAAE,i3BAAi3B;IACl5B,4BAA4B,EAAE,iuBAAiuB;IAC/vB,6BAA6B,EAAE,ydAAyd;IACxf,iBAAiB,EAAE,uqFAAuqF;IAC1rF,qDAAqD,EAAE,wlMAAwlM;IAC/oM,kDAAkD,EAAE,uoGAAuoG;IAC3rG,kDAAkD,EAAE,w6KAAw6K;IAC59K,oDAAoD,EAAE,wgKAAwgK;IAC9jK,mDAAmD,EAAE,gpKAAgpK;CACtsK,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IAutoBeRealizeCompiler, IAutoBeRealizeCompilerListener, IAutoBeRealizeTestProps, IAutoBeRealizeTestResult } from "@autobe/interface";
|
|
1
|
+
import { IAutoBeRealizeCompiler, IAutoBeRealizeCompilerListener, IAutoBeRealizeControllerProps, IAutoBeRealizeTestProps, IAutoBeRealizeTestResult } from "@autobe/interface";
|
|
2
2
|
export declare class AutoBeRealizeCompiler implements IAutoBeRealizeCompiler {
|
|
3
3
|
private readonly listener;
|
|
4
4
|
constructor(listener: IAutoBeRealizeCompilerListener);
|
|
5
|
+
controller(props: IAutoBeRealizeControllerProps): Promise<Record<string, string>>;
|
|
5
6
|
test(props: IAutoBeRealizeTestProps): Promise<IAutoBeRealizeTestResult>;
|
|
6
7
|
getTemplate(): Promise<Record<string, string>>;
|
|
7
8
|
}
|
|
@@ -14,10 +14,16 @@ const AutoBeCompilerInterfaceTemplate_1 = require("../raw/AutoBeCompilerInterfac
|
|
|
14
14
|
const AutoBeCompilerRealizeTemplate_1 = require("../raw/AutoBeCompilerRealizeTemplate");
|
|
15
15
|
const AutoBeCompilerTestTemplate_1 = require("../raw/AutoBeCompilerTestTemplate");
|
|
16
16
|
const testRealizeProject_1 = require("./testRealizeProject");
|
|
17
|
+
const writeRealizeControllers_1 = require("./writeRealizeControllers");
|
|
17
18
|
class AutoBeRealizeCompiler {
|
|
18
19
|
constructor(listener) {
|
|
19
20
|
this.listener = listener;
|
|
20
21
|
}
|
|
22
|
+
controller(props) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return (0, writeRealizeControllers_1.writeRealizeControllers)(props);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
21
27
|
test(props) {
|
|
22
28
|
return (0, testRealizeProject_1.testRealizeProject)(Object.assign(Object.assign({}, props), { files: Object.assign(Object.assign({}, props.files), AutoBeCompilerRealizeTemplate_1.AutoBeCompilerRealizeTemplate) }), this.listener.test);
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeRealizeCompiler.js","sourceRoot":"","sources":["../../src/realize/AutoBeRealizeCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AutoBeRealizeCompiler.js","sourceRoot":"","sources":["../../src/realize/AutoBeRealizeCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,4FAAyF;AACzF,wFAAqF;AACrF,kFAA+E;AAC/E,6DAA0D;AAC1D,uEAAoE;AAEpE,MAAa,qBAAqB;IAChC,YACmB,QAAwC;QAAxC,aAAQ,GAAR,QAAQ,CAAgC;IACxD,CAAC;IAES,UAAU,CACrB,KAAoC;;YAEpC,OAAO,IAAA,iDAAuB,EAAC,KAAK,CAAC,CAAC;QACxC,CAAC;KAAA;IAEM,IAAI,CACT,KAA8B;QAE9B,OAAO,IAAA,uCAAkB,kCAElB,KAAK,KACR,KAAK,kCACA,KAAK,CAAC,KAAK,GACX,6DAA6B,MAGpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CACnB,CAAC;IACJ,CAAC;IAEY,WAAW;;YACtB,qDACK,iEAA+B,GAC/B,uDAA0B,GAC1B,6DAA6B,EAChC;QACJ,CAAC;KAAA;CACF;AAjCD,sDAiCC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeRealizeControllers = void 0;
|
|
7
|
+
const NestiaMigrateNestMethodProgrammer_1 = require("@nestia/migrate/lib/programmers/NestiaMigrateNestMethodProgrammer");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
const createMigrateApplication_1 = require("../interface/createMigrateApplication");
|
|
11
|
+
const writeRealizeControllers = (props) => {
|
|
12
|
+
const app = (0, createMigrateApplication_1.createMigrateApplication)(props.document);
|
|
13
|
+
const result = app.nest({
|
|
14
|
+
simulate: false,
|
|
15
|
+
e2e: false,
|
|
16
|
+
programmer: {
|
|
17
|
+
controllerMethod: (ctx) => {
|
|
18
|
+
const method = NestiaMigrateNestMethodProgrammer_1.NestiaMigrateNestMethodProgrammer.write(ctx);
|
|
19
|
+
const func = props.functions.find((f) => f.endpoint.method === ctx.route.method &&
|
|
20
|
+
f.endpoint.path === ctx.route.path);
|
|
21
|
+
if (func === undefined)
|
|
22
|
+
return method; // unreachable
|
|
23
|
+
const auth = func.role
|
|
24
|
+
? props.authorizations.find((d) => d.role === func.role)
|
|
25
|
+
: undefined;
|
|
26
|
+
if (func.role && auth === undefined)
|
|
27
|
+
return method; // unreachable
|
|
28
|
+
ctx.importer.external({
|
|
29
|
+
type: "instance",
|
|
30
|
+
library: path_1.default
|
|
31
|
+
.relative(ctx.controller.location, func.location)
|
|
32
|
+
.replaceAll(path_1.default.sep, "/")
|
|
33
|
+
.split(".ts")[0],
|
|
34
|
+
name: func.name,
|
|
35
|
+
});
|
|
36
|
+
const call = typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(func.name), undefined, [
|
|
37
|
+
...(func.role ? [func.role] : []),
|
|
38
|
+
...ctx.route.parameters.map((p) => p.name),
|
|
39
|
+
...(ctx.route.query ? [ctx.route.query.name] : []),
|
|
40
|
+
...(ctx.route.body ? [ctx.route.body.name] : []),
|
|
41
|
+
].map((name) => typescript_1.default.factory.createIdentifier(name)));
|
|
42
|
+
return typescript_1.default.factory.updateMethodDeclaration(method, method.modifiers, method.asteriskToken, method.name, method.questionToken, method.typeParameters, auth
|
|
43
|
+
? [
|
|
44
|
+
typescript_1.default.factory.createParameterDeclaration([
|
|
45
|
+
typescript_1.default.factory.createDecorator(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(ctx.importer.external({
|
|
46
|
+
type: "instance",
|
|
47
|
+
library: path_1.default
|
|
48
|
+
.relative(ctx.controller.location, auth.decorator.location)
|
|
49
|
+
.replaceAll(path_1.default.sep, "/")
|
|
50
|
+
.split(".ts")[0],
|
|
51
|
+
name: auth.decorator.name,
|
|
52
|
+
})), undefined, [])),
|
|
53
|
+
], undefined, auth.role, undefined, typescript_1.default.factory.createTypeReferenceNode(ctx.importer.external({
|
|
54
|
+
type: "instance",
|
|
55
|
+
library: path_1.default
|
|
56
|
+
.relative(ctx.controller.location, auth.payload.location)
|
|
57
|
+
.replaceAll(path_1.default.sep, "/")
|
|
58
|
+
.split(".ts")[0],
|
|
59
|
+
name: auth.payload.name,
|
|
60
|
+
})), undefined),
|
|
61
|
+
...method.parameters,
|
|
62
|
+
]
|
|
63
|
+
: method.parameters, method.type, typescript_1.default.factory.createBlock([typescript_1.default.factory.createReturnStatement(call)]));
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return Object.fromEntries(Object.entries(result).filter(([key]) => key.startsWith("src/controllers/")));
|
|
68
|
+
};
|
|
69
|
+
exports.writeRealizeControllers = writeRealizeControllers;
|
|
70
|
+
//# sourceMappingURL=writeRealizeControllers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeRealizeControllers.js","sourceRoot":"","sources":["../../src/realize/writeRealizeControllers.ts"],"names":[],"mappings":";;;;;;AAMA,yHAAsH;AACtH,gDAAwB;AACxB,4DAA4B;AAE5B,oFAAiF;AAE1E,MAAM,uBAAuB,GAAG,CACrC,KAAoC,EACZ,EAAE;IAC1B,MAAM,GAAG,GAA6B,IAAA,mDAAwB,EAC5D,KAAK,CAAC,QAAQ,C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uBAAuB,2BA0GlC"}
|
|
@@ -9,7 +9,6 @@ const NestiaMigrateImportProgrammer_1 = require("@nestia/migrate/lib/programmers
|
|
|
9
9
|
const openapi_1 = require("@samchon/openapi");
|
|
10
10
|
const tstl_1 = require("tstl");
|
|
11
11
|
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
-
const transformOpenApi_1 = require("../../interface/transformOpenApi");
|
|
13
12
|
const FilePrinter_1 = require("../../utils/FilePrinter");
|
|
14
13
|
const AutoBeTestStatementProgrammer_1 = require("./AutoBeTestStatementProgrammer");
|
|
15
14
|
function writeTestFunction(props) {
|
|
@@ -47,7 +46,7 @@ function associate(document) {
|
|
|
47
46
|
}, o)), utils_1.AutoBeEndpointComparator.hashCode, utils_1.AutoBeEndpointComparator.equals);
|
|
48
47
|
const functions = new tstl_1.HashMap(utils_1.AutoBeEndpointComparator.hashCode, utils_1.AutoBeEndpointComparator.equals);
|
|
49
48
|
// from migrate application
|
|
50
|
-
const migrate = openapi_1.HttpMigration.application((0,
|
|
49
|
+
const migrate = openapi_1.HttpMigration.application((0, utils_1.transformOpenApiDocument)(document));
|
|
51
50
|
for (const route of migrate.routes) {
|
|
52
51
|
const endpoint = {
|
|
53
52
|
path: route.path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeTestFunction.js","sourceRoot":"","sources":["../../../src/test/programmers/writeTestFunction.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"writeTestFunction.js","sourceRoot":"","sources":["../../../src/test/programmers/writeTestFunction.ts"],"names":[],"mappings":";;;;;AAeA,8CA4CC;AA1DD,yCAGuB;AACvB,iHAA8G;AAC9G,8CAA0E;AAC1E,+BAAqC;AACrC,4DAAqD;AAErD,yDAAsD;AACtD,mFAAgF;AAIhF,SAAgB,iBAAiB,CAAC,KAA4B;IAC5D,MAAM,GAAG,GAAiC;QACxC,QAAQ,EAAE,IAAI,6DAA6B,EAAE;QAC7C,QAAQ,EAAE,KAAK,CAAC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,CAAC,EAAE,EAAE,CACJ,IAAI,WAAI,CACN;QACE,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI;KACb,EACD,CAAC,CACF,CACJ,EACD,gCAAwB,CAAC,QAAQ,EACjC,gCAAwB,CAAC,MAAM,CAChC,CAAC;IACJ,MAAM,SAAS,GACb,IAAI,cAAO,CACT,gCAAwB,CAAC,QAAQ,EACjC,gCAAwB,CAAC,MAAM,CAChC,CAAC;IAEJ,2BAA2B;IAC3B,MAAM,OAAO,GAA4B,uBAAa,CAAC,WAAW,CAChE,IAAA,gCAAwB,EAAC,QAAQ,CAAC,CACnC,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,QAAQ,GAA4B;YACxC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAe;SAC9B,CAAC;QACF,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC1B,QAAQ,EAAE,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YACtD,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;SACpC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autobe/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "AI backend server code generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Wrtn Technologies",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"url": "https://github.com/wrtnlabs/autobe/issues"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nestia/core": "^7.
|
|
17
|
-
"@nestia/migrate": "^7.
|
|
16
|
+
"@nestia/core": "^7.3.0",
|
|
17
|
+
"@nestia/migrate": "^7.3.0",
|
|
18
18
|
"@samchon/openapi": "^4.6.0",
|
|
19
19
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
20
20
|
"embed-prisma": "^1.1.0",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"tstl": "^3.0.0",
|
|
27
27
|
"tgrid": "^1.2.0",
|
|
28
28
|
"typia": "^9.6.0",
|
|
29
|
-
"@autobe/
|
|
30
|
-
"@autobe/
|
|
31
|
-
"@autobe/
|
|
29
|
+
"@autobe/utils": "^0.14.3",
|
|
30
|
+
"@autobe/filesystem": "^0.14.3",
|
|
31
|
+
"@autobe/interface": "^0.14.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.15.3",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
"sync-request": "^6.1.0",
|
|
37
37
|
"ts-node": "^10.9.2",
|
|
38
38
|
"ts-patch": "^3.3.0",
|
|
39
|
-
"typescript": "~5.8.3"
|
|
40
|
-
"@autobe/filesystem": "^0.13.0"
|
|
39
|
+
"typescript": "~5.8.3"
|
|
41
40
|
},
|
|
42
41
|
"keywords": [
|
|
43
42
|
"ai",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AutoBeOpenApi, IAutoBeInterfaceCompiler } from "@autobe/interface";
|
|
2
|
-
import { invertOpenApiDocument } from "@autobe/utils";
|
|
2
|
+
import { invertOpenApiDocument, transformOpenApiDocument } from "@autobe/utils";
|
|
3
3
|
import { NestiaMigrateApplication } from "@nestia/migrate";
|
|
4
4
|
import { OpenApi } from "@samchon/openapi";
|
|
5
5
|
|
|
6
6
|
import { AutoBeCompilerInterfaceTemplate } from "../raw/AutoBeCompilerInterfaceTemplate";
|
|
7
7
|
import { ArrayUtil } from "../utils/ArrayUtil";
|
|
8
8
|
import { FilePrinter } from "../utils/FilePrinter";
|
|
9
|
-
import {
|
|
9
|
+
import { createMigrateApplication } from "./createMigrateApplication";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Custom Interface compiler that handles API specification and NestJS
|
|
@@ -35,10 +35,8 @@ export class AutoBeInterfaceCompiler implements IAutoBeInterfaceCompiler {
|
|
|
35
35
|
public async write(
|
|
36
36
|
document: AutoBeOpenApi.IDocument,
|
|
37
37
|
): Promise<Record<string, string>> {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
swagger,
|
|
41
|
-
);
|
|
38
|
+
const migrate: NestiaMigrateApplication =
|
|
39
|
+
createMigrateApplication(document);
|
|
42
40
|
const files: Record<string, string> = migrate.nest({
|
|
43
41
|
keyword: true,
|
|
44
42
|
simulate: true,
|
|
@@ -58,7 +56,10 @@ export class AutoBeInterfaceCompiler implements IAutoBeInterfaceCompiler {
|
|
|
58
56
|
: value,
|
|
59
57
|
],
|
|
60
58
|
)),
|
|
61
|
-
[
|
|
59
|
+
[
|
|
60
|
+
"packages/api/swagger.json",
|
|
61
|
+
JSON.stringify(migrate.getData().document(), null, 2),
|
|
62
|
+
],
|
|
62
63
|
...Object.entries(AutoBeCompilerInterfaceTemplate),
|
|
63
64
|
]);
|
|
64
65
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { transformOpenApiDocument } from "@autobe/utils";
|
|
3
|
+
import { NestiaMigrateApplication } from "@nestia/migrate";
|
|
4
|
+
|
|
5
|
+
export const createMigrateApplication = (
|
|
6
|
+
document: AutoBeOpenApi.IDocument,
|
|
7
|
+
): NestiaMigrateApplication => {
|
|
8
|
+
const migrate: NestiaMigrateApplication = new NestiaMigrateApplication(
|
|
9
|
+
transformOpenApiDocument(document),
|
|
10
|
+
);
|
|
11
|
+
migrate.getData().routes.forEach((r) => {
|
|
12
|
+
// @todo -> must be optimized
|
|
13
|
+
r.accessor[r.accessor.length - 1] = document.operations.find(
|
|
14
|
+
(o) => o.path === r.path && o.method === r.method,
|
|
15
|
+
)!.name;
|
|
16
|
+
});
|
|
17
|
+
return migrate;
|
|
18
|
+
};
|
|
@@ -4,8 +4,8 @@ export const AutoBeCompilerRealizeTemplate: Record<string, string> = {
|
|
|
4
4
|
"package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:prisma && npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:env\": \"ts-node build/env.ts\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:prisma\": \"prisma generate --schema prisma/schema\",\n \"build:swagger\": \"nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && npm run build:env && npm run build:prisma\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^7.1.1\",\n \"@nestia/e2e\": \"^7.1.1\",\n \"@nestia/sdk\": \"^7.1.1\",\n \"@nestjs/cli\": \"^11.0.7\",\n \"@rollup/plugin-terser\": \"^0.4.4\",\n \"@rollup/plugin-typescript\": \"^11.1.6\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/bcryptjs\": \"^3.0.0\",\n \"@types/cli\": \"^0.11.21\",\n \"@types/cli-progress\": \"^3.11.5\",\n \"@types/express\": \"^4.17.21\",\n \"@types/inquirer\": \"^8.2.5\",\n \"@types/jsonwebtoken\": \"^9.0.5\",\n \"@types/node\": \"^18.11.0\",\n \"@types/uuid\": \"^8.3.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.1.0\",\n \"@typescript-eslint/parser\": \"^8.1.0\",\n \"chalk\": \"^4.1.2\",\n \"cli\": \"^1.0.1\",\n \"cli-progress\": \"^3.12.0\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"eslint-plugin-deprecation\": \"^3.0.0\",\n \"express\": \"^4.18.2\",\n \"fastify\": \"^5.4.0\",\n \"nestia\": \"^7.1.1\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.8.3\",\n \"typescript-transform-paths\": \"^3.5.5\",\n \"webpack\": \"^5.89.0\",\n \"webpack-cli\": \"^5.1.4\",\n \"write-file-webpack-plugin\": \"^4.5.1\"\n },\n \"dependencies\": {\n \"@nestia/core\": \"^7.1.1\",\n \"@nestia/fetcher\": \"^7.1.1\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@nestjs/platform-fastify\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"bcryptjs\": \"^3.0.2\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\n \"jsonwebtoken\": \"^9.0.2\",\n \"prisma\": \"^6.11.1\",\n \"serialize-error\": \"^4.1.0\",\n \"tgrid\": \"^1.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.5.0\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test -- --simultaneous 1\"\n }\n}\n",
|
|
5
5
|
"src/MyGlobal.ts": "import { PrismaClient } from \"@prisma/client\";\nimport dotenv from \"dotenv\";\nimport dotenvExpand from \"dotenv-expand\";\nimport { Singleton } from \"tstl\";\nimport typia from \"typia\";\n\n/* eslint-disable */\nexport class MyGlobal {\n public static readonly prisma: PrismaClient = new PrismaClient();\n public static testing: boolean = false;\n public static get env(): MyGlobal.IEnvironments {\n return environments.get();\n }\n}\nexport namespace MyGlobal {\n export interface IEnvironments {\n API_PORT: `${number}`;\n\n /** JWT Secret Key. */\n JWT_SECRET_KEY: string;\n }\n}\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n",
|
|
6
6
|
"src/providers/jwtAuthorize.ts": "import { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n",
|
|
7
|
-
"src/providers/jwtDecode.ts": "export function jwtDecode(token: string): { id: string; type: string } {\n try {\n const base64Url = token.split(\".\")[1];\n if (!base64Url) throw new Error(\"Invalid token format\");\n\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => `%${c.charCodeAt(0).toString(16).padStart(2, \"0\")}`)\n .join(\"\"),\n );\n\n const decoded = JSON.parse(jsonPayload) as unknown;\n\n if (\n typeof decoded === \"object\" &&\n decoded !== null &&\n typeof (decoded as any).id === \"string\" &&\n typeof (decoded as any).type === \"string\"\n ) {\n return {\n id: (decoded as { id: string }).id,\n type: (decoded as { type: string }).type,\n };\n }\n\n throw new Error(\"Invalid token payload\");\n } catch {\n throw new Error(\"Failed to decode JWT token\");\n }\n}\n",
|
|
8
7
|
"src/setup/MySetupWizard.ts": "import cp from \"child_process\";\n\nimport { MyConfiguration } from \"../MyConfiguration\";\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport namespace MySetupWizard {\n export async function schema(): Promise<void> {\n if (MyGlobal.testing === false)\n throw new Error(\n \"Error on SetupWizard.schema(): unable to reset database in non-test mode.\",\n );\n const execute = (type: string) => (argv: string) =>\n cp.execSync(`npx prisma migrate ${type} --schema=prisma/schema ${argv}`, {\n stdio: \"ignore\",\n cwd: MyConfiguration.ROOT,\n });\n execute(\"reset\")(\"--force\");\n execute(\"dev\")(\"--name init\");\n }\n\n export async function seed(): Promise<void> {}\n}\n",
|
|
8
|
+
"src/util/toISOStringSafe.ts": "import { tags } from \"typia\";\n\n/**\n * Transforms a value that is either a Date or a string into an ISO 8601\n * formatted string. If it's already a string, it assumes it's already in ISO\n * format.\n */\nexport function toISOStringSafe(\n value: Date | (string & tags.Format<\"date-time\">),\n): string & tags.Format<\"date-time\"> {\n if (value instanceof Date) {\n return value.toISOString() as string & tags.Format<\"date-time\">;\n }\n return value;\n}\n",
|
|
9
9
|
"test/servant.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport { Driver, WorkerServer } from \"tgrid\";\n\nimport { MyBackend } from \"../src/MyBackend\";\nimport { MyGlobal } from \"../src/MyGlobal\";\nimport { IAutoBeRealizeTestConfig } from \"./autobe/compiler/IAutoBeRealizeTestConfig\";\nimport { IAutoBeRealizeTestListener } from \"./autobe/compiler/IAutoBeRealizeTestListener\";\nimport { IAutoBeRealizeTestOperation } from \"./autobe/compiler/IAutoBeRealizeTestOperation\";\nimport { IAutoBeRealizeTestResult } from \"./autobe/compiler/IAutoBeRealizeTestResult\";\nimport { IAutoBeRealizeTestService } from \"./autobe/compiler/IAutoBeRealizeTestService\";\nimport { TestAutomation } from \"./helpers/TestAutomation\";\n\nclass AutoBeRealizeTestService implements IAutoBeRealizeTestService {\n public constructor(\n private readonly listener: Driver<IAutoBeRealizeTestListener>,\n ) {}\n\n public async execute(\n config: IAutoBeRealizeTestConfig,\n ): Promise<IAutoBeRealizeTestResult> {\n const start: Date = new Date();\n const operations: IAutoBeRealizeTestOperation[] = [];\n await TestAutomation.execute({\n open: async (): Promise<MyBackend> => {\n const backend: MyBackend = new MyBackend();\n await backend.open();\n return backend;\n },\n close: (backend: MyBackend): Promise<void> => backend.close(),\n options: {\n reset: config.reset ?? true,\n simultaneous: config.simultaneous ?? 1,\n },\n onComplete: (exec: DynamicExecutor.IExecution): void => {\n const op: IAutoBeRealizeTestOperation = {\n name: exec.name,\n location: exec.location,\n value: exec.value,\n error: exec.error,\n started_at: exec.started_at,\n completed_at: exec.completed_at,\n };\n this.listener.onOperation(op).catch(() => {});\n operations.push(op);\n },\n onReset: (): void => {\n this.listener.onReset().catch(() => {});\n },\n });\n return {\n reset: config.reset ?? true,\n simultaneous: config.simultaneous ?? 1,\n operations,\n started_at: start.toISOString(),\n completed_at: new Date().toISOString(),\n };\n }\n}\n\nconst main = async (): Promise<void> => {\n const worker: WorkerServer<\n null,\n IAutoBeRealizeTestService,\n IAutoBeRealizeTestListener\n > = new WorkerServer();\n const listener: Driver<IAutoBeRealizeTestListener> = worker.getDriver();\n const service: AutoBeRealizeTestService = new AutoBeRealizeTestService(\n listener,\n );\n\n MyGlobal.testing = true;\n await worker.open(service);\n};\nmain().catch((error) => {\n console.log(error);\n process.exit(-1);\n});\n",
|
|
10
10
|
"test/autobe/compiler/IAutoBeRealizeTestOperation.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\nimport { tags } from \"typia\";\n\n/**\n * Detailed result interface representing the execution outcome of an individual\n * E2E test function during comprehensive backend implementation validation.\n *\n * This interface captures comprehensive information about a single test\n * operation execution, including identification details, execution results,\n * error conditions, and precise timing data. Each operation represents the\n * validation of a specific API endpoint or business scenario through Test\n * agent-generated E2E test functions executed against the fully implemented\n * backend application.\n *\n * The operation result provides granular visibility into test execution\n * outcomes, enabling detailed analysis of implementation quality, business\n * logic compliance, and performance characteristics at the individual test\n * level. This detailed tracking supports comprehensive validation reporting and\n * precise identification of implementation issues when they occur.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestOperation {\n /**\n * Unique identifier name of the executed E2E test function.\n *\n * Specifies the function name that was executed during this test operation,\n * typically corresponding to the Test agent-generated test function\n * identifier. This name provides direct traceability between test results and\n * the specific business scenarios, API endpoints, or validation logic being\n * tested.\n *\n * The test function name serves as the primary identifier for correlating\n * execution results with the original test scenarios, enabling stakeholders\n * to understand which specific functionality was validated and whether the\n * implementation correctly fulfills the intended business requirements and\n * API contracts.\n */\n name: string;\n\n /**\n * File system path location of the executed test function source code.\n *\n * Specifies the relative or absolute path to the test file that contains the\n * executed function within the project structure. This location information\n * enables direct navigation to the test source code for detailed analysis,\n * debugging, result interpretation, or modification purposes.\n *\n * The file location provides essential context for understanding test\n * organization, enables developers to quickly locate and examine the specific\n * test implementation, and supports comprehensive test suite maintenance and\n * documentation activities.\n */\n location: string;\n\n /**\n * Return value or result data produced by the test function execution.\n *\n * Contains the actual value returned by the test function upon completion,\n * regardless of whether execution succeeded or failed. This could include API\n * response objects, validation results, test data, computed values, or any\n * other output that the test function produces as part of its business logic\n * validation or endpoint testing.\n *\n * For successful test executions, this value represents the expected result\n * that demonstrates correct implementation behavior. The return value\n * provides insight into the test execution flow and can be analyzed to verify\n * that API responses match expected formats, business logic produces correct\n * outcomes, and data transformations operate as intended.\n */\n value: unknown;\n\n /**\n * Error information captured during test function execution, if any occurred.\n *\n * Contains detailed error information when the test function encounters\n * exceptions, assertion failures, timeout conditions, or other error states\n * during execution. When null, it indicates that the test completed\n * successfully without encountering any error conditions. When present, the\n * error provides comprehensive diagnostic information for understanding\n * implementation issues or test failures.\n *\n * Error information is crucial for identifying implementation defects, API\n * contract violations, business logic errors, integration failures, or\n * performance issues that prevent the backend application from meeting its\n * requirements. The error details enable developers to pinpoint specific\n * problems and implement necessary corrections to achieve full compliance\n * with validation scenarios.\n */\n error: null | unknown;\n\n /**\n * Precise timestamp when this specific test operation began execution.\n *\n * Records the exact moment when this individual test function started\n * execution, providing the reference point for measuring test duration and\n * understanding the temporal sequence of test operations within the overall\n * validation process. This timestamp enables detailed performance analysis\n * and execution timeline reconstruction.\n *\n * The start timestamp is essential for identifying execution patterns,\n * analyzing test concurrency behavior, measuring individual test performance,\n * and understanding the temporal distribution of test execution within the\n * comprehensive validation suite.\n */\n started_at: string & tags.Format<\"date-time\">;\n\n /**\n * Precise timestamp when this specific test operation finished execution.\n *\n * Records the exact moment when this individual test function completed\n * execution, regardless of whether it succeeded or failed. Combined with the\n * start timestamp, this enables precise calculation of test execution\n * duration and provides completion reference for the overall test timeline.\n *\n * The completion timestamp is valuable for performance analysis of individual\n * test operations, identifying slow-performing test scenarios, understanding\n * test execution efficiency, and maintaining comprehensive audit trails of\n * the validation process. It supports optimization efforts and helps identify\n * potential bottlenecks in either the test implementation or the backend\n * application being validated.\n */\n completed_at: string & tags.Format<\"date-time\">;\n}\n",
|
|
11
11
|
"test/autobe/compiler/IAutoBeRealizeTestConfig.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\n/**\n * Configuration interface defining the essential execution parameters required\n * for comprehensive E2E test suite validation against fully implemented backend\n * applications.\n *\n * This interface encapsulates the core execution settings and control\n * parameters necessary to orchestrate the final validation phase of the AutoBE\n * development pipeline. It provides streamlined configuration options that\n * control test execution behavior, database management, and performance\n * characteristics without requiring direct access to implementation files or\n * database schemas.\n *\n * The configuration assumes that the test execution environment has been\n * pre-configured with all necessary resources including generated\n * implementation files, database schemas, and package dependencies. This\n * interface focuses solely on runtime execution parameters that control how the\n * test suite operates within the prepared environment.\n *\n * This lightweight configuration approach enables flexible test execution\n * across different environments while maintaining clear separation between\n * resource provisioning and execution control, supporting both development and\n * production validation scenarios.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestConfig {\n /**\n * Optional flag indicating whether to perform a complete database reset\n * before test execution.\n *\n * When true, specifies that the test execution should begin with a\n * comprehensive database reset, purging all existing data and reconstructing\n * tables to their initial schema-defined state. When false, test execution\n * proceeds with the current database state, which may contain residual data\n * from previous operations.\n *\n * Database reset is crucial for ensuring test isolation, reproducibility, and\n * deterministic results. Clean state testing eliminates interference from\n * residual data and guarantees that each test execution cycle operates under\n * identical baseline conditions, enabling accurate validation of backend\n * implementation behavior.\n *\n * @default true\n */\n reset?: boolean;\n\n /**\n * Optional specification of the maximum number of test functions to execute\n * concurrently during the test suite run.\n *\n * Defines the concurrent execution limit for E2E test functions to optimize\n * testing performance while maintaining system stability and resource\n * management. This value balances test execution speed with resource\n * consumption and helps prevent system overload during comprehensive\n * validation.\n *\n * Concurrent execution significantly reduces total testing time for large\n * test suites while validating the backend application's ability to handle\n * parallel requests correctly. The simultaneous limit ensures controlled load\n * conditions that provide meaningful performance insights while maintaining\n * test reliability and result accuracy.\n *\n * @default 1\n */\n simultaneous?: number;\n}\n",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IAutoBeRealizeCompiler,
|
|
3
3
|
IAutoBeRealizeCompilerListener,
|
|
4
|
+
IAutoBeRealizeControllerProps,
|
|
4
5
|
IAutoBeRealizeTestProps,
|
|
5
6
|
IAutoBeRealizeTestResult,
|
|
6
7
|
} from "@autobe/interface";
|
|
@@ -9,12 +10,19 @@ import { AutoBeCompilerInterfaceTemplate } from "../raw/AutoBeCompilerInterfaceT
|
|
|
9
10
|
import { AutoBeCompilerRealizeTemplate } from "../raw/AutoBeCompilerRealizeTemplate";
|
|
10
11
|
import { AutoBeCompilerTestTemplate } from "../raw/AutoBeCompilerTestTemplate";
|
|
11
12
|
import { testRealizeProject } from "./testRealizeProject";
|
|
13
|
+
import { writeRealizeControllers } from "./writeRealizeControllers";
|
|
12
14
|
|
|
13
15
|
export class AutoBeRealizeCompiler implements IAutoBeRealizeCompiler {
|
|
14
16
|
public constructor(
|
|
15
17
|
private readonly listener: IAutoBeRealizeCompilerListener,
|
|
16
18
|
) {}
|
|
17
19
|
|
|
20
|
+
public async controller(
|
|
21
|
+
props: IAutoBeRealizeControllerProps,
|
|
22
|
+
): Promise<Record<string, string>> {
|
|
23
|
+
return writeRealizeControllers(props);
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
public test(
|
|
19
27
|
props: IAutoBeRealizeTestProps,
|
|
20
28
|
): Promise<IAutoBeRealizeTestResult> {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeRealizeAuthorization,
|
|
3
|
+
AutoBeRealizeFunction,
|
|
4
|
+
IAutoBeRealizeControllerProps,
|
|
5
|
+
} from "@autobe/interface";
|
|
6
|
+
import { NestiaMigrateApplication } from "@nestia/migrate";
|
|
7
|
+
import { NestiaMigrateNestMethodProgrammer } from "@nestia/migrate/lib/programmers/NestiaMigrateNestMethodProgrammer";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import ts from "typescript";
|
|
10
|
+
|
|
11
|
+
import { createMigrateApplication } from "../interface/createMigrateApplication";
|
|
12
|
+
|
|
13
|
+
export const writeRealizeControllers = (
|
|
14
|
+
props: IAutoBeRealizeControllerProps,
|
|
15
|
+
): Record<string, string> => {
|
|
16
|
+
const app: NestiaMigrateApplication = createMigrateApplication(
|
|
17
|
+
props.document,
|
|
18
|
+
);
|
|
19
|
+
const result: Record<string, string> = app.nest({
|
|
20
|
+
simulate: false,
|
|
21
|
+
e2e: false,
|
|
22
|
+
programmer: {
|
|
23
|
+
controllerMethod: (ctx) => {
|
|
24
|
+
const method = NestiaMigrateNestMethodProgrammer.write(ctx);
|
|
25
|
+
const func: AutoBeRealizeFunction | undefined = props.functions.find(
|
|
26
|
+
(f) =>
|
|
27
|
+
f.endpoint.method === ctx.route.method &&
|
|
28
|
+
f.endpoint.path === ctx.route.path,
|
|
29
|
+
);
|
|
30
|
+
if (func === undefined) return method; // unreachable
|
|
31
|
+
|
|
32
|
+
const auth: AutoBeRealizeAuthorization | undefined = func.role
|
|
33
|
+
? props.authorizations.find((d) => d.role === func.role)
|
|
34
|
+
: undefined;
|
|
35
|
+
if (func.role && auth === undefined) return method; // unreachable
|
|
36
|
+
|
|
37
|
+
ctx.importer.external({
|
|
38
|
+
type: "instance",
|
|
39
|
+
library: path
|
|
40
|
+
.relative(ctx.controller.location, func.location)
|
|
41
|
+
.replaceAll(path.sep, "/")
|
|
42
|
+
.split(".ts")[0],
|
|
43
|
+
name: func.name,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const call: ts.Expression = ts.factory.createCallExpression(
|
|
47
|
+
ts.factory.createIdentifier(func.name),
|
|
48
|
+
undefined,
|
|
49
|
+
[
|
|
50
|
+
...(func.role ? [func.role] : []),
|
|
51
|
+
...ctx.route.parameters.map((p) => p.name),
|
|
52
|
+
...(ctx.route.query ? [ctx.route.query.name] : []),
|
|
53
|
+
...(ctx.route.body ? [ctx.route.body.name] : []),
|
|
54
|
+
].map((name) => ts.factory.createIdentifier(name)),
|
|
55
|
+
);
|
|
56
|
+
return ts.factory.updateMethodDeclaration(
|
|
57
|
+
method,
|
|
58
|
+
method.modifiers,
|
|
59
|
+
method.asteriskToken,
|
|
60
|
+
method.name,
|
|
61
|
+
method.questionToken,
|
|
62
|
+
method.typeParameters,
|
|
63
|
+
auth
|
|
64
|
+
? [
|
|
65
|
+
ts.factory.createParameterDeclaration(
|
|
66
|
+
[
|
|
67
|
+
ts.factory.createDecorator(
|
|
68
|
+
ts.factory.createCallExpression(
|
|
69
|
+
ts.factory.createIdentifier(
|
|
70
|
+
ctx.importer.external({
|
|
71
|
+
type: "instance",
|
|
72
|
+
library: path
|
|
73
|
+
.relative(
|
|
74
|
+
ctx.controller.location,
|
|
75
|
+
auth.decorator.location,
|
|
76
|
+
)
|
|
77
|
+
.replaceAll(path.sep, "/")
|
|
78
|
+
.split(".ts")[0],
|
|
79
|
+
name: auth.decorator.name,
|
|
80
|
+
}),
|
|
81
|
+
),
|
|
82
|
+
undefined,
|
|
83
|
+
[],
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
undefined,
|
|
88
|
+
auth.role,
|
|
89
|
+
undefined,
|
|
90
|
+
ts.factory.createTypeReferenceNode(
|
|
91
|
+
ctx.importer.external({
|
|
92
|
+
type: "instance",
|
|
93
|
+
library: path
|
|
94
|
+
.relative(
|
|
95
|
+
ctx.controller.location,
|
|
96
|
+
auth.payload.location,
|
|
97
|
+
)
|
|
98
|
+
.replaceAll(path.sep, "/")
|
|
99
|
+
.split(".ts")[0],
|
|
100
|
+
name: auth.payload.name,
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
103
|
+
undefined,
|
|
104
|
+
),
|
|
105
|
+
...method.parameters,
|
|
106
|
+
]
|
|
107
|
+
: method.parameters,
|
|
108
|
+
method.type,
|
|
109
|
+
ts.factory.createBlock([ts.factory.createReturnStatement(call)]),
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
return Object.fromEntries(
|
|
115
|
+
Object.entries(result).filter(([key]) =>
|
|
116
|
+
key.startsWith("src/controllers/"),
|
|
117
|
+
),
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AutoBeOpenApi, IAutoBeTestWriteProps } from "@autobe/interface";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AutoBeEndpointComparator,
|
|
4
|
+
transformOpenApiDocument,
|
|
5
|
+
} from "@autobe/utils";
|
|
3
6
|
import { NestiaMigrateImportProgrammer } from "@nestia/migrate/lib/programmers/NestiaMigrateImportProgrammer";
|
|
4
7
|
import { HttpMigration, IHttpMigrateApplication } from "@samchon/openapi";
|
|
5
8
|
import { HashMap, Pair } from "tstl";
|
|
6
9
|
import ts, { FunctionDeclaration } from "typescript";
|
|
7
10
|
|
|
8
|
-
import { transformOpenApiDocument } from "../../interface/transformOpenApi";
|
|
9
11
|
import { FilePrinter } from "../../utils/FilePrinter";
|
|
10
12
|
import { AutoBeTestStatementProgrammer } from "./AutoBeTestStatementProgrammer";
|
|
11
13
|
import { IAutoBeTestApiFunction } from "./IAutoBeTestApiFunction";
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformOpenApiDocument = transformOpenApiDocument;
|
|
4
|
-
const openapi_1 = require("@samchon/openapi");
|
|
5
|
-
function transformOpenApiDocument(document) {
|
|
6
|
-
var _a;
|
|
7
|
-
var _b;
|
|
8
|
-
const paths = {};
|
|
9
|
-
for (const op of document.operations) {
|
|
10
|
-
(_a = paths[_b = op.path]) !== null && _a !== void 0 ? _a : (paths[_b] = {});
|
|
11
|
-
paths[op.path][op.method] = {
|
|
12
|
-
summary: op.summary,
|
|
13
|
-
description: op.description,
|
|
14
|
-
parameters: op.parameters.map((p) => ({
|
|
15
|
-
name: p.name,
|
|
16
|
-
in: "path",
|
|
17
|
-
schema: p.schema,
|
|
18
|
-
description: p.description,
|
|
19
|
-
required: true,
|
|
20
|
-
})),
|
|
21
|
-
requestBody: op.requestBody
|
|
22
|
-
? {
|
|
23
|
-
content: {
|
|
24
|
-
"application/json": {
|
|
25
|
-
schema: {
|
|
26
|
-
$ref: `#.components/schemas/${op.requestBody.typeName}`,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
description: op.requestBody.description,
|
|
31
|
-
required: true,
|
|
32
|
-
}
|
|
33
|
-
: undefined,
|
|
34
|
-
responses: op.responseBody
|
|
35
|
-
? {
|
|
36
|
-
[op.method === "post" ? 201 : 200]: {
|
|
37
|
-
content: {
|
|
38
|
-
"application/json": {
|
|
39
|
-
schema: {
|
|
40
|
-
$ref: `#/components/schemas/${op.responseBody.typeName}`,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
description: op.responseBody.description,
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
: undefined,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return openapi_1.OpenApi.convert({
|
|
51
|
-
openapi: "3.1.0",
|
|
52
|
-
paths,
|
|
53
|
-
components: document.components,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=transformOpenApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformOpenApi.js","sourceRoot":"","sources":["../../src/interface/transformOpenApi.ts"],"names":[],"mappings":";;AAGA,4DAkDC;AAp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6BACF;yBACF;wBACD,WAAW,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW;qBACzC;iBACF;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IACD,OAAO,iBAAO,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,OAAO;QAChB,KAAK;QACL,UAAU,EAAE,QAAQ,CAAC,UAAU;KACP,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
-
import { OpenApi, OpenApiV3_1 } from "@samchon/openapi";
|
|
3
|
-
|
|
4
|
-
export function transformOpenApiDocument(
|
|
5
|
-
document: AutoBeOpenApi.IDocument,
|
|
6
|
-
): OpenApi.IDocument {
|
|
7
|
-
const paths: Record<string, OpenApi.IPath> = {};
|
|
8
|
-
for (const op of document.operations) {
|
|
9
|
-
paths[op.path] ??= {};
|
|
10
|
-
paths[op.path][op.method] = {
|
|
11
|
-
summary: op.summary,
|
|
12
|
-
description: op.description,
|
|
13
|
-
parameters: op.parameters.map((p) => ({
|
|
14
|
-
name: p.name,
|
|
15
|
-
in: "path",
|
|
16
|
-
schema: p.schema,
|
|
17
|
-
description: p.description,
|
|
18
|
-
required: true,
|
|
19
|
-
})),
|
|
20
|
-
requestBody: op.requestBody
|
|
21
|
-
? {
|
|
22
|
-
content: {
|
|
23
|
-
"application/json": {
|
|
24
|
-
schema: {
|
|
25
|
-
$ref: `#.components/schemas/${op.requestBody.typeName}`,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
description: op.requestBody.description,
|
|
30
|
-
required: true,
|
|
31
|
-
}
|
|
32
|
-
: undefined,
|
|
33
|
-
responses: op.responseBody
|
|
34
|
-
? {
|
|
35
|
-
[op.method === "post" ? 201 : 200]: {
|
|
36
|
-
content: {
|
|
37
|
-
"application/json": {
|
|
38
|
-
schema: {
|
|
39
|
-
$ref: `#/components/schemas/${op.responseBody.typeName}`,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
description: op.responseBody.description,
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
: undefined,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return OpenApi.convert({
|
|
50
|
-
openapi: "3.1.0",
|
|
51
|
-
paths,
|
|
52
|
-
components: document.components,
|
|
53
|
-
} as OpenApiV3_1.IDocument);
|
|
54
|
-
}
|