@autobe/compiler 0.17.1 → 0.18.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.
@@ -33,7 +33,7 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
33
33
  if (func === undefined || operate === undefined)
34
34
  return method; // unreachable
35
35
  const auth = operate.authorizationRole
36
- ? props.authorizations.find((d) => d.role === operate.authorizationRole)
36
+ ? props.authorizations.find((d) => d.role.name === operate.authorizationRole)
37
37
  : undefined;
38
38
  if (operate.authorizationRole && auth === undefined)
39
39
  return method; // unreachable
@@ -67,7 +67,7 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
67
67
  .split(".ts")[0],
68
68
  name: auth.decorator.name,
69
69
  })), undefined, [])),
70
- ], undefined, auth.role, undefined, typescript_1.default.factory.createTypeReferenceNode(ctx.importer.external({
70
+ ], undefined, auth.role.name, undefined, typescript_1.default.factory.createTypeReferenceNode(ctx.importer.external({
71
71
  type: "instance",
72
72
  library: path_1.default
73
73
  .relative(ctx.controller.location, auth.payload.location)
@@ -1 +1 @@
1
- {"version":3,"file":"writeRealizeControllers.js","sourceRoot":"","sources":["../../src/realize/writeRealizeControllers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,yHAAsH;AACtH,gDAAwB;AACxB,4DAA4B;AAE5B,oFAAiF;AACjF,kDAA+C;AAC/C,sDAAmD;AAE5C,MAAM,uBAAuB,GAAG,CACrC,KAAoC,EACH,EAAE;IACnC,MAAM,GAAG,GAA6B,IAAA,mDAAwB,EAC5D,KAAK,CAAC,QAAQ,CACf,CAAC;IACF,MAAM,MAAM,GAA2B,GAAG,CAAC,IAAI,CAAC;QAC9C,QAAQ,EAAE,KAAK;QACf,GAAG,EAAE,KAAK;QACV,UAAU,EAAE;YACV,gBAAgB,EAAE,CAAC,GAAG,EAAE,EAAE;gBACxB,MAAM,MAAM,GAAG,qEAAiC,CAAC,KAAK,CAAC,GAA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ACnC,EACD,KAAqB,EAAE,4CAAhB,CAAC,GAAG,EAAE,KAAK,CAAC,IAAK,OAAA,CAAC,GAAG,EAAE,MAAM,yBAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA,GAAA,CACjE,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AA9HW,QAAA,uBAAuB,2BA8HlC"}
@@ -13,9 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.FilePrinter = void 0;
16
- const prettier_plugin_sort_imports_1 = __importDefault(require("@trivago/prettier-plugin-sort-imports"));
17
- const import2_1 = __importDefault(require("import2"));
18
- const prettier_1 = require("prettier");
16
+ const eslint_1 = require("eslint");
17
+ const eslint_plugin_perfectionist_1 = __importDefault(require("eslint-plugin-perfectionist"));
19
18
  const typescript_1 = __importDefault(require("typescript"));
20
19
  var FilePrinter;
21
20
  (function (FilePrinter) {
@@ -36,17 +35,18 @@ var FilePrinter;
36
35
  return ((_a = props.top) !== null && _a !== void 0 ? _a : "") + script;
37
36
  };
38
37
  FilePrinter.beautify = (script) => __awaiter(this, void 0, void 0, function* () {
38
+ var _a;
39
39
  try {
40
- return yield (0, prettier_1.format)(script, {
41
- parser: "typescript",
42
- plugins: [prettier_plugin_sort_imports_1.default, yield (0, import2_1.default)("prettier-plugin-jsdoc")],
43
- importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
44
- importOrderSeparation: true,
45
- importOrderSortSpecifiers: true,
46
- importOrderParserPlugins: ["decorators-legacy", "typescript", "jsx"],
40
+ const lint = new eslint_1.ESLint({
41
+ fix: true,
42
+ plugins: {
43
+ ImportOrderPlugin: eslint_plugin_perfectionist_1.default,
44
+ },
47
45
  });
46
+ const results = yield lint.lintText(script).then((v) => v.at(0));
47
+ return (_a = results === null || results === void 0 ? void 0 : results.output) !== null && _a !== void 0 ? _a : script;
48
48
  }
49
- catch (_a) {
49
+ catch (_b) {
50
50
  return script;
51
51
  }
52
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"FilePrinter.js","sourceRoot":"","sources":["../../src/utils/FilePrinter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yGAA+D;AAC/D,sDAA8B;AAC9B,uCAAkC;AAClC,4DAA4B;AAE5B,IAAiB,WAAW,CAkD3B;AAlDD,WAAiB,WAAW;IACb,uBAAW,GAAG,CACzB,IAAU,EACV,OAAe,EACT,EAAE;QACR,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,oBAAE,CAAC,0BAA0B,CAC3B,IAAI,EACJ,oBAAE,CAAC,UAAU,CAAC,sBAAsB,EACpC,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EACtE,IAAI,CACL,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEW,mBAAO,GAAG,GAAG,EAAE,CAC1B,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7D,iBAAK,GAAG,CAAC,KAGrB,EAAU,EAAE;;QACX,MAAM,MAAM,GAAW,oBAAE;aACtB,aAAa,CAAC;YACb,OAAO,EAAE,oBAAE,CAAC,WAAW,CAAC,QAAQ;SACjC,CAAC;aACD,SAAS,CACR,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CACzB,KAAK,CAAC,UAAU,EAChB,oBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EACpD,oBAAE,CAAC,SAAS,CAAC,IAAI,CAClB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,2BAAX,WAAW,QAkD3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/compiler",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -13,22 +13,21 @@
13
13
  "url": "https://github.com/wrtnlabs/autobe/issues"
14
14
  },
15
15
  "dependencies": {
16
- "@nestia/core": "^7.3.2",
17
- "@nestia/migrate": "^7.3.2",
18
- "@samchon/openapi": "^4.6.0",
19
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
16
+ "@nestia/core": "^7.3.3",
17
+ "@nestia/migrate": "^7.3.3",
18
+ "@samchon/openapi": "^4.7.1",
20
19
  "embed-prisma": "^1.1.0",
21
20
  "embed-typescript": "^1.0.1",
21
+ "eslint": "^9.32.0",
22
+ "eslint-plugin-perfectionist": "^4.15.0",
22
23
  "import2": "^1.0.3",
23
- "prettier": "^3.5.3",
24
- "prettier-plugin-jsdoc": "^1.3.2",
25
24
  "prisma-markdown": "^3.0.0",
26
- "tstl": "^3.0.0",
27
25
  "tgrid": "^1.2.0",
28
- "typia": "^9.6.1",
29
- "@autobe/filesystem": "^0.17.1",
30
- "@autobe/interface": "^0.17.1",
31
- "@autobe/utils": "^0.17.1"
26
+ "tstl": "^3.0.0",
27
+ "typia": "^9.7.1",
28
+ "@autobe/filesystem": "^0.18.0",
29
+ "@autobe/interface": "^0.18.0",
30
+ "@autobe/utils": "^0.18.0"
32
31
  },
33
32
  "devDependencies": {
34
33
  "@types/node": "^22.15.3",
@@ -37,19 +37,17 @@ import { AutoBeTestCompiler } from "./test/AutoBeTestCompiler";
37
37
  * @author Samchon
38
38
  */
39
39
  export class AutoBeCompiler implements IAutoBeCompiler {
40
- public constructor(private readonly listener: IAutoBeCompilerListener) {}
40
+ public prisma: IAutoBePrismaCompiler;
41
+ public interface: IAutoBeInterfaceCompiler;
42
+ public typescript: IAutoBeTypeScriptCompiler;
43
+ public test: IAutoBeTestCompiler;
44
+ public realize: IAutoBeRealizeCompiler;
41
45
 
42
- public readonly prisma: IAutoBePrismaCompiler = new AutoBePrismaCompiler();
43
-
44
- public readonly interface: IAutoBeInterfaceCompiler =
45
- new AutoBeInterfaceCompiler();
46
-
47
- public readonly typescript: IAutoBeTypeScriptCompiler =
48
- new AutoBeTypeScriptCompiler();
49
-
50
- public readonly test: IAutoBeTestCompiler = new AutoBeTestCompiler();
51
-
52
- public readonly realize: IAutoBeRealizeCompiler = new AutoBeRealizeCompiler(
53
- this.listener.realize,
54
- );
46
+ public constructor(private readonly listener: IAutoBeCompilerListener) {
47
+ this.prisma = new AutoBePrismaCompiler();
48
+ this.interface = new AutoBeInterfaceCompiler();
49
+ this.typescript = new AutoBeTypeScriptCompiler();
50
+ this.test = new AutoBeTestCompiler();
51
+ this.realize = new AutoBeRealizeCompiler(this.listener.realize);
52
+ }
55
53
  }
@@ -57,9 +57,10 @@ function writeModel(props: {
57
57
  ...(props.model.material ? [] : [`@namespace ${props.file.namespace}`]),
58
58
  "@author AutoBE - https://github.com/wrtnlabs/autobe",
59
59
  ].join("\n"),
60
+ 80,
60
61
  ),
61
62
  `model ${props.model.name} {`,
62
- indent(
63
+ addIndent(
63
64
  ArrayUtil.paddle([writeColumns(props), writeRelations(props)]).join("\n"),
64
65
  ),
65
66
  "}",
@@ -122,7 +123,7 @@ function writePrimary(props: {
122
123
  const type: string | undefined =
123
124
  props.dbms === "postgres" ? POSTGRES_PHYSICAL_TYPES.uuid : undefined;
124
125
  return [
125
- writeComment(props.field.description),
126
+ writeComment(props.field.description, 78),
126
127
  `${props.field.name} String @id${type ? ` ${type}` : ""}`,
127
128
  ].join("\n");
128
129
  }
@@ -139,7 +140,7 @@ function writeField(props: {
139
140
  ]
140
141
  : undefined;
141
142
  return [
142
- writeComment(props.field.description),
143
+ writeComment(props.field.description, 78),
143
144
  [
144
145
  props.field.name,
145
146
  `${logical}${props.field.nullable ? "?" : ""}`,
@@ -309,17 +310,39 @@ function writeGinIndex(props: {
309
310
  /* -----------------------------------------------------------
310
311
  BACKGROUND
311
312
  ----------------------------------------------------------- */
312
- function writeComment(content: string): string {
313
+ function writeComment(content: string, length: number): string {
313
314
  return content
314
315
  .split("\r\n")
315
316
  .join("\n")
316
317
  .split("\n")
318
+ .map((line) => line.trim())
319
+ .map((line) => {
320
+ // 77자에서 "/// " 4자를 뺀 73자가 실제 컨텐츠 최대 길이
321
+ if (line.length <= length - 4) return [line];
322
+ const words: string[] = line.split(" ");
323
+ const result: string[] = [];
324
+ let currentLine = "";
325
+
326
+ for (const word of words) {
327
+ const potentialLine = currentLine ? `${currentLine} ${word}` : word;
328
+ if (potentialLine.length <= 73) {
329
+ currentLine = potentialLine;
330
+ } else {
331
+ if (currentLine) result.push(currentLine);
332
+ currentLine = word;
333
+ }
334
+ }
335
+
336
+ if (currentLine) result.push(currentLine);
337
+ return result;
338
+ })
339
+ .flat()
317
340
  .map((str) => `///${str.length ? ` ${str}` : ""}`)
318
341
  .join("\n")
319
342
  .trim();
320
343
  }
321
344
 
322
- function indent(content: string): string {
345
+ function addIndent(content: string): string {
323
346
  return content
324
347
  .split("\r\n")
325
348
  .join("\n")
@@ -1,7 +1,7 @@
1
1
  export const AutoBeCompilerRealizeTemplate: Record<string, string> = {
2
2
  ".env.local": "API_PORT=37001\nJWT_SECRET_KEY=your_jwt_secret_key",
3
3
  ".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",
4
- "package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:prisma && npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:env\": \"ts-node build/env.ts\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:prisma\": \"prisma generate --schema prisma/schema\",\n \"build:swagger\": \"nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && npm run build:env && npm run build:prisma\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"AGPL-3.0\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^7.3.2\",\n \"@nestia/e2e\": \"^7.3.2\",\n \"@nestia/sdk\": \"^7.3.2\",\n \"@nestjs/cli\": \"^11.0.7\",\n \"@rollup/plugin-terser\": \"^0.4.4\",\n \"@rollup/plugin-typescript\": \"^11.1.6\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/bcryptjs\": \"^3.0.0\",\n \"@types/cli\": \"^0.11.21\",\n \"@types/cli-progress\": \"^3.11.5\",\n \"@types/express\": \"^4.17.21\",\n \"@types/inquirer\": \"^8.2.5\",\n \"@types/jsonwebtoken\": \"^9.0.5\",\n \"@types/node\": \"^18.11.0\",\n \"@types/uuid\": \"^8.3.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.1.0\",\n \"@typescript-eslint/parser\": \"^8.1.0\",\n \"chalk\": \"^4.1.2\",\n \"cli\": \"^1.0.1\",\n \"cli-progress\": \"^3.12.0\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"eslint-plugin-deprecation\": \"^3.0.0\",\n \"express\": \"^4.18.2\",\n \"fastify\": \"^5.4.0\",\n \"nestia\": \"^7.3.2\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\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.3.2\",\n \"@nestia/fetcher\": \"^7.3.2\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@nestjs/platform-fastify\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"bcryptjs\": \"^3.0.2\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\n \"jsonwebtoken\": \"^9.0.2\",\n \"prisma\": \"^6.11.1\",\n \"serialize-error\": \"^4.1.0\",\n \"tgrid\": \"^1.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.6.1\",\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",
4
+ "package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:prisma && npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:env\": \"ts-node build/env.ts\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:prisma\": \"prisma generate --schema prisma/schema\",\n \"build:swagger\": \"nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && npm run build:env && npm run build:prisma\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"AGPL-3.0\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^7.3.3\",\n \"@nestia/e2e\": \"^7.3.3\",\n \"@nestia/sdk\": \"^7.3.3\",\n \"@nestjs/cli\": \"^11.0.7\",\n \"@rollup/plugin-terser\": \"^0.4.4\",\n \"@rollup/plugin-typescript\": \"^11.1.6\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/bcryptjs\": \"^3.0.0\",\n \"@types/cli\": \"^0.11.21\",\n \"@types/cli-progress\": \"^3.11.5\",\n \"@types/express\": \"^4.17.21\",\n \"@types/inquirer\": \"^8.2.5\",\n \"@types/jsonwebtoken\": \"^9.0.5\",\n \"@types/node\": \"^18.11.0\",\n \"@types/uuid\": \"^8.3.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.1.0\",\n \"@typescript-eslint/parser\": \"^8.1.0\",\n \"chalk\": \"^4.1.2\",\n \"cli\": \"^1.0.1\",\n \"cli-progress\": \"^3.12.0\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"eslint-plugin-deprecation\": \"^3.0.0\",\n \"express\": \"^4.18.2\",\n \"fastify\": \"^5.4.0\",\n \"nestia\": \"^7.3.3\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\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.3.3\",\n \"@nestia/fetcher\": \"^7.3.3\",\n \"@nestjs/common\": \"^11.1.3\",\n \"@nestjs/core\": \"^11.1.3\",\n \"@nestjs/platform-express\": \"^11.1.3\",\n \"@nestjs/platform-fastify\": \"^11.1.3\",\n \"@prisma/client\": \"^6.11.1\",\n \"bcryptjs\": \"^3.0.2\",\n \"commander\": \"10.0.0\",\n \"dotenv\": \"^16.3.1\",\n \"dotenv-expand\": \"^10.0.0\",\n \"inquirer\": \"8.2.5\",\n \"jsonwebtoken\": \"^9.0.2\",\n \"prisma\": \"^6.11.1\",\n \"serialize-error\": \"^4.1.0\",\n \"tgrid\": \"^1.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.7.1\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test -- --simultaneous 1\"\n }\n}\n",
5
5
  "src/MyGlobal.ts": "import { PrismaClient } from \"@prisma/client\";\nimport dotenv from \"dotenv\";\nimport dotenvExpand from \"dotenv-expand\";\nimport { Singleton } from \"tstl\";\nimport typia from \"typia\";\n\n/* eslint-disable */\nexport class MyGlobal {\n public static readonly prisma: PrismaClient = new PrismaClient();\n public static testing: boolean = false;\n public static get env(): MyGlobal.IEnvironments {\n return environments.get();\n }\n}\nexport namespace MyGlobal {\n export interface IEnvironments {\n API_PORT: `${number}`;\n\n /** JWT Secret Key. */\n JWT_SECRET_KEY: string;\n }\n}\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n",
6
6
  "src/providers/authorize/jwtAuthorize.ts": "import { ForbiddenException, UnauthorizedException } from \"@nestjs/common\";\nimport jwt from \"jsonwebtoken\";\n\nimport { MyGlobal } from \"../../MyGlobal\";\n\nexport function jwtAuthorize(props: {\n request: {\n headers: { authorization?: string };\n };\n}) {\n if (!props.request.headers.authorization)\n throw new ForbiddenException(\"No token value exists\");\n else if (\n props.request.headers.authorization.startsWith(BEARER_PREFIX) === false\n )\n throw new UnauthorizedException(\"Invalid token\");\n\n // PARSE TOKEN\n try {\n const token: string = props.request.headers.authorization.substring(\n BEARER_PREFIX.length,\n );\n\n const verified = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY);\n\n return verified;\n } catch {\n throw new UnauthorizedException(\"Invalid token\");\n }\n}\n\nconst BEARER_PREFIX = \"Bearer \";\n",
7
7
  "src/setup/MySetupWizard.ts": "import cp from \"child_process\";\n\nimport { MyConfiguration } from \"../MyConfiguration\";\nimport { MyGlobal } from \"../MyGlobal\";\n\nexport namespace MySetupWizard {\n export async function schema(): Promise<void> {\n if (MyGlobal.testing === false)\n throw new Error(\n \"Error on SetupWizard.schema(): unable to reset database in non-test mode.\",\n );\n const execute = (type: string) => (argv: string) =>\n cp.execSync(`npx prisma migrate ${type} --schema=prisma/schema ${argv}`, {\n stdio: \"ignore\",\n cwd: MyConfiguration.ROOT,\n });\n execute(\"reset\")(\"--force\");\n execute(\"dev\")(\"--name init\");\n }\n\n export async function seed(): Promise<void> {}\n}\n",
@@ -1,5 +1,5 @@
1
1
  export const AutoBeCompilerTestTemplate: 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\": \"AGPL-3.0\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@nestia/benchmark\": \"^7.3.2\",\n \"@nestia/e2e\": \"^7.3.2\",\n \"@nestia/sdk\": \"^7.3.2\",\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.3.2\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\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.3.2\",\n \"@nestia/fetcher\": \"^7.3.2\",\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.6.1\",\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",
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\": \"AGPL-3.0\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@nestia/benchmark\": \"^7.3.3\",\n \"@nestia/e2e\": \"^7.3.3\",\n \"@nestia/sdk\": \"^7.3.3\",\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.3.3\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"prisma-markdown\": \"^3.0.1\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\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.3.3\",\n \"@nestia/fetcher\": \"^7.3.3\",\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.7.1\",\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
3
  "src/setup/MySetupWizard.ts": "export namespace MySetupWizard {\n export async function schema(): Promise<void> {\n console.log(\"Realize agent has not generated main program yet.\");\n }\n\n export async function seed(): Promise<void> {}\n}\n",
4
4
  "test/helpers/TestAutomation.ts": "import api from \"@ORGANIZATION/PROJECT-api\";\nimport { DynamicExecutor } from \"@nestia/e2e\";\nimport { sleep_for } from \"tstl\";\n\nimport { MyConfiguration } from \"../../src/MyConfiguration\";\nimport { MySetupWizard } from \"../../src/setup/MySetupWizard\";\n\nexport namespace TestAutomation {\n export interface IProps<T> {\n open(options: IOptions): Promise<T>;\n close(backend: T): Promise<void>;\n onComplete(exec: DynamicExecutor.IExecution): void;\n onReset(): void;\n options: IOptions;\n }\n\n export interface IOptions {\n reset: boolean;\n simultaneous: number;\n include?: string[];\n exclude?: string[];\n }\n\n export const execute = async <T>(\n props: IProps<T>,\n ): Promise<DynamicExecutor.IReport> => {\n // RESET\n if (props.options.reset === true) {\n await MySetupWizard.schema();\n await MySetupWizard.seed();\n await props.onReset();\n }\n\n // OPEN BACKEND\n const backend: T = await props.open(props.options);\n const connection: api.IConnection = {\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\n };\n\n // DO TEST\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\n prefix: \"test\",\n location: __dirname + \"/../features\",\n parameters: () => [\n {\n host: connection.host,\n } satisfies api.IConnection,\n ],\n filter: (func) =>\n (!props.options.include?.length ||\n (props.options.include ?? []).some((str) => func.includes(str))) &&\n (!props.options.exclude?.length ||\n (props.options.exclude ?? []).every((str) => !func.includes(str))),\n onComplete: props.onComplete,\n simultaneous: props.options.simultaneous,\n extension: __filename.split(\".\").pop()!,\n });\n\n // TERMINATE\n await sleep_for(2500);\n await props.close(backend);\n return report;\n };\n}\n",
5
5
  "test/helpers/TestAutomationStdio.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport chalk from \"chalk\";\n\nimport { ArgumentParser } from \"./ArgumentParser\";\nimport { TestAutomation } from \"./TestAutomation\";\n\nexport namespace TestAutomationStdio {\n export const getOptions = () =>\n ArgumentParser.parse<TestAutomation.IOptions>(\n async (command, prompt, action) => {\n command.option(\"--reset <true|false>\", \"reset local DB or not\");\n command.option(\n \"--simultaneous <number>\",\n \"number of simultaneous requests\",\n );\n command.option(\"--include <string...>\", \"include feature files\");\n command.option(\"--exclude <string...>\", \"exclude feature files\");\n\n return action(async (options) => {\n // reset\n if (typeof options.reset === \"string\")\n options.reset = options.reset === \"true\";\n options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\n\n // simultaneous\n options.simultaneous = Number(\n options.simultaneous ??\n (await prompt.number(\"simultaneous\")(\n \"Number of simultaneous requests to make\",\n )),\n );\n if (isNaN(options.simultaneous) || options.simultaneous <= 0)\n options.simultaneous = 1;\n return options as TestAutomation.IOptions;\n });\n },\n );\n\n export const onComplete = (exec: DynamicExecutor.IExecution): void => {\n const trace = (str: string) =>\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\n if (exec.error === null) {\n const elapsed: number =\n new Date(exec.completed_at).getTime() -\n new Date(exec.started_at).getTime();\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\n } else trace(chalk.red(exec.error.name));\n };\n\n export const onReset = (start: Date) => (): void => {\n const now: Date = new Date();\n console.log(\n ` - Reset DB: ${(now.getDate() - start.getDate()).toLocaleString()} ms`,\n );\n };\n\n export const report = (report: DynamicExecutor.IReport): void => {\n const exceptions: Error[] = report.executions\n .filter((exec) => exec.error !== null)\n .map((exec) => exec.error!);\n if (exceptions.length === 0) {\n console.log(\"Success\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n } else {\n for (const exp of exceptions) console.log(exp);\n console.log(\"Failed\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n process.exit(-1);\n }\n };\n}\n",