@nestia/migrate 7.3.3 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,16 +8,16 @@ export const NEST_TEMPLATE: Record<string, string> = {
8
8
  ".vscode/launch.json": "{\n // Use IntelliSense to learn about possible Node.js debug attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"type\": \"node\",\n \"request\": \"launch\",\n \"name\": \"Backend Test\",\n \"program\": \"${workspaceRoot}/test/index.ts\",\n \"cwd\": \"${workspaceRoot}\",\n \"args\": [\n // //----\n // // Not possible to reset DB in debugging mode\n // //\n // // Therefore, if you need DB reset, then do it \n // // through `npm run reset-for-debugging` command\n // //----\n // \"--reset\", \"false\",\n // \"--mode\", \"local\",\n \n //----\n // You can run specific test functions\n //\n // If you want to include or exclude multiple words,\n // then separate them with space character\n //----\n // \"--include\", \"some-words-to-include\",\n // \"--exclude\", \"some-word another-word\",\n ],\n \"outFiles\": [\"${workspaceRoot}/bin/**/*.js\"],\n }\n]\n}",
9
9
  ".vscode/settings.json": "{\n \"editor.tabSize\": 2,\n \"editor.formatOnSave\": true,\n \"[javascript][typescript]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.codeActionsOnSave\": {\n \"source.fixAll.eslint\": \"explicit\"\n },\n }\n}",
10
10
  "LICENSE": "MIT License\n\nCopyright (c) 2022 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",
11
- "README.md": "# Nestia Template\n## Outline\n[![Build Status](https://github.com/samchon/nestia-start/workflows/build/badge.svg)](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\n\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\n\nYou can create a new project from this boilerplate by running below command:\n\n```bash\nnpx nestia start <directory>\n```\n\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \n\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\n\n\n\n\n## Directories and Files\nThis template project has categorized directories like below.\n\nAs you can see from the below, all of the Backend source files are placed into the [src](src/) directory. When you build the TypeScript source files, compiled files would be placed into the `lib` directory following the [tsconfig.json](tsconfig.json) configuration. Otherwise you build client [SDK](#32-sdk) library for npm publishing and their compiled files would be placed into the [packages](packages) directory.\n\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\n - [src/](src): Backend source directory\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\n - [**src/api/structures/**](src/api/structures/): DTO structures\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\n - [**test/**](test): Test Automation Program\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\n - [package.json](package.json): NPM configuration\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\n\n\n\n\n## NPM Run Commands\nList of the run commands defined in the [package.json](package.json) are like below:\n\n - Test\n - **`test`**: Run test automation program\n - `benchmark`: Run performance benchmark program\n - Build\n - `build`: Build everything\n - `build:main`: Build main program (`src` directory)\n - `build:test` Build test automation program (`test` directory)\n - `build:sdk`: Build SDK into main program only\n - `build:swagger`: Build Swagger Documents\n - **`dev`**: Incremental build for development (test program)\n - Deploy\n - `package:api`: Build and deploy the SDK library to the NPM\n - `start`: Start the backend server\n - `start:dev`: Start the backend server with incremental build and reload\n - Webpack\n - `webpack`: Run webpack bundler\n - `webpack:start`: Start the backend server built by webpack\n - `webpack:test`: Run test program to the webpack built\n\n\n\n\n## Specialization\nTransform this template project to be yours.\n\nWhen you've created a new backend project through this template project, you can specialize it to be suitable for you by changing some words. Replace below words through IDE specific function like `Edit > Replace in Files` (*Ctrl + Shift + H*), who've been supported by the VSCode.\n\n| Before | After\n|-----------------|----------------------------------------\n| ORGANIZATION | Your account or corporation name\n| PROJECT | Your own project name\n| AUTHOR | Author name\n| https://github.com/samchon/nestia-start | Your repository URL\n\n\n\n\n## Test Driven Development\nWith [nestia](https://github.com/samchon/nestia) helps to accomplish TDD (Test Driven Development). \n\nJust define DTOs and API controllers' methods (only declarations) first. After the definitions, and build SDK (Software Development Kit) through [nestia](https://github.com/samchon/nestia) (`npm run build:sdk`). After buildling those SDK, develop test automation program using the SDK, following use-case scenarios in the framework of client side.\n\nDuring the test automation program development, you can find that which API is miss-designed or which requirement analysis is not exact. Development of the main program must be the last step after such validation process during TDD.\n\n> Visit the [samchon/backend](https://github.com/samchon/backend), then you may find much detailed story about this TDD.\n>\n> 1. Definitions\n> 2. SDK\n> 3. Test Automation Program\n> 4. Main Program\n\n```typescript\nimport {\n ArrayUtil,\n GaffComparator,\n RandomGenerator,\n TestValidator,\n} from \"@nestia/e2e\";\n\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\nimport { IPage } from \"@ORGANIZATION/PROJECT-api/lib/structures/common/IPage\";\n\nexport async function test_api_bbs_article_index_sort(\n connection: api.IConnection,\n): Promise<void> {\n // GENERATE 100 ARTICLES\n const section: string = \"general\";\n await ArrayUtil.asyncRepeat(100)(() =>\n api.functional.bbs.articles.create(connection, section, {\n writer: RandomGenerator.name(),\n title: RandomGenerator.paragraph(5)(),\n body: RandomGenerator.content(8)()(),\n format: \"txt\",\n files: [],\n password: RandomGenerator.alphabets(8),\n }),\n );\n\n // PREPARE VALIDATOR\n const validator = TestValidator.sort(\"BbsArticleProvider.index()\")(async (\n sort: IPage.Sort<IBbsArticle.IRequest.SortableColumns>,\n ) => {\n const page: IPage<IBbsArticle.ISummary> =\n await api.functional.bbs.articles.index(connection, section, {\n limit: 100,\n sort,\n });\n return page.data;\n });\n\n // DO VALIDATE\n const components = [\n validator(\"created_at\")(GaffComparator.dates((x) => x.created_at)),\n validator(\"updated_at\")(GaffComparator.dates((x) => x.updated_at)),\n validator(\"title\")(GaffComparator.strings((x) => x.title)),\n validator(\"writer\")(GaffComparator.strings((x) => x.writer)),\n validator(\n \"writer\",\n \"title\",\n )(GaffComparator.strings((x) => [x.writer, x.title])),\n ];\n for (const comp of components) {\n await comp(\"+\", false);\n await comp(\"-\", false);\n }\n}\n```\n\nFor reference, if you run `npm run benchmark` command, your test functions defined in the [test/features/api](test/features/api) directory would be utilized for performance benchmarking. If you want to see the performance bench result earlier, visit below link please:\n\n - [docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md](https://github.com/samchon/nestia-start/blob/master/docs/benchmarks/AMD%20Ryzen%209%207940HS%20w%20Radeon%20780M%20Graphics.md)",
11
+ "README.md": "# Nestia Template\n## Outline\n[![Build Status](https://github.com/samchon/nestia-start/workflows/build/badge.svg)](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\n\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\n\nYou can create a new project from this boilerplate by running below command:\n\n```bash\nnpx nestia start <directory>\n```\n\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \n\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\n\n\n\n\n## Directories and Files\nThis template project has categorized directories like below.\n\nAs you can see from the below, all of the Backend source files are placed into the [src](src/) directory. When you build the TypeScript source files, compiled files would be placed into the `lib` directory following the [tsconfig.json](tsconfig.json) configuration. Otherwise you build client [SDK](#32-sdk) library for npm publishing and their compiled files would be placed into the [packages](packages) directory.\n\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\n - [src/](src): Backend source directory\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\n - [**src/api/structures/**](src/api/structures/): DTO structures\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\n - [**test/**](test): Test Automation Program\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\n - [package.json](package.json): NPM configuration\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\n\n\n\n\n## NPM Run Commands\nList of the run commands defined in the [package.json](package.json) are like below:\n\n - Test\n - **`test`**: Run test automation program\n - `benchmark`: Run performance benchmark program\n - Build\n - `build`: Build everything\n - `build:main`: Build main program (`src` directory)\n - `build:test` Build test automation program (`test` directory)\n - `build:sdk`: Build SDK into main program only\n - `build:swagger`: Build Swagger Documents\n - **`dev`**: Incremental build for development (test program)\n - Deploy\n - `package:api`: Build and deploy the SDK library to the NPM\n - `start`: Start the backend server\n - `start:dev`: Start the backend server with incremental build and reload\n - Webpack\n - `webpack`: Run webpack bundler\n - `webpack:start`: Start the backend server built by webpack\n - `webpack:test`: Run test program to the webpack built\n\n\n\n\n## Specialization\nTransform this template project to be yours.\n\nWhen you've created a new backend project through this template project, you can specialize it to be suitable for you by changing some words. Replace below words through IDE specific function like `Edit > Replace in Files` (*Ctrl + Shift + H*), who've been supported by the VSCode.\n\n| Before | After\n|-----------------|----------------------------------------\n| ORGANIZATION | Your account or corporation name\n| PROJECT | Your own project name\n| AUTHOR | Author name\n| https://github.com/samchon/nestia-start | Your repository URL\n\n\n\n\n## Test Driven Development\nWith [nestia](https://github.com/samchon/nestia) helps to accomplish TDD (Test Driven Development). \n\nJust define DTOs and API controllers' methods (only declarations) first. After the definitions, and build SDK (Software Development Kit) through [nestia](https://github.com/samchon/nestia) (`npm run build:sdk`). After buildling those SDK, develop test automation program using the SDK, following use-case scenarios in the framework of client side.\n\nDuring the test automation program development, you can find that which API is miss-designed or which requirement analysis is not exact. Development of the main program must be the last step after such validation process during TDD.\n\n> Visit the [samchon/backend](https://github.com/samchon/backend), then you may find much detailed story about this TDD.\n>\n> 1. Definitions\n> 2. SDK\n> 3. Test Automation Program\n> 4. Main Program\n\n```typescript\nimport {\n ArrayUtil,\n GaffComparator,\n RandomGenerator,\n TestValidator,\n} from \"@nestia/e2e\";\n\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\nimport { IPage } from \"@ORGANIZATION/PROJECT-api/lib/structures/common/IPage\";\n\nexport async function test_api_bbs_article_index_sort(\n connection: api.IConnection,\n): Promise<void> {\n // GENERATE 100 ARTICLES\n const section: string = \"general\";\n await ArrayUtil.asyncRepeat(100, () =>\n api.functional.bbs.articles.create(connection, {\n section,\n body: {\n writer: RandomGenerator.name(),\n title: RandomGenerator.paragraph(),\n body: RandomGenerator.content(),\n format: \"txt\",\n files: [],\n password: RandomGenerator.alphabets(8),\n },\n }),\n );\n\n // PREPARE VALIDATOR\n const validator = TestValidator.sort(\n \"BbsArticleProvider.index()\",\n async (sort: IPage.Sort<IBbsArticle.IRequest.SortableColumns>) => {\n const page: IPage<IBbsArticle.ISummary> =\n await api.functional.bbs.articles.index(connection, {\n section,\n body: {\n limit: 100,\n sort,\n },\n });\n return page.data;\n },\n );\n\n // DO VALIDATE\n const components = [\n validator(\"created_at\")(GaffComparator.dates((x) => x.created_at)),\n validator(\"updated_at\")(GaffComparator.dates((x) => x.updated_at)),\n validator(\"title\")(GaffComparator.strings((x) => x.title)),\n validator(\"writer\")(GaffComparator.strings((x) => x.writer)),\n validator(\n \"writer\",\n \"title\",\n )(GaffComparator.strings((x) => [x.writer, x.title])),\n ];\n for (const comp of components) {\n await comp(\"+\", false);\n await comp(\"-\", false);\n }\n}\n```\n\nFor reference, if you run `npm run benchmark` command, your test functions defined in the [test/features/api](test/features/api) directory would be utilized for performance benchmarking. If you want to see the performance bench result earlier, visit below link please:\n\n - [docs/benchmarks/AMD Ryzen 9 7940HS w Radeon 780M Graphics.md](https://github.com/samchon/nestia-start/blob/master/docs/benchmarks/AMD%20Ryzen%209%207940HS%20w%20Radeon%20780M%20Graphics.md)",
12
12
  "build/env.ts": "import fs from \"fs\";\n\nif (fs.existsSync(`${__dirname}/../.env`) === false)\n fs.copyFileSync(`${__dirname}/../.env.local`, `${__dirname}/../.env`);\n",
13
13
  "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-------|------|-------|----------",
14
14
  "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",
15
15
  "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",
16
- "package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:swagger\": \"npx nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && ts-node build/env.ts\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^7.3.3\",\n \"@nestia/e2e\": \"^7.3.3\",\n \"@nestia/sdk\": \"^7.3.3\",\n \"@nestjs/cli\": \"^11.0.10\",\n \"@rollup/plugin-terser\": \"^0.4.4\",\n \"@rollup/plugin-typescript\": \"^11.1.6\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/cli\": \"^0.11.21\",\n \"@types/cli-progress\": \"^3.11.5\",\n \"@types/express\": \"^4.17.21\",\n \"@types/inquirer\": \"^8.2.5\",\n \"@types/node\": \"^18.11.0\",\n \"@types/uuid\": \"^8.3.4\",\n \"@typescript-eslint/eslint-plugin\": \"^8.1.0\",\n \"@typescript-eslint/parser\": \"^8.1.0\",\n \"chalk\": \"^4.1.2\",\n \"cli\": \"^1.0.1\",\n \"cli-progress\": \"^3.12.0\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"eslint-plugin-deprecation\": \"^3.0.0\",\n \"express\": \"^4.18.2\",\n \"nestia\": \"^7.3.3\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\n \"typescript-transform-paths\": \"^3.5.5\",\n \"webpack\": \"^5.89.0\",\n \"webpack-cli\": \"^5.1.4\",\n \"write-file-webpack-plugin\": \"^4.5.1\"\n },\n \"dependencies\": {\n \"@nestia/core\": \"^7.3.3\",\n \"@nestia/fetcher\": \"^7.3.3\",\n \"@nestjs/common\": \"^11.1.6\",\n \"@nestjs/core\": \"^11.1.6\",\n \"@nestjs/platform-express\": \"^11.1.6\",\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.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.7.1\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test -- --simultaneous 1\"\n }\n}",
16
+ "package.json": "{\n \"private\": true,\n \"name\": \"@ORGANIZATION/PROJECT\",\n \"version\": \"0.1.0\",\n \"description\": \"Starter kit of Nestia\",\n \"main\": \"lib/index.js\",\n \"scripts\": {\n \"benchmark\": \"node bin/test/benchmark\",\n \"test\": \"node bin/test\",\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------BUILDS------------------------\": \"\",\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\n \"build:api\": \"rimraf packages/api/lib && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\n \"build:main\": \"rimraf lib && tsc\",\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\n \"build:swagger\": \"npx nestia swagger\",\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\n \"dev\": \"npm run build:test -- --watch\",\n \"eslint\": \"eslint src && eslint test\",\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\n \"prepare\": \"ts-patch install && ts-node build/env.ts\",\n \"prettier\": \"prettier src --write && prettier test --write\",\n \"------------------------WEBPACK------------------------\": \"\",\n \"webpack\": \"rimraf dist && webpack\",\n \"webpack:start\": \"cd dist && node dist/server\",\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\n \"------------------------DEPLOYS------------------------\": \"\",\n \"package:api\": \"npm run build:api && cd packages/api && npm publish\",\n \"start\": \"node lib/executable/server\",\n \"start:dev\": \"nest start --watch\",\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia-start\"\n },\n \"keywords\": [\n \"nestia\",\n \"template\",\n \"boilerplate\"\n ],\n \"author\": \"AUTHOR\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\n },\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\n \"devDependencies\": {\n \"@autobe/interface\": \"^0.10.6\",\n \"@nestia/benchmark\": \"^8.0.0\",\n \"@nestia/e2e\": \"^8.0.0\",\n \"@nestia/sdk\": \"^8.0.0\",\n \"@nestjs/cli\": \"^11.0.10\",\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\": \"^8.0.0\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\n \"typescript-transform-paths\": \"^3.5.5\",\n \"webpack\": \"^5.89.0\",\n \"webpack-cli\": \"^5.1.4\",\n \"write-file-webpack-plugin\": \"^4.5.1\"\n },\n \"dependencies\": {\n \"@nestia/core\": \"^8.0.0\",\n \"@nestia/fetcher\": \"^8.0.0\",\n \"@nestjs/common\": \"^11.1.6\",\n \"@nestjs/core\": \"^11.1.6\",\n \"@nestjs/platform-express\": \"^11.1.6\",\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.1.0\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^9.7.2\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test -- --simultaneous 1\"\n }\n}",
17
17
  "packages/api/.gitignore": "lib/\nnode_modules/\n\nswagger.json\nopenai.json",
18
18
  "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.",
19
19
  "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",
20
- "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\": \"^7.3.2\",\n \"tgrid\": \"^1.2.0\",\n \"typia\": \"^9.7.1\"\n }\n}",
20
+ "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\": \"^8.0.0-dev.20250829\",\n \"tgrid\": \"^1.2.0\",\n \"typia\": \"^9.7.2\"\n }\n}",
21
21
  "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",
22
22
  "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\": \"ES5\", /* 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. */// \"rootDir\": \"./\", /* 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\": [\n \"../../src/api\"\n ]\n}",
23
23
  "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",
@@ -5,7 +5,7 @@ export const SDK_TEMPLATE: Record<string, string> = {
5
5
  "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",
6
6
  "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",
7
7
  "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",
8
- "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 && typia patch\",\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 \"test:manual\": \"ts-node test/manual.ts\"\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\": \"^7.3.3\",\n \"tgrid\": \"^1.2.0\",\n \"typia\": \"^9.7.1\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^7.3.3\",\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\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\n \"typescript-transform-paths\": \"^3.5.5\"\n }\n}",
8
+ "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 && typia patch\",\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 \"test:manual\": \"ts-node test/manual.ts\"\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\": \"^8.0.0\",\n \"tgrid\": \"^1.2.0\",\n \"typia\": \"^9.7.2\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^8.0.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\": \"^3.3.0\",\n \"typescript\": \"~5.9.2\",\n \"typescript-transform-paths\": \"^3.5.5\"\n }\n}",
9
9
  "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",
10
10
  "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",
11
11
  "src/HttpError.ts": "export { HttpError } from \"@nestia/fetcher\";\n",
@@ -1,6 +1,8 @@
1
1
  import { IHttpMigrateRoute, OpenApi } from "@samchon/openapi";
2
2
  import ts from "typescript";
3
3
  import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
4
+ import { StatementFactory } from "typia/lib/factories/StatementFactory";
5
+ import { Escaper } from "typia/lib/utils/Escaper";
4
6
 
5
7
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
6
8
  import { FilePrinter } from "../utils/FilePrinter";
@@ -141,100 +143,141 @@ export namespace NestiaMigrateApiFunctionProgrammer {
141
143
  ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key)
142
144
  : ts.factory.createIdentifier(key);
143
145
  const fetch = () =>
144
- ts.factory.createCallExpression(
145
- IdentifierFactory.access(
146
- ts.factory.createIdentifier(
147
- ctx.importer.external({
148
- type: "instance",
149
- library: `@nestia/fetcher/lib/${encrypted ? "EncryptedFetcher" : "PlainFetcher"}`,
150
- name: encrypted ? "EncryptedFetcher" : "PlainFetcher",
151
- }),
146
+ ts.factory.createAwaitExpression(
147
+ ts.factory.createCallExpression(
148
+ IdentifierFactory.access(
149
+ ts.factory.createIdentifier(
150
+ ctx.importer.external({
151
+ type: "instance",
152
+ library: `@nestia/fetcher/lib/${encrypted ? "EncryptedFetcher" : "PlainFetcher"}`,
153
+ name: encrypted ? "EncryptedFetcher" : "PlainFetcher",
154
+ }),
155
+ ),
156
+ "fetch",
152
157
  ),
153
- "fetch",
154
- ),
155
- undefined,
156
- [
157
- contentType && contentType !== "multipart/form-data"
158
- ? ts.factory.createObjectLiteralExpression(
159
- [
160
- ts.factory.createSpreadAssignment(
161
- ts.factory.createIdentifier("connection"),
162
- ),
163
- ts.factory.createPropertyAssignment(
164
- "headers",
165
- ts.factory.createObjectLiteralExpression(
166
- [
167
- ts.factory.createSpreadAssignment(
168
- IdentifierFactory.access(
169
- ts.factory.createIdentifier("connection"),
170
- "headers",
158
+ undefined,
159
+ [
160
+ contentType && contentType !== "multipart/form-data"
161
+ ? ts.factory.createObjectLiteralExpression(
162
+ [
163
+ ts.factory.createSpreadAssignment(
164
+ ts.factory.createIdentifier("connection"),
165
+ ),
166
+ ts.factory.createPropertyAssignment(
167
+ "headers",
168
+ ts.factory.createObjectLiteralExpression(
169
+ [
170
+ ts.factory.createSpreadAssignment(
171
+ IdentifierFactory.access(
172
+ ts.factory.createIdentifier("connection"),
173
+ "headers",
174
+ ),
175
+ ),
176
+ ts.factory.createPropertyAssignment(
177
+ ts.factory.createStringLiteral("Content-Type"),
178
+ ts.factory.createStringLiteral(contentType),
171
179
  ),
172
- ),
173
- ts.factory.createPropertyAssignment(
174
- ts.factory.createStringLiteral("Content-Type"),
175
- ts.factory.createStringLiteral(contentType),
176
- ),
177
- ],
178
- true,
180
+ ],
181
+ true,
182
+ ),
179
183
  ),
180
- ),
181
- ],
182
- true,
183
- )
184
- : ts.factory.createIdentifier("connection"),
185
- ts.factory.createObjectLiteralExpression(
186
- [
187
- ts.factory.createSpreadAssignment(
188
- IdentifierFactory.access(
189
- ts.factory.createIdentifier(ctx.route.accessor.at(-1)!),
190
- "METADATA",
191
- ),
192
- ),
193
- ts.factory.createPropertyAssignment(
194
- "path",
195
- ts.factory.createCallExpression(
184
+ ],
185
+ true,
186
+ )
187
+ : ts.factory.createIdentifier("connection"),
188
+ ts.factory.createObjectLiteralExpression(
189
+ [
190
+ ts.factory.createSpreadAssignment(
196
191
  IdentifierFactory.access(
197
192
  ts.factory.createIdentifier(ctx.route.accessor.at(-1)!),
198
- "path",
193
+ "METADATA",
199
194
  ),
200
- undefined,
201
- getArguments(ctx, false),
202
195
  ),
203
- ),
204
- ts.factory.createPropertyAssignment(
205
- "status",
206
- ts.factory.createNull(),
207
- ),
208
- ],
209
- true,
210
- ),
211
- ...(ctx.route.body ? [property(ctx.route.body.key)] : []),
212
- ],
196
+ ts.factory.createPropertyAssignment(
197
+ "path",
198
+ ts.factory.createCallExpression(
199
+ IdentifierFactory.access(
200
+ ts.factory.createIdentifier(ctx.route.accessor.at(-1)!),
201
+ "path",
202
+ ),
203
+ undefined,
204
+ getArguments(ctx, false),
205
+ ),
206
+ ),
207
+ ts.factory.createPropertyAssignment(
208
+ "status",
209
+ ts.factory.createNull(),
210
+ ),
211
+ ],
212
+ true,
213
+ ),
214
+ ...(ctx.route.body ? [property(ctx.route.body.key)] : []),
215
+ ],
216
+ ),
213
217
  );
214
- if (ctx.config.simulate !== true)
215
- return [ts.factory.createReturnStatement(fetch())];
216
- return [
217
- ts.factory.createReturnStatement(
218
- ts.factory.createConditionalExpression(
219
- ts.factory.createStrictEquality(
220
- ts.factory.createTrue(),
221
- ts.factory.createIdentifier("connection.simulate"),
222
- ),
223
- undefined,
224
- ts.factory.createCallExpression(
225
- ts.factory.createIdentifier(
226
- `${ctx.route.accessor.at(-1)!}.simulate`,
218
+
219
+ const value: ts.Expression =
220
+ ctx.config.simulate !== true
221
+ ? fetch()
222
+ : ts.factory.createConditionalExpression(
223
+ ts.factory.createStrictEquality(
224
+ ts.factory.createTrue(),
225
+ ts.factory.createIdentifier("connection.simulate"),
227
226
  ),
228
- [],
229
- [
230
- ts.factory.createIdentifier("connection"),
231
- ...getArguments(ctx, true),
232
- ],
233
- ),
234
- undefined,
235
- fetch(),
227
+ undefined,
228
+ ts.factory.createCallExpression(
229
+ ts.factory.createIdentifier(
230
+ `${ctx.route.accessor.at(-1)!}.simulate`,
231
+ ),
232
+ [],
233
+ [
234
+ ts.factory.createIdentifier("connection"),
235
+ ...getArguments(ctx, true),
236
+ ],
237
+ ),
238
+ undefined,
239
+ fetch(),
240
+ );
241
+ const headers: Array<IAssignHeader | ISetHeader> = getHeaders(
242
+ ctx.route.comment(),
243
+ );
244
+ if (headers.length === 0) return [ts.factory.createReturnStatement(value)];
245
+ return [
246
+ StatementFactory.constant({
247
+ name: "output",
248
+ type: ts.factory.createTypeReferenceNode(
249
+ `${ctx.route.accessor.at(-1)!}.Response`,
250
+ ),
251
+ value,
252
+ }),
253
+ ts.factory.createExpressionStatement(
254
+ ts.factory.createBinaryExpression(
255
+ ts.factory.createIdentifier("connection.headers"),
256
+ ts.factory.createToken(ts.SyntaxKind.QuestionQuestionEqualsToken),
257
+ ts.factory.createObjectLiteralExpression([]),
236
258
  ),
237
259
  ),
260
+ ...headers.map((h) =>
261
+ ts.factory.createExpressionStatement(
262
+ h.type === "assign"
263
+ ? ts.factory.createCallExpression(
264
+ ts.factory.createIdentifier("Object.assign"),
265
+ undefined,
266
+ [
267
+ ts.factory.createIdentifier("connection.headers"),
268
+ ts.factory.createIdentifier(`output.${h.accessor}`),
269
+ ],
270
+ )
271
+ : ts.factory.createBinaryExpression(
272
+ ts.factory.createIdentifier(
273
+ `connection.headers${Escaper.variable(h.property) ? `.${h.property}` : `[${JSON.stringify(h.property)}]`}`,
274
+ ),
275
+ ts.factory.createToken(ts.SyntaxKind.EqualsToken),
276
+ ts.factory.createIdentifier(`output.${h.accessor}`),
277
+ ),
278
+ ),
279
+ ),
280
+ ts.factory.createReturnStatement(ts.factory.createIdentifier("output")),
238
281
  ];
239
282
  };
240
283
 
@@ -257,4 +300,44 @@ export namespace NestiaMigrateApiFunctionProgrammer {
257
300
  : []),
258
301
  ];
259
302
  };
303
+
304
+ const getHeaders = (
305
+ description: string,
306
+ ): Array<IAssignHeader | ISetHeader> => {
307
+ const directives: Array<IAssignHeader | ISetHeader> = [];
308
+ for (const line of description.split("\n").map((l) => l.trim())) {
309
+ if (line.startsWith("@setHeader ")) {
310
+ const parts: string[] = line
311
+ .substring("@setHeader ".length)
312
+ .trim()
313
+ .split(/\s+/);
314
+ if (parts.length >= 2)
315
+ directives.push({
316
+ type: "set",
317
+ accessor: parts[0],
318
+ property: parts[1],
319
+ });
320
+ } else if (line.startsWith("@assignHeaders ")) {
321
+ const accessor: string = line
322
+ .substring("@assignHeaders ".length)
323
+ .trim();
324
+ if (accessor.length !== 0)
325
+ directives.push({
326
+ type: "assign",
327
+ accessor,
328
+ });
329
+ }
330
+ }
331
+ return directives;
332
+ };
333
+ }
334
+
335
+ interface IAssignHeader {
336
+ type: "assign";
337
+ accessor: string;
338
+ }
339
+ interface ISetHeader {
340
+ type: "set";
341
+ accessor: string;
342
+ property: string;
260
343
  }