@autobe/compiler 0.10.5 → 0.11.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.
Files changed (64) hide show
  1. package/lib/AutoBeCompiler.d.ts +4 -1
  2. package/lib/AutoBeCompiler.js +7 -4
  3. package/lib/AutoBeCompiler.js.map +1 -1
  4. package/lib/AutoBeTypeScriptCompiler.js +6 -1
  5. package/lib/AutoBeTypeScriptCompiler.js.map +1 -1
  6. package/lib/index.d.ts +3 -3
  7. package/lib/index.js +3 -3
  8. package/lib/index.js.map +1 -1
  9. package/lib/{AutoBeInterfaceCompiler.d.ts → interface/AutoBeInterfaceCompiler.d.ts} +2 -1
  10. package/lib/{AutoBeInterfaceCompiler.js → interface/AutoBeInterfaceCompiler.js} +11 -6
  11. package/lib/interface/AutoBeInterfaceCompiler.js.map +1 -0
  12. package/lib/prisma/AutoBePrismaCompiler.d.ts +6 -0
  13. package/lib/{AutoBePrismaCompiler.js → prisma/AutoBePrismaCompiler.js} +2 -27
  14. package/lib/prisma/AutoBePrismaCompiler.js.map +1 -0
  15. package/lib/prisma/writePrismaApplication.js +7 -4
  16. package/lib/prisma/writePrismaApplication.js.map +1 -1
  17. package/lib/raw/AutoBeCompilerInterfaceTemplate.d.ts +1 -0
  18. package/lib/raw/AutoBeCompilerInterfaceTemplate.js +8 -0
  19. package/lib/raw/AutoBeCompilerInterfaceTemplate.js.map +1 -0
  20. package/lib/raw/AutoBeCompilerRealizeTemplate.d.ts +1 -0
  21. package/lib/raw/AutoBeCompilerRealizeTemplate.js +17 -0
  22. package/lib/raw/AutoBeCompilerRealizeTemplate.js.map +1 -0
  23. package/lib/raw/AutoBeCompilerTestTemplate.d.ts +1 -0
  24. package/lib/raw/AutoBeCompilerTestTemplate.js +12 -0
  25. package/lib/raw/AutoBeCompilerTestTemplate.js.map +1 -0
  26. package/lib/raw/nestjs.json +10 -8
  27. package/lib/raw/test.json +2 -2
  28. package/lib/realize/AutoBeRealizeCompiler.d.ts +7 -0
  29. package/lib/realize/AutoBeRealizeCompiler.js +31 -0
  30. package/lib/realize/AutoBeRealizeCompiler.js.map +1 -0
  31. package/lib/realize/testRealizeProject.d.ts +2 -0
  32. package/lib/realize/testRealizeProject.js +80 -0
  33. package/lib/realize/testRealizeProject.js.map +1 -0
  34. package/lib/{AutoBeTestCompiler.d.ts → test/AutoBeTestCompiler.d.ts} +1 -0
  35. package/lib/{AutoBeTestCompiler.js → test/AutoBeTestCompiler.js} +16 -4
  36. package/lib/test/AutoBeTestCompiler.js.map +1 -0
  37. package/lib/utils/ProcessUtil.d.ts +4 -0
  38. package/lib/utils/ProcessUtil.js +30 -0
  39. package/lib/utils/ProcessUtil.js.map +1 -0
  40. package/package.json +8 -6
  41. package/src/AutoBeCompiler.ts +12 -3
  42. package/src/AutoBeTypeScriptCompiler.ts +7 -2
  43. package/src/index.ts +3 -3
  44. package/src/{AutoBeInterfaceCompiler.ts → interface/AutoBeInterfaceCompiler.ts} +10 -8
  45. package/src/prisma/AutoBePrismaCompiler.ts +36 -0
  46. package/src/prisma/writePrismaApplication.ts +10 -6
  47. package/src/raw/AutoBeCompilerInterfaceTemplate.ts +4 -0
  48. package/src/raw/AutoBeCompilerRealizeTemplate.ts +13 -0
  49. package/src/raw/AutoBeCompilerTestTemplate.ts +8 -0
  50. package/src/raw/nestjs.json +10 -8
  51. package/src/raw/test.json +2 -2
  52. package/src/realize/AutoBeRealizeCompiler.ts +40 -0
  53. package/src/realize/testRealizeProject.ts +78 -0
  54. package/src/{AutoBeTestCompiler.ts → test/AutoBeTestCompiler.ts} +19 -5
  55. package/src/utils/ProcessUtil.ts +14 -0
  56. package/lib/AutoBeInterfaceCompiler.js.map +0 -1
  57. package/lib/AutoBePrismaCompiler.d.ts +0 -31
  58. package/lib/AutoBePrismaCompiler.js.map +0 -1
  59. package/lib/AutoBeTestCompiler.js.map +0 -1
  60. package/lib/raw/AutoBeCompilerTemplate.d.ts +0 -1
  61. package/lib/raw/AutoBeCompilerTemplate.js +0 -10
  62. package/lib/raw/AutoBeCompilerTemplate.js.map +0 -1
  63. package/src/AutoBePrismaCompiler.ts +0 -61
  64. package/src/raw/AutoBeCompilerTemplate.ts +0 -6
@@ -0,0 +1,78 @@
1
+ import { FileSystemIterator } from "@autobe/filesystem";
2
+ import {
3
+ IAutoBeRealizeTestListener,
4
+ IAutoBeRealizeTestProps,
5
+ IAutoBeRealizeTestResult,
6
+ IAutoBeRealizeTestService,
7
+ } from "@autobe/interface";
8
+ import crypto from "crypto";
9
+ import fs from "fs";
10
+ import os from "os";
11
+ import { Driver, WorkerConnector } from "tgrid";
12
+
13
+ import { ProcessUtil } from "../utils/ProcessUtil";
14
+
15
+ export async function testRealizeProject(
16
+ props: IAutoBeRealizeTestProps,
17
+ listener: IAutoBeRealizeTestListener,
18
+ ): Promise<IAutoBeRealizeTestResult> {
19
+ const cwd: string = `${os.tmpdir()}/autobe-realize-${crypto.randomUUID()}`;
20
+ await fs.promises.mkdtemp(cwd);
21
+ try {
22
+ await setup(props.files, cwd);
23
+ return await test(props, listener, cwd);
24
+ } catch (error) {
25
+ throw error;
26
+ } finally {
27
+ await fs.promises.rm(cwd, {
28
+ recursive: true,
29
+ force: true,
30
+ });
31
+ }
32
+ }
33
+
34
+ async function setup(
35
+ files: Record<string, string>,
36
+ cwd: string,
37
+ ): Promise<void> {
38
+ await FileSystemIterator.save({
39
+ root: cwd,
40
+ files,
41
+ });
42
+
43
+ const exec = async (s: string) =>
44
+ ProcessUtil.exec(s, {
45
+ cwd,
46
+ });
47
+ await exec("pnpm install");
48
+ await exec("pnpm run build:prisma");
49
+ await exec("pnpm run build:test");
50
+ }
51
+
52
+ async function test(
53
+ props: IAutoBeRealizeTestProps,
54
+ listener: IAutoBeRealizeTestListener,
55
+ cwd: string,
56
+ ): Promise<IAutoBeRealizeTestResult> {
57
+ const worker: WorkerConnector<
58
+ null,
59
+ IAutoBeRealizeTestListener,
60
+ IAutoBeRealizeTestService
61
+ > = new WorkerConnector(null, listener, "thread");
62
+ await worker.connect(`${cwd}/bin/test/servant.js`, {
63
+ stdio: "ignore",
64
+ cwd,
65
+ });
66
+ const service: Driver<IAutoBeRealizeTestService> = worker.getDriver();
67
+ try {
68
+ const result: IAutoBeRealizeTestResult = await service.execute({
69
+ reset: props.reset,
70
+ simultaneous: props.simultaneous,
71
+ });
72
+ return result;
73
+ } catch (error) {
74
+ throw error;
75
+ } finally {
76
+ await worker.close();
77
+ }
78
+ }
@@ -7,15 +7,17 @@ import {
7
7
  IAutoBeTypeScriptCompileResult,
8
8
  } from "@autobe/interface";
9
9
  import { AutoBeEndpointComparator, validateTestFunction } from "@autobe/utils";
10
- import { EmbedTypeScript } from "embed-typescript";
10
+ import { EmbedTypeScript, IEmbedTypeScriptResult } from "embed-typescript";
11
11
  import { HashMap, Pair } from "tstl";
12
12
  import ts from "typescript";
13
13
  import { IValidation } from "typia";
14
14
  import typiaTransform from "typia/lib/transform";
15
15
 
16
- import TestExternal from "./raw/test.json";
17
- import { writeTestFunction } from "./test/programmers/writeTestFunction";
18
- import { FilePrinter } from "./utils/FilePrinter";
16
+ import { AutoBeCompilerInterfaceTemplate } from "../raw/AutoBeCompilerInterfaceTemplate";
17
+ import { AutoBeCompilerTestTemplate } from "../raw/AutoBeCompilerTestTemplate";
18
+ import TestExternal from "../raw/test.json";
19
+ import { FilePrinter } from "../utils/FilePrinter";
20
+ import { writeTestFunction } from "./programmers/writeTestFunction";
19
21
 
20
22
  export class AutoBeTestCompiler implements IAutoBeTestCompiler {
21
23
  public async compile(
@@ -51,7 +53,12 @@ export class AutoBeTestCompiler implements IAutoBeTestCompiler {
51
53
  ],
52
54
  }),
53
55
  });
54
- return compiler.compile(props.files);
56
+ const result: IEmbedTypeScriptResult = await compiler.compile(props.files);
57
+ return result.type === "success"
58
+ ? { type: "success" }
59
+ : result.type === "failure"
60
+ ? { type: "failure", diagnostics: result.diagnostics }
61
+ : { type: "exception", error: result.error };
55
62
  }
56
63
 
57
64
  public async validate(
@@ -92,4 +99,11 @@ export class AutoBeTestCompiler implements IAutoBeTestCompiler {
92
99
  public async getExternal(): Promise<Record<string, string>> {
93
100
  return TestExternal as Record<string, string>;
94
101
  }
102
+
103
+ public async getTemplate(): Promise<Record<string, string>> {
104
+ return {
105
+ ...AutoBeCompilerInterfaceTemplate,
106
+ ...AutoBeCompilerTestTemplate,
107
+ };
108
+ }
95
109
  }
@@ -0,0 +1,14 @@
1
+ import cp from "child_process";
2
+ import { promisify } from "util";
3
+
4
+ export namespace ProcessUtil {
5
+ export async function exec(
6
+ command: string,
7
+ options?: cp.ExecOptions,
8
+ ): Promise<string | Buffer> {
9
+ const result = await promisify(cp.exec)(command, options);
10
+ return typeof result.stdout === "string"
11
+ ? result.stdout
12
+ : Buffer.from(result.stdout);
13
+ }
14
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoBeInterfaceCompiler.js","sourceRoot":"","sources":["../src/AutoBeInterfaceCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yCAAsD;AACtD,6CAA2D;AAG3D,mEAAwE;AACxE,yEAAsE;AACtE,iDAA8C;AAC9C,qDAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,uBAAuB;IACrB,OAAO,CAClB,QAAiC;;YAEjC,MAAM,OAAO,GAAsB,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;YACtE,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,OAAO,MAAM,CAAC,WAAW,CAAC;gBACxB,GAAG,CAAC,MAAM,qBAAS,CAAC,QAAQ,CAC1B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACrB,KAAqB,EAAE,0CAAhB,CAAC,GAAG,EAAE,KAAK,CAAC;oBAAK,OAAA;wBACtB,GAAG;wBACH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,KAAK;4BACpD,CAAC,CAAC,MAAM,yBAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;4BACnC,CAAC,CAAC,KAAK;qBACV,CAAA;kBAAA,CACF,CAAC;gBACF,CAAC,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC/D,GAAG,MAAM,CAAC,OAAO,CAAC,+CAAsB,CAAC,CAAC,MAAM,CAC9C,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,iBAAiB,CACrC;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,SAAS,CACpB,QAAiC;;YAEjC,OAAO,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;KAAA;IAEY,MAAM,CACjB,QAA2B;;YAE3B,OAAO,IAAA,6BAAqB,EAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;KAAA;CACF;AA7CD,0DA6CC"}
@@ -1,31 +0,0 @@
1
- import { AutoBePrisma, IAutoBePrismaCompileResult, IAutoBePrismaCompiler, IAutoBePrismaCompilerProps, 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
- */
27
- export declare class AutoBePrismaCompiler implements IAutoBePrismaCompiler {
28
- compile(props: IAutoBePrismaCompilerProps): Promise<IAutoBePrismaCompileResult>;
29
- validate(application: AutoBePrisma.IApplication): Promise<IAutoBePrismaValidation>;
30
- write(application: AutoBePrisma.IApplication, dbms?: "postgres" | "sqlite"): Promise<Record<string, string>>;
31
- }
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"AutoBeTestCompiler.js","sourceRoot":"","sources":["../src/AutoBeTestCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,yCAA+E;AAC/E,uDAAmD;AACnD,+BAAqC;AACrC,4DAA4B;AAE5B,oEAAiD;AAEjD,gEAA2C;AAC3C,4EAAyE;AACzE,qDAAkD;AAElD,MAAa,kBAAkB;IAChB,OAAO,CAClB,KAAoC;;;YAEpC,MAAM,KAAK,GAAW,MAAA,KAAK,CAAC,OAAO,mCAAI,2BAA2B,CAAC;YACnE,MAAM,QAAQ,GAAoB,IAAI,kCAAe,CAAC;gBACpD,QAAQ,EAAE,mBAAsC;gBAChD,eAAe,EAAE;oBACf,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;oBAC9B,MAAM,EAAE,oBAAE,CAAC,UAAU,CAAC,QAAQ;oBAC9B,kBAAkB,EAAE,IAAI;oBACxB,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE;wBACL,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC;wBACtB,CAAC,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC,aAAa,CAAC;qBACpC;oBACD,MAAM,EAAE,IAAI;oBACZ,YAAY,EAAE,IAAI;oBAClB,eAAe,EAAE,IAAI;oBACrB,sBAAsB,EAAE,IAAI;oBAC5B,qBAAqB,EAAE,IAAI;iBAC5B;gBACD,YAAY,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;oBACvC,MAAM,EAAE;wBACN,IAAA,mBAAc,EACZ,OAAO,EACP,EAAE,EACF;4BACE,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;yBAClD,CACF;qBACF;iBACF,CAAC;aACH,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;KAAA;IAEY,QAAQ,CACnB,KAA+B;;YAE/B,MAAM,MAAM,GAAyB,EAAE,CAAC;YACxC,MAAM,SAAS,GAGX,IAAI,cAAO,CACb,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAC3B,CAAC,EAAE,EAAE,EAAE,CACL,IAAI,WAAI,CACN;gBACE,MAAM,EAAE,EAAE,CAAC,MAAM;gBACjB,IAAI,EAAE,EAAE,CAAC,IAAI;aACd,EACD,EAAE,CACH,CACJ,EACD,gCAAwB,CAAC,QAAQ,EACjC,gCAAwB,CAAC,MAAM,CAChC,CAAC;YACF,IAAA,4BAAoB,EAAC;gBACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,SAAS,EAAE,SAAS;gBACpB,MAAM;aACP,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7C,CAAC;KAAA;IAEY,KAAK,CAAC,KAA4B;;YAC7C,MAAM,OAAO,GAAW,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;YACjD,OAAO,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5E,CAAC;KAAA;IAEY,WAAW;;YACtB,OAAO,mBAAsC,CAAC;QAChD,CAAC;KAAA;CACF;AA3ED,gDA2EC"}
@@ -1 +0,0 @@
1
- export declare const AutoBeCompilerTemplate: Record<string, string>;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AutoBeCompilerTemplate = void 0;
4
- exports.AutoBeCompilerTemplate = {
5
- "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: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:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:swagger\": \"npx 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 && ts-node build/env.ts\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@nestia/benchmark\": \"^7.1.0\",\n \"@nestia/e2e\": \"^7.1.0\",\n \"@nestia/sdk\": \"^7.1.0\",\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/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/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 \"nestia\": \"^7.1.0\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\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.0\",\n \"@nestia/fetcher\": \"^7.1.0\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\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",
6
- "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}\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n",
7
- "src/providers/jwtDecode.ts": "export function jwtDecode(token: string): { id: string; type: string } {\n try {\n const base64Url = token.split(\".\")[1];\n if (!base64Url) throw new Error(\"Invalid token format\");\n\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => `%${c.charCodeAt(0).toString(16).padStart(2, \"0\")}`)\n .join(\"\"),\n );\n\n const decoded = JSON.parse(jsonPayload) as unknown;\n\n if (\n typeof decoded === \"object\" &&\n decoded !== null &&\n typeof (decoded as any).id === \"string\" &&\n typeof (decoded as any).type === \"string\"\n ) {\n return {\n id: (decoded as { id: string }).id,\n type: (decoded as { type: string }).type,\n };\n }\n\n throw new Error(\"Invalid token payload\");\n } catch {\n throw new Error(\"Failed to decode JWT token\");\n }\n}\n",
8
- "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n },\n \"include\": [\".\", \"../src\"]\n}"
9
- };
10
- //# sourceMappingURL=AutoBeCompilerTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoBeCompilerTemplate.js","sourceRoot":"","sources":["../../src/raw/AutoBeCompilerTemplate.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAA2B;IAC5D,cAAc,EAAE,opIAAopI;IACpqI,iBAAiB,EAAE,ktBAAktB;IACruB,4BAA4B,EAAE,w8BAAw8B;IACt+B,oBAAoB,EAAE,6KAA6K;CACpM,CAAC"}
@@ -1,61 +0,0 @@
1
- import {
2
- AutoBePrisma,
3
- IAutoBePrismaCompileResult,
4
- IAutoBePrismaCompiler,
5
- IAutoBePrismaCompilerProps,
6
- IAutoBePrismaValidation,
7
- } from "@autobe/interface";
8
- import { EmbedPrisma } from "embed-prisma";
9
-
10
- import { validatePrismaApplication } from "./prisma/validatePrismaApplication";
11
- import { writePrismaApplication } from "./prisma/writePrismaApplication";
12
-
13
- /**
14
- * Custom Prisma compiler that handles database schema validation and
15
- * generation.
16
- *
17
- * This compiler provides the foundational compilation layer that transforms
18
- * business requirements into validated database architectures through
19
- * sophisticated AST manipulation. The AutoBePrismaCompiler operates exclusively
20
- * on {@link AutoBePrisma.IApplication} structures, eliminating error-prone
21
- * text-based schema authoring while ensuring perfect consistency between
22
- * business logic and data storage design.
23
- *
24
- * The implementation leverages EmbedPrisma for robust schema compilation,
25
- * custom validation logic for comprehensive AST analysis, and specialized
26
- * writing utilities for deterministic code generation. The compiler ensures
27
- * 100% syntactic correctness and semantic integrity through multi-layered
28
- * validation including relationship graph analysis, business logic validation,
29
- * and performance optimization.
30
- *
31
- * The compilation process produces comprehensive documentation, optimal
32
- * indexes, proper constraints, and ERD diagrams ready for production deployment
33
- * while maintaining perfect alignment with business requirements throughout the
34
- * automated development pipeline.
35
- *
36
- * @author Samchon
37
- */
38
- export class AutoBePrismaCompiler implements IAutoBePrismaCompiler {
39
- public async compile(
40
- props: IAutoBePrismaCompilerProps,
41
- ): Promise<IAutoBePrismaCompileResult> {
42
- const compiler: EmbedPrisma = new EmbedPrisma();
43
- return compiler.compile(props.files);
44
- }
45
-
46
- public async validate(
47
- application: AutoBePrisma.IApplication,
48
- ): Promise<IAutoBePrismaValidation> {
49
- return validatePrismaApplication(application);
50
- }
51
-
52
- public async write(
53
- application: AutoBePrisma.IApplication,
54
- dbms: "postgres" | "sqlite" = "postgres",
55
- ): Promise<Record<string, string>> {
56
- return writePrismaApplication({
57
- application,
58
- dbms,
59
- });
60
- }
61
- }
@@ -1,6 +0,0 @@
1
- export const AutoBeCompilerTemplate: Record<string, string> = {
2
- "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: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:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:swagger\": \"npx 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 && ts-node build/env.ts\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@nestia/benchmark\": \"^7.1.0\",\n \"@nestia/e2e\": \"^7.1.0\",\n \"@nestia/sdk\": \"^7.1.0\",\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/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/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 \"nestia\": \"^7.1.0\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\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.0\",\n \"@nestia/fetcher\": \"^7.1.0\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\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",
3
- "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}\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n",
4
- "src/providers/jwtDecode.ts": "export function jwtDecode(token: string): { id: string; type: string } {\n try {\n const base64Url = token.split(\".\")[1];\n if (!base64Url) throw new Error(\"Invalid token format\");\n\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => `%${c.charCodeAt(0).toString(16).padStart(2, \"0\")}`)\n .join(\"\"),\n );\n\n const decoded = JSON.parse(jsonPayload) as unknown;\n\n if (\n typeof decoded === \"object\" &&\n decoded !== null &&\n typeof (decoded as any).id === \"string\" &&\n typeof (decoded as any).type === \"string\"\n ) {\n return {\n id: (decoded as { id: string }).id,\n type: (decoded as { type: string }).type,\n };\n }\n\n throw new Error(\"Invalid token payload\");\n } catch {\n throw new Error(\"Failed to decode JWT token\");\n }\n}\n",
5
- "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n },\n \"include\": [\".\", \"../src\"]\n}"
6
- };