@autobe/compiler 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeCompiler.d.ts +25 -5
- package/lib/AutoBeCompiler.js +24 -8
- package/lib/AutoBeCompiler.js.map +1 -1
- package/lib/AutoBeInterfaceCompiler.d.ts +26 -0
- package/lib/AutoBeInterfaceCompiler.js +81 -2
- package/lib/AutoBeInterfaceCompiler.js.map +1 -1
- package/lib/AutoBePrismaCompiler.d.ts +27 -2
- package/lib/AutoBePrismaCompiler.js +33 -5
- package/lib/AutoBePrismaCompiler.js.map +1 -1
- package/lib/AutoBeTypeScriptCompiler.d.ts +25 -0
- package/lib/AutoBeTypeScriptCompiler.js +26 -1
- package/lib/AutoBeTypeScriptCompiler.js.map +1 -1
- package/lib/prisma/writePrismaApplication.d.ts +4 -1
- package/lib/prisma/writePrismaApplication.js +93 -52
- package/lib/prisma/writePrismaApplication.js.map +1 -1
- package/package.json +2 -2
- package/src/AutoBeCompiler.ts +24 -17
- package/src/AutoBeInterfaceCompiler.ts +98 -5
- package/src/AutoBePrismaCompiler.ts +33 -4
- package/src/AutoBeTypeScriptCompiler.ts +26 -1
- package/src/prisma/writePrismaApplication.ts +133 -69
package/lib/AutoBeCompiler.d.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAutoBeCompiler, IAutoBeInterfaceCompiler, IAutoBePrismaCompiler, IAutoBeTypeScriptCompiler } from "@autobe/interface";
|
|
2
|
+
/**
|
|
3
|
+
* Comprehensive compilation infrastructure for the vibe coding pipeline.
|
|
4
|
+
*
|
|
5
|
+
* This class provides the three-tier compiler system that transforms AST
|
|
6
|
+
* structures into production-ready code across all development phases. The
|
|
7
|
+
* AutoBeCompiler integrates the custom Prisma compiler, Interface compiler, and
|
|
8
|
+
* official TypeScript compiler into a unified compilation infrastructure.
|
|
9
|
+
*
|
|
10
|
+
* The compilation system ensures 100% syntactic correctness and semantic
|
|
11
|
+
* integrity throughout the automated development workflow by operating on
|
|
12
|
+
* validated AST data and providing continuous validation feedback loops. This
|
|
13
|
+
* enables the revolutionary "structure first, validate continuously, generate
|
|
14
|
+
* deterministically" approach that guarantees generated applications work
|
|
15
|
+
* correctly on the first attempt.
|
|
16
|
+
*
|
|
17
|
+
* For high-performance scenarios with multiple concurrent users, individual
|
|
18
|
+
* compiler components can be separated into dedicated worker processes to
|
|
19
|
+
* prevent blocking during computationally intensive compilation operations
|
|
20
|
+
* while maintaining the same interface compatibility.
|
|
21
|
+
*
|
|
22
|
+
* @author Samchon
|
|
23
|
+
*/
|
|
2
24
|
export declare class AutoBeCompiler implements IAutoBeCompiler {
|
|
3
25
|
readonly prisma: IAutoBePrismaCompiler;
|
|
4
|
-
interface
|
|
5
|
-
typescript
|
|
6
|
-
private readonly interface_compiler_;
|
|
7
|
-
private readonly typescript_compiler_;
|
|
26
|
+
readonly interface: IAutoBeInterfaceCompiler;
|
|
27
|
+
readonly typescript: IAutoBeTypeScriptCompiler;
|
|
8
28
|
}
|
package/lib/AutoBeCompiler.js
CHANGED
|
@@ -4,17 +4,33 @@ exports.AutoBeCompiler = void 0;
|
|
|
4
4
|
const AutoBeInterfaceCompiler_1 = require("./AutoBeInterfaceCompiler");
|
|
5
5
|
const AutoBePrismaCompiler_1 = require("./AutoBePrismaCompiler");
|
|
6
6
|
const AutoBeTypeScriptCompiler_1 = require("./AutoBeTypeScriptCompiler");
|
|
7
|
+
/**
|
|
8
|
+
* Comprehensive compilation infrastructure for the vibe coding pipeline.
|
|
9
|
+
*
|
|
10
|
+
* This class provides the three-tier compiler system that transforms AST
|
|
11
|
+
* structures into production-ready code across all development phases. The
|
|
12
|
+
* AutoBeCompiler integrates the custom Prisma compiler, Interface compiler, and
|
|
13
|
+
* official TypeScript compiler into a unified compilation infrastructure.
|
|
14
|
+
*
|
|
15
|
+
* The compilation system ensures 100% syntactic correctness and semantic
|
|
16
|
+
* integrity throughout the automated development workflow by operating on
|
|
17
|
+
* validated AST data and providing continuous validation feedback loops. This
|
|
18
|
+
* enables the revolutionary "structure first, validate continuously, generate
|
|
19
|
+
* deterministically" approach that guarantees generated applications work
|
|
20
|
+
* correctly on the first attempt.
|
|
21
|
+
*
|
|
22
|
+
* For high-performance scenarios with multiple concurrent users, individual
|
|
23
|
+
* compiler components can be separated into dedicated worker processes to
|
|
24
|
+
* prevent blocking during computationally intensive compilation operations
|
|
25
|
+
* while maintaining the same interface compatibility.
|
|
26
|
+
*
|
|
27
|
+
* @author Samchon
|
|
28
|
+
*/
|
|
7
29
|
class AutoBeCompiler {
|
|
8
30
|
constructor() {
|
|
9
31
|
this.prisma = new AutoBePrismaCompiler_1.AutoBePrismaCompiler();
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
}
|
|
13
|
-
interface(document) {
|
|
14
|
-
return this.interface_compiler_.compile(document);
|
|
15
|
-
}
|
|
16
|
-
typescript(props) {
|
|
17
|
-
return this.typescript_compiler_.compile(props);
|
|
32
|
+
this.interface = new AutoBeInterfaceCompiler_1.AutoBeInterfaceCompiler();
|
|
33
|
+
this.typescript = new AutoBeTypeScriptCompiler_1.AutoBeTypeScriptCompiler();
|
|
18
34
|
}
|
|
19
35
|
}
|
|
20
36
|
exports.AutoBeCompiler = AutoBeCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeCompiler.js","sourceRoot":"","sources":["../src/AutoBeCompiler.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AutoBeCompiler.js","sourceRoot":"","sources":["../src/AutoBeCompiler.ts"],"names":[],"mappings":";;;AAOA,uEAAoE;AACpE,iEAA8D;AAC9D,yEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,cAAc;IAA3B;QACkB,WAAM,GAA0B,IAAI,2CAAoB,EAAE,CAAC;QAE3D,cAAS,GACvB,IAAI,iDAAuB,EAAE,CAAC;QAEhB,eAAU,GACxB,IAAI,mDAAwB,EAAE,CAAC;IACnC,CAAC;CAAA;AARD,wCAQC"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import { AutoBeOpenApi, IAutoBeInterfaceCompiler } from "@autobe/interface";
|
|
2
|
+
import { OpenApi } from "@samchon/openapi";
|
|
3
|
+
/**
|
|
4
|
+
* Custom Interface compiler that handles API specification and NestJS
|
|
5
|
+
* application generation.
|
|
6
|
+
*
|
|
7
|
+
* This compiler transforms validated {@link AutoBeOpenApi.IDocument} AST
|
|
8
|
+
* structures into comprehensive NestJS projects through a sophisticated
|
|
9
|
+
* multi-stage transformation pipeline. The Interface compiler bridges the gap
|
|
10
|
+
* between database design and application implementation, ensuring perfect
|
|
11
|
+
* alignment with business requirements and database schemas.
|
|
12
|
+
*
|
|
13
|
+
* The compiler leverages NestiaMigrateApplication for robust NestJS project
|
|
14
|
+
* generation and HttpMigration for bidirectional conversion between AutoBE AST
|
|
15
|
+
* and standard OpenAPI formats. All generated TypeScript code is automatically
|
|
16
|
+
* formatted with Prettier and organized with proper import sorting for
|
|
17
|
+
* production-ready quality.
|
|
18
|
+
*
|
|
19
|
+
* Key capabilities include generating complete NestJS applications with
|
|
20
|
+
* controllers, DTOs, client SDKs, and E2E test scaffolds, all enhanced with
|
|
21
|
+
* keyworded parameter optimization for AI consumption and comprehensive
|
|
22
|
+
* documentation derived from AST descriptions.
|
|
23
|
+
*
|
|
24
|
+
* @author Samchon
|
|
25
|
+
*/
|
|
2
26
|
export declare class AutoBeInterfaceCompiler implements IAutoBeInterfaceCompiler {
|
|
3
27
|
compile(document: AutoBeOpenApi.IDocument): Promise<Record<string, string>>;
|
|
28
|
+
transform(document: AutoBeOpenApi.IDocument): Promise<OpenApi.IDocument>;
|
|
29
|
+
invert(document: OpenApi.IDocument): Promise<AutoBeOpenApi.IDocument>;
|
|
4
30
|
}
|
|
@@ -19,10 +19,33 @@ const prettier_plugin_sort_imports_1 = __importDefault(require("@trivago/prettie
|
|
|
19
19
|
const import2_1 = __importDefault(require("import2"));
|
|
20
20
|
const prettier_1 = require("prettier");
|
|
21
21
|
const ArrayUtil_1 = require("./utils/ArrayUtil");
|
|
22
|
+
/**
|
|
23
|
+
* Custom Interface compiler that handles API specification and NestJS
|
|
24
|
+
* application generation.
|
|
25
|
+
*
|
|
26
|
+
* This compiler transforms validated {@link AutoBeOpenApi.IDocument} AST
|
|
27
|
+
* structures into comprehensive NestJS projects through a sophisticated
|
|
28
|
+
* multi-stage transformation pipeline. The Interface compiler bridges the gap
|
|
29
|
+
* between database design and application implementation, ensuring perfect
|
|
30
|
+
* alignment with business requirements and database schemas.
|
|
31
|
+
*
|
|
32
|
+
* The compiler leverages NestiaMigrateApplication for robust NestJS project
|
|
33
|
+
* generation and HttpMigration for bidirectional conversion between AutoBE AST
|
|
34
|
+
* and standard OpenAPI formats. All generated TypeScript code is automatically
|
|
35
|
+
* formatted with Prettier and organized with proper import sorting for
|
|
36
|
+
* production-ready quality.
|
|
37
|
+
*
|
|
38
|
+
* Key capabilities include generating complete NestJS applications with
|
|
39
|
+
* controllers, DTOs, client SDKs, and E2E test scaffolds, all enhanced with
|
|
40
|
+
* keyworded parameter optimization for AI consumption and comprehensive
|
|
41
|
+
* documentation derived from AST descriptions.
|
|
42
|
+
*
|
|
43
|
+
* @author Samchon
|
|
44
|
+
*/
|
|
22
45
|
class AutoBeInterfaceCompiler {
|
|
23
46
|
compile(document) {
|
|
24
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const swagger =
|
|
48
|
+
const swagger = transformDocument(document);
|
|
26
49
|
const migrate = new migrate_1.NestiaMigrateApplication(swagger);
|
|
27
50
|
const files = migrate.nest({
|
|
28
51
|
keyword: true,
|
|
@@ -43,6 +66,16 @@ class AutoBeInterfaceCompiler {
|
|
|
43
66
|
})))), { "packages/api/swagger.json": JSON.stringify(swagger, null, 2), "README.md": "# AutoBE Generated Backend Server\n\n\n\nA backend repository generated by [`@autobe`](https://github.com/wrtnlabs/autobe).\n\nThis backend program was automatically generated using [`@autobe`](https://github.com/wrtnlabs/autobe), the AI vibe coding agent for backend servers of below stack.\n\n- TypeScript\n- NestJS / Nestia\n- Prisma\n- Postgres\n\n## Project Structure\n\nThis template project has categorized directories like below.\n\nAt first, [`@autobe`](https://github.com/wrtnlabs/autobe) generated files are placed like below:\n\n- analysis agent: [docs/analysis](docs/analysis)\n- prisma agent\n - [prisma/schema](prisma/schema)\n - [docs/ERD.md](docs/ERD.md)\n- interface agent\n - [src/api/structures](src/api/structures): DTO structures\n - [src/api/controllers](src/controllers): API controller classes\n - [test/features](test/features): List of e2e test functions\n\nFrom a source code perspective, all backend files are organized within the `src` directory.\n\nWhen you build the TypeScript source files, compiled files will be placed in the `lib` directory according to the [tsconfig.json](tsconfig.json) configuration.\n\nOtherwise you build client [SDK](https://nestia.io/docs/sdk) library for npm publishing and their compiled files would be placed into the [packages/api](packages/api) directory.\n\n - [packages/api](packages/api): SDK module built by `npm run build:api`\n - [src](src): Backend source directory\n - [src/api](src/api): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\n - [src/api/functional](src/api/functional): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\n - [src/api/structures](src/api/structures): DTO structures\n - [src/controllers](src/controllers): Controller classes of the Main Program\n - [**test/**](test): Test Automation Program\n - [test/features](test/features): List of test functions\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\n - [package.json](package.json): NPM configuration\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\n\n## NPM Run Commands\n\nList of the run commands defined in the [package.json](package.json) are like below:\n\n - Test\n - **`test`**: Run test automation program\n - `benchmark`: Run performance benchmark program\n - Build\n - `build`: Build everything\n - `build:main`: Build main program (`src` directory)\n - `build:test` Build test automation program (`test` directory)\n - `build:sdk`: Build SDK into main program only\n - `build:swagger`: Build Swagger Documents\n - **`dev`**: Incremental build for development (test program)\n - Deploy\n - `package:api`: Build and deploy the SDK library to the NPM\n - `start`: Start the backend server\n - `start:dev`: Start the backend server with incremental build and reload\n - Webpack\n - `webpack`: Run webpack bundler\n - `webpack:start`: Start the backend server built by webpack\n - `webpack:test`: Run test program to the webpack built\n\n## Specialization\n\nTransform this template project to be yours.\n\nWhen you've created a new backend project through this template project, you can specialize it to be suitable for you by changing some words. Replace below words through IDE specific function like `Edit > Replace in Files` (*Ctrl + Shift + H*), who've been supported by the VSCode.\n\n| Before | After\n|--------------|----------------------------------------\n| ORGANIZATION | Your account or corporation name\n| PROJECT | Your own project name\n| AUTHOR | Author name\n| https://github.com/samchon/nestia-start | Your repository URL" /* AutoBeCompilerConstants.README */ });
|
|
44
67
|
});
|
|
45
68
|
}
|
|
69
|
+
transform(document) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return transformDocument(document);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
invert(document) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return invertDocument(document);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
46
79
|
}
|
|
47
80
|
exports.AutoBeInterfaceCompiler = AutoBeInterfaceCompiler;
|
|
48
81
|
function beautify(script) {
|
|
@@ -62,7 +95,7 @@ function beautify(script) {
|
|
|
62
95
|
}
|
|
63
96
|
});
|
|
64
97
|
}
|
|
65
|
-
function
|
|
98
|
+
function transformDocument(route) {
|
|
66
99
|
var _a;
|
|
67
100
|
var _b;
|
|
68
101
|
const paths = {};
|
|
@@ -113,4 +146,50 @@ function createOpenApiDocument(route) {
|
|
|
113
146
|
components: route.components,
|
|
114
147
|
});
|
|
115
148
|
}
|
|
149
|
+
function invertDocument(document) {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
const app = openapi_1.HttpMigration.application(document);
|
|
152
|
+
return {
|
|
153
|
+
operations: app.routes
|
|
154
|
+
.filter((r) => r.query === null)
|
|
155
|
+
.map((r) => {
|
|
156
|
+
var _a, _b, _c, _d, _e, _f;
|
|
157
|
+
return ({
|
|
158
|
+
specification: empty("specification"),
|
|
159
|
+
method: r.method,
|
|
160
|
+
path: r.path,
|
|
161
|
+
summary: (_a = r.operation().summary) !== null && _a !== void 0 ? _a : empty("summary"),
|
|
162
|
+
description: (_b = r.operation().description) !== null && _b !== void 0 ? _b : empty("description"),
|
|
163
|
+
parameters: r.parameters.map((p) => {
|
|
164
|
+
var _a;
|
|
165
|
+
return ({
|
|
166
|
+
name: p.name,
|
|
167
|
+
description: (_a = p.parameter().description) !== null && _a !== void 0 ? _a : empty("description"),
|
|
168
|
+
schema: p.schema,
|
|
169
|
+
});
|
|
170
|
+
}),
|
|
171
|
+
requestBody: ((_c = r.body) === null || _c === void 0 ? void 0 : _c.type) === "application/json" &&
|
|
172
|
+
openapi_1.OpenApiTypeChecker.isReference(r.body.schema)
|
|
173
|
+
? {
|
|
174
|
+
description: (_d = r.body.description()) !== null && _d !== void 0 ? _d : empty("description"),
|
|
175
|
+
typeName: r.body.schema.$ref.split("/").pop(),
|
|
176
|
+
}
|
|
177
|
+
: null,
|
|
178
|
+
responseBody: ((_e = r.success) === null || _e === void 0 ? void 0 : _e.type) === "application/json" &&
|
|
179
|
+
openapi_1.OpenApiTypeChecker.isReference(r.success.schema)
|
|
180
|
+
? {
|
|
181
|
+
description: (_f = r.success.description()) !== null && _f !== void 0 ? _f : empty("description"),
|
|
182
|
+
typeName: r.success.schema.$ref.split("/").pop(),
|
|
183
|
+
}
|
|
184
|
+
: null,
|
|
185
|
+
});
|
|
186
|
+
}),
|
|
187
|
+
components: {
|
|
188
|
+
schemas: ((_b = (_a = document.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {}),
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function empty(key) {
|
|
193
|
+
return `Describe ${key} as much as possible with clear and concise words.`;
|
|
194
|
+
}
|
|
116
195
|
//# sourceMappingURL=AutoBeInterfaceCompiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeInterfaceCompiler.js","sourceRoot":"","sources":["../src/AutoBeInterfaceCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"AutoBeInterfaceCompiler.js","sourceRoot":"","sources":["../src/AutoBeInterfaceCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,6CAA2D;AAC3D,8CAM0B;AAC1B,yGAA+D;AAC/D,sDAA8B;AAC9B,uCAAkC;AAGlC,iDAA8C;AAE9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,uBAAuB;IACrB,OAAO,CAClB,QAAiC;;YAEjC,MAAM,OAAO,GAAsB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAC/D,MAAM,OAAO,GAA6B,IAAI,kCAAwB,CACpE,OAAO,CACR,CAAC;YACF,MAAM,KAAK,GAA2B,OAAO,CAAC,IAAI,CAAC;gBACjD,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE;oBACN,GAAG,EAAE,QAAQ;oBACb,KAAK,EAAE,0DAA0D;iBAClE;aACF,CAAC,CAAC;YACH,uCACK,MAAM,CAAC,WAAW,CACnB,MAAM,qBAAS,CAAC,QAAQ,CACtB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACrB,KAAqB,EAAE,0CAAhB,CAAC,GAAG,EAAE,KAAK,CAAC;gBAAK,OAAA;oBACtB,GAAG;oBACH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,KAAK;wBACpD,CAAC,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC;wBACvB,CAAC,CAAC,KAAK;iBACV,CAAA;cAAA,CACF,CACF,KACD,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC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,CAAC,OAAO,CAAC,WAAW,EAAE,mCAAI,KAAK,CAAC,aAAa,CAAC;wBACjD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;qBAClD;oBACH,CAAC,CAAC,IAAI;aACX,CAAoC,CAAA;SAAA,CACxC;QACH,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,MAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,OAAO,mCAAI,EAAE,CAG3C;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,YAAY,GAAG,oDAAoD,CAAC;AAC7E,CAAC"}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import { AutoBePrisma, IAutoBePrismaCompiler, IAutoBePrismaCompilerProps, IAutoBePrismaCompilerResult, IAutoBePrismaValidation } from "@autobe/interface";
|
|
2
|
+
/**
|
|
3
|
+
* Custom Prisma compiler that handles database schema validation and
|
|
4
|
+
* generation.
|
|
5
|
+
*
|
|
6
|
+
* This compiler provides the foundational compilation layer that transforms
|
|
7
|
+
* business requirements into validated database architectures through
|
|
8
|
+
* sophisticated AST manipulation. The AutoBePrismaCompiler operates exclusively
|
|
9
|
+
* on {@link AutoBePrisma.IApplication} structures, eliminating error-prone
|
|
10
|
+
* text-based schema authoring while ensuring perfect consistency between
|
|
11
|
+
* business logic and data storage design.
|
|
12
|
+
*
|
|
13
|
+
* The implementation leverages EmbedPrisma for robust schema compilation,
|
|
14
|
+
* custom validation logic for comprehensive AST analysis, and specialized
|
|
15
|
+
* writing utilities for deterministic code generation. The compiler ensures
|
|
16
|
+
* 100% syntactic correctness and semantic integrity through multi-layered
|
|
17
|
+
* validation including relationship graph analysis, business logic validation,
|
|
18
|
+
* and performance optimization.
|
|
19
|
+
*
|
|
20
|
+
* The compilation process produces comprehensive documentation, optimal
|
|
21
|
+
* indexes, proper constraints, and ERD diagrams ready for production deployment
|
|
22
|
+
* while maintaining perfect alignment with business requirements throughout the
|
|
23
|
+
* automated development pipeline.
|
|
24
|
+
*
|
|
25
|
+
* @author Samchon
|
|
26
|
+
*/
|
|
2
27
|
export declare class AutoBePrismaCompiler implements IAutoBePrismaCompiler {
|
|
3
28
|
compile(props: IAutoBePrismaCompilerProps): Promise<IAutoBePrismaCompilerResult>;
|
|
4
|
-
validate(
|
|
5
|
-
write(
|
|
29
|
+
validate(application: AutoBePrisma.IApplication): Promise<IAutoBePrismaValidation>;
|
|
30
|
+
write(application: AutoBePrisma.IApplication, dbms?: "postgres" | "sqlite"): Promise<Record<string, string>>;
|
|
6
31
|
}
|
|
@@ -13,6 +13,31 @@ exports.AutoBePrismaCompiler = void 0;
|
|
|
13
13
|
const embed_prisma_1 = require("embed-prisma");
|
|
14
14
|
const validatePrismaApplication_1 = require("./prisma/validatePrismaApplication");
|
|
15
15
|
const writePrismaApplication_1 = require("./prisma/writePrismaApplication");
|
|
16
|
+
/**
|
|
17
|
+
* Custom Prisma compiler that handles database schema validation and
|
|
18
|
+
* generation.
|
|
19
|
+
*
|
|
20
|
+
* This compiler provides the foundational compilation layer that transforms
|
|
21
|
+
* business requirements into validated database architectures through
|
|
22
|
+
* sophisticated AST manipulation. The AutoBePrismaCompiler operates exclusively
|
|
23
|
+
* on {@link AutoBePrisma.IApplication} structures, eliminating error-prone
|
|
24
|
+
* text-based schema authoring while ensuring perfect consistency between
|
|
25
|
+
* business logic and data storage design.
|
|
26
|
+
*
|
|
27
|
+
* The implementation leverages EmbedPrisma for robust schema compilation,
|
|
28
|
+
* custom validation logic for comprehensive AST analysis, and specialized
|
|
29
|
+
* writing utilities for deterministic code generation. The compiler ensures
|
|
30
|
+
* 100% syntactic correctness and semantic integrity through multi-layered
|
|
31
|
+
* validation including relationship graph analysis, business logic validation,
|
|
32
|
+
* and performance optimization.
|
|
33
|
+
*
|
|
34
|
+
* The compilation process produces comprehensive documentation, optimal
|
|
35
|
+
* indexes, proper constraints, and ERD diagrams ready for production deployment
|
|
36
|
+
* while maintaining perfect alignment with business requirements throughout the
|
|
37
|
+
* automated development pipeline.
|
|
38
|
+
*
|
|
39
|
+
* @author Samchon
|
|
40
|
+
*/
|
|
16
41
|
class AutoBePrismaCompiler {
|
|
17
42
|
compile(props) {
|
|
18
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -20,14 +45,17 @@ class AutoBePrismaCompiler {
|
|
|
20
45
|
return compiler.compile(props.files);
|
|
21
46
|
});
|
|
22
47
|
}
|
|
23
|
-
validate(
|
|
48
|
+
validate(application) {
|
|
24
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return (0, validatePrismaApplication_1.validatePrismaApplication)(
|
|
50
|
+
return (0, validatePrismaApplication_1.validatePrismaApplication)(application);
|
|
26
51
|
});
|
|
27
52
|
}
|
|
28
|
-
write(
|
|
29
|
-
return __awaiter(this,
|
|
30
|
-
return (0, writePrismaApplication_1.writePrismaApplication)(
|
|
53
|
+
write(application_1) {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function* (application, dbms = "postgres") {
|
|
55
|
+
return (0, writePrismaApplication_1.writePrismaApplication)({
|
|
56
|
+
application,
|
|
57
|
+
dbms,
|
|
58
|
+
});
|
|
31
59
|
});
|
|
32
60
|
}
|
|
33
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBePrismaCompiler.js","sourceRoot":"","sources":["../src/AutoBePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,+CAA2C;AAE3C,kFAA+E;AAC/E,4EAAyE;AAEzE,MAAa,oBAAoB;IAClB,OAAO,CAClB,KAAiC;;YAEjC,MAAM,QAAQ,GAAgB,IAAI,0BAAW,EAAE,CAAC;YAChD,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;KAAA;IAEY,QAAQ,CACnB,
|
|
1
|
+
{"version":3,"file":"AutoBePrismaCompiler.js","sourceRoot":"","sources":["../src/AutoBePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,+CAA2C;AAE3C,kFAA+E;AAC/E,4EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,oBAAoB;IAClB,OAAO,CAClB,KAAiC;;YAEjC,MAAM,QAAQ,GAAgB,IAAI,0BAAW,EAAE,CAAC;YAChD,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;KAAA;IAEY,QAAQ,CACnB,WAAsC;;YAEtC,OAAO,IAAA,qDAAyB,EAAC,WAAW,CAAC,CAAC;QAChD,CAAC;KAAA;IAEY,KAAK;6DAChB,WAAsC,EACtC,OAA8B,UAAU;YAExC,OAAO,IAAA,+CAAsB,EAAC;gBAC5B,WAAW;gBACX,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAvBD,oDAuBC"}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
import { IAutoBeTypeScriptCompiler, IAutoBeTypeScriptCompilerProps, IAutoBeTypeScriptCompilerResult } from "@autobe/interface";
|
|
2
|
+
/**
|
|
3
|
+
* Official TypeScript compiler for final code validation and quality assurance.
|
|
4
|
+
*
|
|
5
|
+
* This compiler provides the ultimate validation layer that ensures all
|
|
6
|
+
* generated code meets production standards and integrates seamlessly with the
|
|
7
|
+
* TypeScript ecosystem. While the AST-based approach eliminates most potential
|
|
8
|
+
* errors before code generation, the AutoBeTypeScriptCompiler serves as the
|
|
9
|
+
* final quality gate for perfect integration verification throughout the vibe
|
|
10
|
+
* coding pipeline.
|
|
11
|
+
*
|
|
12
|
+
* The implementation validates framework integration with NestJS APIs, type
|
|
13
|
+
* system integrity for complex relationships, dependency resolution across
|
|
14
|
+
* modules, and build system compatibility with standard toolchains. It provides
|
|
15
|
+
* comprehensive IDE support including intelligent autocomplete, real-time error
|
|
16
|
+
* detection, sophisticated refactoring capabilities, and complete navigation
|
|
17
|
+
* features.
|
|
18
|
+
*
|
|
19
|
+
* The compiler enables critical feedback loops necessary for AI self-correction
|
|
20
|
+
* when implementation or test code contains compilation errors requiring
|
|
21
|
+
* iterative refinement. This ensures that generated applications are
|
|
22
|
+
* immediately deployable without manual debugging cycles while maintaining the
|
|
23
|
+
* reliability of the automated development process.
|
|
24
|
+
*
|
|
25
|
+
* @author Samchon
|
|
26
|
+
*/
|
|
2
27
|
export declare class AutoBeTypeScriptCompiler implements IAutoBeTypeScriptCompiler {
|
|
3
28
|
compile(props: IAutoBeTypeScriptCompilerProps): Promise<IAutoBeTypeScriptCompilerResult>;
|
|
4
29
|
}
|
|
@@ -18,6 +18,31 @@ const embed_typescript_1 = require("embed-typescript");
|
|
|
18
18
|
const typescript_1 = __importDefault(require("typescript"));
|
|
19
19
|
const transform_2 = __importDefault(require("typia/lib/transform"));
|
|
20
20
|
const external_json_1 = __importDefault(require("./raw/external.json"));
|
|
21
|
+
/**
|
|
22
|
+
* Official TypeScript compiler for final code validation and quality assurance.
|
|
23
|
+
*
|
|
24
|
+
* This compiler provides the ultimate validation layer that ensures all
|
|
25
|
+
* generated code meets production standards and integrates seamlessly with the
|
|
26
|
+
* TypeScript ecosystem. While the AST-based approach eliminates most potential
|
|
27
|
+
* errors before code generation, the AutoBeTypeScriptCompiler serves as the
|
|
28
|
+
* final quality gate for perfect integration verification throughout the vibe
|
|
29
|
+
* coding pipeline.
|
|
30
|
+
*
|
|
31
|
+
* The implementation validates framework integration with NestJS APIs, type
|
|
32
|
+
* system integrity for complex relationships, dependency resolution across
|
|
33
|
+
* modules, and build system compatibility with standard toolchains. It provides
|
|
34
|
+
* comprehensive IDE support including intelligent autocomplete, real-time error
|
|
35
|
+
* detection, sophisticated refactoring capabilities, and complete navigation
|
|
36
|
+
* features.
|
|
37
|
+
*
|
|
38
|
+
* The compiler enables critical feedback loops necessary for AI self-correction
|
|
39
|
+
* when implementation or test code contains compilation errors requiring
|
|
40
|
+
* iterative refinement. This ensures that generated applications are
|
|
41
|
+
* immediately deployable without manual debugging cycles while maintaining the
|
|
42
|
+
* reliability of the automated development process.
|
|
43
|
+
*
|
|
44
|
+
* @author Samchon
|
|
45
|
+
*/
|
|
21
46
|
class AutoBeTypeScriptCompiler {
|
|
22
47
|
compile(props) {
|
|
23
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -29,9 +54,9 @@ class AutoBeTypeScriptCompiler {
|
|
|
29
54
|
target: typescript_1.default.ScriptTarget.ESNext,
|
|
30
55
|
module: typescript_1.default.ModuleKind.CommonJS,
|
|
31
56
|
downlevelIteration: true,
|
|
57
|
+
baseUrl: "./",
|
|
32
58
|
paths: {
|
|
33
59
|
[alias]: ["./src/api"],
|
|
34
|
-
[`${alias}/lib/`]: ["./src/api"],
|
|
35
60
|
[`${alias}/lib/*`]: ["./src/api/*"],
|
|
36
61
|
},
|
|
37
62
|
strict: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoBeTypeScriptCompiler.js","sourceRoot":"","sources":["../src/AutoBeTypeScriptCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,2EAA6D;AAC7D,uDAAmD;AACnD,4DAA4B;AAC5B,oEAAiD;AAEjD,wEAA2C;AAE3C,MAAa,wBAAwB;IACtB,OAAO,CAClB,KAAqC;;;YAErC,MAAM,KAAK,GAAW,MAAA,KAAK,CAAC,OAAO,mCAAI,2BAA2B,CAAC;YACnE,MAAM,QAAQ,GAAoB,IAAI,kCAAe,CAAC;gBACpD,QAAQ,EAAE,uBAAkC;gBAC5C,eAAe,EAAE;oBACf,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;oBAC9B,MAAM,EAAE,oBAAE,CAAC,UAAU,CAAC,QAAQ;oBAC9B,kBAAkB,EAAE,IAAI;oBACxB,
|
|
1
|
+
{"version":3,"file":"AutoBeTypeScriptCompiler.js","sourceRoot":"","sources":["../src/AutoBeTypeScriptCompiler.ts"],"names":[],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AAK,CAAC,KAAK,GACX,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAC,EACvB,CAAC;QACL,CAAC;KAAA;CACF;AA9CD,4DA8CC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
-
export declare function writePrismaApplication(
|
|
2
|
+
export declare function writePrismaApplication(props: {
|
|
3
|
+
dbms: "postgres" | "sqlite";
|
|
4
|
+
application: AutoBePrisma.IApplication;
|
|
5
|
+
}): Record<string, string>;
|