UNPKG

@autobe/compiler

Version:

AI backend server code generator

15 lines 45.3 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", "src/MyConfiguration.ts": "import { ExceptionManager } from \"@nestia/core\";\nimport {\n ConflictException,\n InternalServerErrorException,\n NotFoundException,\n} from \"@nestjs/common\";\nimport { Prisma } from \"@prisma/client\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport { MyGlobal } from \"./MyGlobal\";\n\nexport namespace MyConfiguration {\n export const API_PORT = () => Number(MyGlobal.env.API_PORT);\n export const ROOT = (() => {\n const split: string[] = __dirname.split(path.sep);\n return split.at(-1) === \"src\" && split.at(-2) === \"bin\"\n ? path.resolve(__dirname + \"/../..\")\n : fs.existsSync(__dirname + \"/.env\")\n ? __dirname\n : path.resolve(__dirname + \"/..\");\n })().replaceAll(\"\\\\\", \"/\");\n}\n\nExceptionManager.insert(Prisma.PrismaClientKnownRequestError, (exp) => {\n switch (exp.code) {\n case \"P2025\":\n return new NotFoundException(exp.message);\n case \"P2002\": // UNIQUE CONSTRAINT\n return new ConflictException(exp.message);\n default:\n return new InternalServerErrorException(exp.message);\n }\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\n // PARSE TOKEN\n try {\n if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === true\n ) {\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 } else {\n const token = props.request.headers.authorization;\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n }\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 MySetupWizard.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", "tsconfig.json": "{\n \"compilerOptions\": {\n /* Visit https://aka.ms/tsconfig to read more about this file */\n\n /* Projects */\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\n\n /* Language and Environment */\n \"target\": \"ES2015\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\n \"lib\": [\n \"DOM\",\n \"ESNext\",\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */\n // \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\n \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\n \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\n\n /* Modules */\n \"module\": \"commonjs\", /* Specify what module code is generated. */\n // \"rootDir\": \"./\", /* Specify the root folder within your source files. */\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\n \"paths\": {\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"./src/api/*\"],\n \"@ORGANIZATION/PROJECT-api\": [\"./src/api\"],\n }, /* Specify a set of entries that re-map imports to additional lookup locations. */\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\n\n /* JavaScript Support */\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\n\n /* Emit */\n // \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */\n // \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */\n // \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */\n // \"removeComments\": true, /* Disable emitting comments. */\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\n // \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */\n // \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */\n \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\n\n /* Interop Constraints */\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */\n // \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. */\n\n /* Type Checking */\n \"strict\": true, /* Enable all strict type-checking options. */\n // \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\n \"noUnusedLocals\": false, /* Enable error reporting when local variables aren't read. */\n \"noUnusedParameters\": false, /* Raise an error when a function parameter isn't read. */\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\n \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\n \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\n\n /* Completeness */\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\n \"plugins\": [\n { \"transform\": \"typescript-transform-paths\" },\n { \"transform\": \"typia/lib/transform\" },\n { \n \"transform\": \"@nestia/core/lib/transform\",\n /**\n * Validate request body.\n * \n * - \"assert\": Use typia.assert() function\n * - \"is\": Use typia.is() function\n * - \"validate\": Use typia.validate() function\n * - \"assertEquals\": Use typia.assertEquals() function\n * - \"equals\": Use typia.equals() function\n * - \"validateEquals\": Use typia.validateEquals() function\n */\n \"validate\": \"validate\",\n /**\n * Validate JSON typed response body.\n * \n * - \"assert\": Use typia.assertStringify() function\n * - \"is\": Use typia.isStringify() function\n * - \"validate\": Use typia.validateStringify() function\n * - \"validate.log\": typia.validateStringify(), but do not throw and just log it\n * - \"stringify\": Use typia.stringify() function, but dangerous\n * - null: Just use JSON.stringify() function, without boosting\n */\n \"stringify\": \"assert\",\n },\n ]\n },\n \"include\": [\n \"src\"\n ],\n \"exclude\": [\n \"node_modules\",\n \"packages\",\n ]\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" };