UNPKG

@autobe/compiler

Version:

AI backend server code generator

15 lines 36.5 kB
export const AutoBeCompilerRealizeTemplate: Record<string, string> = { ".env.local": "API_PORT=37001\nJWT_SECRET_KEY=your_jwt_secret_key", ".gitignore": "bin/\ndist/\nlib/\nnode_modules/\n\nprisma/migrations\nprisma/schema/migrations\nprisma/bbs.db\n\n*.DS_Store\npackage-lock.json\npnpm-lock.yaml\n.npmrc", "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\": \"AGPL-3.0\",\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", "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", "src/providers/authorize/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", "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", "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", "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", "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", "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", "test/autobe/compiler/IAutoBeRealizeTestResult.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\nimport { tags } from \"typia\";\n\nimport { IAutoBeRealizeTestOperation } from \"./IAutoBeRealizeTestOperation\";\n\n/**\n * Comprehensive result interface containing complete information about E2E test\n * suite execution for backend implementation validation.\n *\n * This interface represents the final consolidated results of executing the\n * entire Test agent-generated E2E test suite against the fully implemented\n * backend application. It encapsulates all aspects of the test execution\n * process including configuration parameters, individual operation results, and\n * timing information that collectively determine the validation outcome of the\n * generated backend implementation.\n *\n * The result structure provides stakeholders with comprehensive visibility into\n * the validation process, enabling detailed analysis of backend implementation\n * quality, compliance with requirements, and production readiness assessment\n * based on exhaustive functional testing.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestResult {\n /**\n * Whether the test execution included a clean database reset before testing.\n *\n * Indicates if the test suite execution began with a complete database reset\n * to ensure clean testing conditions. When true, all existing data was purged\n * and database tables were reconstructed to their initial state before test\n * execution commenced, guaranteeing test isolation and reproducibility.\n *\n * Database reset is essential for ensuring that test results are\n * deterministic and accurately reflect the application's behavior under\n * controlled conditions, free from interference by residual data from\n * previous executions or development activities. This flag helps stakeholders\n * understand the testing conditions and trust the reliability of results.\n */\n reset: boolean;\n\n /**\n * Number of test functions that were executed simultaneously during the test\n * suite run.\n *\n * Specifies the concurrent execution limit that was applied during E2E test\n * function execution to optimize testing performance while maintaining system\n * stability. This value represents the balance between test execution speed\n * and resource consumption that was used to validate the backend\n * implementation's ability to handle concurrent requests.\n *\n * The simultaneous execution count provides insight into the load conditions\n * under which the backend application was validated, helping stakeholders\n * understand the concurrency testing coverage and the application's\n * performance characteristics under parallel request scenarios.\n */\n simultaneous: number;\n\n /**\n * Complete collection of individual test operation results with detailed\n * execution information.\n *\n * Contains the comprehensive array of {@link IAutoBeRealizeTestOperation}\n * results representing every E2E test function that was executed during the\n * validation process. Each operation result includes detailed information\n * about test execution outcomes, return values, error conditions, timing\n * data, and validation status for specific API endpoints or business\n * scenarios.\n *\n * This complete result set enables stakeholders to perform detailed analysis\n * of which functionality passed validation, which tests failed, what specific\n * issues were encountered, and how the backend implementation performs under\n * various test scenarios. The operation results serve as the authoritative\n * record of implementation quality and compliance with established\n * requirements.\n */\n operations: IAutoBeRealizeTestOperation[];\n\n /**\n * Timestamp when the comprehensive test suite execution was initiated.\n *\n * Records the exact moment when the E2E test suite execution began, marking\n * the start of the final validation phase in the AutoBE development pipeline.\n * This timestamp provides the reference point for understanding the complete\n * test execution timeline and measuring the duration of comprehensive backend\n * validation.\n *\n * The start timestamp is essential for performance analysis of the entire\n * validation process, enabling stakeholders to understand test execution\n * efficiency and identify potential optimization opportunities in the testing\n * infrastructure or backend implementation.\n */\n started_at: string & tags.Format<\"date-time\">;\n\n /**\n * Timestamp when the entire test suite execution was finalized.\n *\n * Records the exact moment when all planned E2E test operations finished\n * execution, marking the completion of the comprehensive validation process.\n * This timestamp represents the definitive end point of the AutoBE\n * development pipeline validation phase and provides the completion reference\n * for calculating total validation duration.\n *\n * The completion timestamp serves as the official validation completion\n * marker for stakeholders tracking project delivery milestones and provides\n * essential audit trail information for the complete development and\n * validation cycle. Combined with the start timestamp, it enables precise\n * measurement of the total time required for comprehensive backend\n * validation.\n */\n completed_at: string & tags.Format<\"date-time\">;\n}\n", "test/autobe/compiler/IAutoBeRealizeTestListener.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\nimport { IAutoBeRealizeTestOperation } from \"../compiler/IAutoBeRealizeTestOperation\";\n\n/**\n * Interface for Worker RPC event listener provided by client processes to\n * receive real-time E2E test execution events from worker processes.\n *\n * This interface defines the event handling contract for client processes that\n * delegate E2E test execution to dedicated worker processes. Client processes\n * provide an implementation of this interface to receive real-time\n * notifications about test operation progress, individual test completion\n * events, and database reset activities throughout the comprehensive test\n * execution pipeline.\n *\n * In TGrid's RPC paradigm, this listener acts as the Acceptor that client\n * processes expose to worker processes, enabling bidirectional communication\n * where workers can notify clients about test execution progress while\n * maintaining process isolation. The listener functions enable client processes\n * to provide interactive user experiences, display progress indicators, and\n * respond to the dynamic nature of test execution workflows.\n *\n * The listener interface focuses on critical test execution events that require\n * immediate client notification, ensuring optimal performance by transmitting\n * only essential progress information from worker to client processes without\n * overwhelming the communication channel.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestListener {\n /**\n * Handles individual E2E test operation completion events from worker\n * processes.\n *\n * Called when each individual E2E test function completes execution in the\n * worker process, providing comprehensive details about the test operation\n * outcome including execution results, timing information, error conditions,\n * and progress tracking data. This enables client processes to display\n * real-time test execution progress and provide immediate feedback about test\n * validation outcomes.\n *\n * The operation events provide granular visibility into the test execution\n * pipeline, allowing client processes to:\n *\n * - Display individual test completion status and results\n * - Track overall test suite execution progress with completion counters\n * - Show specific test function names and execution locations for context\n * - Present detailed error information when test failures occur\n * - Calculate and display test execution performance metrics and timing data\n * - Provide real-time feedback about backend implementation quality assessment\n *\n * This event stream enables responsive user interfaces that keep stakeholders\n * informed about comprehensive validation progress while the actual test\n * execution occurs in isolated worker processes for optimal system\n * performance.\n *\n * @param event Complete test operation result containing execution details,\n * timing information, success/failure status, return values, error\n * conditions, and progress tracking data from the individual test function\n * execution in the worker process\n * @returns Promise that resolves when the client process has completed\n * handling the test operation event, enabling proper flow control and\n * ensuring client readiness for subsequent operation notifications\n */\n onOperation(event: IAutoBeRealizeTestOperation): Promise<void>;\n\n /**\n * Handles database reset completion events from worker processes.\n *\n * Called when the worker process completes database reset operations before\n * test execution begins, indicating that the test environment has been\n * prepared with clean initial conditions. This event enables client processes\n * to display test preparation status and confirm that subsequent test\n * operations will execute under controlled, predictable database states.\n *\n * The reset event provides important timing information for client processes\n * to:\n *\n * - Display test preparation progress and database initialization status\n * - Confirm that clean testing conditions have been established\n * - Indicate the transition from setup phase to actual test execution\n * - Track the overall test execution timeline including preparation overhead\n * - Provide user feedback about test environment readiness and validation scope\n *\n * Database reset represents a critical preparation step that ensures test\n * isolation and reproducibility by eliminating interference from residual\n * data, making this event essential for client understanding of test\n * execution reliability and deterministic result conditions.\n *\n * @returns Promise that resolves when the client process has completed\n * handling the database reset notification, ensuring proper synchronization\n * between worker database preparation activities and client progress\n * display updates\n */\n onReset(): Promise<void>;\n}\n", "test/autobe/compiler/IAutoBeRealizeTestService.ts": "//---------------------------------------------------\n// Cloned from @autobe/interface\n//---------------------------------------------------\nimport { IAutoBeRealizeTestResult } from \"../compiler/IAutoBeRealizeTestResult\";\nimport { IAutoBeRealizeTestConfig } from \"./IAutoBeRealizeTestConfig\";\n\n/**\n * Interface representing the Worker RPC service for executing comprehensive E2E\n * test validation against fully implemented backend applications.\n *\n * This interface defines the remote procedure call functions that can be\n * invoked on dedicated worker processes to execute complete E2E test suites\n * against generated backend implementations. The service enables comprehensive\n * validation of backend application quality and production readiness through\n * automated test execution workflows in isolated worker environments.\n *\n * In TGrid's RPC paradigm, this service acts as the Provider that worker\n * processes expose for test execution operations. The main process obtains a\n * `Driver<IAutoBeRealizeTestService>` instance to delegate intensive test\n * execution tasks to worker processes, ensuring optimal performance and\n * resource isolation while maintaining system responsiveness during\n * comprehensive test validation workflows.\n *\n * The service orchestrates the complete test execution pipeline including\n * environment setup, database initialization, concurrent test function\n * execution, and comprehensive result collection to provide definitive\n * assessment of backend implementation quality and production deployment\n * readiness within dedicated worker process boundaries.\n *\n * @author Samchon\n */\nexport interface IAutoBeRealizeTestService {\n /**\n * Executes comprehensive E2E test suite against the fully implemented backend\n * application to validate production readiness.\n *\n * Performs complete test execution pipeline from environment setup through\n * test suite execution to result compilation, validating that the generated\n * backend implementation correctly fulfills all business requirements, API\n * contracts, and database integration specifications under realistic\n * operational conditions.\n *\n * The execution process encompasses:\n *\n * **Environment Preparation**:\n *\n * - Configuration of test environment with pre-loaded implementation files and\n * database schemas from the worker context\n * - Optional database reset for clean testing conditions that eliminate\n * interference from residual data\n * - Package dependency resolution and testing infrastructure setup\n * - Validation of all necessary resources for comprehensive test execution\n *\n * **Test Suite Execution**:\n *\n * - Systematic execution of Test agent-generated E2E test functions with\n * controlled concurrency for optimal performance\n * - Real-time monitoring of individual test operations with detailed progress\n * tracking and result collection\n * - Comprehensive error handling and result aggregation for both successful\n * validations and failure scenarios\n * - Integration testing of API endpoints, business logic, and database\n * operations under realistic load conditions\n *\n * **Quality Assessment**:\n *\n * - Validation of API contract compliance and response schema correctness\n * - Business logic verification through comprehensive scenario coverage\n * - Database integration testing with proper transaction handling\n * - Error condition testing to ensure robust error handling and recovery\n * - Performance validation under controlled concurrent request scenarios\n *\n * **Result Compilation**:\n *\n * - Detailed collection of individual test operation outcomes with timing and\n * performance data\n * - Comprehensive analysis of success rates, failure patterns, and\n * implementation quality metrics\n * - Production readiness assessment based on comprehensive validation results\n * - Detailed diagnostic information for any identified issues or failures\n *\n * The test execution provides the definitive assessment of whether the\n * generated backend application meets all specified requirements and is ready\n * for production deployment without manual debugging or modification. The\n * worker-based execution ensures optimal system performance by isolating\n * intensive test operations from the main process while maintaining\n * comprehensive validation accuracy.\n *\n * @param config Basic test execution configuration including database reset\n * and concurrency control settings. The worker process is expected to have\n * access to pre-loaded implementation files, database schemas, and package\n * configuration through its initialization context, requiring only\n * execution parameters for the test suite run.\n * @returns Promise resolving to comprehensive test execution results\n * including configuration details, individual operation outcomes, timing\n * information, success/failure analysis, and definitive production\n * readiness assessment from the isolated worker execution context\n */\n execute(config: IAutoBeRealizeTestConfig): Promise<IAutoBeRealizeTestResult>;\n}\n" };