@nestia/migrate 0.15.0 → 0.15.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.
@@ -40,7 +40,7 @@ exports.NEST_TEMPLATE = [
|
|
40
40
|
{
|
41
41
|
"location": "docs/benchmarks",
|
42
42
|
"file": "AMD Ryzen 9 7940HS w Radeon 780M Graphics.md",
|
43
|
-
"content": "# Benchmark Report\r\n> Generated by [`@nestia/
|
43
|
+
"content": "# Benchmark Report\r\n> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)\r\n\r\n - Specifications\r\n - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics \r\n - RAM: 31 GB\r\n - NodeJS Version: v20.10.0\r\n - Backend Server: 1 core / 1 thread\r\n - Arguments\r\n - Count: 40,000\r\n - Threads: 4\r\n - Simultaneous: 32\r\n - Time\r\n - Start: 2024-07-25T19:14:00.253Z\r\n - Complete: 2024-07-25T19:16:37.125Z\r\n - Elapsed: 156,872 ms\r\n\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nTotal | 41,226 | 41,226 | 114 | 109.72 | 8 | 998\r\n\r\n> Unit: milliseconds\r\n\r\n## Memory Usage\r\n```mermaid\r\nxychart-beta\r\n x-axis \"Time (second)\"\r\n y-axis \"Memory (MB)\"\r\n line [37, 44, 33, 40, 66, 95, 114, 119, 123, 43, 42, 47, 68, 70, 66, 81, 87, 87, 97, 115, 135, 47, 58, 54, 61, 75, 45, 43, 49, 62, 83, 51, 65, 78, 54, 61, 63, 71, 72, 53, 70, 69, 61, 68, 88, 62, 70, 65, 67, 85, 62, 75, 81, 78, 58, 75, 77, 64, 69, 84, 98, 64, 70, 89, 98, 102, 58, 76, 82, 97, 61, 74, 77, 95, 70, 79, 92, 80, 92, 94, 94, 109, 71, 83, 80, 59, 70, 77, 92, 97, 75, 82, 89, 95, 78, 84, 100, 105, 117, 134, 129, 71, 85, 86, 88, 69, 76, 91, 92, 85, 86, 91, 104, 102, 78, 91, 81, 76, 91, 118, 114, 115, 135, 143, 73, 90, 91, 92, 102, 77, 85, 98, 81, 92, 83, 94, 72, 112, 92, 107, 100, 102, 115]\r\n```\r\n\r\n## Endpoints\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nPATCH /bbs/articles/:section | 6,703 | 6,703 | 167.16 | 125.5 | 8 | 996\r\nPUT /bbs/articles/:section/:id | 326 | 326 | 117.86 | 101.2 | 11 | 546\r\nGET /bbs/articles/:section/:id | 680 | 680 | 110.42 | 93.49 | 10 | 579\r\nPOST /bbs/articles/:section | 33,517 | 33,517 | 103.4 | 103.45 | 8 | 998\r\n\r\n> Unit: milliseconds\r\n\r\n## Failures\r\nMethod | Path | Count | Failures\r\n-------|------|-------|----------"
|
44
44
|
},
|
45
45
|
{
|
46
46
|
"location": "",
|
@@ -55,12 +55,12 @@ exports.NEST_TEMPLATE = [
|
|
55
55
|
{
|
56
56
|
"location": "",
|
57
57
|
"file": "package.json",
|
58
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"benchmark\": \"node bin/test/benchmark\",\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/benchmark\": \"^0.
|
58
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"benchmark\": \"node bin/test/benchmark\",\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/benchmark\": \"^0.2.0\",\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@nestia/sdk\": \"^3.8.1\",\r\n \"@rollup/plugin-terser\": \"^0.4.4\",\r\n \"@rollup/plugin-typescript\": \"^11.1.6\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/cli-progress\": \"^3.11.5\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^6.19.1\",\r\n \"@typescript-eslint/parser\": \"^6.19.1\",\r\n \"chalk\": \"^4.1.2\",\r\n \"cli\": \"^1.0.1\",\r\n \"cli-progress\": \"^3.12.0\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^2.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.5.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"rollup\": \"^4.18.0\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.2.1\",\r\n \"typescript\": \"^5.5.4\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^3.8.1\",\r\n \"@nestia/fetcher\": \"^3.8.1\",\r\n \"@nestjs/common\": \"^10.3.10\",\r\n \"@nestjs/core\": \"^10.3.10\",\r\n \"@nestjs/platform-express\": \"^10.3.10\",\r\n \"commander\": \"10.0.0\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"tstl\": \"^3.0.0\",\r\n \"typia\": \"^6.5.4\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
|
59
59
|
},
|
60
60
|
{
|
61
61
|
"location": "packages/api",
|
62
62
|
"file": ".gitignore",
|
63
|
-
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json"
|
63
|
+
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json\r\nopenai.json"
|
64
64
|
},
|
65
65
|
{
|
66
66
|
"location": "packages/api",
|
@@ -70,7 +70,7 @@ exports.NEST_TEMPLATE = [
|
|
70
70
|
{
|
71
71
|
"location": "packages/api",
|
72
72
|
"file": "package.json",
|
73
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"
|
73
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"package.json\",\r\n \"swagger.json\",\r\n \"openai.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.8.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"typia\": \"^6.5.4\"\r\n }\r\n}"
|
74
74
|
},
|
75
75
|
{
|
76
76
|
"location": "packages/api",
|
@@ -95,7 +95,7 @@ exports.NEST_TEMPLATE = [
|
|
95
95
|
{
|
96
96
|
"location": "",
|
97
97
|
"file": "README.md",
|
98
|
-
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\r\n\r\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\r\n\r\nYou can create a new project from this boilerplate by running below command:\r\n\r\n```bash\r\nnpx nestia start <directory>\r\n```\r\n\r\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \r\n\r\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\r\n\r\n\r\n\r\n\r\n## Directories and Files\r\nThis template project has categorized directories like below.\r\n\r\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.\r\n\r\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\r\n - [src/](src): Backend source directory\r\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\r\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\r\n - [**src/api/structures/**](src/api/structures/): DTO structures\r\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\r\n - [**test/**](test): Test Automation Program\r\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\r\n - [package.json](package.json): NPM configuration\r\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\r\n - [tsconfig.api.json](tsconfig.api.json): TypeScript configuration for the SDK generation\r\n\r\n\r\n\r\n\r\n## NPM Run Commands\r\nList of the run commands defined in the [package.json](package.json) are like below:\r\n\r\n -
|
98
|
+
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\r\n\r\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\r\n\r\nYou can create a new project from this boilerplate by running below command:\r\n\r\n```bash\r\nnpx nestia start <directory>\r\n```\r\n\r\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \r\n\r\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\r\n\r\n\r\n\r\n\r\n## Directories and Files\r\nThis template project has categorized directories like below.\r\n\r\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.\r\n\r\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\r\n - [src/](src): Backend source directory\r\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\r\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\r\n - [**src/api/structures/**](src/api/structures/): DTO structures\r\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\r\n - [**test/**](test): Test Automation Program\r\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\r\n - [package.json](package.json): NPM configuration\r\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\r\n - [tsconfig.api.json](tsconfig.api.json): TypeScript configuration for the SDK generation\r\n\r\n\r\n\r\n\r\n## NPM Run Commands\r\nList of the run commands defined in the [package.json](package.json) are like below:\r\n\r\n - Test\r\n - **`test`**: Run test automation program\r\n - `benchmark`: Run performance benchmark program\r\n - Build\r\n - `build`: Build everything\r\n - `build:main`: Build main program (`src` directory)\r\n - `build:test` Build test automation program (`test` directory)\r\n - `build:sdk`: Build SDK into main program only\r\n - `build:swagger`: Build Swagger Documents\r\n - **`dev`**: Incremental build for development (test program)\r\n - Deploy\r\n - `package:api`: Build and deploy the SDK library to the NPM\r\n - `start`: Start local NestJS server\r\n - Webpack\r\n - `webpack`: Run webpack bundler\r\n - `webpack:start`: Start the backend server built by webpack\r\n - `webpack:test`: Run test program to the webpack built\r\n\r\n\r\n\r\n\r\n## Specialization\r\nTransform this template project to be yours.\r\n\r\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.\r\n\r\n| Before | After\r\n|-----------------|----------------------------------------\r\n| ORGANIZATION | Your account or corporation name\r\n| PROJECT | Your own project name\r\n| AUTHOR | Author name\r\n| https://github.com/samchon/nestia-start | Your repository URL\r\n\r\n\r\n\r\n\r\n## Test Driven Development\r\nWith [nestia](https://github.com/samchon/nestia) helps to accomplish TDD (Test Driven Development). \r\n\r\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.\r\n\r\nDuring the test automation program development, you can find that which API is mis-designed or which requirement analysis is not exact. Development of the main program must be the last step after such validation process during TDD.\r\n\r\n> Visit the [samchon/backend](https://github.com/samchon/backend), then you may find much detailed story about this TDD.\r\n>\r\n> 1. Definitions\r\n> 2. SDK\r\n> 3. Test Automation Program\r\n> 4. Main Program\r\n\r\n```typescript\r\nimport {\r\n ArrayUtil,\r\n GaffComparator,\r\n RandomGenerator,\r\n TestValidator,\r\n} from \"@nestia/e2e\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\r\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\r\nimport { IPage } from \"@ORGANIZATION/PROJECT-api/lib/structures/common/IPage\";\r\n\r\nexport async function test_api_bbs_article_index_sort(\r\n connection: api.IConnection,\r\n): Promise<void> {\r\n // GENERATE 100 ARTICLES\r\n const section: string = \"general\";\r\n await ArrayUtil.asyncRepeat(100)(() =>\r\n api.functional.bbs.articles.create(connection, section, {\r\n writer: RandomGenerator.name(),\r\n title: RandomGenerator.paragraph(5)(),\r\n body: RandomGenerator.content(8)()(),\r\n format: \"txt\",\r\n files: [],\r\n password: RandomGenerator.alphabets(8),\r\n }),\r\n );\r\n\r\n // PREPARE VALIDATOR\r\n const validator = TestValidator.sort(\"BbsArticleProvider.index()\")(async (\r\n sort: IPage.Sort<IBbsArticle.IRequest.SortableColumns>,\r\n ) => {\r\n const page: IPage<IBbsArticle.ISummary> =\r\n await api.functional.bbs.articles.index(connection, section, {\r\n limit: 100,\r\n sort,\r\n });\r\n return page.data;\r\n });\r\n\r\n // DO VALIDATE\r\n const components = [\r\n validator(\"created_at\")(GaffComparator.dates((x) => x.created_at)),\r\n validator(\"updated_at\")(GaffComparator.dates((x) => x.updated_at)),\r\n validator(\"title\")(GaffComparator.strings((x) => x.title)),\r\n validator(\"writer\")(GaffComparator.strings((x) => x.writer)),\r\n validator(\r\n \"writer\",\r\n \"title\",\r\n )(GaffComparator.strings((x) => [x.writer, x.title])),\r\n ];\r\n for (const comp of components) {\r\n await comp(\"+\", false);\r\n await comp(\"-\", false);\r\n }\r\n}\r\n```\r\n\r\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:\r\n\r\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)"
|
99
99
|
},
|
100
100
|
{
|
101
101
|
"location": "src/api",
|
@@ -140,7 +140,7 @@ exports.NEST_TEMPLATE = [
|
|
140
140
|
{
|
141
141
|
"location": "src/executable",
|
142
142
|
"file": "server.ts",
|
143
|
-
"content": "import
|
143
|
+
"content": "import { MyBackend } from \"../MyBackend\";\r\n\r\nconst EXTENSION = __filename.substring(__filename.length - 2);\r\nif (EXTENSION === \"js\") require(\"source-map-support/register\");\r\n\r\nasync function main(): Promise<void> {\r\n // BACKEND SEVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n // UNEXPECTED ERRORS\r\n global.process.on(\"uncaughtException\", console.error);\r\n global.process.on(\"unhandledRejection\", console.error);\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
144
144
|
},
|
145
145
|
{
|
146
146
|
"location": "src/executable",
|
@@ -165,7 +165,7 @@ exports.NEST_TEMPLATE = [
|
|
165
165
|
{
|
166
166
|
"location": "src/utils",
|
167
167
|
"file": "ErrorUtil.ts",
|
168
|
-
"content": "import
|
168
|
+
"content": "import serializeError = require(\"serialize-error\");\r\n\r\nexport namespace ErrorUtil {\r\n export const toJSON = (err: any): object =>\r\n err instanceof Object && err.toJSON instanceof Function\r\n ? err.toJSON()\r\n : serializeError(err);\r\n}\r\n"
|
169
169
|
},
|
170
170
|
{
|
171
171
|
"location": "src/utils",
|
@@ -190,7 +190,7 @@ exports.NEST_TEMPLATE = [
|
|
190
190
|
{
|
191
191
|
"location": "test",
|
192
192
|
"file": "index.ts",
|
193
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport { MyBackend } from \"../src/MyBackend\";\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport { MyGlobal } from \"../src/MyGlobal\";\r\nimport { ArgumentParser } from \"./helpers/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n include?: string[];\r\n exclude?: string[];\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, _prompt, action) => {\r\n // command.option(\"--mode <string>\", \"target mode\");\r\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n\r\n return action(async (options) => {\r\n // if (typeof options.reset === \"string\")\r\n // options.reset = options.reset === \"true\";\r\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\r\n // \"LOCAL\",\r\n // \"DEV\",\r\n // \"REAL\",\r\n // ]);\r\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nasync function main(): Promise<void> {\r\n // CONFIGURATIONS\r\n const options: IOptions = await getOptions();\r\n MyGlobal.testing = true;\r\n\r\n // BACKEND SERVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n //----\r\n // CLINET CONNECTOR\r\n //----\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
193
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport { MyBackend } from \"../src/MyBackend\";\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport { MyGlobal } from \"../src/MyGlobal\";\r\nimport { ArgumentParser } from \"./helpers/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n include?: string[];\r\n exclude?: string[];\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, _prompt, action) => {\r\n // command.option(\"--mode <string>\", \"target mode\");\r\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n\r\n return action(async (options) => {\r\n // if (typeof options.reset === \"string\")\r\n // options.reset = options.reset === \"true\";\r\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\r\n // \"LOCAL\",\r\n // \"DEV\",\r\n // \"REAL\",\r\n // ]);\r\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nasync function main(): Promise<void> {\r\n // CONFIGURATIONS\r\n const options: IOptions = await getOptions();\r\n MyGlobal.testing = true;\r\n\r\n // BACKEND SERVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n //----\r\n // CLINET CONNECTOR\r\n //----\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n await backend.close();\r\n\r\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\r\n (exec) => exec.error !== null,\r\n );\r\n if (failures.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n for (const f of failures) console.log(f.error);\r\n process.exit(-1);\r\n }\r\n\r\n console.log(\r\n [\r\n `All: #${report.executions.length}`,\r\n `Success: #${report.executions.length - failures.length}`,\r\n `Failed: #${failures.length}`,\r\n ].join(\"\\n\"),\r\n );\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
194
194
|
},
|
195
195
|
{
|
196
196
|
"location": "test",
|
@@ -200,7 +200,7 @@ exports.NEST_TEMPLATE = [
|
|
200
200
|
{
|
201
201
|
"location": "test",
|
202
202
|
"file": "webpack.ts",
|
203
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\nimport cp from \"child_process\";\r\nimport { sleep_for } from \"tstl\";\r\n\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport api from \"../src/api\";\r\n\r\nconst main = async (): Promise<void> => {\r\n // OPEN BUNDLED SERVER\r\n const backend = cp.fork(`${MyConfiguration.ROOT}/dist/server.js`, {\r\n cwd: `${MyConfiguration.ROOT}/dist`,\r\n });\r\n await sleep_for(2_500);\r\n\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
203
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\nimport cp from \"child_process\";\r\nimport { sleep_for } from \"tstl\";\r\n\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport api from \"../src/api\";\r\n\r\nconst main = async (): Promise<void> => {\r\n // OPEN BUNDLED SERVER\r\n const backend = cp.fork(`${MyConfiguration.ROOT}/dist/server.js`, {\r\n cwd: `${MyConfiguration.ROOT}/dist`,\r\n });\r\n await sleep_for(2_500);\r\n\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n\r\n backend.kill();\r\n\r\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\r\n (exec) => exec.error !== null,\r\n );\r\n if (failures.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n for (const f of failures) console.log(f.error);\r\n process.exit(-1);\r\n }\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
204
204
|
},
|
205
205
|
{
|
206
206
|
"location": "",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NEST_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/NEST_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,+CAA+C;KAC3D;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,m1BAAm1B;KAC/1B;IACD;QACE,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,k+BAAk+B;KAC9+B;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,iHAAiH;KAC7H;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,iBAAiB;QACzB,SAAS,EAAE,iIAAiI;KAC7I;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,irCAAirC;KAC7rC;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,qRAAqR;KACjS;IACD;QACE,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,8CAA8C;QACtD,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"NEST_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/NEST_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,+CAA+C;KAC3D;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,m1BAAm1B;KAC/1B;IACD;QACE,UAAU,EAAE,mBAAmB;QAC/B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,k+BAAk+B;KAC9+B;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,iHAAiH;KAC7H;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,iBAAiB;QACzB,SAAS,EAAE,iIAAiI;KAC7I;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,irCAAirC;KAC7rC;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,qRAAqR;KACjS;IACD;QACE,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,8CAA8C;QACtD,SAAS,EAAE,u5DAAu5D;KACn6D;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,inCAAinC;KAC7nC;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,woBAAwoB;KACppB;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,mtIAAmtI;KAC/tI;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,0DAA0D;KACtE;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,8mCAA8mC;KAC1nC;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,izBAAizB;KAC7zB;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,mmEAAmmE;KAC/mE;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,itBAAitB;KAC7tB;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,qyWAAqyW;KACjzW;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,yhBAAyhB;KACriB;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,86NAA86N;KAC17N;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,oDAAoD;KAChE;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,2DAA2D;KACvE;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kGAAkG;KAC9G;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,kIAAkI;KAC9I;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,yDAAyD;KACrE;IACD;QACE,UAAU,EAAE,wBAAwB;QACpC,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,gyFAAgyF;KAC5yF;IACD;QACE,UAAU,EAAE,2BAA2B;QACvC,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,4QAA4Q;KACxR;IACD;QACE,UAAU,EAAE,2BAA2B;QACvC,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,+hDAA+hD;KAC3iD;IACD;QACE,UAAU,EAAE,gBAAgB;QAC5B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,8jBAA8jB;KAC1kB;IACD;QACE,UAAU,EAAE,gBAAgB;QAC5B,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,8+BAA8+B;KAC1/B;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,2nCAA2nC;KACvoC;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,ikBAAikB;KAC7kB;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,mpBAAmpB;KAC/pB;IACD;QACE,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,4QAA4Q;KACxR;IACD;QACE,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,kVAAkV;KAC9V;IACD;QACE,UAAU,EAAE,gBAAgB;QAC5B,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,i9HAAi9H;KAC79H;IACD;QACE,UAAU,EAAE,gBAAgB;QAC5B,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,ucAAuc;KACnd;IACD;QACE,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,mBAAmB;QAC3B,SAAS,EAAE,smFAAsmF;KAClnF;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,o3GAAo3G;KACh4G;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,yJAAyJ;KACrK;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,ozDAAozD;KACh0D;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,y8XAAy8X;KACr9X;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,mBAAmB;QAC3B,SAAS,EAAE,g1DAAg1D;KAC51D;CACF,CAAA"}
|
@@ -30,7 +30,7 @@ exports.SDK_TEMPLATE = [
|
|
30
30
|
{
|
31
31
|
"location": "",
|
32
32
|
"file": "package.json",
|
33
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.
|
33
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.8.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"typia\": \"^6.5.4\"\r\n },\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@rollup/plugin-terser\": \"^0.4.4\",\r\n \"@rollup/plugin-typescript\": \"^11.1.6\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"@types/swagger-ui-express\": \"^4.1.6\",\r\n \"chalk\": \"4.1.2\",\r\n \"commander\": \"^10.0.0\",\r\n \"express\": \"^4.19.2\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"rollup\": \"^4.13.2\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.2.1\",\r\n \"typescript\": \"^5.5.4\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n }\r\n}"
|
34
34
|
},
|
35
35
|
{
|
36
36
|
"location": "",
|
@@ -80,12 +80,7 @@ exports.SDK_TEMPLATE = [
|
|
80
80
|
{
|
81
81
|
"location": "test",
|
82
82
|
"file": "index.ts",
|
83
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n extension: __filename.substring(__filename.length - 2),\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
84
|
-
},
|
85
|
-
{
|
86
|
-
"location": "test",
|
87
|
-
"file": "manual.ts",
|
88
|
-
"content": ""
|
83
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n extension: __filename.substring(__filename.length - 2),\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n\r\n // REPORT EXCEPTIONS\r\n const exceptions: Error[] = report.executions\r\n .filter((exec) => exec.error !== null)\r\n .map((exec) => exec.error!);\r\n if (exceptions.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n if (options.trace !== false) for (const exp of exceptions) console.log(exp);\r\n console.log(\"Failed\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n }\r\n\r\n // TERMINATE\r\n if (exceptions.length) process.exit(-1);\r\n else process.exit(0);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
89
84
|
},
|
90
85
|
{
|
91
86
|
"location": "test",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SDK_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/SDK_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,mFAAmF;KAC/F;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,oxBAAoxB;KAChyB;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,sRAAsR;KAClS;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,4rBAA4rB;KACxsB;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,inCAAinC;KAC7nC;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,uoEAAuoE;KACnpE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,geAAge;KAC5e;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,oyHAAoyH;KAChzH;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,wqBAAwqB;KACprB;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,oDAAoD;KAChE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,2DAA2D;KACvE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kGAAkG;KAC9G;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,kIAAkI;KAC9I;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,yDAAyD;KACrE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,0hsDAA0hsD;KACtisD;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"SDK_TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/SDK_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,mFAAmF;KAC/F;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,oxBAAoxB;KAChyB;IACD;QACE,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,sRAAsR;KAClS;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,4rBAA4rB;KACxsB;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,inCAAinC;KAC7nC;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,uoEAAuoE;KACnpE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,oBAAoB;QAC5B,SAAS,EAAE,geAAge;KAC5e;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,oyHAAoyH;KAChzH;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,wqBAAwqB;KACprB;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,oDAAoD;KAChE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,2DAA2D;KACvE;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kGAAkG;KAC9G;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,kIAAkI;KAC9I;IACD;QACE,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,yDAAyD;KACrE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,0hsDAA0hsD;KACtisD;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,24FAA24F;KACv5F;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,uxBAAuxB;KACnyB;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,+lBAA+lB;KAC3mB;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,uMAAuM;KACnN;IACD;QACE,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,odAAod;KAChe;IACD;QACE,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,mBAAmB;QAC3B,SAAS,EAAE,gtEAAgtE;KAC5tE;IACD;QACE,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,24WAA24W;KACv5W;CACF,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nestia/migrate",
|
3
|
-
"version": "0.15.
|
3
|
+
"version": "0.15.1",
|
4
4
|
"description": "Migration program from swagger to NestJS",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"typings": "lib/index.d.ts",
|
@@ -36,10 +36,10 @@
|
|
36
36
|
},
|
37
37
|
"homepage": "https://nestia.io",
|
38
38
|
"devDependencies": {
|
39
|
-
"@nestia/benchmark": "^0.
|
40
|
-
"@nestia/core": "^3.
|
39
|
+
"@nestia/benchmark": "^0.2.0",
|
40
|
+
"@nestia/core": "^3.8.1",
|
41
41
|
"@nestia/e2e": "^0.7.0",
|
42
|
-
"@nestia/fetcher": "^3.
|
42
|
+
"@nestia/fetcher": "^3.8.1",
|
43
43
|
"@nestjs/common": "^10.3.8",
|
44
44
|
"@nestjs/core": "^10.3.8",
|
45
45
|
"@nestjs/platform-express": "^10.3.8",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"prettier": "^3.2.5",
|
72
72
|
"tstl": "^3.0.0",
|
73
73
|
"typescript": "^5.5.3",
|
74
|
-
"typia": "^6.5.
|
74
|
+
"typia": "^6.5.4"
|
75
75
|
},
|
76
76
|
"files": [
|
77
77
|
"lib",
|
@@ -37,7 +37,7 @@ export const NEST_TEMPLATE = [
|
|
37
37
|
{
|
38
38
|
"location": "docs/benchmarks",
|
39
39
|
"file": "AMD Ryzen 9 7940HS w Radeon 780M Graphics.md",
|
40
|
-
"content": "# Benchmark Report\r\n> Generated by [`@nestia/
|
40
|
+
"content": "# Benchmark Report\r\n> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)\r\n\r\n - Specifications\r\n - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics \r\n - RAM: 31 GB\r\n - NodeJS Version: v20.10.0\r\n - Backend Server: 1 core / 1 thread\r\n - Arguments\r\n - Count: 40,000\r\n - Threads: 4\r\n - Simultaneous: 32\r\n - Time\r\n - Start: 2024-07-25T19:14:00.253Z\r\n - Complete: 2024-07-25T19:16:37.125Z\r\n - Elapsed: 156,872 ms\r\n\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nTotal | 41,226 | 41,226 | 114 | 109.72 | 8 | 998\r\n\r\n> Unit: milliseconds\r\n\r\n## Memory Usage\r\n```mermaid\r\nxychart-beta\r\n x-axis \"Time (second)\"\r\n y-axis \"Memory (MB)\"\r\n line [37, 44, 33, 40, 66, 95, 114, 119, 123, 43, 42, 47, 68, 70, 66, 81, 87, 87, 97, 115, 135, 47, 58, 54, 61, 75, 45, 43, 49, 62, 83, 51, 65, 78, 54, 61, 63, 71, 72, 53, 70, 69, 61, 68, 88, 62, 70, 65, 67, 85, 62, 75, 81, 78, 58, 75, 77, 64, 69, 84, 98, 64, 70, 89, 98, 102, 58, 76, 82, 97, 61, 74, 77, 95, 70, 79, 92, 80, 92, 94, 94, 109, 71, 83, 80, 59, 70, 77, 92, 97, 75, 82, 89, 95, 78, 84, 100, 105, 117, 134, 129, 71, 85, 86, 88, 69, 76, 91, 92, 85, 86, 91, 104, 102, 78, 91, 81, 76, 91, 118, 114, 115, 135, 143, 73, 90, 91, 92, 102, 77, 85, 98, 81, 92, 83, 94, 72, 112, 92, 107, 100, 102, 115]\r\n```\r\n\r\n## Endpoints\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nPATCH /bbs/articles/:section | 6,703 | 6,703 | 167.16 | 125.5 | 8 | 996\r\nPUT /bbs/articles/:section/:id | 326 | 326 | 117.86 | 101.2 | 11 | 546\r\nGET /bbs/articles/:section/:id | 680 | 680 | 110.42 | 93.49 | 10 | 579\r\nPOST /bbs/articles/:section | 33,517 | 33,517 | 103.4 | 103.45 | 8 | 998\r\n\r\n> Unit: milliseconds\r\n\r\n## Failures\r\nMethod | Path | Count | Failures\r\n-------|------|-------|----------"
|
41
41
|
},
|
42
42
|
{
|
43
43
|
"location": "",
|
@@ -52,12 +52,12 @@ export const NEST_TEMPLATE = [
|
|
52
52
|
{
|
53
53
|
"location": "",
|
54
54
|
"file": "package.json",
|
55
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"benchmark\": \"node bin/test/benchmark\",\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/benchmark\": \"^0.
|
55
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"benchmark\": \"node bin/test/benchmark\",\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/benchmark\": \"^0.2.0\",\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@nestia/sdk\": \"^3.8.1\",\r\n \"@rollup/plugin-terser\": \"^0.4.4\",\r\n \"@rollup/plugin-typescript\": \"^11.1.6\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/cli-progress\": \"^3.11.5\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^6.19.1\",\r\n \"@typescript-eslint/parser\": \"^6.19.1\",\r\n \"chalk\": \"^4.1.2\",\r\n \"cli\": \"^1.0.1\",\r\n \"cli-progress\": \"^3.12.0\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^2.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.5.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"rollup\": \"^4.18.0\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.2.1\",\r\n \"typescript\": \"^5.5.4\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^3.8.1\",\r\n \"@nestia/fetcher\": \"^3.8.1\",\r\n \"@nestjs/common\": \"^10.3.10\",\r\n \"@nestjs/core\": \"^10.3.10\",\r\n \"@nestjs/platform-express\": \"^10.3.10\",\r\n \"commander\": \"10.0.0\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"tstl\": \"^3.0.0\",\r\n \"typia\": \"^6.5.4\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
|
56
56
|
},
|
57
57
|
{
|
58
58
|
"location": "packages/api",
|
59
59
|
"file": ".gitignore",
|
60
|
-
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json"
|
60
|
+
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json\r\nopenai.json"
|
61
61
|
},
|
62
62
|
{
|
63
63
|
"location": "packages/api",
|
@@ -67,7 +67,7 @@ export const NEST_TEMPLATE = [
|
|
67
67
|
{
|
68
68
|
"location": "packages/api",
|
69
69
|
"file": "package.json",
|
70
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"
|
70
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"package.json\",\r\n \"swagger.json\",\r\n \"openai.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.8.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"typia\": \"^6.5.4\"\r\n }\r\n}"
|
71
71
|
},
|
72
72
|
{
|
73
73
|
"location": "packages/api",
|
@@ -92,7 +92,7 @@ export const NEST_TEMPLATE = [
|
|
92
92
|
{
|
93
93
|
"location": "",
|
94
94
|
"file": "README.md",
|
95
|
-
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\r\n\r\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\r\n\r\nYou can create a new project from this boilerplate by running below command:\r\n\r\n```bash\r\nnpx nestia start <directory>\r\n```\r\n\r\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \r\n\r\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\r\n\r\n\r\n\r\n\r\n## Directories and Files\r\nThis template project has categorized directories like below.\r\n\r\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.\r\n\r\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\r\n - [src/](src): Backend source directory\r\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\r\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\r\n - [**src/api/structures/**](src/api/structures/): DTO structures\r\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\r\n - [**test/**](test): Test Automation Program\r\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\r\n - [package.json](package.json): NPM configuration\r\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\r\n - [tsconfig.api.json](tsconfig.api.json): TypeScript configuration for the SDK generation\r\n\r\n\r\n\r\n\r\n## NPM Run Commands\r\nList of the run commands defined in the [package.json](package.json) are like below:\r\n\r\n -
|
95
|
+
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-start/actions?query=workflow%3Abuild)\r\n\r\nA template repository for backend projects using [nestia](https://github.com/samchon/nestia).\r\n\r\nYou can create a new project from this boilerplate by running below command:\r\n\r\n```bash\r\nnpx nestia start <directory>\r\n```\r\n\r\nFor reference, this is a minimal boilerplate project concentrating only on [nestia](https://github.com/samchon/nestia) SDK generation. \r\n\r\nIf you wanna much detailed boilerplate project, visit [`@samchon/backend`](https://github.com/samchon/backend).\r\n\r\n\r\n\r\n\r\n## Directories and Files\r\nThis template project has categorized directories like below.\r\n\r\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.\r\n\r\n - [packages/api/](packages/api): SDK module built by `npm run build:api`\r\n - [src/](src): Backend source directory\r\n - [src/api/](src/api/): Client SDK that would be published to the `@ORGANIZATION/PROJECT-api`\r\n - [**src/api/functional/**](src/api/functional/): API functions generated by the [`nestia`](https://github.com/samchon/nestia)\r\n - [**src/api/structures/**](src/api/structures/): DTO structures\r\n - [src/controllers/](src/controllers/): Controller classes of the Main Program\r\n - [**test/**](test): Test Automation Program\r\n - [nestia.config.ts](nestia.config.ts): Configuration file of [`nestia`](https://github.com/samchon/nestia)\r\n - [package.json](package.json): NPM configuration\r\n - [tsconfig.json](tsconfig.json): TypeScript configuration for the main program\r\n - [tsconfig.api.json](tsconfig.api.json): TypeScript configuration for the SDK generation\r\n\r\n\r\n\r\n\r\n## NPM Run Commands\r\nList of the run commands defined in the [package.json](package.json) are like below:\r\n\r\n - Test\r\n - **`test`**: Run test automation program\r\n - `benchmark`: Run performance benchmark program\r\n - Build\r\n - `build`: Build everything\r\n - `build:main`: Build main program (`src` directory)\r\n - `build:test` Build test automation program (`test` directory)\r\n - `build:sdk`: Build SDK into main program only\r\n - `build:swagger`: Build Swagger Documents\r\n - **`dev`**: Incremental build for development (test program)\r\n - Deploy\r\n - `package:api`: Build and deploy the SDK library to the NPM\r\n - `start`: Start local NestJS server\r\n - Webpack\r\n - `webpack`: Run webpack bundler\r\n - `webpack:start`: Start the backend server built by webpack\r\n - `webpack:test`: Run test program to the webpack built\r\n\r\n\r\n\r\n\r\n## Specialization\r\nTransform this template project to be yours.\r\n\r\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.\r\n\r\n| Before | After\r\n|-----------------|----------------------------------------\r\n| ORGANIZATION | Your account or corporation name\r\n| PROJECT | Your own project name\r\n| AUTHOR | Author name\r\n| https://github.com/samchon/nestia-start | Your repository URL\r\n\r\n\r\n\r\n\r\n## Test Driven Development\r\nWith [nestia](https://github.com/samchon/nestia) helps to accomplish TDD (Test Driven Development). \r\n\r\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.\r\n\r\nDuring the test automation program development, you can find that which API is mis-designed or which requirement analysis is not exact. Development of the main program must be the last step after such validation process during TDD.\r\n\r\n> Visit the [samchon/backend](https://github.com/samchon/backend), then you may find much detailed story about this TDD.\r\n>\r\n> 1. Definitions\r\n> 2. SDK\r\n> 3. Test Automation Program\r\n> 4. Main Program\r\n\r\n```typescript\r\nimport {\r\n ArrayUtil,\r\n GaffComparator,\r\n RandomGenerator,\r\n TestValidator,\r\n} from \"@nestia/e2e\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\r\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\r\nimport { IPage } from \"@ORGANIZATION/PROJECT-api/lib/structures/common/IPage\";\r\n\r\nexport async function test_api_bbs_article_index_sort(\r\n connection: api.IConnection,\r\n): Promise<void> {\r\n // GENERATE 100 ARTICLES\r\n const section: string = \"general\";\r\n await ArrayUtil.asyncRepeat(100)(() =>\r\n api.functional.bbs.articles.create(connection, section, {\r\n writer: RandomGenerator.name(),\r\n title: RandomGenerator.paragraph(5)(),\r\n body: RandomGenerator.content(8)()(),\r\n format: \"txt\",\r\n files: [],\r\n password: RandomGenerator.alphabets(8),\r\n }),\r\n );\r\n\r\n // PREPARE VALIDATOR\r\n const validator = TestValidator.sort(\"BbsArticleProvider.index()\")(async (\r\n sort: IPage.Sort<IBbsArticle.IRequest.SortableColumns>,\r\n ) => {\r\n const page: IPage<IBbsArticle.ISummary> =\r\n await api.functional.bbs.articles.index(connection, section, {\r\n limit: 100,\r\n sort,\r\n });\r\n return page.data;\r\n });\r\n\r\n // DO VALIDATE\r\n const components = [\r\n validator(\"created_at\")(GaffComparator.dates((x) => x.created_at)),\r\n validator(\"updated_at\")(GaffComparator.dates((x) => x.updated_at)),\r\n validator(\"title\")(GaffComparator.strings((x) => x.title)),\r\n validator(\"writer\")(GaffComparator.strings((x) => x.writer)),\r\n validator(\r\n \"writer\",\r\n \"title\",\r\n )(GaffComparator.strings((x) => [x.writer, x.title])),\r\n ];\r\n for (const comp of components) {\r\n await comp(\"+\", false);\r\n await comp(\"-\", false);\r\n }\r\n}\r\n```\r\n\r\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:\r\n\r\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)"
|
96
96
|
},
|
97
97
|
{
|
98
98
|
"location": "src/api",
|
@@ -137,7 +137,7 @@ export const NEST_TEMPLATE = [
|
|
137
137
|
{
|
138
138
|
"location": "src/executable",
|
139
139
|
"file": "server.ts",
|
140
|
-
"content": "import
|
140
|
+
"content": "import { MyBackend } from \"../MyBackend\";\r\n\r\nconst EXTENSION = __filename.substring(__filename.length - 2);\r\nif (EXTENSION === \"js\") require(\"source-map-support/register\");\r\n\r\nasync function main(): Promise<void> {\r\n // BACKEND SEVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n // UNEXPECTED ERRORS\r\n global.process.on(\"uncaughtException\", console.error);\r\n global.process.on(\"unhandledRejection\", console.error);\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
141
141
|
},
|
142
142
|
{
|
143
143
|
"location": "src/executable",
|
@@ -162,7 +162,7 @@ export const NEST_TEMPLATE = [
|
|
162
162
|
{
|
163
163
|
"location": "src/utils",
|
164
164
|
"file": "ErrorUtil.ts",
|
165
|
-
"content": "import
|
165
|
+
"content": "import serializeError = require(\"serialize-error\");\r\n\r\nexport namespace ErrorUtil {\r\n export const toJSON = (err: any): object =>\r\n err instanceof Object && err.toJSON instanceof Function\r\n ? err.toJSON()\r\n : serializeError(err);\r\n}\r\n"
|
166
166
|
},
|
167
167
|
{
|
168
168
|
"location": "src/utils",
|
@@ -187,7 +187,7 @@ export const NEST_TEMPLATE = [
|
|
187
187
|
{
|
188
188
|
"location": "test",
|
189
189
|
"file": "index.ts",
|
190
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport { MyBackend } from \"../src/MyBackend\";\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport { MyGlobal } from \"../src/MyGlobal\";\r\nimport { ArgumentParser } from \"./helpers/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n include?: string[];\r\n exclude?: string[];\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, _prompt, action) => {\r\n // command.option(\"--mode <string>\", \"target mode\");\r\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n\r\n return action(async (options) => {\r\n // if (typeof options.reset === \"string\")\r\n // options.reset = options.reset === \"true\";\r\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\r\n // \"LOCAL\",\r\n // \"DEV\",\r\n // \"REAL\",\r\n // ]);\r\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nasync function main(): Promise<void> {\r\n // CONFIGURATIONS\r\n const options: IOptions = await getOptions();\r\n MyGlobal.testing = true;\r\n\r\n // BACKEND SERVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n //----\r\n // CLINET CONNECTOR\r\n //----\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
190
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport { MyBackend } from \"../src/MyBackend\";\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport { MyGlobal } from \"../src/MyGlobal\";\r\nimport { ArgumentParser } from \"./helpers/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n include?: string[];\r\n exclude?: string[];\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, _prompt, action) => {\r\n // command.option(\"--mode <string>\", \"target mode\");\r\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n\r\n return action(async (options) => {\r\n // if (typeof options.reset === \"string\")\r\n // options.reset = options.reset === \"true\";\r\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\r\n // \"LOCAL\",\r\n // \"DEV\",\r\n // \"REAL\",\r\n // ]);\r\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nasync function main(): Promise<void> {\r\n // CONFIGURATIONS\r\n const options: IOptions = await getOptions();\r\n MyGlobal.testing = true;\r\n\r\n // BACKEND SERVER\r\n const backend: MyBackend = new MyBackend();\r\n await backend.open();\r\n\r\n //----\r\n // CLINET CONNECTOR\r\n //----\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n await backend.close();\r\n\r\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\r\n (exec) => exec.error !== null,\r\n );\r\n if (failures.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n for (const f of failures) console.log(f.error);\r\n process.exit(-1);\r\n }\r\n\r\n console.log(\r\n [\r\n `All: #${report.executions.length}`,\r\n `Success: #${report.executions.length - failures.length}`,\r\n `Failed: #${failures.length}`,\r\n ].join(\"\\n\"),\r\n );\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
191
191
|
},
|
192
192
|
{
|
193
193
|
"location": "test",
|
@@ -197,7 +197,7 @@ export const NEST_TEMPLATE = [
|
|
197
197
|
{
|
198
198
|
"location": "test",
|
199
199
|
"file": "webpack.ts",
|
200
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\nimport cp from \"child_process\";\r\nimport { sleep_for } from \"tstl\";\r\n\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport api from \"../src/api\";\r\n\r\nconst main = async (): Promise<void> => {\r\n // OPEN BUNDLED SERVER\r\n const backend = cp.fork(`${MyConfiguration.ROOT}/dist/server.js`, {\r\n cwd: `${MyConfiguration.ROOT}/dist`,\r\n });\r\n await sleep_for(2_500);\r\n\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
200
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\nimport cp from \"child_process\";\r\nimport { sleep_for } from \"tstl\";\r\n\r\nimport { MyConfiguration } from \"../src/MyConfiguration\";\r\nimport api from \"../src/api\";\r\n\r\nconst main = async (): Promise<void> => {\r\n // OPEN BUNDLED SERVER\r\n const backend = cp.fork(`${MyConfiguration.ROOT}/dist/server.js`, {\r\n cwd: `${MyConfiguration.ROOT}/dist`,\r\n });\r\n await sleep_for(2_500);\r\n\r\n // DO TEST\r\n const connection: api.IConnection = {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n };\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n\r\n backend.kill();\r\n\r\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\r\n (exec) => exec.error !== null,\r\n );\r\n if (failures.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n for (const f of failures) console.log(f.error);\r\n process.exit(-1);\r\n }\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
201
201
|
},
|
202
202
|
{
|
203
203
|
"location": "",
|
@@ -27,7 +27,7 @@ export const SDK_TEMPLATE = [
|
|
27
27
|
{
|
28
28
|
"location": "",
|
29
29
|
"file": "package.json",
|
30
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.
|
30
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.8.0\",\r\n \"tgrid\": \"^1.0.2\",\r\n \"typia\": \"^6.5.4\"\r\n },\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@rollup/plugin-terser\": \"^0.4.4\",\r\n \"@rollup/plugin-typescript\": \"^11.1.6\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"@types/swagger-ui-express\": \"^4.1.6\",\r\n \"chalk\": \"4.1.2\",\r\n \"commander\": \"^10.0.0\",\r\n \"express\": \"^4.19.2\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"rollup\": \"^4.13.2\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.2.1\",\r\n \"typescript\": \"^5.5.4\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n }\r\n}"
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"location": "",
|
@@ -77,12 +77,7 @@ export const SDK_TEMPLATE = [
|
|
77
77
|
{
|
78
78
|
"location": "test",
|
79
79
|
"file": "index.ts",
|
80
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n extension: __filename.substring(__filename.length - 2),\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n
|
81
|
-
},
|
82
|
-
{
|
83
|
-
"location": "test",
|
84
|
-
"file": "manual.ts",
|
85
|
-
"content": ""
|
80
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\nimport chalk from \"chalk\";\r\n\r\nimport { TestGlobal } from \"./TestGlobal\";\r\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\r\n\r\ninterface IOptions {\r\n simulate: boolean;\r\n include?: string[];\r\n exclude?: string[];\r\n trace: boolean;\r\n}\r\n\r\nconst getOptions = () =>\r\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\r\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\r\n command.option(\"--include <string...>\", \"include feature files\");\r\n command.option(\"--exclude <string...>\", \"exclude feature files\");\r\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\r\n\r\n return action(async (options) => {\r\n if (typeof options.simulate === \"string\")\r\n options.simulate = options.simulate === \"true\";\r\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\r\n options.trace = options.trace !== (\"false\" as any);\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): Promise<void> => {\r\n // DO TEST\r\n const options: IOptions = await getOptions();\r\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\r\n prefix: \"test\",\r\n location: __dirname + \"/features\",\r\n extension: __filename.substring(__filename.length - 2),\r\n parameters: () => [\r\n {\r\n ...TestGlobal.connection(),\r\n simulate: options.simulate,\r\n },\r\n ],\r\n filter: (func) =>\r\n (!options.include?.length ||\r\n (options.include ?? []).some((str) => func.includes(str))) &&\r\n (!options.exclude?.length ||\r\n (options.exclude ?? []).every((str) => !func.includes(str))),\r\n onComplete: (exec) => {\r\n const trace = (str: string) =>\r\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\r\n if (exec.error === null) {\r\n const elapsed: number =\r\n new Date(exec.completed_at).getTime() -\r\n new Date(exec.started_at).getTime();\r\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\r\n } else trace(chalk.red(exec.error.name));\r\n },\r\n });\r\n\r\n // REPORT EXCEPTIONS\r\n const exceptions: Error[] = report.executions\r\n .filter((exec) => exec.error !== null)\r\n .map((exec) => exec.error!);\r\n if (exceptions.length === 0) {\r\n console.log(\"Success\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n } else {\r\n if (options.trace !== false) for (const exp of exceptions) console.log(exp);\r\n console.log(\"Failed\");\r\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\r\n }\r\n\r\n // TERMINATE\r\n if (exceptions.length) process.exit(-1);\r\n else process.exit(0);\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
86
81
|
},
|
87
82
|
{
|
88
83
|
"location": "test",
|