@nestia/migrate 11.3.0 → 11.3.1

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 (98) hide show
  1. package/lib/bundles/NEST_TEMPLATE.js +2 -2
  2. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  3. package/lib/bundles/SDK_TEMPLATE.js +1 -1
  4. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  5. package/lib/factories/ExpressionFactory.d.ts +9 -0
  6. package/lib/factories/ExpressionFactory.js +16 -0
  7. package/lib/factories/ExpressionFactory.js.map +1 -0
  8. package/lib/factories/IdentifierFactory.d.ts +11 -0
  9. package/lib/factories/IdentifierFactory.js +36 -0
  10. package/lib/factories/IdentifierFactory.js.map +1 -0
  11. package/lib/factories/LiteralFactory.d.ts +9 -0
  12. package/lib/factories/LiteralFactory.js +52 -0
  13. package/lib/factories/LiteralFactory.js.map +1 -0
  14. package/lib/factories/StatementFactory.d.ts +12 -0
  15. package/lib/factories/StatementFactory.js +20 -0
  16. package/lib/factories/StatementFactory.js.map +1 -0
  17. package/lib/factories/TypeFactory.d.ts +8 -0
  18. package/lib/factories/TypeFactory.js +25 -0
  19. package/lib/factories/TypeFactory.js.map +1 -0
  20. package/lib/factories/TypeLiteralFactory.d.ts +2 -2
  21. package/lib/factories/TypeLiteralFactory.js +12 -15
  22. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  23. package/lib/factories/index.d.ts +5 -0
  24. package/lib/factories/index.js +22 -0
  25. package/lib/factories/index.js.map +1 -0
  26. package/lib/index.mjs +171 -126
  27. package/lib/index.mjs.map +1 -1
  28. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +2 -2
  29. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +2 -5
  30. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  31. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +3 -3
  32. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +45 -48
  33. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  34. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +3 -3
  35. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +59 -62
  36. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  37. package/lib/programmers/NestiaMigrateApiProgrammer.js +2 -5
  38. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  39. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +3 -3
  40. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +36 -39
  41. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  42. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +20 -23
  43. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  44. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +2 -2
  45. package/lib/programmers/NestiaMigrateDtoProgrammer.js +2 -5
  46. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  47. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +3 -3
  48. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +23 -26
  49. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  50. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  51. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +4 -4
  52. package/lib/programmers/NestiaMigrateImportProgrammer.js +11 -14
  53. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  54. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +2 -2
  55. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +5 -8
  56. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  57. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +2 -2
  58. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +32 -37
  59. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  60. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +2 -2
  61. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +9 -12
  62. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  63. package/lib/programmers/NestiaMigrateNestProgrammer.js +2 -5
  64. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  65. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +2 -2
  66. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +44 -43
  67. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  68. package/lib/structures/INestiaMigrateConfig.d.ts +2 -2
  69. package/lib/utils/FilePrinter.d.ts +4 -4
  70. package/lib/utils/FilePrinter.js +9 -11
  71. package/lib/utils/FilePrinter.js.map +1 -1
  72. package/package.json +8 -7
  73. package/src/bundles/NEST_TEMPLATE.ts +2 -2
  74. package/src/bundles/SDK_TEMPLATE.ts +1 -1
  75. package/src/factories/ExpressionFactory.ts +30 -0
  76. package/src/factories/IdentifierFactory.ts +69 -0
  77. package/src/factories/LiteralFactory.ts +61 -0
  78. package/src/factories/StatementFactory.ts +40 -0
  79. package/src/factories/TypeFactory.ts +33 -0
  80. package/src/factories/TypeLiteralFactory.ts +17 -17
  81. package/src/factories/index.ts +5 -0
  82. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +6 -7
  83. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +81 -74
  84. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +143 -142
  85. package/src/programmers/NestiaMigrateApiProgrammer.ts +11 -11
  86. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +71 -66
  87. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +58 -52
  88. package/src/programmers/NestiaMigrateDtoProgrammer.ts +5 -5
  89. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +41 -34
  90. package/src/programmers/NestiaMigrateE2eProgrammer.ts +8 -9
  91. package/src/programmers/NestiaMigrateImportProgrammer.ts +22 -22
  92. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +8 -8
  93. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +68 -68
  94. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +18 -20
  95. package/src/programmers/NestiaMigrateNestProgrammer.ts +14 -14
  96. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +67 -59
  97. package/src/structures/INestiaMigrateConfig.ts +2 -2
  98. package/src/utils/FilePrinter.ts +20 -21
package/lib/index.mjs CHANGED
@@ -10,15 +10,15 @@ import * as __typia_transform__accessExpressionAsString from "typia/lib/internal
10
10
 
11
11
  import * as __typia_transform__validateReport from "typia/lib/internal/_validateReport";
12
12
 
13
- import { OpenApiTypeChecker, NamingConvention, HttpMigration, OpenApiConverter } from "@typia/utils";
13
+ import { NamingConvention, OpenApiTypeChecker, HttpMigration, OpenApiConverter } from "@typia/utils";
14
14
 
15
15
  import "typia";
16
16
 
17
- import { HashMap, hash, VariadicSingleton } from "tstl";
17
+ import { addSyntheticLeadingComment, SyntaxKind, factory, TsPrinter, NodeFlags } from "@ttsc/factory";
18
18
 
19
- import ts from "typescript";
19
+ import { HashMap, hash, VariadicSingleton } from "tstl";
20
20
 
21
- import { TypeFactory, FormatCheatSheet, IdentifierFactory, StatementFactory, LiteralFactory, ExpressionFactory } from "@typia/core";
21
+ import { FormatCheatSheet } from "@typia/core";
22
22
 
23
23
  const NEST_TEMPLATE = {
24
24
  ".env.local": "API_PORT=37001",
@@ -35,11 +35,11 @@ const NEST_TEMPLATE = {
35
35
  "docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md": '# Benchmark Report\n> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)\n\n - Specifications\n - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics \n - RAM: 31 GB\n - NodeJS Version: v20.10.0\n - Backend Server: 1 core / 1 thread\n - Arguments\n - Count: 40,000\n - Threads: 4\n - Simultaneous: 32\n - Time\n - Start: 2024-10-29T19:14:35.941Z\n - Complete: 2024-10-29T19:16:11.418Z\n - Elapsed: 95,477 ms\n\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\n----|----|----|----|----|----|----\nTotal | 41,586 | 41,586 | 69.24 | 73.05 | 5 | 546\n\n> Unit: milliseconds\n\n## Memory Consumptions\n```mermaid\nxychart-beta\n x-axis "Time (second)"\n y-axis "Memory (MB)"\n line "Resident Set Size" [122, 156, 159, 142, 154, 165, 184, 185, 187, 189, 200, 205, 209, 217, 221, 225, 229, 224, 230, 235, 242, 250, 256, 262, 267, 272, 234, 237, 249, 259, 266, 273, 285, 292, 291, 216, 225, 235, 243, 200, 208, 214, 186, 186, 171, 177, 187, 199, 185, 192, 205, 171, 180, 158, 170, 179, 163, 163, 176, 188, 193, 202, 213, 219, 230, 239, 256, 265, 283, 301, 240, 249, 257, 267, 284, 282, 290, 202, 213, 166, 178, 188, 200, 203, 208, 180, 191, 199, 175]\n line "Heap Total" [85, 116, 120, 103, 114, 124, 146, 146, 147, 148, 158, 166, 170, 176, 180, 184, 187, 185, 190, 195, 203, 211, 217, 222, 225, 229, 194, 197, 209, 218, 225, 232, 241, 249, 247, 176, 185, 194, 202, 160, 168, 173, 146, 146, 130, 136, 146, 158, 145, 151, 165, 129, 139, 116, 128, 137, 120, 123, 136, 148, 152, 161, 172, 179, 189, 198, 215, 223, 241, 257, 200, 209, 216, 227, 244, 242, 249, 163, 174, 127, 136, 147, 159, 162, 166, 138, 150, 158, 132]\n line "Heap Used + External" [69, 94, 62, 82, 88, 107, 71, 83, 93, 107, 136, 72, 76, 85, 92, 106, 139, 48, 68, 69, 86, 95, 108, 116, 140, 175, 67, 74, 88, 112, 125, 136, 142, 169, 180, 91, 104, 105, 121, 60, 71, 91, 64, 74, 86, 110, 121, 135, 76, 82, 103, 70, 93, 66, 91, 107, 76, 75, 95, 101, 115, 127, 136, 154, 165, 168, 196, 193, 214, 232, 84, 94, 101, 118, 145, 147, 149, 86, 96, 72, 90, 112, 126, 133, 132, 78, 87, 107, 88]\n line "Heap Used Only" [66, 89, 59, 78, 83, 100, 68, 79, 88, 101, 129, 68, 72, 80, 86, 100, 131, 45, 64, 65, 81, 90, 103, 110, 133, 168, 64, 71, 84, 108, 120, 130, 136, 162, 173, 88, 100, 101, 117, 58, 68, 87, 61, 71, 83, 107, 118, 130, 73, 79, 99, 67, 89, 63, 88, 103, 74, 72, 91, 98, 111, 123, 132, 149, 160, 163, 190, 187, 208, 225, 81, 90, 97, 114, 140, 143, 145, 83, 93, 70, 87, 108, 122, 130, 128, 76, 84, 104, 85]\n```\n\n> - 🟦 Resident Set Size\n> - 🟢 Heap Total\n> - 🔴 Heap Used + External\n> - 🟡 Heap Used Only\n\n## Endpoints\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\n----|----|----|----|----|----|----\nPATCH /bbs/articles/:section | 6,439 | 6,439 | 108.37 | 76.56 | 6 | 546\nPUT /bbs/articles/:section/:id | 380 | 380 | 78.52 | 69.03 | 6 | 296\nGET /bbs/articles/:section/:id | 917 | 917 | 77.65 | 69.84 | 6 | 463\nDELETE /bbs/articles/:section/:id | 201 | 201 | 73.89 | 63.55 | 7 | 307\nPOST /bbs/articles/:section | 33,649 | 33,649 | 61.39 | 70.04 | 5 | 546\n\n> Unit: milliseconds\n\n## Failures\nMethod | Path | Count | Failures\n-------|------|-------|----------',
36
36
  "nest-cli.json": '{\n "$schema": "https://json.schemastore.org/nest-cli",\n "collection": "@nestjs/schematics",\n "sourceRoot": "src",\n "entryFile": "executable/server",\n "compilerOptions": {\n "deleteOutDir": true\n }\n}\n',
37
37
  "nestia.config.ts": '// nestia configuration file\nimport type sdk from "@nestia/sdk";\nimport { NestFactory } from "@nestjs/core";\n\nimport { MyModule } from "./src/MyModule";\n\nconst NESTIA_CONFIG: sdk.INestiaConfig = {\n input: () => NestFactory.create(MyModule),\n output: "src/api",\n swagger: {\n output: "packages/api/swagger.json",\n servers: [\n {\n url: "http://localhost:37001",\n description: "Local Server",\n },\n ],\n beautify: true,\n },\n distribute: "packages/api",\n keyword: true,\n simulate: true,\n primitive: false,\n};\nexport default NESTIA_CONFIG;\n',
38
- "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": "ts-node test/index.ts",\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": "ts-node src/executable/server.ts",\n "start:prod": "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 "@autobe/interface": "^0.10.6",\n "@nestia/benchmark": "^11.3.0",\n "@nestia/e2e": "^11.3.0",\n "@nestjs/cli": "^11.0.16",\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": "^11.3.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": "^4.0.1",\n "typescript": "~6.0.3",\n "typescript-transform-paths": "^3.5.6",\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": "^11.3.0",\n "@nestia/fetcher": "^11.3.0",\n "@nestia/sdk": "^11.3.0",\n "@nestjs/common": "^11.1.16",\n "@nestjs/core": "^11.1.16",\n "@nestjs/platform-express": "^11.1.16",\n "commander": "10.0.0",\n "dotenv": "^16.3.1",\n "dotenv-expand": "^10.0.0",\n "inquirer": "8.2.5",\n "serialize-error": "^4.1.0",\n "tgrid": "^1.2.1",\n "tstl": "^3.0.0",\n "typia": "12.1.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}',
38
+ "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": "ts-node test/index.ts",\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": "ts-node src/executable/server.ts",\n "start:prod": "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 "@autobe/interface": "^0.10.6",\n "@nestia/benchmark": "^11.3.1",\n "@nestia/e2e": "^11.3.1",\n "@nestjs/cli": "^11.0.16",\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": "^11.3.1",\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": "^4.0.1",\n "typescript": "~6.0.3",\n "typescript-transform-paths": "^3.5.6",\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": "^11.3.1",\n "@nestia/fetcher": "^11.3.1",\n "@nestia/sdk": "^11.3.1",\n "@nestjs/common": "^11.1.16",\n "@nestjs/core": "^11.1.16",\n "@nestjs/platform-express": "^11.1.16",\n "commander": "10.0.0",\n "dotenv": "^16.3.1",\n "dotenv-expand": "^10.0.0",\n "inquirer": "8.2.5",\n "serialize-error": "^4.1.0",\n "tgrid": "^1.2.1",\n "tstl": "^3.0.0",\n "typia": "^12.1.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}',
39
39
  "packages/api/.gitignore": "lib/\nnode_modules/\n\nswagger.json\nopenai.json",
40
40
  "packages/api/LICENSE": 'MIT License\n\nCopyright (c) 2021 ORGANIZATION\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.',
41
41
  "packages/api/README.md": "# SDK Library\nThis is a SDK library generated by [`nestia`](https://nestia.io).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n# What [`Nestia`](https://nestia.io) is:\n![Nestia Logo](https://nestia.io/logo.png)\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n[![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\n[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\n\nNestia is a set of helper libraries for NestJS, supporting below features:\n\n - `@nestia/core`: super-fast decorators\n - `@nestia/sdk`:\n - Swagger generator evolved than ever\n - SDK library generator for clients\n - Mockup Simulator for client applications\n - Automatic E2E test functions generator\n - `@nestia/migrate`: migration from Swagger to NestJS\n - `nestia`: just CLI (command line interface) tool\n\n> **Note**\n> \n> - **Only one line** required, with pure TypeScript type\n> - Enhance performance **30x** up\n> - Runtime validator is **20,000x faster** than `class-validator`\n> - JSON serialization is **200x faster** than `class-transformer`\n> - Software Development Kit\n> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)\n> - Mockup simulator means embedded backend simulator in SDK\n> - similar with [msw](https://mswjs.io/), but fully automated",
42
- "packages/api/package.json": '{\n "name": "@ORGANIZATION/PROJECT-api",\n "version": "0.1.0",\n "description": "SDK library generated by Nestia",\n "main": "lib/index.js",\n "module": "lib/index.mjs",\n "typings": "lib/index.d.ts",\n "repository": {\n "type": "git",\n "url": "https://github.com/samchon/nestia"\n },\n "author": "Jeongho Nam",\n "license": "MIT",\n "bugs": {\n "url": "https://github.com/samchon/nestia/issues"\n },\n "homepage": "https://nestia.io",\n "files": [\n "lib",\n "package.json",\n "swagger.json",\n "openai.json",\n "README.md"\n ],\n "dependencies": {\n "@nestia/fetcher": "^11.3.0",\n "tgrid": "^1.2.1",\n "typia": "12.1.0"\n }\n}',
42
+ "packages/api/package.json": '{\n "name": "@ORGANIZATION/PROJECT-api",\n "version": "0.1.0",\n "description": "SDK library generated by Nestia",\n "main": "lib/index.js",\n "module": "lib/index.mjs",\n "typings": "lib/index.d.ts",\n "repository": {\n "type": "git",\n "url": "https://github.com/samchon/nestia"\n },\n "author": "Jeongho Nam",\n "license": "MIT",\n "bugs": {\n "url": "https://github.com/samchon/nestia/issues"\n },\n "homepage": "https://nestia.io",\n "files": [\n "lib",\n "package.json",\n "swagger.json",\n "openai.json",\n "README.md"\n ],\n "dependencies": {\n "@nestia/fetcher": "^11.3.1",\n "tgrid": "^1.2.1",\n "typia": "^12.1.0"\n }\n}',
43
43
  "packages/api/rollup.config.js": 'const typescript = require("@rollup/plugin-typescript");\nconst terser = require("@rollup/plugin-terser");\n\nmodule.exports = {\n input: `${__dirname}/../../src/api/index.ts`,\n output: {\n dir: `${__dirname}/lib`,\n format: "esm",\n entryFileNames: "[name].mjs",\n sourcemap: true,\n },\n plugins: [\n typescript({\n tsconfig: `${__dirname}/tsconfig.json`,\n module: "ESNext",\n target: "ESNext",\n }),\n terser({\n format: {\n comments: "some",\n beautify: true,\n ecma: "2020",\n },\n compress: false,\n mangle: false,\n module: true,\n }),\n ],\n};\n',
44
44
  "packages/api/tsconfig.json": '{\n "compilerOptions": {\n /* Visit https://aka.ms/tsconfig to read more about this file */\n /* Projects */\n // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\n // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\n // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */\n // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\n // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */\n // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */\n /* Language and Environment */\n "target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\n "lib": [\n "DOM",\n "ES2015"\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// "jsx": "preserve", /* Specify what JSX code is generated. */\n // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\n // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */\n // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. \'React.createElement\' or \'h\'. */\n // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. \'React.Fragment\' or \'Fragment\'. */\n // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using \'jsx: react-jsx*\'. */\n // "reactNamespace": "", /* Specify the object invoked for \'createElement\'. This only applies when targeting \'react\' JSX emit. */\n // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */\n // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */\n // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */\n /* Modules */\n "module": "commonjs", /* Specify what module code is generated. */\n "rootDir": "../../src/api", /* Specify the root folder within your source files. */\n // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */\n // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */\n // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */\n // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */\n // "typeRoots": [], /* Specify multiple folders that act like \'./node_modules/@types\'. */\n // "types": [], /* Specify type package names to be included without being referenced in a source file. */\n // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */\n // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */\n // "resolveJsonModule": true, /* Enable importing .json files. */\n // "noResolve": true, /* Disallow \'import\'s, \'require\'s or \'<reference>\'s from expanding the number of files TypeScript should add to a project. */\n /* JavaScript Support */\n // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the \'checkJS\' option to get errors from these files. */\n // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */\n // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from \'node_modules\'. Only applicable with \'allowJs\'. */\n /* Emit */\n "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// "declarationMap": true, /* Create sourcemaps for d.ts files. */\n // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */\n "sourceMap": true, /* Create source map files for emitted JavaScript files. */// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If \'declaration\' is true, also designates a file that bundles all .d.ts output. */\n "outDir": "./lib", /* Specify an output folder for all emitted files. */// "removeComments": true, /* Disable emitting comments. */\n // "noEmit": true, /* Disable emitting files from a compilation. */\n // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\n // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */\n // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */\n // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */\n // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */\n // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\n // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\n "newLine": "lf", /* Set the newline character for emitting files. */// "stripInternal": true, /* Disable emitting declarations that have \'@internal\' in their JSDoc comments. */\n // "noEmitHelpers": true, /* Disable generating custom helper functions like \'__extends\' in compiled output. */\n // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */\n // "preserveConstEnums": true, /* Disable erasing \'const enum\' declarations in generated code. */\n // "declarationDir": "./", /* Specify the output directory for generated declaration files. */\n // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\n /* Interop Constraints */\n // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\n // "allowSyntheticDefaultImports": true, /* Allow \'import x from y\' when a module doesn\'t have a default export. */\n "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables \'allowSyntheticDefaultImports\' for type compatibility. */// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\n "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. *//* Type Checking */\n "strict": true, /* Enable all strict type-checking options. */// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied \'any\' type. */\n // "strictNullChecks": true, /* When type checking, take into account \'null\' and \'undefined\'. */\n // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\n // "strictBindCallApply": true, /* Check that the arguments for \'bind\', \'call\', and \'apply\' methods match the original function. */\n // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */\n // "noImplicitThis": true, /* Enable error reporting when \'this\' is given the type \'any\'. */\n // "useUnknownInCatchVariables": true, /* Default catch clause variables as \'unknown\' instead of \'any\'. */\n // "alwaysStrict": true, /* Ensure \'use strict\' is always emitted. */\n // "noUnusedLocals": true, /* Enable error reporting when local variables aren\'t read. */\n // "noUnusedParameters": true, /* Raise an error when a function parameter isn\'t read. */\n // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding \'undefined\'. */\n // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\n // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */\n // "noUncheckedIndexedAccess": true, /* Add \'undefined\' to a type when accessed using an index. */\n // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\n // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\n // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */\n // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */\n /* Completeness */\n // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */\n "skipLibCheck": true, /* Skip type checking all .d.ts files. */\n "plugins": [\n {\n "transform": "typia/lib/transform"\n }\n ],\n "strictNullChecks": true\n },\n "include": ["../../src/api"]\n}',
45
45
  "prettier.config.js": 'module.exports = {\n // DEFAULT CONFIGURATIONS\n parser: "typescript",\n printWidth: 80,\n semi: true,\n tabWidth: 2,\n trailingComma: "all",\n\n // PLUG-IN CONFIGURATIONS\n plugins: ["@trivago/prettier-plugin-sort-imports"],\n importOrder: [\n "<THIRD_PARTY_MODULES>",\n "^@ORGANIZATION/PROJECT-api(.*)$",\n "^[./]",\n ],\n importOrderSeparation: true,\n importOrderSortSpecifiers: true,\n importOrderParserPlugins: ["decorators-legacy", "typescript"],\n};\n',
@@ -79,7 +79,7 @@ const SDK_TEMPLATE = {
79
79
  LICENSE: 'MIT License\n\nCopyright (c) 2024 Jeongho Nam\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.\n',
80
80
  "README.md": '# Software Development Kit\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n## How to Test\n```bash\nnpm install\nnpm start # run only "test/start.ts" file\nnpm run test # everything under the "test/features" directory\nnpm run test:simulate # "test/features" with mockup simulation mode\n```\n\nIf you run `npm start` command, only [test/start.ts](test/start.ts) file would be executed.\n\nOtherwise you run `npm run test` command instead, run everything in the [test/features](test/features) directory.\n\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you\'ve configured the "E2E test function generation mode" of the `@nestia/migrate` (or `@nestia/editor`).\n\n```bash\nnpm install -g @nestia/migrate\nnpx @nestia/migrate\n? Migration mode (Use arrow keys):\n NestJS\n > SDK\n? Swagger file location: assets/input/clickhouse.json\n? Output directory path: assets/output/clickhouse-sdk-manual\n? Mokup Simulator: true\n? E2E Test Functions: true\n```\n\n\n\n\n## Deploy\n```bash\nnpm install\nnpm run deploy\n```\n\nJust run `npm run deploy` command, then your SDK library would be published.\n\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you\'re utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\n\n-----------\n\n> ## What [`Nestia`](https://nestia.io) is:\n> ![Nestia Logo](https://nestia.io/logo.png)\n> \n> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\n> [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\n> [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\n> \n> Nestia is a set of helper libraries for NestJS, supporting below features:\n> \n> - `@nestia/core`: Super-fast decorators\n> - `@nestia/sdk`:\n> - Swagger generator evolved than ever\n> - SDK library generator for clients\n> - Mockup Simulator for client applications\n> - Automatic E2E test functions generator\n> - `@nestia/migrate`: Migration from Swagger to NestJS\n> - `@nestia/editor`: Online TypeScript Swagger Editor\n> - `nestia`: Just CLI (command line interface) tool\n> \n>> **Note**\n>> \n>> - **Only one line** required, with pure TypeScript type\n>> - Enhance performance **30x** up\n>> - Runtime validator is **20,000x faster** than `class-validator`\n>> - JSON serialization is **200x faster** than `class-transformer`\n>> - Software Development Kit\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\n>> - Mockup simulator means embedded backend simulator in SDK\n>> - similar with [msw](https://mswjs.io/), but fully automated',
81
81
  "hello.js": 'function print(command, description) {\n return console.log(`\\x1b[1m${command}\\x1b[2m: ${description}\\x1b[0m`);\n}\n\nconsole.log("-----------------------------------------");\nconsole.log("\\x1b[7mGenerated by \\x1b[2m@nestia/editor\\x1b[0m");\nconsole.log("");\nconsole.log(" - \\x1b[36mhttps://nestia.io/docs/editor\\x1b[0m");\nconsole.log(" - \\x1b[36mhttps://github.com/samchon/nestia\\x1b[0m");\nconsole.log("-----------------------------------------");\n\nprint("npm run start", "Run only test/start.ts");\nprint("npm run test", "Run every test/features/**/*.ts files");\nprint("npm run test:simulate", "Test with mockup simulator");\n',
82
- "package.json": '{\n "name": "@ORGANIZATION/PROJECT-api",\n "version": "0.1.0",\n "description": "SDK library generated by Nestia",\n "main": "lib/index.js",\n "module": "lib/index.mjs",\n "typings": "lib/index.d.ts",\n "scripts": {\n "build": "rimraf lib && tsc && rollup -c",\n "build:test": "rimraf bin && tsc --project test/tsconfig.json",\n "deploy": "npm run build && npm publish",\n "dev": "npm run build:test -- --watch",\n "hello": "node hello",\n "prepare": "ts-patch install",\n "start": "ts-node test/start.ts",\n "swagger": "ts-node test/swagger.ts",\n "test": "ts-node test/index.ts",\n "test:simulate": "ts-node test/index.ts --simulate true"\n },\n "repository": {\n "type": "git",\n "url": "https://github.com/samchon/nestia"\n },\n "author": "Jeongho Nam",\n "license": "MIT",\n "bugs": {\n "url": "https://github.com/samchon/nestia/issues"\n },\n "homepage": "https://nestia.io",\n "files": [\n "lib",\n "swagger.json",\n "package.json",\n "README.md"\n ],\n "dependencies": {\n "@nestia/fetcher": "^11.3.0",\n "tgrid": "^1.2.1",\n "typia": "12.1.0"\n },\n "devDependencies": {\n "@nestia/e2e": "^11.3.0",\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/express": "^4.17.21",\n "@types/inquirer": "8.2.5",\n "@types/swagger-ui-express": "^4.1.6",\n "chalk": "4.1.2",\n "commander": "^10.0.0",\n "express": "^4.19.2",\n "inquirer": "8.2.5",\n "prettier": "^3.2.5",\n "rimraf": "^5.0.5",\n "rollup": "^4.13.2",\n "swagger-ui-express": "^5.0.0",\n "ts-node": "^10.9.2",\n "ts-patch": "^4.0.1",\n "typescript": "~6.0.3",\n "typescript-transform-paths": "^3.5.6"\n }\n}',
82
+ "package.json": '{\n "name": "@ORGANIZATION/PROJECT-api",\n "version": "0.1.0",\n "description": "SDK library generated by Nestia",\n "main": "lib/index.js",\n "module": "lib/index.mjs",\n "typings": "lib/index.d.ts",\n "scripts": {\n "build": "rimraf lib && tsc && rollup -c",\n "build:test": "rimraf bin && tsc --project test/tsconfig.json",\n "deploy": "npm run build && npm publish",\n "dev": "npm run build:test -- --watch",\n "hello": "node hello",\n "prepare": "ts-patch install",\n "start": "ts-node test/start.ts",\n "swagger": "ts-node test/swagger.ts",\n "test": "ts-node test/index.ts",\n "test:simulate": "ts-node test/index.ts --simulate true"\n },\n "repository": {\n "type": "git",\n "url": "https://github.com/samchon/nestia"\n },\n "author": "Jeongho Nam",\n "license": "MIT",\n "bugs": {\n "url": "https://github.com/samchon/nestia/issues"\n },\n "homepage": "https://nestia.io",\n "files": [\n "lib",\n "swagger.json",\n "package.json",\n "README.md"\n ],\n "dependencies": {\n "@nestia/fetcher": "^11.3.1",\n "tgrid": "^1.2.1",\n "typia": "^12.1.0"\n },\n "devDependencies": {\n "@nestia/e2e": "^11.3.1",\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/express": "^4.17.21",\n "@types/inquirer": "8.2.5",\n "@types/swagger-ui-express": "^4.1.6",\n "chalk": "4.1.2",\n "commander": "^10.0.0",\n "express": "^4.19.2",\n "inquirer": "8.2.5",\n "prettier": "^3.2.5",\n "rimraf": "^5.0.5",\n "rollup": "^4.13.2",\n "swagger-ui-express": "^5.0.0",\n "ts-node": "^10.9.2",\n "ts-patch": "^4.0.1",\n "typescript": "~6.0.3",\n "typescript-transform-paths": "^3.5.6"\n }\n}',
83
83
  "prettier.config.js": 'module.exports = {\n // DEFAULT CONFIGURATIONS\n parser: "typescript",\n printWidth: 80,\n semi: true,\n tabWidth: 2,\n trailingComma: "all",\n\n // PLUG-IN CONFIGURATIONS\n plugins: ["@trivago/prettier-plugin-sort-imports"],\n importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],\n importOrderSeparation: true,\n importOrderSortSpecifiers: true,\n importOrderParserPlugins: ["decorators-legacy", "typescript", "jsx"],\n};\n',
84
84
  "rollup.config.js": 'const typescript = require("@rollup/plugin-typescript");\nconst terser = require("@rollup/plugin-terser");\n\nmodule.exports = {\n input: "./src/index.ts",\n output: {\n dir: "lib",\n format: "esm",\n entryFileNames: "[name].mjs",\n sourcemap: true,\n },\n plugins: [\n typescript({\n tsconfig: "tsconfig.json",\n module: "ES2020",\n target: "ES2020",\n }),\n terser({\n format: {\n comments: "some",\n beautify: true,\n ecma: "2020",\n },\n compress: false,\n mangle: false,\n module: true,\n }),\n ],\n};\n',
85
85
  "src/HttpError.ts": 'export { HttpError } from "@nestia/fetcher";\n',
@@ -101,18 +101,63 @@ var FilePrinter;
101
101
  (function(FilePrinter) {
102
102
  FilePrinter.description = (node, comment) => {
103
103
  if (comment.length === 0) return node;
104
- ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, [ "*", ...comment.split("\r\n").join("\n").split("\n").map(str => ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`), "" ].join("\n"), true);
104
+ addSyntheticLeadingComment(node, SyntaxKind.MultiLineCommentTrivia, [ "*", ...comment.split("\r\n").join("\n").split("\n").map(str => ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`), "" ].join("\n"), true);
105
105
  return node;
106
106
  };
107
- FilePrinter.newLine = () => ts.factory.createExpressionStatement(ts.factory.createIdentifier("\n"));
107
+ FilePrinter.newLine = () => factory.createIdentifier("");
108
108
  FilePrinter.write = props => {
109
- const script = ts.createPrinter({
110
- newLine: ts.NewLineKind.LineFeed
111
- }).printFile(ts.factory.createSourceFile(props.statements, ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None));
109
+ const script = new TsPrinter({
110
+ newLine: "\n"
111
+ }).printFile(undefined, props.statements);
112
112
  return (props.top ?? "") + script;
113
113
  };
114
114
  })(FilePrinter || (FilePrinter = {}));
115
115
 
116
+ var ExpressionFactory;
117
+
118
+ (function(ExpressionFactory) {
119
+ ExpressionFactory.number = value => value < 0 ? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value))) : factory.createNumericLiteral(value);
120
+ ExpressionFactory.bigint = value => factory.createCallExpression(factory.createIdentifier("BigInt"), undefined, [ factory.createIdentifier(value.toString()) ]);
121
+ })(ExpressionFactory || (ExpressionFactory = {}));
122
+
123
+ var TypeFactory;
124
+
125
+ (function(TypeFactory) {
126
+ TypeFactory.keyword = type => factory.createKeywordTypeNode(type === "void" ? SyntaxKind.VoidKeyword : type === "any" ? SyntaxKind.AnyKeyword : type === "unknown" ? SyntaxKind.UnknownKeyword : type === "boolean" ? SyntaxKind.BooleanKeyword : type === "number" ? SyntaxKind.NumberKeyword : type === "bigint" ? SyntaxKind.BigIntKeyword : SyntaxKind.StringKeyword);
127
+ })(TypeFactory || (TypeFactory = {}));
128
+
129
+ var IdentifierFactory;
130
+
131
+ (function(IdentifierFactory) {
132
+ IdentifierFactory.identifier = name => NamingConvention.variable(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name);
133
+ IdentifierFactory.access = (input, key, chain) => {
134
+ const postfix = IdentifierFactory.identifier(key);
135
+ return postfix.kind === "StringLiteral" ? chain === true ? factory.createElementAccessChain(input, factory.createToken(SyntaxKind.QuestionDotToken), postfix) : factory.createElementAccessExpression(input, postfix) : chain === true ? factory.createPropertyAccessChain(input, factory.createToken(SyntaxKind.QuestionDotToken), postfix) : factory.createPropertyAccessExpression(input, postfix);
136
+ };
137
+ IdentifierFactory.parameter = (name, type, init) => {
138
+ const optional = init !== undefined && init.kind === "Token" && init.token === SyntaxKind.QuestionToken;
139
+ return factory.createParameterDeclaration(undefined, undefined, name, optional ? factory.createToken(SyntaxKind.QuestionToken) : undefined, type ?? TypeFactory.keyword("any"), optional ? undefined : init);
140
+ };
141
+ })(IdentifierFactory || (IdentifierFactory = {}));
142
+
143
+ var LiteralFactory;
144
+
145
+ (function(LiteralFactory) {
146
+ LiteralFactory.write = input => {
147
+ if (input === null) return factory.createNull(); else if (isFactoryNode(input)) return input; else if (input instanceof Array) return writeArray(input); else if (typeof input === "object") return writeObject(input); else if (typeof input === "boolean") return input ? factory.createTrue() : factory.createFalse(); else if (typeof input === "bigint") return ExpressionFactory.bigint(input); else if (typeof input === "number") return ExpressionFactory.number(input); else if (typeof input === "string") return factory.createStringLiteral(input); else if (typeof input === "function") return factory.createIdentifier("undefined"); else throw new TypeError("Error on LiteralFactory.write(): unknown type.");
148
+ };
149
+ const PASSTHROUGH = new Set([ "ArrowFunction", "CallExpression", "Identifier" ]);
150
+ const isFactoryNode = input => typeof input === "object" && input !== null && typeof input.kind === "string" && PASSTHROUGH.has(input.kind);
151
+ const writeObject = obj => factory.createObjectLiteralExpression(Object.entries(obj).filter(([, value]) => value !== undefined).map(([key, value]) => factory.createPropertyAssignment(IdentifierFactory.identifier(key), LiteralFactory.write(value))), true);
152
+ const writeArray = array => factory.createArrayLiteralExpression(array.map(LiteralFactory.write), true);
153
+ })(LiteralFactory || (LiteralFactory = {}));
154
+
155
+ var StatementFactory;
156
+
157
+ (function(StatementFactory) {
158
+ StatementFactory.constant = props => factory.createVariableStatement(undefined, factory.createVariableDeclarationList([ factory.createVariableDeclaration(props.name, undefined, props.type !== undefined ? props.type : props.value === undefined ? TypeFactory.keyword("any") : undefined, props.value) ], NodeFlags.Const));
159
+ })(StatementFactory || (StatementFactory = {}));
160
+
116
161
  var StringUtil;
117
162
 
118
163
  (function(StringUtil) {
@@ -185,9 +230,9 @@ var NestiaMigrateSchemaProgrammer;
185
230
  })();
186
231
  union.push(type);
187
232
  if (union.length === 0) return TypeFactory.keyword("any"); else if (union.length === 1) return union[0];
188
- return ts.factory.createUnionTypeNode(union);
233
+ return factory.createUnionTypeNode(union);
189
234
  };
190
- const writeConstant = props => ts.factory.createLiteralTypeNode(typeof props.schema.const === "boolean" ? props.schema.const === true ? ts.factory.createTrue() : ts.factory.createFalse() : typeof props.schema.const === "number" ? props.schema.const < 0 ? ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, ts.factory.createNumericLiteral(-props.schema.const)) : ts.factory.createNumericLiteral(props.schema.const) : ts.factory.createStringLiteral(props.schema.const));
235
+ const writeConstant = props => factory.createLiteralTypeNode(typeof props.schema.const === "boolean" ? props.schema.const === true ? factory.createTrue() : factory.createFalse() : typeof props.schema.const === "number" ? props.schema.const < 0 ? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(-props.schema.const)) : factory.createNumericLiteral(props.schema.const) : factory.createStringLiteral(props.schema.const));
191
236
  const writeBoolean = () => TypeFactory.keyword("boolean");
192
237
  const writeInteger = props => writeNumeric({
193
238
  factory: () => [ TypeFactory.keyword("number"), props.importer.tag("Type", "int32") ],
@@ -205,10 +250,10 @@ var NestiaMigrateSchemaProgrammer;
205
250
  if (props.schema.minimum !== undefined) intersection.push(props.importer.tag(props.schema.exclusiveMinimum ? "ExclusiveMinimum" : "Minimum", props.schema.minimum));
206
251
  if (props.schema.maximum !== undefined) intersection.push(props.importer.tag(props.schema.exclusiveMaximum ? "ExclusiveMaximum" : "Maximum", props.schema.maximum));
207
252
  if (props.schema.multipleOf !== undefined) intersection.push(props.importer.tag("MultipleOf", props.schema.multipleOf));
208
- return intersection.length === 1 ? intersection[0] : ts.factory.createIntersectionTypeNode(intersection);
253
+ return intersection.length === 1 ? intersection[0] : factory.createIntersectionTypeNode(intersection);
209
254
  };
210
255
  const writeString = props => {
211
- if (props.schema.format === "binary") return ts.factory.createTypeReferenceNode("File");
256
+ if (props.schema.format === "binary") return factory.createTypeReferenceNode("File");
212
257
  const intersection = [ TypeFactory.keyword("string") ];
213
258
  if (props.schema.default !== undefined) intersection.push(props.importer.tag("Default", props.schema.default));
214
259
  if (props.schema.minLength !== undefined) intersection.push(props.importer.tag("MinLength", props.schema.minLength));
@@ -216,10 +261,10 @@ var NestiaMigrateSchemaProgrammer;
216
261
  if (props.schema.pattern !== undefined) intersection.push(props.importer.tag("Pattern", props.schema.pattern));
217
262
  if (props.schema.format !== undefined && FormatCheatSheet[props.schema.format] !== undefined) intersection.push(props.importer.tag("Format", props.schema.format));
218
263
  if (props.schema.contentMediaType !== undefined) intersection.push(props.importer.tag("ContentMediaType", props.schema.contentMediaType));
219
- return intersection.length === 1 ? intersection[0] : ts.factory.createIntersectionTypeNode(intersection);
264
+ return intersection.length === 1 ? intersection[0] : factory.createIntersectionTypeNode(intersection);
220
265
  };
221
266
  const writeArray = props => {
222
- const intersection = [ ts.factory.createArrayTypeNode(NestiaMigrateSchemaProgrammer.write({
267
+ const intersection = [ factory.createArrayTypeNode(NestiaMigrateSchemaProgrammer.write({
223
268
  components: props.components,
224
269
  importer: props.importer,
225
270
  schema: props.schema.items
@@ -227,31 +272,31 @@ var NestiaMigrateSchemaProgrammer;
227
272
  if (props.schema.minItems !== undefined) intersection.push(props.importer.tag("MinItems", props.schema.minItems));
228
273
  if (props.schema.maxItems !== undefined) intersection.push(props.importer.tag("MaxItems", props.schema.maxItems));
229
274
  if (props.schema.uniqueItems === true) intersection.push(props.importer.tag("UniqueItems"));
230
- return intersection.length === 1 ? intersection[0] : ts.factory.createIntersectionTypeNode(intersection);
275
+ return intersection.length === 1 ? intersection[0] : factory.createIntersectionTypeNode(intersection);
231
276
  };
232
- const writeTuple = props => ts.factory.createTupleTypeNode([ ...props.schema.prefixItems.map(item => NestiaMigrateSchemaProgrammer.write({
277
+ const writeTuple = props => factory.createTupleTypeNode([ ...props.schema.prefixItems.map(item => NestiaMigrateSchemaProgrammer.write({
233
278
  components: props.components,
234
279
  importer: props.importer,
235
280
  schema: item
236
- })), ...typeof props.schema.additionalItems === "object" && props.schema.additionalItems !== null ? [ ts.factory.createRestTypeNode(NestiaMigrateSchemaProgrammer.write({
281
+ })), ...typeof props.schema.additionalItems === "object" && props.schema.additionalItems !== null ? [ factory.createRestTypeNode(NestiaMigrateSchemaProgrammer.write({
237
282
  components: props.components,
238
283
  importer: props.importer,
239
284
  schema: props.schema.additionalItems
240
- })) ] : props.schema.additionalItems === true ? [ ts.factory.createRestTypeNode(ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))) ] : [] ]);
285
+ })) ] : props.schema.additionalItems === true ? [ factory.createRestTypeNode(factory.createArrayTypeNode(factory.createKeywordTypeNode(SyntaxKind.AnyKeyword))) ] : [] ]);
241
286
  const writeObject = props => {
242
- const regular = () => ts.factory.createTypeLiteralNode(Object.entries(props.schema.properties ?? []).map(([key, value], index) => [ ...index !== 0 && (!!value.title?.length || !!value.description?.length) ? [ ts.factory.createIdentifier("\n") ] : [], writeRegularProperty({
287
+ const regular = () => factory.createTypeLiteralNode(Object.entries(props.schema.properties ?? []).map(([key, value], index) => [ ...index !== 0 && (!!value.title?.length || !!value.description?.length) ? [ factory.createIdentifier("\n") ] : [], writeRegularProperty({
243
288
  components: props.components,
244
289
  importer: props.importer,
245
290
  required: props.schema.required ?? [],
246
291
  key,
247
292
  value
248
293
  }) ]).flat());
249
- const dynamic = () => ts.factory.createTypeLiteralNode([ writeDynamicProperty({
294
+ const dynamic = () => factory.createTypeLiteralNode([ writeDynamicProperty({
250
295
  components: props.components,
251
296
  importer: props.importer,
252
297
  schema: props.schema.additionalProperties
253
298
  }) ]);
254
- return !!props.schema.properties?.length && typeof props.schema.additionalProperties === "object" ? ts.factory.createIntersectionTypeNode([ regular(), dynamic() ]) : typeof props.schema.additionalProperties === "object" ? dynamic() : regular();
299
+ return !!props.schema.properties?.length && typeof props.schema.additionalProperties === "object" ? factory.createIntersectionTypeNode([ regular(), dynamic() ]) : typeof props.schema.additionalProperties === "object" ? dynamic() : regular();
255
300
  };
256
301
  const writeRegularProperty = props => {
257
302
  const valueTypeNode = NestiaMigrateSchemaProgrammer.write({
@@ -259,23 +304,23 @@ var NestiaMigrateSchemaProgrammer;
259
304
  importer: props.importer,
260
305
  schema: props.value
261
306
  });
262
- return FilePrinter.description(ts.factory.createPropertySignature(props.value.readOnly ? [ ts.factory.createToken(ts.SyntaxKind.ReadonlyKeyword) ] : undefined, NamingConvention.variable(props.key) ? ts.factory.createIdentifier(props.key) : ts.factory.createStringLiteral(props.key), props.required.includes(props.key) ? undefined : ts.factory.createToken(ts.SyntaxKind.QuestionToken), props.required.includes(props.key) ? valueTypeNode : ts.isUnionTypeNode(valueTypeNode) ? ts.factory.createUnionTypeNode([ ...valueTypeNode.types, ts.factory.createTypeReferenceNode("undefined") ]) : ts.factory.createUnionTypeNode([ valueTypeNode, ts.factory.createTypeReferenceNode("undefined") ])), writeComment$1(props.value));
307
+ return FilePrinter.description(factory.createPropertySignature(props.value.readOnly ? [ factory.createToken(SyntaxKind.ReadonlyKeyword) ] : undefined, NamingConvention.variable(props.key) ? factory.createIdentifier(props.key) : factory.createStringLiteral(props.key), props.required.includes(props.key) ? undefined : factory.createToken(SyntaxKind.QuestionToken), props.required.includes(props.key) ? valueTypeNode : valueTypeNode.kind === "UnionTypeNode" ? factory.createUnionTypeNode([ ...valueTypeNode.types, factory.createTypeReferenceNode("undefined") ]) : factory.createUnionTypeNode([ valueTypeNode, factory.createTypeReferenceNode("undefined") ])), writeComment$1(props.value));
263
308
  };
264
- const writeDynamicProperty = props => FilePrinter.description(ts.factory.createIndexSignature(undefined, [ ts.factory.createParameterDeclaration(undefined, undefined, ts.factory.createIdentifier("key"), undefined, TypeFactory.keyword("string")) ], NestiaMigrateSchemaProgrammer.write(props)), writeComment$1(props.schema));
309
+ const writeDynamicProperty = props => FilePrinter.description(factory.createIndexSignature(undefined, [ factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("key"), undefined, TypeFactory.keyword("string")) ], NestiaMigrateSchemaProgrammer.write(props)), writeComment$1(props.schema));
265
310
  const writeReference = props => {
266
311
  if (props.schema.$ref.startsWith("#/components/schemas") === false) return TypeFactory.keyword("any");
267
312
  const name = props.schema.$ref.split("/").slice(3).filter(str => str.length !== 0).map(StringUtil.escapeNonVariable).join("");
268
313
  if (name === "") return TypeFactory.keyword("any");
269
314
  return props.importer.dto(name);
270
315
  };
271
- const writeUnion = props => ts.factory.createUnionTypeNode(props.elements.map(schema => NestiaMigrateSchemaProgrammer.write({
316
+ const writeUnion = props => factory.createUnionTypeNode(props.elements.map(schema => NestiaMigrateSchemaProgrammer.write({
272
317
  components: props.components,
273
318
  importer: props.importer,
274
319
  schema
275
320
  })));
276
321
  })(NestiaMigrateSchemaProgrammer || (NestiaMigrateSchemaProgrammer = {}));
277
322
 
278
- const createNode = text => ts.factory.createTypeReferenceNode(text);
323
+ const createNode = text => factory.createTypeReferenceNode(text);
279
324
 
280
325
  const writeComment$1 = schema => {
281
326
  const plugins = [];
@@ -304,23 +349,23 @@ const COMMENT_TAGS = [ "@format", "@pattern", "@length", "@minLength", "@maxLeng
304
349
  var NestiaMigrateApiFunctionProgrammer;
305
350
 
306
351
  (function(NestiaMigrateApiFunctionProgrammer) {
307
- NestiaMigrateApiFunctionProgrammer.write = ctx => FilePrinter.description(ts.factory.createFunctionDeclaration([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword), ts.factory.createModifier(ts.SyntaxKind.AsyncKeyword) ], undefined, ctx.route.accessor.at(-1), undefined, NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx), ts.factory.createTypeReferenceNode("Promise", [ ts.factory.createTypeReferenceNode(ctx.route.success === null ? "void" : `${ctx.route.accessor.at(-1)}.Response`) ]), ts.factory.createBlock(writeBody(ctx), true)), writeDescription(ctx.config, ctx.route));
352
+ NestiaMigrateApiFunctionProgrammer.write = ctx => FilePrinter.description(factory.createFunctionDeclaration([ factory.createModifier(SyntaxKind.ExportKeyword), factory.createModifier(SyntaxKind.AsyncKeyword) ], undefined, ctx.route.accessor.at(-1), undefined, NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx), factory.createTypeReferenceNode("Promise", [ factory.createTypeReferenceNode(ctx.route.success === null ? "void" : `${ctx.route.accessor.at(-1)}.Response`) ]), factory.createBlock(writeBody(ctx), true)), writeDescription(ctx.config, ctx.route));
308
353
  NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations = (ctx, connectionName) => {
309
- const connection = IdentifierFactory.parameter(connectionName ?? "connection", ts.factory.createTypeReferenceNode(ctx.importer.external({
354
+ const connection = IdentifierFactory.parameter(connectionName ?? "connection", factory.createTypeReferenceNode(ctx.importer.external({
310
355
  type: "instance",
311
356
  library: "@nestia/fetcher",
312
357
  name: "IConnection"
313
- }), ctx.route.headers ? [ ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Headers`) ] : undefined));
358
+ }), ctx.route.headers ? [ factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Headers`) ] : undefined));
314
359
  if (ctx.config.keyword === true) {
315
360
  const isProps = ctx.route.parameters.length > 0 || !!ctx.route.query || !!ctx.route.body;
316
361
  if (isProps === false) return [ connection ];
317
- return [ connection, ts.factory.createParameterDeclaration(undefined, undefined, "props", undefined, ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Props`)) ];
362
+ return [ connection, factory.createParameterDeclaration(undefined, undefined, "props", undefined, factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Props`)) ];
318
363
  }
319
364
  return [ connection, ...ctx.route.parameters.map(p => IdentifierFactory.parameter(p.key, NestiaMigrateSchemaProgrammer.write({
320
365
  components: ctx.components,
321
366
  importer: ctx.importer,
322
367
  schema: p.schema
323
- }))), ...ctx.route.query ? [ IdentifierFactory.parameter(ctx.route.query.key, ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`)) ] : [], ...ctx.route.body ? [ IdentifierFactory.parameter(ctx.route.body.key, ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Body`), (ctx.route.body.type === "application/json" || ctx.route.body.type === "text/plain") && ctx.route.operation().requestBody?.required === false ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : undefined) ] : [] ];
368
+ }))), ...ctx.route.query ? [ IdentifierFactory.parameter(ctx.route.query.key, factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`)) ] : [], ...ctx.route.body ? [ IdentifierFactory.parameter(ctx.route.body.key, factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Body`), (ctx.route.body.type === "application/json" || ctx.route.body.type === "text/plain") && ctx.route.operation().requestBody?.required === false ? factory.createToken(SyntaxKind.QuestionToken) : undefined) ] : [] ];
324
369
  };
325
370
  const writeDescription = (config, route) => {
326
371
  const comment = route.comment();
@@ -329,24 +374,24 @@ var NestiaMigrateApiFunctionProgrammer;
329
374
  const writeBody = ctx => {
330
375
  const encrypted = !!ctx.route.success?.["x-nestia-encrypted"];
331
376
  const contentType = ctx.route.body?.type ?? "application/json";
332
- const property = key => ctx.config.keyword === true ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key) : ts.factory.createIdentifier(key);
333
- const fetch = () => ts.factory.createAwaitExpression(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.importer.external({
377
+ const property = key => ctx.config.keyword === true ? IdentifierFactory.access(factory.createIdentifier("props"), key) : factory.createIdentifier(key);
378
+ const fetch = () => factory.createAwaitExpression(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
334
379
  type: "instance",
335
380
  library: encrypted ? "@nestia/fetcher/lib/EncryptedFetcher" : `@nestia/fetcher`,
336
381
  name: encrypted ? "EncryptedFetcher" : "PlainFetcher"
337
- })), "fetch"), undefined, [ contentType && contentType !== "multipart/form-data" ? ts.factory.createObjectLiteralExpression([ ts.factory.createSpreadAssignment(ts.factory.createIdentifier("connection")), ts.factory.createPropertyAssignment("headers", ts.factory.createObjectLiteralExpression([ ts.factory.createSpreadAssignment(IdentifierFactory.access(ts.factory.createIdentifier("connection"), "headers")), ts.factory.createPropertyAssignment(ts.factory.createStringLiteral("Content-Type"), ts.factory.createStringLiteral(contentType)) ], true)) ], true) : ts.factory.createIdentifier("connection"), ts.factory.createObjectLiteralExpression([ ts.factory.createSpreadAssignment(IdentifierFactory.access(ts.factory.createIdentifier(ctx.route.accessor.at(-1)), "METADATA")), ts.factory.createPropertyAssignment("path", ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.route.accessor.at(-1)), "path"), undefined, getArguments(ctx, false))), ts.factory.createPropertyAssignment("status", ts.factory.createNull()) ], true), ...ctx.route.body ? [ property(ctx.route.body.key) ] : [] ]));
338
- const value = ctx.config.simulate !== true ? fetch() : ts.factory.createConditionalExpression(ts.factory.createStrictEquality(ts.factory.createTrue(), ts.factory.createIdentifier("connection.simulate")), undefined, ts.factory.createCallExpression(ts.factory.createIdentifier(`${ctx.route.accessor.at(-1)}.simulate`), [], [ ts.factory.createIdentifier("connection"), ...getArguments(ctx, true) ]), undefined, fetch());
382
+ })), "fetch"), undefined, [ contentType && contentType !== "multipart/form-data" ? factory.createObjectLiteralExpression([ factory.createSpreadAssignment(factory.createIdentifier("connection")), factory.createPropertyAssignment("headers", factory.createObjectLiteralExpression([ factory.createSpreadAssignment(IdentifierFactory.access(factory.createIdentifier("connection"), "headers")), factory.createPropertyAssignment(factory.createStringLiteral("Content-Type"), factory.createStringLiteral(contentType)) ], true)) ], true) : factory.createIdentifier("connection"), factory.createObjectLiteralExpression([ factory.createSpreadAssignment(IdentifierFactory.access(factory.createIdentifier(ctx.route.accessor.at(-1)), "METADATA")), factory.createPropertyAssignment("path", factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.route.accessor.at(-1)), "path"), undefined, getArguments(ctx, false))), factory.createPropertyAssignment("status", factory.createNull()) ], true), ...ctx.route.body ? [ property(ctx.route.body.key) ] : [] ]));
383
+ const value = ctx.config.simulate !== true ? fetch() : factory.createConditionalExpression(factory.createStrictEquality(factory.createTrue(), factory.createIdentifier("connection.simulate")), undefined, factory.createCallExpression(factory.createIdentifier(`${ctx.route.accessor.at(-1)}.simulate`), [], [ factory.createIdentifier("connection"), ...getArguments(ctx, true) ]), undefined, fetch());
339
384
  const headers = getHeaders(ctx.route.comment());
340
- if (headers.length === 0) return [ ts.factory.createReturnStatement(value) ];
385
+ if (headers.length === 0) return [ factory.createReturnStatement(value) ];
341
386
  return [ StatementFactory.constant({
342
387
  name: "output",
343
- type: ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Response`),
388
+ type: factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Response`),
344
389
  value
345
- }), ts.factory.createExpressionStatement(ts.factory.createBinaryExpression(ts.factory.createIdentifier("connection.headers"), ts.factory.createToken(ts.SyntaxKind.QuestionQuestionEqualsToken), ts.factory.createObjectLiteralExpression([]))), ...headers.map(h => ts.factory.createExpressionStatement(h.type === "assign" ? ts.factory.createCallExpression(ts.factory.createIdentifier("Object.assign"), undefined, [ ts.factory.createIdentifier("connection.headers"), ts.factory.createIdentifier(`output.${h.accessor}`) ]) : ts.factory.createBinaryExpression(ts.factory.createIdentifier(`connection.headers${NamingConvention.variable(h.property) ? `.${h.property}` : `[${JSON.stringify(h.property)}]`}`), ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createIdentifier(`output.${h.accessor}`)))), ts.factory.createReturnStatement(ts.factory.createIdentifier("output")) ];
390
+ }), factory.createExpressionStatement(factory.createBinaryExpression(factory.createIdentifier("connection.headers"), factory.createToken(SyntaxKind.QuestionQuestionEqualsToken), factory.createObjectLiteralExpression([]))), ...headers.map(h => factory.createExpressionStatement(h.type === "assign" ? factory.createCallExpression(factory.createIdentifier("Object.assign"), undefined, [ factory.createIdentifier("connection.headers"), factory.createIdentifier(`output.${h.accessor}`) ]) : factory.createBinaryExpression(factory.createIdentifier(`connection.headers${NamingConvention.variable(h.property) ? `.${h.property}` : `[${JSON.stringify(h.property)}]`}`), factory.createToken(SyntaxKind.EqualsToken), factory.createIdentifier(`output.${h.accessor}`)))), factory.createReturnStatement(factory.createIdentifier("output")) ];
346
391
  };
347
392
  const getArguments = (ctx, body) => {
348
- if (ctx.route.parameters.length === 0 && ctx.route.query === null && (body === false || ctx.route.body === null)) return []; else if (ctx.config.keyword === true) return [ ts.factory.createIdentifier("props") ];
349
- return [ ...ctx.route.parameters.map(p => ts.factory.createIdentifier(p.key)), ...ctx.route.query ? [ ts.factory.createIdentifier(ctx.route.query.key) ] : [], ...body && ctx.route.body ? [ ts.factory.createIdentifier(ctx.route.body.key) ] : [] ];
393
+ if (ctx.route.parameters.length === 0 && ctx.route.query === null && (body === false || ctx.route.body === null)) return []; else if (ctx.config.keyword === true) return [ factory.createIdentifier("props") ];
394
+ return [ ...ctx.route.parameters.map(p => factory.createIdentifier(p.key)), ...ctx.route.query ? [ factory.createIdentifier(ctx.route.query.key) ] : [], ...body && ctx.route.body ? [ factory.createIdentifier(ctx.route.body.key) ] : [] ];
350
395
  };
351
396
  const getHeaders = description => {
352
397
  const directives = [];
@@ -379,18 +424,18 @@ var NestiaMigrateApiSimulationProgrammer;
379
424
  importer: ctx.importer,
380
425
  schema: ctx.route.success.schema
381
426
  }) : TypeFactory.keyword("void");
382
- return constant$1("random", ts.factory.createArrowFunction(undefined, undefined, [], output, undefined, ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.importer.external({
427
+ return constant$1("random", factory.createArrowFunction(undefined, undefined, [], output, undefined, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
383
428
  type: "default",
384
429
  library: "typia",
385
430
  name: "typia"
386
431
  })), "random"), [ output ], undefined)));
387
432
  };
388
433
  NestiaMigrateApiSimulationProgrammer.simulate = ctx => {
389
- const caller = () => ts.factory.createCallExpression(ts.factory.createIdentifier("random"), undefined, undefined);
390
- return constant$1("simulate", ts.factory.createArrowFunction(undefined, undefined, NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx, ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null ? "_connection" : undefined), ts.factory.createTypeReferenceNode(ctx.route.success ? "Response" : "void"), undefined, ts.factory.createBlock([ ...assert(ctx), ts.factory.createReturnStatement(caller()) ], true)));
434
+ const caller = () => factory.createCallExpression(factory.createIdentifier("random"), undefined, undefined);
435
+ return constant$1("simulate", factory.createArrowFunction(undefined, undefined, NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx, ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null ? "_connection" : undefined), factory.createTypeReferenceNode(ctx.route.success ? "Response" : "void"), undefined, factory.createBlock([ ...assert(ctx), factory.createReturnStatement(caller()) ], true)));
391
436
  };
392
437
  const assert = ctx => {
393
- const property = key => ctx.config.keyword === true ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key) : ts.factory.createIdentifier(key);
438
+ const property = key => ctx.config.keyword === true ? IdentifierFactory.access(factory.createIdentifier("props"), key) : factory.createIdentifier(key);
394
439
  const parameters = [ ...ctx.route.parameters.map(p => ({
395
440
  category: "param",
396
441
  name: p.key,
@@ -419,47 +464,47 @@ var NestiaMigrateApiSimulationProgrammer;
419
464
  if (parameters.length === 0) return [];
420
465
  const validator = StatementFactory.constant({
421
466
  name: "assert",
422
- value: ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.importer.external({
467
+ value: factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
423
468
  type: "instance",
424
469
  library: `@nestia/fetcher`,
425
470
  name: "NestiaSimulator"
426
- })), "assert"), undefined, [ ts.factory.createObjectLiteralExpression([ ts.factory.createPropertyAssignment("method", ts.factory.createIdentifier("METADATA.method")), ts.factory.createPropertyAssignment("host", ts.factory.createIdentifier("connection.host")), ts.factory.createPropertyAssignment("path", NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(ctx.config, ctx.route)), ts.factory.createPropertyAssignment("contentType", ts.factory.createStringLiteral(ctx.route.success?.type ?? "application/json")) ], true) ])
471
+ })), "assert"), undefined, [ factory.createObjectLiteralExpression([ factory.createPropertyAssignment("method", factory.createIdentifier("METADATA.method")), factory.createPropertyAssignment("host", factory.createIdentifier("connection.host")), factory.createPropertyAssignment("path", NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(ctx.config, ctx.route)), factory.createPropertyAssignment("contentType", factory.createStringLiteral(ctx.route.success?.type ?? "application/json")) ], true) ])
427
472
  });
428
- const individual = parameters.map(p => ts.factory.createCallExpression((() => {
429
- const base = IdentifierFactory.access(ts.factory.createIdentifier("assert"), p.category);
473
+ const individual = parameters.map(p => factory.createCallExpression((() => {
474
+ const base = IdentifierFactory.access(factory.createIdentifier("assert"), p.category);
430
475
  if (p.category !== "param") return base;
431
- return ts.factory.createCallExpression(base, undefined, [ ts.factory.createStringLiteral(p.name) ]);
432
- })(), undefined, [ ts.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.importer.external({
476
+ return factory.createCallExpression(base, undefined, [ factory.createStringLiteral(p.name) ]);
477
+ })(), undefined, [ factory.createArrowFunction(undefined, undefined, [], undefined, undefined, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
433
478
  type: "default",
434
479
  library: "typia",
435
480
  name: "typia"
436
- })), "assert"), undefined, [ p.category === "headers" ? ts.factory.createIdentifier("connection.headers") : property(p.name) ])) ])).map(ts.factory.createExpressionStatement);
481
+ })), "assert"), undefined, [ p.category === "headers" ? factory.createIdentifier("connection.headers") : property(p.name) ])) ])).map(factory.createExpressionStatement);
437
482
  return [ validator, tryAndCatch(ctx.importer, individual) ];
438
483
  };
439
- const tryAndCatch = (importer, individual) => ts.factory.createTryStatement(ts.factory.createBlock(individual, true), ts.factory.createCatchClause("exp", ts.factory.createBlock([ ts.factory.createIfStatement(ts.factory.createLogicalNot(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(importer.external({
484
+ const tryAndCatch = (importer, individual) => factory.createTryStatement(factory.createBlock(individual, true), factory.createCatchClause("exp", factory.createBlock([ factory.createIfStatement(factory.createLogicalNot(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(importer.external({
440
485
  type: "default",
441
486
  library: "typia",
442
487
  name: "typia"
443
- })), "is"), [ ts.factory.createTypeReferenceNode(importer.external({
488
+ })), "is"), [ factory.createTypeReferenceNode(importer.external({
444
489
  type: "instance",
445
490
  library: "@nestia/fetcher",
446
491
  name: "HttpError"
447
- })) ], [ ts.factory.createIdentifier("exp") ])), ts.factory.createThrowStatement(ts.factory.createIdentifier("exp"))), ts.factory.createReturnStatement(ts.factory.createAsExpression(ts.factory.createObjectLiteralExpression([ ts.factory.createPropertyAssignment("success", ts.factory.createFalse()), ts.factory.createPropertyAssignment("status", ts.factory.createIdentifier("exp.status")), ts.factory.createPropertyAssignment("headers", ts.factory.createIdentifier("exp.headers")), ts.factory.createPropertyAssignment("data", ts.factory.createIdentifier("exp.toJSON().message")) ], true), TypeFactory.keyword("any"))) ], true)), undefined);
492
+ })) ], [ factory.createIdentifier("exp") ])), factory.createThrowStatement(factory.createIdentifier("exp"))), factory.createReturnStatement(factory.createAsExpression(factory.createObjectLiteralExpression([ factory.createPropertyAssignment("success", factory.createFalse()), factory.createPropertyAssignment("status", factory.createIdentifier("exp.status")), factory.createPropertyAssignment("headers", factory.createIdentifier("exp.headers")), factory.createPropertyAssignment("data", factory.createIdentifier("exp.toJSON().message")) ], true), TypeFactory.keyword("any"))) ], true)), undefined);
448
493
  })(NestiaMigrateApiSimulationProgrammer || (NestiaMigrateApiSimulationProgrammer = {}));
449
494
 
450
- const constant$1 = (name, expression) => ts.factory.createVariableStatement([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword) ], ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration(ts.factory.createIdentifier(name), undefined, undefined, expression) ], ts.NodeFlags.Const));
495
+ const constant$1 = (name, expression) => factory.createVariableStatement([ factory.createModifier(SyntaxKind.ExportKeyword) ], factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.createIdentifier(name), undefined, undefined, expression) ], NodeFlags.Const));
451
496
 
452
497
  var NestiaMigrateApiNamespaceProgrammer;
453
498
 
454
499
  (function(NestiaMigrateApiNamespaceProgrammer) {
455
500
  NestiaMigrateApiNamespaceProgrammer.write = ctx => {
456
501
  const types = writeTypes(ctx);
457
- return ts.factory.createModuleDeclaration([ ts.factory.createToken(ts.SyntaxKind.ExportKeyword) ], ts.factory.createIdentifier(ctx.route.accessor.at(-1)), ts.factory.createModuleBlock([ ...types, ...types.length ? [ FilePrinter.newLine() ] : [], writeMetadata(ctx), FilePrinter.newLine(), writePathFunction(ctx), ...ctx.config.simulate === true ? [ NestiaMigrateApiSimulationProgrammer.random(ctx), NestiaMigrateApiSimulationProgrammer.simulate(ctx) ] : [] ]), ts.NodeFlags.Namespace);
502
+ return factory.createModuleDeclaration([ factory.createToken(SyntaxKind.ExportKeyword) ], factory.createIdentifier(ctx.route.accessor.at(-1)), factory.createModuleBlock([ ...types, ...types.length ? [ FilePrinter.newLine() ] : [], writeMetadata(ctx), FilePrinter.newLine(), writePathFunction(ctx), ...ctx.config.simulate === true ? [ NestiaMigrateApiSimulationProgrammer.random(ctx), NestiaMigrateApiSimulationProgrammer.simulate(ctx) ] : [] ]), NodeFlags.Namespace);
458
503
  };
459
- NestiaMigrateApiNamespaceProgrammer.writePathCallExpression = (config, route) => ts.factory.createCallExpression(ts.factory.createIdentifier(`${route.accessor.at(-1)}.path`), undefined, route.parameters.length === 0 && route.query === null ? [] : config.keyword === true ? [ ts.factory.createIdentifier("props") ] : [ ...route.parameters, ...route.query ? [ route.query ] : [] ].map(p => ts.factory.createIdentifier(p.key)));
504
+ NestiaMigrateApiNamespaceProgrammer.writePathCallExpression = (config, route) => factory.createCallExpression(factory.createIdentifier(`${route.accessor.at(-1)}.path`), undefined, route.parameters.length === 0 && route.query === null ? [] : config.keyword === true ? [ factory.createIdentifier("props") ] : [ ...route.parameters, ...route.query ? [ route.query ] : [] ].map(p => factory.createIdentifier(p.key)));
460
505
  const writeTypes = ctx => {
461
506
  const array = [];
462
- const declare = (name, type) => array.push(ts.factory.createTypeAliasDeclaration([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword) ], name, undefined, type));
507
+ const declare = (name, type) => array.push(factory.createTypeAliasDeclaration([ factory.createModifier(SyntaxKind.ExportKeyword) ], name, undefined, type));
463
508
  if (ctx.config.keyword === true && (ctx.route.parameters.length > 0 || ctx.route.query || ctx.route.body)) declare("Props", NestiaMigrateSchemaProgrammer.write({
464
509
  components: ctx.components,
465
510
  importer: ctx.importer,
@@ -501,13 +546,13 @@ var NestiaMigrateApiNamespaceProgrammer;
501
546
  }));
502
547
  return array;
503
548
  };
504
- const writeMetadata = ctx => constant("METADATA", ts.factory.createAsExpression(ts.factory.createObjectLiteralExpression([ ts.factory.createPropertyAssignment("method", ts.factory.createStringLiteral(ctx.route.method.toUpperCase())), ts.factory.createPropertyAssignment("path", ts.factory.createStringLiteral(getPath(ctx.route))), ts.factory.createPropertyAssignment("request", ctx.route.body ? LiteralFactory.write({
549
+ const writeMetadata = ctx => constant("METADATA", factory.createAsExpression(factory.createObjectLiteralExpression([ factory.createPropertyAssignment("method", factory.createStringLiteral(ctx.route.method.toUpperCase())), factory.createPropertyAssignment("path", factory.createStringLiteral(getPath(ctx.route))), factory.createPropertyAssignment("request", ctx.route.body ? LiteralFactory.write({
505
550
  type: ctx.route.body.type,
506
551
  encrypted: !!ctx.route.body["x-nestia-encrypted"]
507
- }) : ts.factory.createNull()), ts.factory.createPropertyAssignment("response", ctx.route.method.toUpperCase() !== "HEAD" ? LiteralFactory.write({
552
+ }) : factory.createNull()), factory.createPropertyAssignment("response", ctx.route.method.toUpperCase() !== "HEAD" ? LiteralFactory.write({
508
553
  type: ctx.route.success?.type ?? "application/json",
509
554
  encrypted: !!ctx.route.success?.["x-nestia-encrypted"]
510
- }) : ts.factory.createNull()), ...ctx.route.success?.type === "application/x-www-form-urlencoded" ? [ ts.factory.createPropertyAssignment("parseQuery", ts.factory.createCallExpression(ts.factory.createIdentifier(`${ctx.importer.external({
555
+ }) : factory.createNull()), ...ctx.route.success?.type === "application/x-www-form-urlencoded" ? [ factory.createPropertyAssignment("parseQuery", factory.createCallExpression(factory.createIdentifier(`${ctx.importer.external({
511
556
  type: "default",
512
557
  library: "typia",
513
558
  name: "typia"
@@ -515,55 +560,55 @@ var NestiaMigrateApiNamespaceProgrammer;
515
560
  components: ctx.components,
516
561
  importer: ctx.importer,
517
562
  schema: ctx.route.success.schema
518
- }) ], undefined)) ] : [] ], true), ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("const"))));
563
+ }) ], undefined)) ] : [] ], true), factory.createTypeReferenceNode(factory.createIdentifier("const"))));
519
564
  const writePathFunction = ctx => {
520
565
  const empty = ctx.route.parameters.length === 0 && ctx.route.query === null;
521
- const property = key => ctx.config.keyword === true ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key) : ts.factory.createIdentifier(key);
522
- const out = body => constant("path", ts.factory.createArrowFunction([], [], empty ? [] : ctx.config.keyword === true ? [ IdentifierFactory.parameter("props", ctx.route.body ? ts.factory.createTypeReferenceNode("Omit", [ ts.factory.createTypeReferenceNode("Props"), ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(ctx.route.body.key)) ]) : ts.factory.createTypeReferenceNode("Props")) ] : [ ...ctx.route.parameters.map(p => IdentifierFactory.parameter(p.key, NestiaMigrateSchemaProgrammer.write({
566
+ const property = key => ctx.config.keyword === true ? IdentifierFactory.access(factory.createIdentifier("props"), key) : factory.createIdentifier(key);
567
+ const out = body => constant("path", factory.createArrowFunction([], [], empty ? [] : ctx.config.keyword === true ? [ IdentifierFactory.parameter("props", ctx.route.body ? factory.createTypeReferenceNode("Omit", [ factory.createTypeReferenceNode("Props"), factory.createLiteralTypeNode(factory.createStringLiteral(ctx.route.body.key)) ]) : factory.createTypeReferenceNode("Props")) ] : [ ...ctx.route.parameters.map(p => IdentifierFactory.parameter(p.key, NestiaMigrateSchemaProgrammer.write({
523
568
  components: ctx.components,
524
569
  importer: ctx.importer,
525
570
  schema: p.schema
526
- }))), ...ctx.route.query ? [ IdentifierFactory.parameter(ctx.route.query.key, ts.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`)) ] : [] ], undefined, undefined, body));
571
+ }))), ...ctx.route.query ? [ IdentifierFactory.parameter(ctx.route.query.key, factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`)) ] : [] ], undefined, undefined, body));
527
572
  const template = () => {
528
573
  const path = getPath(ctx.route);
529
574
  const split = path.split(":");
530
- if (split.length === 1) return ts.factory.createStringLiteral(path);
531
- return ts.factory.createTemplateExpression(ts.factory.createTemplateHead(split[0]), split.slice(1).map((s, i, arr) => {
575
+ if (split.length === 1) return factory.createStringLiteral(path);
576
+ return factory.createTemplateExpression(factory.createTemplateHead(split[0]), split.slice(1).map((s, i, arr) => {
532
577
  const name = s.split("/")[0];
533
- return ts.factory.createTemplateSpan(ts.factory.createCallExpression(ts.factory.createIdentifier("encodeURIComponent"), undefined, [ ts.factory.createBinaryExpression(property(ctx.route.parameters.find(p => p.name === name).key), ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken), ts.factory.createStringLiteral("null")) ]), (i !== arr.length - 1 ? ts.factory.createTemplateMiddle : ts.factory.createTemplateTail)(s.substring(name.length)));
578
+ return factory.createTemplateSpan(factory.createCallExpression(factory.createIdentifier("encodeURIComponent"), undefined, [ factory.createBinaryExpression(property(ctx.route.parameters.find(p => p.name === name).key), factory.createToken(SyntaxKind.QuestionQuestionToken), factory.createStringLiteral("null")) ]), (i !== arr.length - 1 ? factory.createTemplateMiddle : factory.createTemplateTail)(s.substring(name.length)));
534
579
  }));
535
580
  };
536
581
  if (!ctx.route.query) return out(template());
537
582
  const computeName = str => ctx.route.parameters.find(p => p.key === str) !== undefined ? computeName("_" + str) : str;
538
583
  const variables = computeName("variables");
539
- return out(ts.factory.createBlock([ local({
584
+ return out(factory.createBlock([ local({
540
585
  name: variables,
541
586
  type: "URLSearchParams",
542
- expression: ts.factory.createNewExpression(ts.factory.createIdentifier("URLSearchParams"), [], [])
543
- }), ts.factory.createForOfStatement(undefined, ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration(ts.factory.createArrayBindingPattern([ ts.factory.createBindingElement(undefined, undefined, ts.factory.createIdentifier("key"), undefined), ts.factory.createBindingElement(undefined, undefined, ts.factory.createIdentifier("value"), undefined) ]), undefined, undefined, undefined) ], ts.NodeFlags.Const), ts.factory.createCallExpression(ts.factory.createIdentifier("Object.entries"), undefined, [ ts.factory.createAsExpression(property(ctx.route.query.key), TypeFactory.keyword("any")) ]), ts.factory.createIfStatement(ts.factory.createStrictEquality(ts.factory.createIdentifier("undefined"), ts.factory.createIdentifier("value")), ts.factory.createContinueStatement(), ts.factory.createIfStatement(ts.factory.createCallExpression(ts.factory.createIdentifier("Array.isArray"), undefined, [ ts.factory.createIdentifier("value") ]), ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("value"), ts.factory.createIdentifier("forEach")), undefined, [ ts.factory.createArrowFunction(undefined, undefined, [ IdentifierFactory.parameter("elem") ], undefined, undefined, ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(variables), "append"), undefined, [ ts.factory.createIdentifier("key"), ts.factory.createCallExpression(ts.factory.createIdentifier("String"), undefined, [ ts.factory.createIdentifier("elem") ]) ])) ])), ts.factory.createExpressionStatement(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(variables), "set"), undefined, [ ts.factory.createIdentifier("key"), ts.factory.createCallExpression(ts.factory.createIdentifier("String"), undefined, [ ts.factory.createIdentifier("value") ]) ]))))), local({
587
+ expression: factory.createNewExpression(factory.createIdentifier("URLSearchParams"), [], [])
588
+ }), factory.createForOfStatement(undefined, factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.createArrayBindingPattern([ factory.createBindingElement(undefined, undefined, factory.createIdentifier("key"), undefined), factory.createBindingElement(undefined, undefined, factory.createIdentifier("value"), undefined) ]), undefined, undefined, undefined) ], NodeFlags.Const), factory.createCallExpression(factory.createIdentifier("Object.entries"), undefined, [ factory.createAsExpression(property(ctx.route.query.key), TypeFactory.keyword("any")) ]), factory.createIfStatement(factory.createStrictEquality(factory.createIdentifier("undefined"), factory.createIdentifier("value")), factory.createContinueStatement(), factory.createIfStatement(factory.createCallExpression(factory.createIdentifier("Array.isArray"), undefined, [ factory.createIdentifier("value") ]), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("value"), factory.createIdentifier("forEach")), undefined, [ factory.createArrowFunction(undefined, undefined, [ IdentifierFactory.parameter("elem") ], undefined, undefined, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "append"), undefined, [ factory.createIdentifier("key"), factory.createCallExpression(factory.createIdentifier("String"), undefined, [ factory.createIdentifier("elem") ]) ])) ])), factory.createExpressionStatement(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "set"), undefined, [ factory.createIdentifier("key"), factory.createCallExpression(factory.createIdentifier("String"), undefined, [ factory.createIdentifier("value") ]) ]))))), local({
544
589
  name: "location",
545
590
  type: "string",
546
591
  expression: template()
547
- }), ts.factory.createReturnStatement(ts.factory.createConditionalExpression(ts.factory.createStrictEquality(ExpressionFactory.number(0), IdentifierFactory.access(ts.factory.createIdentifier(variables), "size")), undefined, ts.factory.createIdentifier("location"), undefined, ts.factory.createTemplateExpression(ts.factory.createTemplateHead(""), [ ts.factory.createTemplateSpan(ts.factory.createIdentifier("location"), ts.factory.createTemplateMiddle("?")), ts.factory.createTemplateSpan(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(variables), "toString"), undefined, undefined), ts.factory.createTemplateTail("")) ]))) ], true));
592
+ }), factory.createReturnStatement(factory.createConditionalExpression(factory.createStrictEquality(ExpressionFactory.number(0), IdentifierFactory.access(factory.createIdentifier(variables), "size")), undefined, factory.createIdentifier("location"), undefined, factory.createTemplateExpression(factory.createTemplateHead(""), [ factory.createTemplateSpan(factory.createIdentifier("location"), factory.createTemplateMiddle("?")), factory.createTemplateSpan(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "toString"), undefined, undefined), factory.createTemplateTail("")) ]))) ], true));
548
593
  };
549
594
  })(NestiaMigrateApiNamespaceProgrammer || (NestiaMigrateApiNamespaceProgrammer = {}));
550
595
 
551
- const constant = (name, expression) => ts.factory.createVariableStatement([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword) ], ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration(name, undefined, undefined, expression) ], ts.NodeFlags.Const));
596
+ const constant = (name, expression) => factory.createVariableStatement([ factory.createModifier(SyntaxKind.ExportKeyword) ], factory.createVariableDeclarationList([ factory.createVariableDeclaration(name, undefined, undefined, expression) ], NodeFlags.Const));
552
597
 
553
598
  const getPath = route => (route.emendedPath.startsWith("/") ? "" : "/") + route.emendedPath;
554
599
 
555
- const local = props => ts.factory.createVariableStatement([], ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration(props.name, undefined, ts.factory.createTypeReferenceNode(props.type), props.expression) ], ts.NodeFlags.Const));
600
+ const local = props => factory.createVariableStatement([], factory.createVariableDeclarationList([ factory.createVariableDeclaration(props.name, undefined, factory.createTypeReferenceNode(props.type), props.expression) ], NodeFlags.Const));
556
601
 
557
602
  var TypeLiteralFactory;
558
603
 
559
604
  (function(TypeLiteralFactory) {
560
- TypeLiteralFactory.generate = value => typeof value === "boolean" ? generateBoolean(value) : typeof value === "number" ? generateNumber(value) : typeof value === "string" ? generatestring(value) : typeof value === "object" ? value === null ? generateNull() : Array.isArray(value) ? generateTuple(value) : generateObject(value) : ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword);
561
- const generatestring = str => ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(str));
562
- const generateNumber = num => ts.factory.createLiteralTypeNode(num < 0 ? ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, ts.factory.createNumericLiteral(-num)) : ts.factory.createNumericLiteral(num));
563
- const generateBoolean = bool => ts.factory.createLiteralTypeNode(bool ? ts.factory.createTrue() : ts.factory.createFalse());
564
- const generateNull = () => ts.factory.createLiteralTypeNode(ts.factory.createNull());
565
- const generateTuple = items => ts.factory.createTupleTypeNode(items.map(TypeLiteralFactory.generate));
566
- const generateObject = obj => ts.factory.createTypeLiteralNode(Object.entries(obj).map(([key, value]) => ts.factory.createPropertySignature(undefined, NamingConvention.variable(key) ? ts.factory.createIdentifier(key) : ts.factory.createStringLiteral(key), undefined, TypeLiteralFactory.generate(value))));
605
+ TypeLiteralFactory.generate = value => typeof value === "boolean" ? generateBoolean(value) : typeof value === "number" ? generateNumber(value) : typeof value === "string" ? generatestring(value) : typeof value === "object" ? value === null ? generateNull() : Array.isArray(value) ? generateTuple(value) : generateObject(value) : factory.createKeywordTypeNode(SyntaxKind.AnyKeyword);
606
+ const generatestring = str => factory.createLiteralTypeNode(factory.createStringLiteral(str));
607
+ const generateNumber = num => factory.createLiteralTypeNode(num < 0 ? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(-num)) : factory.createNumericLiteral(num));
608
+ const generateBoolean = bool => factory.createLiteralTypeNode(bool ? factory.createTrue() : factory.createFalse());
609
+ const generateNull = () => factory.createLiteralTypeNode(factory.createNull());
610
+ const generateTuple = items => factory.createTupleTypeNode(items.map(TypeLiteralFactory.generate));
611
+ const generateObject = obj => factory.createTypeLiteralNode(Object.entries(obj).map(([key, value]) => factory.createPropertySignature(undefined, NamingConvention.variable(key) ? factory.createIdentifier(key) : factory.createStringLiteral(key), undefined, TypeLiteralFactory.generate(value))));
567
612
  })(TypeLiteralFactory || (TypeLiteralFactory = {}));
568
613
 
569
614
  var MapUtil;
@@ -598,7 +643,7 @@ class NestiaMigrateImportProgrammer {
598
643
  dto(name, namespace) {
599
644
  const file = name.split(".")[0];
600
645
  this.dtos_.add(file);
601
- return ts.factory.createTypeReferenceNode(namespace?.length ? ts.factory.createQualifiedName(ts.factory.createIdentifier(namespace), ts.factory.createIdentifier(file)) : name);
646
+ return factory.createTypeReferenceNode(namespace?.length ? factory.createQualifiedName(factory.createIdentifier(namespace), factory.createIdentifier(file)) : name);
602
647
  }
603
648
  tag(type, arg) {
604
649
  const instance = this.external({
@@ -606,10 +651,10 @@ class NestiaMigrateImportProgrammer {
606
651
  library: "typia",
607
652
  name: "tags"
608
653
  });
609
- return ts.factory.createTypeReferenceNode(`${instance}.${type}`, arg === undefined ? [] : [ TypeLiteralFactory.generate(arg) ]);
654
+ return factory.createTypeReferenceNode(`${instance}.${type}`, arg === undefined ? [] : [ TypeLiteralFactory.generate(arg) ]);
610
655
  }
611
656
  toStatements(dtoPath, current) {
612
- return [ ...[ ...this.external_.entries() ].map(([library, props]) => ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, props.default !== null ? ts.factory.createIdentifier(props.default) : undefined, props.instances.size ? ts.factory.createNamedImports([ ...props.instances ].map(i => ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(i)))) : undefined), ts.factory.createStringLiteral(library))), ...this.external_.size && this.dtos_.size ? [ FilePrinter.newLine() ] : [], ...[ ...this.dtos_ ].filter(current ? name => name !== current.split(".")[0] : () => true).map(i => ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(i)) ])), ts.factory.createStringLiteral(dtoPath(i)))) ];
657
+ return [ ...[ ...this.external_.entries() ].map(([library, props]) => factory.createImportDeclaration(undefined, factory.createImportClause(false, props.default !== null ? factory.createIdentifier(props.default) : undefined, props.instances.size ? factory.createNamedImports([ ...props.instances ].map(i => factory.createImportSpecifier(false, undefined, factory.createIdentifier(i)))) : undefined), factory.createStringLiteral(library))), ...this.external_.size && this.dtos_.size ? [ FilePrinter.newLine() ] : [], ...[ ...this.dtos_ ].filter(current ? name => name !== current.split(".")[0] : () => true).map(i => factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([ factory.createImportSpecifier(false, undefined, factory.createIdentifier(i)) ])), factory.createStringLiteral(dtoPath(i)))) ];
613
658
  }
614
659
  }
615
660
 
@@ -629,7 +674,7 @@ var NestiaMigrateApiFileProgrammer;
629
674
  importer,
630
675
  route
631
676
  }) ]).flat();
632
- return [ ...importer.toStatements(ref => `../${"../".repeat(props.namespace.length)}structures/${ref}`), ...[ ...props.children ].map(child => ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(child)), ts.factory.createStringLiteral(`./${child}/index`), undefined)), ...statements ];
677
+ return [ ...importer.toStatements(ref => `../${"../".repeat(props.namespace.length)}structures/${ref}`), ...[ ...props.children ].map(child => factory.createExportDeclaration(undefined, false, factory.createNamespaceExport(factory.createIdentifier(child)), factory.createStringLiteral(`./${child}/index`))), ...statements ];
633
678
  };
634
679
  })(NestiaMigrateApiFileProgrammer || (NestiaMigrateApiFileProgrammer = {}));
635
680
 
@@ -660,7 +705,7 @@ var NestiaMigrateDtoProgrammer;
660
705
  });
661
706
  return modulo;
662
707
  };
663
- const writeAlias = config => components => importer => (key, value) => FilePrinter.description(ts.factory.createTypeAliasDeclaration([ ts.factory.createToken(ts.SyntaxKind.ExportKeyword) ], key.split(".").at(-1), [], NestiaMigrateSchemaProgrammer.write({
708
+ const writeAlias = config => components => importer => (key, value) => FilePrinter.description(factory.createTypeAliasDeclaration([ factory.createToken(SyntaxKind.ExportKeyword) ], key.split(".").at(-1), [], NestiaMigrateSchemaProgrammer.write({
664
709
  components,
665
710
  importer,
666
711
  schema: value
@@ -724,7 +769,7 @@ var NestiaMigrateApiProgrammer;
724
769
  if (modulo.children.size !== 0) {
725
770
  const internal = [];
726
771
  for (const child of modulo.children.values()) internal.push(...iterate(importer, child));
727
- output.push(ts.factory.createModuleDeclaration([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword) ], ts.factory.createIdentifier(modulo.name), ts.factory.createModuleBlock(internal), ts.NodeFlags.Namespace));
772
+ output.push(factory.createModuleDeclaration([ factory.createModifier(SyntaxKind.ExportKeyword) ], factory.createIdentifier(modulo.name), factory.createModuleBlock(internal), NodeFlags.Namespace));
728
773
  }
729
774
  output.push(FilePrinter.newLine());
730
775
  return output;
@@ -734,35 +779,35 @@ var NestiaMigrateApiProgrammer;
734
779
  var NestiaMigrateE2eFunctionProgrammer;
735
780
 
736
781
  (function(NestiaMigrateE2eFunctionProgrammer) {
737
- NestiaMigrateE2eFunctionProgrammer.write = ctx => ts.factory.createFunctionDeclaration([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword), ts.factory.createModifier(ts.SyntaxKind.AsyncKeyword) ], undefined, [ "test", "api", ...ctx.route.accessor ].join("_"), undefined, [ IdentifierFactory.parameter("connection", ts.factory.createTypeReferenceNode(ts.factory.createQualifiedName(ts.factory.createIdentifier(ctx.importer.external({
782
+ NestiaMigrateE2eFunctionProgrammer.write = ctx => factory.createFunctionDeclaration([ factory.createModifier(SyntaxKind.ExportKeyword), factory.createModifier(SyntaxKind.AsyncKeyword) ], undefined, [ "test", "api", ...ctx.route.accessor ].join("_"), undefined, [ IdentifierFactory.parameter("connection", factory.createTypeReferenceNode(factory.createQualifiedName(factory.createIdentifier(ctx.importer.external({
738
783
  type: "default",
739
784
  library: "@ORGANIZATION/PROJECT-api",
740
785
  name: "api"
741
- })), ts.factory.createIdentifier("IConnection")))) ], undefined, ts.factory.createBlock(NestiaMigrateE2eFunctionProgrammer.writeBody(ctx), true));
742
- NestiaMigrateE2eFunctionProgrammer.writeBody = ctx => [ ts.factory.createVariableStatement([], ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration("output", undefined, ctx.route.success ? NestiaMigrateSchemaProgrammer.write({
786
+ })), factory.createIdentifier("IConnection")))) ], undefined, factory.createBlock(NestiaMigrateE2eFunctionProgrammer.writeBody(ctx), true));
787
+ NestiaMigrateE2eFunctionProgrammer.writeBody = ctx => [ factory.createVariableStatement([], factory.createVariableDeclarationList([ factory.createVariableDeclaration("output", undefined, ctx.route.success ? NestiaMigrateSchemaProgrammer.write({
743
788
  components: ctx.components,
744
789
  importer: ctx.importer,
745
790
  schema: ctx.route.success.schema
746
- }) : undefined, ts.factory.createAwaitExpression(writeCallExpressionn(ctx))) ], ts.NodeFlags.Const)), ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(ctx.importer.external({
791
+ }) : undefined, factory.createAwaitExpression(writeCallExpressionn(ctx))) ], NodeFlags.Const)), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier(ctx.importer.external({
747
792
  type: "default",
748
793
  library: "typia",
749
794
  name: "typia"
750
- })), "assert"), undefined, [ ts.factory.createIdentifier("output") ])) ];
795
+ })), "assert"), undefined, [ factory.createIdentifier("output") ])) ];
751
796
  const writeCallExpressionn = ctx => {
752
- const fetch = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("api.functional"), ts.factory.createIdentifier(ctx.route.accessor.join(".")));
753
- const connection = ts.factory.createIdentifier("connection");
754
- if (ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null) return ts.factory.createCallExpression(fetch, undefined, [ connection ]);
755
- const random = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(ctx.importer.external({
797
+ const fetch = factory.createPropertyAccessExpression(factory.createIdentifier("api.functional"), factory.createIdentifier(ctx.route.accessor.join(".")));
798
+ const connection = factory.createIdentifier("connection");
799
+ if (ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null) return factory.createCallExpression(fetch, undefined, [ connection ]);
800
+ const random = factory.createPropertyAccessExpression(factory.createIdentifier(ctx.importer.external({
756
801
  type: "default",
757
802
  library: "typia",
758
803
  name: "typia"
759
804
  })), "random");
760
- if (ctx.config.keyword === true) return ts.factory.createCallExpression(fetch, undefined, [ connection, LiteralFactory.write(Object.fromEntries([ ...ctx.route.parameters, ctx.route.query, ctx.route.body ].filter(x => x !== null).map(({key, schema: value}) => [ key, ts.factory.createCallExpression(random, [ NestiaMigrateSchemaProgrammer.write({
805
+ if (ctx.config.keyword === true) return factory.createCallExpression(fetch, undefined, [ connection, LiteralFactory.write(Object.fromEntries([ ...ctx.route.parameters, ctx.route.query, ctx.route.body ].filter(x => x !== null).map(({key, schema: value}) => [ key, factory.createCallExpression(random, [ NestiaMigrateSchemaProgrammer.write({
761
806
  components: ctx.components,
762
807
  importer: ctx.importer,
763
808
  schema: value
764
809
  }) ], undefined) ]))) ]);
765
- return ts.factory.createCallExpression(fetch, undefined, [ connection, ...[ ...ctx.route.parameters, ctx.route.query, ctx.route.body ].filter(p => !!p).map(p => ts.factory.createCallExpression(random, [ NestiaMigrateSchemaProgrammer.write({
810
+ return factory.createCallExpression(fetch, undefined, [ connection, ...[ ...ctx.route.parameters, ctx.route.query, ctx.route.body ].filter(p => !!p).map(p => factory.createCallExpression(random, [ NestiaMigrateSchemaProgrammer.write({
766
811
  components: ctx.components,
767
812
  importer: ctx.importer,
768
813
  schema: p.schema
@@ -776,7 +821,7 @@ var NestiaMigrateApiStartProgrammer;
776
821
  NestiaMigrateApiStartProgrammer.write = context => {
777
822
  const importer = new NestiaMigrateImportProgrammer;
778
823
  const main = writeMain(context, importer, pick(context.application.routes));
779
- const statements = [ ...importer.toStatements(name => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`), FilePrinter.newLine(), ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier("TestGlobal")) ])), ts.factory.createStringLiteral("./TestGlobal"), undefined), FilePrinter.newLine(), main, ts.factory.createExpressionStatement(writeStarter()) ];
824
+ const statements = [ ...importer.toStatements(name => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`), FilePrinter.newLine(), factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([ factory.createImportSpecifier(false, undefined, factory.createIdentifier("TestGlobal")) ])), factory.createStringLiteral("./TestGlobal")), FilePrinter.newLine(), main, factory.createExpressionStatement(writeStarter()) ];
780
825
  return {
781
826
  "test/start.ts": FilePrinter.write({
782
827
  statements
@@ -785,19 +830,19 @@ var NestiaMigrateApiStartProgrammer;
785
830
  };
786
831
  const writeMain = (ctx, importer, route) => StatementFactory.constant({
787
832
  name: "main",
788
- value: ts.factory.createArrowFunction([ ts.factory.createToken(ts.SyntaxKind.AsyncKeyword) ], undefined, [], undefined, undefined, ts.factory.createBlock([ writeConnection(ctx, importer), ...NestiaMigrateE2eFunctionProgrammer.writeBody({
833
+ value: factory.createArrowFunction([ factory.createToken(SyntaxKind.AsyncKeyword) ], undefined, [], undefined, undefined, factory.createBlock([ writeConnection(ctx, importer), ...NestiaMigrateE2eFunctionProgrammer.writeBody({
789
834
  config: ctx.config,
790
835
  components: ctx.application.document().components,
791
836
  importer,
792
837
  route
793
838
  }) ], true))
794
839
  });
795
- const writeConnection = (ctx, importer) => ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([ ts.factory.createVariableDeclaration("connection", undefined, ts.factory.createTypeReferenceNode(ts.factory.createQualifiedName(ts.factory.createIdentifier(importer.external({
840
+ const writeConnection = (ctx, importer) => factory.createVariableStatement(undefined, factory.createVariableDeclarationList([ factory.createVariableDeclaration("connection", undefined, factory.createTypeReferenceNode(factory.createQualifiedName(factory.createIdentifier(importer.external({
796
841
  type: "default",
797
842
  library: "@ORGANIZATION/PROJECT-api",
798
843
  name: "api"
799
- })), ts.factory.createIdentifier("IConnection"))), ts.factory.createObjectLiteralExpression([ ts.factory.createSpreadAssignment(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("TestGlobal"), "connection"), undefined, undefined)), ...ctx.application.document().servers?.[0]?.url?.length ? [ ts.factory.createPropertyAssignment("host", ts.factory.createStringLiteral(ctx.application.document().servers[0].url)) ] : [], ...ctx.config.simulate === true ? [ ts.factory.createPropertyAssignment("simulate", ts.factory.createTrue()) ] : [] ], true)) ], ts.NodeFlags.Const));
800
- const writeStarter = () => ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createIdentifier("main"), undefined, undefined), "catch"), undefined, [ ts.factory.createArrowFunction(undefined, undefined, [ IdentifierFactory.parameter("exp") ], undefined, undefined, ts.factory.createBlock([ ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("console"), "log"), undefined, [ ts.factory.createIdentifier("exp") ])), ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("process"), "exit"), undefined, [ ts.factory.createPrefixMinus(ts.factory.createNumericLiteral("1")) ])) ], true)) ]);
844
+ })), factory.createIdentifier("IConnection"))), factory.createObjectLiteralExpression([ factory.createSpreadAssignment(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("TestGlobal"), "connection"), undefined, undefined)), ...ctx.application.document().servers?.[0]?.url?.length ? [ factory.createPropertyAssignment("host", factory.createStringLiteral(ctx.application.document().servers[0].url)) ] : [], ...ctx.config.simulate === true ? [ factory.createPropertyAssignment("simulate", factory.createTrue()) ] : [] ], true)) ], NodeFlags.Const));
845
+ const writeStarter = () => factory.createCallExpression(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("main"), undefined, undefined), "catch"), undefined, [ factory.createArrowFunction(undefined, undefined, [ IdentifierFactory.parameter("exp") ], undefined, undefined, factory.createBlock([ factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("console"), "log"), undefined, [ factory.createIdentifier("exp") ])), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("process"), "exit"), undefined, [ factory.createPrefixMinus(factory.createNumericLiteral("1")) ])) ], true)) ]);
801
846
  })(NestiaMigrateApiStartProgrammer || (NestiaMigrateApiStartProgrammer = {}));
802
847
 
803
848
  const pick = array => {
@@ -875,7 +920,7 @@ var NestiaMigrateNestMethodProgrammer;
875
920
  importer: ctx.importer,
876
921
  schema: ctx.route.success.schema
877
922
  }) : TypeFactory.keyword("void");
878
- const method = ts.factory.createMethodDeclaration([ ...writeMethodDecorators(ctx), ts.factory.createToken(ts.SyntaxKind.PublicKeyword), ts.factory.createToken(ts.SyntaxKind.AsyncKeyword) ], undefined, ctx.route.accessor.at(-1), undefined, undefined, writeParameters(ctx), ts.factory.createTypeReferenceNode("Promise", [ output ]), ts.factory.createBlock([ ...[ ...ctx.route.parameters.map(p => p.key), ...ctx.route.headers ? [ "headers" ] : [], ...ctx.route.query ? [ "query" ] : [], ...ctx.route.body ? [ "body" ] : [] ].map(str => ts.factory.createExpressionStatement(ts.factory.createIdentifier(str))), ts.factory.createReturnStatement(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(ctx.importer.external({
923
+ const method = factory.createMethodDeclaration([ ...writeMethodDecorators(ctx), factory.createToken(SyntaxKind.PublicKeyword), factory.createToken(SyntaxKind.AsyncKeyword) ], undefined, ctx.route.accessor.at(-1), undefined, undefined, writeParameters(ctx), factory.createTypeReferenceNode("Promise", [ output ]), factory.createBlock([ ...[ ...ctx.route.parameters.map(p => p.key), ...ctx.route.headers ? [ "headers" ] : [], ...ctx.route.query ? [ "query" ] : [], ...ctx.route.body ? [ "body" ] : [] ].map(str => factory.createExpressionStatement(factory.createIdentifier(str))), factory.createReturnStatement(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
879
924
  type: "default",
880
925
  library: "typia",
881
926
  name: "typia"
@@ -884,29 +929,29 @@ var NestiaMigrateNestMethodProgrammer;
884
929
  };
885
930
  const writeDescription = (config, method) => [ method.comment(), `@${config.author?.tag ?? "nestia"} ${config.author?.value ?? "Generated by Nestia - https://github.com/samchon/nestia"}` ].join("\n");
886
931
  const writeMethodDecorators = ctx => {
887
- const external = (lib, instance) => ts.factory.createIdentifier(ctx.importer.external({
932
+ const external = (lib, instance) => factory.createIdentifier(ctx.importer.external({
888
933
  type: "instance",
889
934
  library: lib,
890
935
  name: instance
891
936
  }));
892
937
  const decorators = [];
893
938
  if (ctx.route.success) decorators.push(...writeExampleDecorators("Response")(ctx.importer)(ctx.route.success.media()));
894
- if (ctx.route.operation()["x-samchon-human"] === true) decorators.push(ts.factory.createDecorator(ts.factory.createCallExpression(external("@nestia/core", "HumanRoute"), undefined, undefined)));
939
+ if (ctx.route.operation()["x-samchon-human"] === true) decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestia/core", "HumanRoute"), undefined, undefined)));
895
940
  const localPath = ctx.route.emendedPath.slice(ctx.controller.path.length).split("/").filter(str => !!str.length).join("/");
896
- const router = instance => ts.factory.createDecorator(ts.factory.createCallExpression(IdentifierFactory.access(external("@nestia/core", instance), StringUtil.capitalize(ctx.route.method)), [], localPath.length ? [ ts.factory.createStringLiteral(localPath) ] : undefined));
897
- if (ctx.route.success?.["x-nestia-encrypted"]) decorators.push(router("EncryptedRoute")); else if (ctx.route.success?.type === "text/plain") decorators.push(ts.factory.createDecorator(ts.factory.createCallExpression(external("@nestjs/common", StringUtil.capitalize(ctx.route.method)), [], [ ts.factory.createStringLiteral(ctx.route.path) ]))); else if (ctx.route.success?.type === "application/x-www-form-urlencoded") decorators.push(router("TypedQuery")); else if (ctx.route.method === "head") decorators.push(ts.factory.createDecorator(ts.factory.createCallExpression(external("@nestjs/common", "Head"), [], [ ts.factory.createStringLiteral(ctx.route.path) ]))); else if (ctx.route.success === null || ctx.route.success?.type === "application/json") decorators.push(router("TypedRoute"));
898
- for (const [key, value] of Object.entries(ctx.route.exceptions ?? {})) decorators.push(ts.factory.createDecorator(ts.factory.createCallExpression(external("@nestia/core", "TypedException"), [ NestiaMigrateSchemaProgrammer.write({
941
+ const router = instance => factory.createDecorator(factory.createCallExpression(IdentifierFactory.access(external("@nestia/core", instance), StringUtil.capitalize(ctx.route.method)), [], localPath.length ? [ factory.createStringLiteral(localPath) ] : undefined));
942
+ if (ctx.route.success?.["x-nestia-encrypted"]) decorators.push(router("EncryptedRoute")); else if (ctx.route.success?.type === "text/plain") decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestjs/common", StringUtil.capitalize(ctx.route.method)), [], [ factory.createStringLiteral(ctx.route.path) ]))); else if (ctx.route.success?.type === "application/x-www-form-urlencoded") decorators.push(router("TypedQuery")); else if (ctx.route.method === "head") decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestjs/common", "Head"), [], [ factory.createStringLiteral(ctx.route.path) ]))); else if (ctx.route.success === null || ctx.route.success?.type === "application/json") decorators.push(router("TypedRoute"));
943
+ for (const [key, value] of Object.entries(ctx.route.exceptions ?? {})) decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestia/core", "TypedException"), [ NestiaMigrateSchemaProgrammer.write({
899
944
  components: ctx.components,
900
945
  importer: ctx.importer,
901
946
  schema: value.schema
902
- }) ], [ isNaN(Number(key)) ? ts.factory.createStringLiteral(key) : ExpressionFactory.number(Number(key)), ...value.response().description?.length ? [ ts.factory.createStringLiteral(value.response().description) ] : [] ])));
947
+ }) ], [ isNaN(Number(key)) ? factory.createStringLiteral(key) : ExpressionFactory.number(Number(key)), ...value.response().description?.length ? [ factory.createStringLiteral(value.response().description) ] : [] ])));
903
948
  return decorators;
904
949
  };
905
- const writeParameters = ctx => [ ...ctx.route.parameters.map(p => ts.factory.createParameterDeclaration([ ...writeExampleDecorators("Parameter")(ctx.importer)(p.parameter()), ts.factory.createDecorator(ts.factory.createCallExpression(ts.factory.createIdentifier(ctx.importer.external({
950
+ const writeParameters = ctx => [ ...ctx.route.parameters.map(p => factory.createParameterDeclaration([ ...writeExampleDecorators("Parameter")(ctx.importer)(p.parameter()), factory.createDecorator(factory.createCallExpression(factory.createIdentifier(ctx.importer.external({
906
951
  type: "instance",
907
952
  library: "@nestia/core",
908
953
  name: "TypedParam"
909
- })), undefined, [ ts.factory.createStringLiteral(p.key) ])) ], undefined, p.key, undefined, NestiaMigrateSchemaProgrammer.write({
954
+ })), undefined, [ factory.createStringLiteral(p.key) ])) ], undefined, p.key, undefined, NestiaMigrateSchemaProgrammer.write({
910
955
  components: ctx.components,
911
956
  importer: ctx.importer,
912
957
  schema: p.schema
@@ -931,7 +976,7 @@ var NestiaMigrateNestMethodProgrammer;
931
976
  }) ] : [], ...ctx.route.body ? [ writeDtoParameter({
932
977
  method: ctx.route.body["x-nestia-encrypted"] ? "EncryptedBody" : ctx.route.body.type === "application/json" ? "TypedBody" : ctx.route.body.type === "application/x-www-form-urlencoded" ? [ "TypedQuery", "Body" ] : ctx.route.body.type === "text/plain" ? "PlainBody" : ctx.route.body.type === "multipart/form-data" ? [ "TypedFormData", "Body" ] : "TypedBody",
933
978
  variable: "body",
934
- arguments: ctx.route.body.type === "multipart/form-data" ? [ ts.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.factory.createCallExpression(ts.factory.createIdentifier(ctx.importer.external({
979
+ arguments: ctx.route.body.type === "multipart/form-data" ? [ factory.createArrowFunction(undefined, undefined, [], undefined, undefined, factory.createCallExpression(factory.createIdentifier(ctx.importer.external({
935
980
  type: "default",
936
981
  library: "multer",
937
982
  name: "Multer"
@@ -943,26 +988,26 @@ var NestiaMigrateNestMethodProgrammer;
943
988
  examples: ctx.route.body.media().examples
944
989
  }) ] : [] ];
945
990
  const writeDtoParameter = accessor => components => importer => props => {
946
- const instance = ts.factory.createIdentifier(importer.external({
991
+ const instance = factory.createIdentifier(importer.external({
947
992
  type: "instance",
948
993
  library: "@nestia/core",
949
994
  name: typeof accessor.method === "string" ? accessor.method : accessor.method[0]
950
995
  }));
951
- return ts.factory.createParameterDeclaration([ ...writeExampleDecorators("Parameter")(importer)(props), ts.factory.createDecorator(ts.factory.createCallExpression(typeof accessor.method === "string" ? instance : IdentifierFactory.access(instance, accessor.method[1]), undefined, accessor.arguments)) ], undefined, accessor.variable, props.required === false ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : undefined, NestiaMigrateSchemaProgrammer.write({
996
+ return factory.createParameterDeclaration([ ...writeExampleDecorators("Parameter")(importer)(props), factory.createDecorator(factory.createCallExpression(typeof accessor.method === "string" ? instance : IdentifierFactory.access(instance, accessor.method[1]), undefined, accessor.arguments)) ], undefined, accessor.variable, props.required === false ? factory.createToken(SyntaxKind.QuestionToken) : undefined, NestiaMigrateSchemaProgrammer.write({
952
997
  components,
953
998
  importer,
954
999
  schema: props.schema
955
1000
  }));
956
1001
  };
957
- const writeExampleDecorators = kind => importer => media => [ ...media.example !== undefined ? [ ts.factory.createDecorator(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(importer.external({
1002
+ const writeExampleDecorators = kind => importer => media => [ ...media.example !== undefined ? [ factory.createDecorator(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(importer.external({
958
1003
  type: "instance",
959
1004
  library: "@nestia/core",
960
1005
  name: "SwaggerExample"
961
- })), kind), [], [ LiteralFactory.write(media.example) ])) ] : [], ...Object.entries(media.examples ?? {}).map(([key, value]) => ts.factory.createDecorator(ts.factory.createCallExpression(IdentifierFactory.access(ts.factory.createIdentifier(importer.external({
1006
+ })), kind), [], [ LiteralFactory.write(media.example) ])) ] : [], ...Object.entries(media.examples ?? {}).map(([key, value]) => factory.createDecorator(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(importer.external({
962
1007
  type: "instance",
963
1008
  library: "@nestia/core",
964
1009
  name: "SwaggerExample"
965
- })), kind), [], [ ts.factory.createStringLiteral(key), LiteralFactory.write(value) ]))) ];
1010
+ })), kind), [], [ factory.createStringLiteral(key), LiteralFactory.write(value) ]))) ];
966
1011
  })(NestiaMigrateNestMethodProgrammer || (NestiaMigrateNestMethodProgrammer = {}));
967
1012
 
968
1013
  var NestiaMigrateNestControllerProgrammer;
@@ -970,11 +1015,11 @@ var NestiaMigrateNestControllerProgrammer;
970
1015
  (function(NestiaMigrateNestControllerProgrammer) {
971
1016
  NestiaMigrateNestControllerProgrammer.write = props => {
972
1017
  const importer = new NestiaMigrateImportProgrammer;
973
- const $class = ts.factory.createClassDeclaration([ ts.factory.createDecorator(ts.factory.createCallExpression(ts.factory.createIdentifier(importer.external({
1018
+ const $class = factory.createClassDeclaration([ factory.createDecorator(factory.createCallExpression(factory.createIdentifier(importer.external({
974
1019
  type: "instance",
975
1020
  library: "@nestjs/common",
976
1021
  name: "Controller"
977
- })), [], [ ts.factory.createStringLiteral(props.controller.path) ])), ts.factory.createToken(ts.SyntaxKind.ExportKeyword) ], props.controller.name, [], [], props.controller.routes.map((route, index) => [ ...index !== 0 ? [ FilePrinter.newLine() ] : [], (props.config.programmer?.controllerMethod ?? NestiaMigrateNestMethodProgrammer.write)({
1022
+ })), [], [ factory.createStringLiteral(props.controller.path) ])), factory.createToken(SyntaxKind.ExportKeyword) ], props.controller.name, [], [], props.controller.routes.map((route, index) => [ ...index !== 0 ? [ FilePrinter.newLine() ] : [], (props.config.programmer?.controllerMethod ?? NestiaMigrateNestMethodProgrammer.write)({
978
1023
  config: props.config,
979
1024
  components: props.components,
980
1025
  controller: props.controller,
@@ -988,10 +1033,10 @@ var NestiaMigrateNestControllerProgrammer;
988
1033
  var NestiaMigrateNestModuleProgrammer;
989
1034
 
990
1035
  (function(NestiaMigrateNestModuleProgrammer) {
991
- NestiaMigrateNestModuleProgrammer.write = controllers => [ $import("@nestjs/common")("Module"), ...controllers.length ? [ FilePrinter.newLine() ] : [], ...controllers.map(c => $import(`${c.location.replace("src/", "./")}/${c.name}`)(c.name)), ...controllers.length ? [ FilePrinter.newLine() ] : [], ts.factory.createClassDeclaration([ ts.factory.createDecorator(ts.factory.createCallExpression(ts.factory.createIdentifier("Module"), undefined, [ ts.factory.createObjectLiteralExpression([ ts.factory.createPropertyAssignment(ts.factory.createIdentifier("controllers"), ts.factory.createArrayLiteralExpression(controllers.map(c => ts.factory.createIdentifier(c.name)), true)) ], true) ])), ts.factory.createToken(ts.SyntaxKind.ExportKeyword) ], "MyModule", undefined, undefined, []) ];
1036
+ NestiaMigrateNestModuleProgrammer.write = controllers => [ $import("@nestjs/common")("Module"), ...controllers.length ? [ FilePrinter.newLine() ] : [], ...controllers.map(c => $import(`${c.location.replace("src/", "./")}/${c.name}`)(c.name)), ...controllers.length ? [ FilePrinter.newLine() ] : [], factory.createClassDeclaration([ factory.createDecorator(factory.createCallExpression(factory.createIdentifier("Module"), undefined, [ factory.createObjectLiteralExpression([ factory.createPropertyAssignment(factory.createIdentifier("controllers"), factory.createArrayLiteralExpression(controllers.map(c => factory.createIdentifier(c.name)), true)) ], true) ])), factory.createToken(SyntaxKind.ExportKeyword) ], "MyModule", undefined, undefined, []) ];
992
1037
  })(NestiaMigrateNestModuleProgrammer || (NestiaMigrateNestModuleProgrammer = {}));
993
1038
 
994
- const $import = file => instance => ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(instance)) ])), ts.factory.createStringLiteral(file));
1039
+ const $import = file => instance => factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([ factory.createImportSpecifier(false, undefined, factory.createIdentifier(instance)) ])), factory.createStringLiteral(file));
995
1040
 
996
1041
  var NestiaMigrateNestProgrammer;
997
1042
 
@@ -1022,7 +1067,7 @@ var NestiaMigrateNestProgrammer;
1022
1067
  if (modulo.children.size) {
1023
1068
  const internal = [];
1024
1069
  for (const child of modulo.children.values()) internal.push(...iterate(importer)(child));
1025
- output.push(ts.factory.createModuleDeclaration([ ts.factory.createModifier(ts.SyntaxKind.ExportKeyword) ], ts.factory.createIdentifier(modulo.name), ts.factory.createModuleBlock(internal), ts.NodeFlags.Namespace));
1070
+ output.push(factory.createModuleDeclaration([ factory.createModifier(SyntaxKind.ExportKeyword) ], factory.createIdentifier(modulo.name), factory.createModuleBlock(internal), NodeFlags.Namespace));
1026
1071
  }
1027
1072
  output.push(FilePrinter.newLine());
1028
1073
  return output;