@autobe/compiler 0.25.7 → 0.27.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.
@@ -173,7 +173,8 @@ function writeRelations(props) {
173
173
  function writeConstraint(props) {
174
174
  // spellchecker:ignore-next-line
175
175
  const name = `${props.model.name}_${props.foreign.name}_rela`;
176
- return [
176
+ const tooMuchLong = props.dbms === "postgres" && name.length > MAX_IDENTIFIER_LENGTH;
177
+ const body = [
177
178
  props.foreign.relation.name,
178
179
  `${props.foreign.relation.targetModel}${props.foreign.nullable ? "?" : ""}`,
179
180
  `@relation(${[
@@ -183,39 +184,55 @@ function writeConstraint(props) {
183
184
  `fields: [${props.foreign.name}]`,
184
185
  `references: [id]`,
185
186
  `onDelete: Cascade`,
186
- ...(props.dbms === "sqlite" || name.length <= MAX_IDENTIFIER_LENGTH
187
- ? []
188
- : [`map: "${shortName(name)}"`]),
187
+ ...(tooMuchLong ? [`map: "${shortName(name)}"`] : []),
189
188
  ].join(", ")})`,
190
189
  ].join(" ");
190
+ return tooMuchLong
191
+ ? utils_1.StringUtil.trim `
192
+ // spellchecker: ignore-next-line
193
+ ${body}
194
+ `
195
+ : body;
191
196
  }
192
197
  function writeForeignIndex(props) {
193
198
  const name = `${props.model.name}_${props.field.name}_fkey`;
194
199
  const prefix = `@@${props.field.unique === true ? "unique" : "index"}([${props.field.name}]`;
195
200
  if (name.length <= MAX_IDENTIFIER_LENGTH)
196
201
  return `${prefix})`;
197
- return `${prefix}, map: "${shortName(name)}")`;
202
+ return utils_1.StringUtil.trim `
203
+ // spellchecker: ignore-next-line
204
+ ${prefix}, map: "${shortName(name)}")
205
+ `;
198
206
  }
199
207
  function writeUniqueIndex(props) {
200
208
  const name = `${props.model.name}_${props.unique.fieldNames.join("_")}_key`;
201
209
  const prefix = `@@unique([${props.unique.fieldNames.join(", ")}]`;
202
210
  if (name.length <= MAX_IDENTIFIER_LENGTH)
203
211
  return `${prefix})`;
204
- return `${prefix}, map: "${shortName(name)}")`;
212
+ return utils_1.StringUtil.trim `
213
+ // spellchecker: ignore-next-line
214
+ ${prefix}, map: "${shortName(name)}")
215
+ `;
205
216
  }
206
217
  function writePlainIndex(props) {
207
218
  const name = `${props.model.name}_${props.plain.fieldNames.join("_")}_idx`;
208
219
  const prefix = `@@index([${props.plain.fieldNames.join(", ")}]`;
209
220
  if (name.length <= MAX_IDENTIFIER_LENGTH)
210
221
  return `${prefix})`;
211
- return `${prefix}, map: "${shortName(name)}")`;
222
+ return utils_1.StringUtil.trim `
223
+ // spellchecker: ignore-next-line
224
+ ${prefix}, map: "${shortName(name)}")
225
+ `;
212
226
  }
213
227
  function writeGinIndex(props) {
214
228
  const name = `${props.model.name}_${props.gin.fieldName}_idx`;
215
229
  const prefix = `@@index([${props.gin.fieldName}(ops: raw("gin_trgm_ops"))], type: Gin`;
216
230
  if (name.length <= MAX_IDENTIFIER_LENGTH)
217
231
  return `${prefix})`;
218
- return `${prefix}, map: "${shortName(name)}")`;
232
+ return utils_1.StringUtil.trim `
233
+ // spellchecker: ignore-next-line
234
+ ${prefix}, map: "${shortName(name)}")
235
+ `;
219
236
  }
220
237
  /* -----------------------------------------------------------
221
238
  BACKGROUND
@@ -1 +1 @@
1
- {"version":3,"file":"writePrismaApplication.js","sourceRoot":"","sources":["../../src/prisma/writePrismaApplication.ts"],"names":[],"mappings":";;;;;AAMA,wDAqBC;AA1BD,yCAAoD;AACpD,oDAA4B;AAE5B,kDAA+C;AAE/C,SAAgB,sBAAsB,CAAC,KAGtC;IACC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK;QACxC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM;YAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1D,uCACK,MAAM,CAAC,WAAW,CACnB,KAAK,CAAC,WAAW,CAAC,KAAK;SACpB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,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,CAAC,MAAM,IAAI,qBAAqB;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,IAAI,GAAW,gBAAM;SACxB,UAAU,CAAC,KAAK,CAAC;SACjB,MAAM,CAAC,IAAI,CAAC;SACZ,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,qBAAqB,GAAG,sBAAsB,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AAC5F,CAAC;AAED,MAAM,aAAa,GAAG;IACpB,eAAe;IACf,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,QAAQ;IAChB,UAAU;IACV,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,QAAQ;CACd,CAAC;AACF,MAAM,uBAAuB,GAAG;IAC9B,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,qBAAqB;IAC7B,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,iBAAiB;IAC3B,GAAG,EAAE,oBAAoB;CAC1B,CAAC;AAEF,MAAM,kBAAkB,GAAG,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;CAezC,CAAC;AACF,MAAM,gBAAgB,GAAG,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;CAavC,CAAC;AACF,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC"}
@@ -4,9 +4,10 @@ exports.AutoBeCompilerInterfaceTemplate = void 0;
4
4
  exports.AutoBeCompilerInterfaceTemplate = {
5
5
  ".eslintrc.cjs": "module.exports = {\n root: true,\n plugins: [\"@typescript-eslint\", \"deprecation\"],\n extends: [\"plugin:@typescript-eslint/recommended\"],\n parser: \"@typescript-eslint/parser\",\n parserOptions: {\n project: [\"tsconfig.json\", \"test/tsconfig.json\"],\n },\n overrides: [\n {\n files: [\"src/**/*.ts\", \"test/**/*.ts\"],\n rules: {\n \"@typescript-eslint/consistent-type-definitions\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-inferrable-types\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-vars\": \"off\",\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/prefer-as-const\": \"off\",\n \"prefer-as-const\": \"off\",\n },\n },\n ],\n};\n",
6
6
  ".github/workflows/build.yml": "name: build\non:\n pull_request:\n paths:\n - 'src/**'\n - 'test/**'\n - 'package.json'\njobs:\n Ubuntu:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 20.x\n - uses: pnpm/action-setup@v4\n with:\n version: 8\n \n - name: Install Backend-Server\n run: pnpm install\n\n - name: Build Swagger\n run: pnpm run build:swagger\n\n - name: Build SDK\n run: pnpm run build:sdk\n\n - name: Compile Backend-Server\n run: pnpm run build\n\n # - name: Run Test Program\n # run: pnpm run test -- --reset true --simultaneous 16\n\n - name: EsLint\n run: pnpm run eslint\n",
7
- ".gitignore": "bin/\ndist/\nlib/\nnode_modules/\n\nprisma/migrations\nprisma/schema/migrations\nprisma/bbs.db\n\n*.DS_Store\n.env\n.npmrc\npackage-lock.json\npnpm-lock.yaml",
7
+ ".gitignore": "./autobe/\nbin/\ndist/\nlib/\nnode_modules/\n\nprisma/migrations\nprisma/schema/migrations\nprisma/bbs.db\n\n*.DS_Store\n.env\n.npmrc\npackage-lock.json\npnpm-lock.yaml",
8
8
  "LICENSE": "MIT License\n\nCopyright (c) 2025 Wrtn Technologies\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.",
9
9
  "README.md": "# AutoBE Generated Backend Server\n\n![AutoBE Logo](https://github.com/user-attachments/assets/a90d14be-fd50-4dc7-ae9d-ca66c2124f31)\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```mermaid\nflowchart\nsubgraph \"Backend Coding Agent\"\n coder(\"Facade Controller\")\nend\nsubgraph \"Functional Agents\"\n coder --\"Requirements Analysis\"--> analyze(\"Analyze\")\n coder --\"ERD\"--> prisma(\"Prisma\")\n coder --\"API Design\"--> interface(\"Interface\")\n coder --\"Test Codes\" --> test(\"Test\")\n coder --\"Main Program\" --> realize(\"Realize\")\nend\nsubgraph \"Compiler Feedback\"\n prisma --\"validates\" --> prismaCompiler(\"Prisma Compiler\")\n interface --\"validates\" --> openapiValidator(\"OpenAPI Validator\")\n interface --\"generates\" --> tsCompiler(\"TypeScript Compiler\")\n test --\"validates\" --> tsCompiler(\"TypeScript Compiler\")\n realize --\"validates\" --> tsCompiler(\"TypeScript Compiler\")\nend\n```\n\nAlso, this backend application was built following [`@autobe`](https://github.com/wrtnlabs/autobe)'s waterfall development model, where each specialized AI agent handles a specific phase of development. The process ensures 100% working code through continuous compiler feedback and validation at every stage.\n\nEach agent receives input from previous phases and produces validated output that becomes the foundation for the next development stage. The **Facade Controller** orchestrates the entire process, while **Functional Agents** handle specialized tasks with built-in **Compiler Feedback** ensuring code quality and correctness.\n\nBelow table shows the mapping between waterfall phases, corresponding [`@autobe`](https://github.com/wrtnlabs/autobe) agents, and the actual deliverables you can find in this repository:\n\nWaterfall Model | AutoBe Agent | Result\n----------------|--------------|----------------------------------------------\nRequirements | Facade | Conversation History\nAnalysis | Analyze | [Requirement Analysis Report](docs/analysis)\nDesign | Prisma | [Entity Relationship Diagram](docs/ERD.md) / [Prisma Schema](prisma/schema)\nDesign | Interface | [API Controllers](src/controllers) / [DTO Structures](src/api/structures)\nDevelopment | Realize | [API Provider Functions](src/providers)\nTesting | Test | [E2E Test Functions](test/features/api)\nMaintenance | - | Use Claude Code like AI coding tool please\n\n## Project Structure\n\nThis template project has categorized directories like below.\n\nAs you can see from the below, all of the Backend source files are placed into the [src](src/) directory. When you build the TypeScript source files, compiled files would be placed into the `lib` directory following the [`tsconfig.json`](tsconfig.json) configuration. Otherwise you build client [SDK library](https://nestia.io/docs/sdk/) for npm publishing and their compiled files would be placed into the [`packages`](packages) directory.\n\n - [`packages/api/`](packages/api): SDK module built by `npm run build:api`\n - [`docs/`](docs/): Documentation directory\n - [`docs/analysis`](docs/analysis/): Requirement Analysis report\n - [`docs/ERD.md`](docs/ERD.md): Entity Relationship Diagram and detailed descriptions\n - [`prisma/schema`](prisma/schema): Prisma ORM schema files\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 - [`src/providers/`](src/providers/): Implementations of the API functions\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\n\n## License\n\nAutoBE is licensed under the [GNU Affero General Public License v3.0 (AGPL-3.0)](https://github.com/wrtnlabs/autobe/?tab=AGPL-3.0-1-ov-file#readme). If you modify AutoBE itself or offer it as a network service, you must make your source code available under the same license.\n\nHowever, backend applications generated by AutoBE can be relicensed under any license you choose, such as MIT. This means you can freely use AutoBE-generated code in commercial projects without open source obligations, similar to how other code generation tools work.\n",
10
- "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n \"noUnusedParameters\": false,\n },\n \"include\": [\".\", \"../src\"]\n}"
10
+ "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n \"noUnusedParameters\": false,\n },\n \"include\": [\".\", \"../src\"]\n}",
11
+ "typos.toml": "[default]\nlocale = 'en-us'\nextend-ignore-re = [\n \"(?Rm)^.*(<!--|#|//)\\\\s*spellchecker:disable-line(-->|\\n)?$\",\n \".*(?:spellchecker|typos):\\\\s?ignore-next-line[^\\\\n]*\\\\n[^\\\\n]*\",\n \"(?s)(<!--|#|//)\\\\s*spellchecker:off\\\\s*(-->|\\n).*?(<!--|#|//)\\\\s*spellchecker:on\",\n]\n\n[default.extend-words]\nJeongho = \"Jeongho\"\nNam = \"Nam\"\ntypia = \"typia\"\n\n[files]\nextend-exclude = [\"*.json\"]"
11
12
  };
12
13
  //# sourceMappingURL=AutoBeCompilerInterfaceTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoBeCompilerInterfaceTemplate.js","sourceRoot":"","sources":["../../src/raw/AutoBeCompilerInterfaceTemplate.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAA2B;IACrE,eAAe,EAAE,ywCAAywC;IAC1xC,6BAA6B,EAAE,8wBAA8wB;IAC7yB,YAAY,EAAE,+JAA+J;IAC7K,SAAS,EAAE,2kCAA2kC;IACtlC,WAAW,EAAE,y+MAAy+M;IACt/M,oBAAoB,EAAE,iNAAiN;CACxO,CAAC"}
1
+ {"version":3,"file":"AutoBeCompilerInterfaceTemplate.js","sourceRoot":"","sources":["../../src/raw/AutoBeCompilerInterfaceTemplate.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAA2B;IACrE,eAAe,EAAE,ywCAAywC;IAC1xC,6BAA6B,EAAE,8wBAA8wB;IAC7yB,YAAY,EAAE,0KAA0K;IACxL,SAAS,EAAE,2kCAA2kC;IACtlC,WAAW,EAAE,y+MAAy+M;IACt/M,oBAAoB,EAAE,iNAAiN;IACvO,YAAY,EAAE,waAAwa;CACvb,CAAC"}
@@ -33,10 +33,10 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
33
33
  f.endpoint.path === ctx.route.path);
34
34
  if (func === undefined || operate === undefined)
35
35
  return method; // unreachable
36
- const auth = operate.authorizationRole
37
- ? props.authorizations.find((d) => d.role.name === operate.authorizationRole)
36
+ const authorization = operate.authorizationActor
37
+ ? props.authorizations.find((d) => d.actor.name === operate.authorizationActor)
38
38
  : undefined;
39
- if (operate.authorizationRole && auth === undefined)
39
+ if (operate.authorizationActor && authorization === undefined)
40
40
  return method; // unreachable
41
41
  ctx.importer.external({
42
42
  type: "instance",
@@ -47,7 +47,7 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
47
47
  name: func.name,
48
48
  });
49
49
  const inputArguments = [
50
- ...(operate.authorizationRole ? [operate.authorizationRole] : []),
50
+ ...(operate.authorizationActor ? [operate.authorizationActor] : []),
51
51
  ...ctx.route.parameters.map((p) => p.name),
52
52
  ...(ctx.route.query ? [ctx.route.query.name] : []),
53
53
  ...(ctx.route.body ? [ctx.route.body.name] : []),
@@ -63,28 +63,15 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
63
63
  typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("console.log"), undefined, [typescript_1.default.factory.createIdentifier("error")])),
64
64
  typescript_1.default.factory.createThrowStatement(typescript_1.default.factory.createIdentifier("error")),
65
65
  ], true)), undefined);
66
- return typescript_1.default.factory.updateMethodDeclaration(method, method.modifiers, method.asteriskToken, method.name, method.questionToken, method.typeParameters, auth
66
+ return typescript_1.default.factory.updateMethodDeclaration(method, method.modifiers, method.asteriskToken, method.name, method.questionToken, method.typeParameters, authorization
67
67
  ? [
68
- typescript_1.default.factory.createParameterDeclaration([
69
- typescript_1.default.factory.createDecorator(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(ctx.importer.external({
70
- type: "instance",
71
- library: path_1.default
72
- .relative(ctx.controller.location, auth.decorator.location)
73
- .replaceAll(path_1.default.sep, "/")
74
- .split(".ts")[0],
75
- name: auth.decorator.name,
76
- })), undefined, [])),
77
- ], undefined, auth.role.name, undefined, typescript_1.default.factory.createTypeReferenceNode(ctx.importer.external({
78
- type: "instance",
79
- library: path_1.default
80
- .relative(ctx.controller.location, auth.payload.location)
81
- .replaceAll(path_1.default.sep, "/")
82
- .split(".ts")[0],
83
- name: auth.payload.name,
84
- })), undefined),
68
+ createAuthorizationParameter(ctx, authorization),
85
69
  ...method.parameters,
86
70
  ]
87
- : method.parameters, method.type, typescript_1.default.factory.createBlock([tryCatch]));
71
+ : operate.authorizationType === "login" ||
72
+ operate.authorizationType === "join"
73
+ ? [createIpParameter(ctx), ...method.parameters]
74
+ : method.parameters, method.type, typescript_1.default.factory.createBlock([tryCatch]));
88
75
  },
89
76
  },
90
77
  });
@@ -92,4 +79,28 @@ const writeRealizeControllers = (props) => __awaiter(void 0, void 0, void 0, fun
92
79
  return Object.fromEntries(entries);
93
80
  });
94
81
  exports.writeRealizeControllers = writeRealizeControllers;
82
+ const createAuthorizationParameter = (ctx, authorization) => typescript_1.default.factory.createParameterDeclaration([
83
+ typescript_1.default.factory.createDecorator(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(ctx.importer.external({
84
+ type: "instance",
85
+ library: path_1.default
86
+ .relative(ctx.controller.location, authorization.decorator.location)
87
+ .replaceAll(path_1.default.sep, "/")
88
+ .split(".ts")[0],
89
+ name: authorization.decorator.name,
90
+ })), undefined, [])),
91
+ ], undefined, authorization.actor.name, undefined, typescript_1.default.factory.createTypeReferenceNode(ctx.importer.external({
92
+ type: "instance",
93
+ library: path_1.default
94
+ .relative(ctx.controller.location, authorization.payload.location)
95
+ .replaceAll(path_1.default.sep, "/")
96
+ .split(".ts")[0],
97
+ name: authorization.payload.name,
98
+ })), undefined);
99
+ const createIpParameter = (ctx) => typescript_1.default.factory.createParameterDeclaration([
100
+ typescript_1.default.factory.createDecorator(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(ctx.importer.external({
101
+ type: "instance",
102
+ library: "@nestjs/common",
103
+ name: "Ip",
104
+ })), undefined, [])),
105
+ ], undefined, "ip", undefined, typescript_1.default.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.StringKeyword), undefined);
95
106
  //# sourceMappingURL=writeRealizeControllers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeRealizeControllers.js","sourceRoot":"","sources":["../../src/realize/writeRealizeControllers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,yCAAyD;AACzD,6CAA2D;AAC3D,yHAAsH;AACtH,gDAAwB;AACxB,4DAA4B;AAE5B,kDAA+C;AAC/C,sDAAmD;AAE5C,MAAM,uBAAuB,GAAG,CACrC,KAAoC,EACH,EAAE;IACnC,MAAM,GAAG,GAA6B,IAAI,kCAAwB,CAChE,IAAA,gCAAwB,EAAC,KAAK,CAAC,QAAQ,CAAC,CACzC,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,GAAG,CAAC,CAAC;gBAC5D,MAAM,OAAO,GACX,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,GAA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T,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAChC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;4BACpB,IAAI,EAAE,UAAU;4BAChB,OAAO,EAAE,cAAI;iCACV,QAAQ,CACP,GAAG,CAAC,UAAU,CAAC,QAAQ,EACvB,IAAI,CAAC,OAAO,CAAC,QAAQ,CACtB;iCACA,UAAU,CAAC,cAAI,CAAC,GAAG,EAAE,GAAG,CAAC;iCACzB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAClB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;yBACxB,CAAC,CACH,EACD,SAAS,CACV;wBACD,GAAG,MAAM,CAAC,UAAU;qBACrB;oBACH,CAAC,CAAC,MAAM,CAAC,UAAU,EACrB,MAAM,CAAC,IAAI,EACX,oBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,CACnC,CAAC;YACJ,CAAC;SACF;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAuB,MAAM,qBAAS,CAAC,QAAQ,CAC1D,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CACtC,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,CACnC,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;AAhKW,QAAA,uBAAuB,2BAgKlC"}
1
+ {"version":3,"file":"writeRealizeControllers.js","sourceRoot":"","sources":["../../src/realize/writeRealizeControllers.ts"],"names":[],"mappings":";;;;;;;;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AAS,EACT,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7D,SAAS,CACV,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/compiler",
3
- "version": "0.25.7",
3
+ "version": "0.27.0",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -30,9 +30,9 @@
30
30
  "tgrid": "^1.2.0",
31
31
  "tstl": "^3.0.0",
32
32
  "typia": "^9.7.2",
33
- "@autobe/filesystem": "^0.25.7",
34
- "@autobe/interface": "^0.25.7",
35
- "@autobe/utils": "^0.25.7"
33
+ "@autobe/filesystem": "^0.27.0",
34
+ "@autobe/utils": "^0.27.0",
35
+ "@autobe/interface": "^0.27.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^22.15.3",
@@ -256,7 +256,9 @@ function writeConstraint(props: {
256
256
  }): string {
257
257
  // spellchecker:ignore-next-line
258
258
  const name: string = `${props.model.name}_${props.foreign.name}_rela`;
259
- return [
259
+ const tooMuchLong: boolean =
260
+ props.dbms === "postgres" && name.length > MAX_IDENTIFIER_LENGTH;
261
+ const body: string = [
260
262
  props.foreign.relation.name,
261
263
  `${props.foreign.relation.targetModel}${props.foreign.nullable ? "?" : ""}`,
262
264
  `@relation(${[
@@ -266,11 +268,15 @@ function writeConstraint(props: {
266
268
  `fields: [${props.foreign.name}]`,
267
269
  `references: [id]`,
268
270
  `onDelete: Cascade`,
269
- ...(props.dbms === "sqlite" || name.length <= MAX_IDENTIFIER_LENGTH
270
- ? []
271
- : [`map: "${shortName(name)}"`]),
271
+ ...(tooMuchLong ? [`map: "${shortName(name)}"`] : []),
272
272
  ].join(", ")})`,
273
273
  ].join(" ");
274
+ return tooMuchLong
275
+ ? StringUtil.trim`
276
+ // spellchecker: ignore-next-line
277
+ ${body}
278
+ `
279
+ : body;
274
280
  }
275
281
 
276
282
  function writeForeignIndex(props: {
@@ -280,7 +286,10 @@ function writeForeignIndex(props: {
280
286
  const name: string = `${props.model.name}_${props.field.name}_fkey`;
281
287
  const prefix: string = `@@${props.field.unique === true ? "unique" : "index"}([${props.field.name}]`;
282
288
  if (name.length <= MAX_IDENTIFIER_LENGTH) return `${prefix})`;
283
- return `${prefix}, map: "${shortName(name)}")`;
289
+ return StringUtil.trim`
290
+ // spellchecker: ignore-next-line
291
+ ${prefix}, map: "${shortName(name)}")
292
+ `;
284
293
  }
285
294
 
286
295
  function writeUniqueIndex(props: {
@@ -290,7 +299,10 @@ function writeUniqueIndex(props: {
290
299
  const name: string = `${props.model.name}_${props.unique.fieldNames.join("_")}_key`;
291
300
  const prefix: string = `@@unique([${props.unique.fieldNames.join(", ")}]`;
292
301
  if (name.length <= MAX_IDENTIFIER_LENGTH) return `${prefix})`;
293
- return `${prefix}, map: "${shortName(name)}")`;
302
+ return StringUtil.trim`
303
+ // spellchecker: ignore-next-line
304
+ ${prefix}, map: "${shortName(name)}")
305
+ `;
294
306
  }
295
307
 
296
308
  function writePlainIndex(props: {
@@ -300,7 +312,10 @@ function writePlainIndex(props: {
300
312
  const name: string = `${props.model.name}_${props.plain.fieldNames.join("_")}_idx`;
301
313
  const prefix: string = `@@index([${props.plain.fieldNames.join(", ")}]`;
302
314
  if (name.length <= MAX_IDENTIFIER_LENGTH) return `${prefix})`;
303
- return `${prefix}, map: "${shortName(name)}")`;
315
+ return StringUtil.trim`
316
+ // spellchecker: ignore-next-line
317
+ ${prefix}, map: "${shortName(name)}")
318
+ `;
304
319
  }
305
320
 
306
321
  function writeGinIndex(props: {
@@ -310,7 +325,10 @@ function writeGinIndex(props: {
310
325
  const name: string = `${props.model.name}_${props.gin.fieldName}_idx`;
311
326
  const prefix: string = `@@index([${props.gin.fieldName}(ops: raw("gin_trgm_ops"))], type: Gin`;
312
327
  if (name.length <= MAX_IDENTIFIER_LENGTH) return `${prefix})`;
313
- return `${prefix}, map: "${shortName(name)}")`;
328
+ return StringUtil.trim`
329
+ // spellchecker: ignore-next-line
330
+ ${prefix}, map: "${shortName(name)}")
331
+ `;
314
332
  }
315
333
 
316
334
  /* -----------------------------------------------------------
@@ -1,8 +1,9 @@
1
1
  export const AutoBeCompilerInterfaceTemplate: Record<string, string> = {
2
2
  ".eslintrc.cjs": "module.exports = {\n root: true,\n plugins: [\"@typescript-eslint\", \"deprecation\"],\n extends: [\"plugin:@typescript-eslint/recommended\"],\n parser: \"@typescript-eslint/parser\",\n parserOptions: {\n project: [\"tsconfig.json\", \"test/tsconfig.json\"],\n },\n overrides: [\n {\n files: [\"src/**/*.ts\", \"test/**/*.ts\"],\n rules: {\n \"@typescript-eslint/consistent-type-definitions\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-inferrable-types\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-vars\": \"off\",\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/prefer-as-const\": \"off\",\n \"prefer-as-const\": \"off\",\n },\n },\n ],\n};\n",
3
3
  ".github/workflows/build.yml": "name: build\non:\n pull_request:\n paths:\n - 'src/**'\n - 'test/**'\n - 'package.json'\njobs:\n Ubuntu:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 20.x\n - uses: pnpm/action-setup@v4\n with:\n version: 8\n \n - name: Install Backend-Server\n run: pnpm install\n\n - name: Build Swagger\n run: pnpm run build:swagger\n\n - name: Build SDK\n run: pnpm run build:sdk\n\n - name: Compile Backend-Server\n run: pnpm run build\n\n # - name: Run Test Program\n # run: pnpm run test -- --reset true --simultaneous 16\n\n - name: EsLint\n run: pnpm run eslint\n",
4
- ".gitignore": "bin/\ndist/\nlib/\nnode_modules/\n\nprisma/migrations\nprisma/schema/migrations\nprisma/bbs.db\n\n*.DS_Store\n.env\n.npmrc\npackage-lock.json\npnpm-lock.yaml",
4
+ ".gitignore": "./autobe/\nbin/\ndist/\nlib/\nnode_modules/\n\nprisma/migrations\nprisma/schema/migrations\nprisma/bbs.db\n\n*.DS_Store\n.env\n.npmrc\npackage-lock.json\npnpm-lock.yaml",
5
5
  "LICENSE": "MIT License\n\nCopyright (c) 2025 Wrtn Technologies\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.",
6
6
  "README.md": "# AutoBE Generated Backend Server\n\n![AutoBE Logo](https://github.com/user-attachments/assets/a90d14be-fd50-4dc7-ae9d-ca66c2124f31)\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```mermaid\nflowchart\nsubgraph \"Backend Coding Agent\"\n coder(\"Facade Controller\")\nend\nsubgraph \"Functional Agents\"\n coder --\"Requirements Analysis\"--> analyze(\"Analyze\")\n coder --\"ERD\"--> prisma(\"Prisma\")\n coder --\"API Design\"--> interface(\"Interface\")\n coder --\"Test Codes\" --> test(\"Test\")\n coder --\"Main Program\" --> realize(\"Realize\")\nend\nsubgraph \"Compiler Feedback\"\n prisma --\"validates\" --> prismaCompiler(\"Prisma Compiler\")\n interface --\"validates\" --> openapiValidator(\"OpenAPI Validator\")\n interface --\"generates\" --> tsCompiler(\"TypeScript Compiler\")\n test --\"validates\" --> tsCompiler(\"TypeScript Compiler\")\n realize --\"validates\" --> tsCompiler(\"TypeScript Compiler\")\nend\n```\n\nAlso, this backend application was built following [`@autobe`](https://github.com/wrtnlabs/autobe)'s waterfall development model, where each specialized AI agent handles a specific phase of development. The process ensures 100% working code through continuous compiler feedback and validation at every stage.\n\nEach agent receives input from previous phases and produces validated output that becomes the foundation for the next development stage. The **Facade Controller** orchestrates the entire process, while **Functional Agents** handle specialized tasks with built-in **Compiler Feedback** ensuring code quality and correctness.\n\nBelow table shows the mapping between waterfall phases, corresponding [`@autobe`](https://github.com/wrtnlabs/autobe) agents, and the actual deliverables you can find in this repository:\n\nWaterfall Model | AutoBe Agent | Result\n----------------|--------------|----------------------------------------------\nRequirements | Facade | Conversation History\nAnalysis | Analyze | [Requirement Analysis Report](docs/analysis)\nDesign | Prisma | [Entity Relationship Diagram](docs/ERD.md) / [Prisma Schema](prisma/schema)\nDesign | Interface | [API Controllers](src/controllers) / [DTO Structures](src/api/structures)\nDevelopment | Realize | [API Provider Functions](src/providers)\nTesting | Test | [E2E Test Functions](test/features/api)\nMaintenance | - | Use Claude Code like AI coding tool please\n\n## Project Structure\n\nThis template project has categorized directories like below.\n\nAs you can see from the below, all of the Backend source files are placed into the [src](src/) directory. When you build the TypeScript source files, compiled files would be placed into the `lib` directory following the [`tsconfig.json`](tsconfig.json) configuration. Otherwise you build client [SDK library](https://nestia.io/docs/sdk/) for npm publishing and their compiled files would be placed into the [`packages`](packages) directory.\n\n - [`packages/api/`](packages/api): SDK module built by `npm run build:api`\n - [`docs/`](docs/): Documentation directory\n - [`docs/analysis`](docs/analysis/): Requirement Analysis report\n - [`docs/ERD.md`](docs/ERD.md): Entity Relationship Diagram and detailed descriptions\n - [`prisma/schema`](prisma/schema): Prisma ORM schema files\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 - [`src/providers/`](src/providers/): Implementations of the API functions\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\n\n## License\n\nAutoBE is licensed under the [GNU Affero General Public License v3.0 (AGPL-3.0)](https://github.com/wrtnlabs/autobe/?tab=AGPL-3.0-1-ov-file#readme). If you modify AutoBE itself or offer it as a network service, you must make your source code available under the same license.\n\nHowever, backend applications generated by AutoBE can be relicensed under any license you choose, such as MIT. This means you can freely use AutoBE-generated code in commercial projects without open source obligations, similar to how other code generation tools work.\n",
7
- "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n \"noUnusedParameters\": false,\n },\n \"include\": [\".\", \"../src\"]\n}"
7
+ "test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n \"noUnusedLocals\": false,\n \"noUnusedParameters\": false,\n },\n \"include\": [\".\", \"../src\"]\n}",
8
+ "typos.toml": "[default]\nlocale = 'en-us'\nextend-ignore-re = [\n \"(?Rm)^.*(<!--|#|//)\\\\s*spellchecker:disable-line(-->|\\n)?$\",\n \".*(?:spellchecker|typos):\\\\s?ignore-next-line[^\\\\n]*\\\\n[^\\\\n]*\",\n \"(?s)(<!--|#|//)\\\\s*spellchecker:off\\\\s*(-->|\\n).*?(<!--|#|//)\\\\s*spellchecker:on\",\n]\n\n[default.extend-words]\nJeongho = \"Jeongho\"\nNam = \"Nam\"\ntypia = \"typia\"\n\n[files]\nextend-exclude = [\"*.json\"]"
8
9
  };
@@ -36,13 +36,14 @@ export const writeRealizeControllers = async (
36
36
  );
37
37
  if (func === undefined || operate === undefined) return method; // unreachable
38
38
 
39
- const auth: AutoBeRealizeAuthorization | undefined =
40
- operate.authorizationRole
39
+ const authorization: AutoBeRealizeAuthorization | undefined =
40
+ operate.authorizationActor
41
41
  ? props.authorizations.find(
42
- (d) => d.role.name === operate.authorizationRole,
42
+ (d) => d.actor.name === operate.authorizationActor,
43
43
  )
44
44
  : undefined;
45
- if (operate.authorizationRole && auth === undefined) return method; // unreachable
45
+ if (operate.authorizationActor && authorization === undefined)
46
+ return method; // unreachable
46
47
 
47
48
  ctx.importer.external({
48
49
  type: "instance",
@@ -54,7 +55,7 @@ export const writeRealizeControllers = async (
54
55
  });
55
56
 
56
57
  const inputArguments: string[] = [
57
- ...(operate.authorizationRole ? [operate.authorizationRole] : []),
58
+ ...(operate.authorizationActor ? [operate.authorizationActor] : []),
58
59
  ...ctx.route.parameters.map((p) => p.name),
59
60
  ...(ctx.route.query ? [ctx.route.query.name] : []),
60
61
  ...(ctx.route.body ? [ctx.route.body.name] : []),
@@ -114,51 +115,15 @@ export const writeRealizeControllers = async (
114
115
  method.name,
115
116
  method.questionToken,
116
117
  method.typeParameters,
117
- auth
118
+ authorization
118
119
  ? [
119
- ts.factory.createParameterDeclaration(
120
- [
121
- ts.factory.createDecorator(
122
- ts.factory.createCallExpression(
123
- ts.factory.createIdentifier(
124
- ctx.importer.external({
125
- type: "instance",
126
- library: path
127
- .relative(
128
- ctx.controller.location,
129
- auth.decorator.location,
130
- )
131
- .replaceAll(path.sep, "/")
132
- .split(".ts")[0],
133
- name: auth.decorator.name,
134
- }),
135
- ),
136
- undefined,
137
- [],
138
- ),
139
- ),
140
- ],
141
- undefined,
142
- auth.role.name,
143
- undefined,
144
- ts.factory.createTypeReferenceNode(
145
- ctx.importer.external({
146
- type: "instance",
147
- library: path
148
- .relative(
149
- ctx.controller.location,
150
- auth.payload.location,
151
- )
152
- .replaceAll(path.sep, "/")
153
- .split(".ts")[0],
154
- name: auth.payload.name,
155
- }),
156
- ),
157
- undefined,
158
- ),
120
+ createAuthorizationParameter(ctx, authorization),
159
121
  ...method.parameters,
160
122
  ]
161
- : method.parameters,
123
+ : operate.authorizationType === "login" ||
124
+ operate.authorizationType === "join"
125
+ ? [createIpParameter(ctx), ...method.parameters]
126
+ : method.parameters,
162
127
  method.type,
163
128
  ts.factory.createBlock([tryCatch]),
164
129
  );
@@ -174,3 +139,69 @@ export const writeRealizeControllers = async (
174
139
  );
175
140
  return Object.fromEntries(entries);
176
141
  };
142
+
143
+ const createAuthorizationParameter = (
144
+ ctx: NestiaMigrateNestMethodProgrammer.IContext,
145
+ authorization: AutoBeRealizeAuthorization,
146
+ ) =>
147
+ ts.factory.createParameterDeclaration(
148
+ [
149
+ ts.factory.createDecorator(
150
+ ts.factory.createCallExpression(
151
+ ts.factory.createIdentifier(
152
+ ctx.importer.external({
153
+ type: "instance",
154
+ library: path
155
+ .relative(
156
+ ctx.controller.location,
157
+ authorization.decorator.location,
158
+ )
159
+ .replaceAll(path.sep, "/")
160
+ .split(".ts")[0],
161
+ name: authorization.decorator.name,
162
+ }),
163
+ ),
164
+ undefined,
165
+ [],
166
+ ),
167
+ ),
168
+ ],
169
+ undefined,
170
+ authorization.actor.name,
171
+ undefined,
172
+ ts.factory.createTypeReferenceNode(
173
+ ctx.importer.external({
174
+ type: "instance",
175
+ library: path
176
+ .relative(ctx.controller.location, authorization.payload.location)
177
+ .replaceAll(path.sep, "/")
178
+ .split(".ts")[0],
179
+ name: authorization.payload.name,
180
+ }),
181
+ ),
182
+ undefined,
183
+ );
184
+
185
+ const createIpParameter = (ctx: NestiaMigrateNestMethodProgrammer.IContext) =>
186
+ ts.factory.createParameterDeclaration(
187
+ [
188
+ ts.factory.createDecorator(
189
+ ts.factory.createCallExpression(
190
+ ts.factory.createIdentifier(
191
+ ctx.importer.external({
192
+ type: "instance",
193
+ library: "@nestjs/common",
194
+ name: "Ip",
195
+ }),
196
+ ),
197
+ undefined,
198
+ [],
199
+ ),
200
+ ),
201
+ ],
202
+ undefined,
203
+ "ip",
204
+ undefined,
205
+ ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
206
+ undefined,
207
+ );