@nestia/migrate 4.6.0 → 4.6.1-dev.20250117
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.
- package/README.md +87 -87
- package/lib/bundles/NEST_TEMPLATE.js +66 -66
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +30 -30
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/index.mjs +92 -92
- package/lib/utils/openapi-down-convert/converter.js +2 -2
- package/package.json +6 -6
- package/src/MigrateApplication.ts +107 -107
- package/src/analyzers/MigrateApplicationAnalyzer.ts +18 -18
- package/src/analyzers/MigrateControllerAnalyzer.ts +51 -51
- package/src/archivers/MigrateFileArchiver.ts +38 -38
- package/src/bundles/NEST_TEMPLATE.ts +66 -66
- package/src/bundles/SDK_TEMPLATE.ts +30 -30
- package/src/executable/bundle.js +125 -125
- package/src/executable/migrate.ts +7 -7
- package/src/factories/TypeLiteralFactory.ts +57 -57
- package/src/index.ts +4 -4
- package/src/internal/MigrateCommander.ts +86 -86
- package/src/internal/MigrateInquirer.ts +89 -89
- package/src/module.ts +8 -8
- package/src/programmers/MigrateApiFileProgrammer.ts +49 -49
- package/src/programmers/MigrateApiFunctionProgrammer.ts +210 -210
- package/src/programmers/MigrateApiNamespaceProgrammer.ts +417 -417
- package/src/programmers/MigrateApiProgrammer.ts +103 -103
- package/src/programmers/MigrateApiSimulatationProgrammer.ts +324 -324
- package/src/programmers/MigrateApiStartProgrammer.ts +194 -194
- package/src/programmers/MigrateDtoProgrammer.ts +87 -87
- package/src/programmers/MigrateE2eFileProgrammer.ts +117 -117
- package/src/programmers/MigrateE2eProgrammer.ts +34 -34
- package/src/programmers/MigrateImportProgrammer.ts +118 -118
- package/src/programmers/MigrateNestControllerProgrammer.ts +50 -50
- package/src/programmers/MigrateNestMethodProgrammer.ts +393 -393
- package/src/programmers/MigrateNestModuleProgrammer.ts +65 -65
- package/src/programmers/MigrateNestProgrammer.ts +81 -81
- package/src/programmers/MigrateSchemaProgrammer.ts +373 -373
- package/src/structures/IHttpMigrateController.ts +8 -8
- package/src/structures/IHttpMigrateDto.ts +8 -8
- package/src/structures/IHttpMigrateFile.ts +5 -5
- package/src/structures/IHttpMigrateProgram.ts +27 -27
- package/src/structures/IHttpMigrateRoute.ts +1 -1
- package/src/structures/IHttpMigrateSchema.ts +4 -4
- package/src/utils/FilePrinter.ts +36 -36
- package/src/utils/MapUtil.ts +13 -13
- package/src/utils/OpenApiTypeChecker.ts +73 -73
- package/src/utils/SetupWizard.ts +12 -12
- package/src/utils/StringUtil.ts +113 -113
- package/src/utils/openapi-down-convert/RefVisitor.ts +139 -139
- package/src/utils/openapi-down-convert/converter.ts +527 -527
@@ -2,216 +2,216 @@ export const NEST_TEMPLATE = [
|
|
2
2
|
{
|
3
3
|
"location": "",
|
4
4
|
"file": ".env",
|
5
|
-
"content": "# BASIC SERVER INFO\nPROJECT_API_PORT=37001"
|
5
|
+
"content": "# BASIC SERVER INFO\r\nPROJECT_API_PORT=37001"
|
6
6
|
},
|
7
7
|
{
|
8
8
|
"location": "",
|
9
9
|
"file": ".eslintrc.cjs",
|
10
|
-
"content": "module.exports = {\n root: true,\n plugins: [\"@typescript-eslint\", \"deprecation\"],\n extends: [\"plugin:@typescript-eslint/recommended\"],\n parser: \"@typescript-eslint/parser\",\n parserOptions: {\n project: [\"tsconfig.json\", \"test/tsconfig.json\"],\n },\n overrides: [\n {\n files: [\"src/**/*.ts\", \"test/**/*.ts\"],\n rules: {\n \"@typescript-eslint/consistent-type-definitions\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-inferrable-types\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@typescript-eslint/no-unused-vars\": \"off\",\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n },\n },\n ],\n};\n"
|
10
|
+
"content": "module.exports = {\r\n root: true,\r\n plugins: [\"@typescript-eslint\", \"deprecation\"],\r\n extends: [\"plugin:@typescript-eslint/recommended\"],\r\n parser: \"@typescript-eslint/parser\",\r\n parserOptions: {\r\n project: [\"tsconfig.json\", \"test/tsconfig.json\"],\r\n },\r\n overrides: [\r\n {\r\n files: [\"src/**/*.ts\", \"test/**/*.ts\"],\r\n rules: {\r\n \"@typescript-eslint/consistent-type-definitions\": \"off\",\r\n \"@typescript-eslint/no-empty-function\": \"off\",\r\n \"@typescript-eslint/no-empty-interface\": \"off\",\r\n \"@typescript-eslint/no-explicit-any\": \"off\",\r\n \"@typescript-eslint/no-inferrable-types\": \"off\",\r\n \"@typescript-eslint/no-namespace\": \"off\",\r\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\r\n \"@typescript-eslint/no-unused-vars\": \"off\",\r\n \"@typescript-eslint/no-var-requires\": \"off\",\r\n \"@typescript-eslint/no-floating-promises\": \"error\",\r\n \"@typescript-eslint/no-require-imports\": \"off\",\r\n \"@typescript-eslint/no-empty-object-type\": \"off\",\r\n },\r\n },\r\n ],\r\n};\r\n"
|
11
11
|
},
|
12
12
|
{
|
13
13
|
"location": ".github/workflows",
|
14
14
|
"file": "build.yml",
|
15
|
-
"content": "name: build\non:\n pull_request:\n paths:\n - 'src/**'\n - 'test/**'\n - 'package.json'\njobs:\n Ubuntu:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 20.x\n - uses: pnpm/action-setup@v4\n with:\n version: 8\n \n - name: Install Backend-Server\n run: pnpm install\n\n - name: Build Swagger\n run: npm run build:swagger\n\n - name: Build SDK\n run: npm run build:sdk\n\n - name: Compile Backend-Server\n run: npm run build\n\n - name: Run Test Program\n run: npm run test\n\n - name: Test Webpack\n run: npm run webpack && npm run test:webpack\n\n - name: EsLint\n run: npm run eslint\n"
|
15
|
+
"content": "name: build\r\non:\r\n pull_request:\r\n paths:\r\n - 'src/**'\r\n - 'test/**'\r\n - 'package.json'\r\njobs:\r\n Ubuntu:\r\n runs-on: ubuntu-latest\r\n steps:\r\n - uses: actions/checkout@v4\r\n - uses: actions/setup-node@v4\r\n with:\r\n node-version: 20.x\r\n - uses: pnpm/action-setup@v4\r\n with:\r\n version: 8\r\n \r\n - name: Install Backend-Server\r\n run: pnpm install\r\n\r\n - name: Build Swagger\r\n run: npm run build:swagger\r\n\r\n - name: Build SDK\r\n run: npm run build:sdk\r\n\r\n - name: Compile Backend-Server\r\n run: npm run build\r\n\r\n - name: Run Test Program\r\n run: npm run test\r\n\r\n - name: Test Webpack\r\n run: npm run webpack && npm run test:webpack\r\n\r\n - name: EsLint\r\n run: npm run eslint\r\n"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
"location": "",
|
19
19
|
"file": ".gitignore",
|
20
|
-
"content": ".git/\nbin/\ndist/\nlib/\nnode_modules/\npackages/api/lib/\n\npackage-lock.json\npnpm-lock.yaml"
|
20
|
+
"content": ".git/\r\nbin/\r\ndist/\r\nlib/\r\nnode_modules/\r\npackages/api/lib/\r\n\r\npackage-lock.json\r\npnpm-lock.yaml"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"location": "",
|
24
24
|
"file": ".prettierignore",
|
25
|
-
"content": "dist\nbin\nnode_modules\npackages\nsrc/api/functional\nsrc/api/utils/NestiaSimulator.ts\nREADME.md\ntsconfig.json"
|
25
|
+
"content": "dist\r\nbin\r\nnode_modules\r\npackages\r\nsrc/api/functional\r\nsrc/api/utils/NestiaSimulator.ts\r\nREADME.md\r\ntsconfig.json"
|
26
26
|
},
|
27
27
|
{
|
28
28
|
"location": ".vscode",
|
29
29
|
"file": "launch.json",
|
30
|
-
"content": "{\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}"
|
30
|
+
"content": "{\r\n // Use IntelliSense to learn about possible Node.js debug attributes.\r\n // Hover to view descriptions of existing attributes.\r\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\r\n \"version\": \"0.2.0\",\r\n \"configurations\": [\r\n {\r\n \"type\": \"node\",\r\n \"request\": \"launch\",\r\n \"name\": \"Backend Test\",\r\n \"program\": \"${workspaceRoot}/test/index.ts\",\r\n \"cwd\": \"${workspaceRoot}\",\r\n \"args\": [\r\n // //----\r\n // // Not possible to reset DB in debugging mode\r\n // //\r\n // // Therefore, if you need DB reset, then do it \r\n // // through `npm run reset-for-debugging` command\r\n // //----\r\n // \"--reset\", \"false\",\r\n // \"--mode\", \"local\",\r\n \r\n //----\r\n // You can run specific test functions\r\n //\r\n // If you want to include or exclude multiple words,\r\n // then separate them with space character\r\n //----\r\n // \"--include\", \"some-words-to-include\",\r\n // \"--exclude\", \"some-word another-word\",\r\n ],\r\n \"outFiles\": [\"${workspaceRoot}/bin/**/*.js\"],\r\n }\r\n]\r\n}"
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"location": ".vscode",
|
34
34
|
"file": "settings.json",
|
35
|
-
"content": "{\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}"
|
35
|
+
"content": "{\r\n \"editor.tabSize\": 2,\r\n \"editor.formatOnSave\": true,\r\n \"[javascript][typescript]\": {\r\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\r\n \"editor.codeActionsOnSave\": {\r\n \"source.fixAll.eslint\": \"explicit\"\r\n },\r\n }\r\n}"
|
36
36
|
},
|
37
37
|
{
|
38
|
-
"location": "",
|
39
|
-
"file": "
|
40
|
-
"content": "
|
38
|
+
"location": "docs/benchmarks",
|
39
|
+
"file": "AMD Ryzen 9 7940HS w Radeon 780M Graphics.md",
|
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-10-29T19:14:35.941Z\r\n - Complete: 2024-10-29T19:16:11.418Z\r\n - Elapsed: 95,477 ms\r\n\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nTotal | 41,586 | 41,586 | 69.24 | 73.05 | 5 | 546\r\n\r\n> Unit: milliseconds\r\n\r\n## Memory Consumptions\r\n```mermaid\r\nxychart-beta\r\n x-axis \"Time (second)\"\r\n y-axis \"Memory (MB)\"\r\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]\r\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]\r\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]\r\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]\r\n```\r\n\r\n> - 🟦 Resident Set Size\r\n> - 🟢 Heap Total\r\n> - 🔴 Heap Used + External\r\n> - 🟡 Heap Used Only\r\n\r\n## Endpoints\r\nType | Count | Success | Mean. | Stdev. | Minimum | Maximum\r\n----|----|----|----|----|----|----\r\nPATCH /bbs/articles/:section | 6,439 | 6,439 | 108.37 | 76.56 | 6 | 546\r\nPUT /bbs/articles/:section/:id | 380 | 380 | 78.52 | 69.03 | 6 | 296\r\nGET /bbs/articles/:section/:id | 917 | 917 | 77.65 | 69.84 | 6 | 463\r\nDELETE /bbs/articles/:section/:id | 201 | 201 | 73.89 | 63.55 | 7 | 307\r\nPOST /bbs/articles/:section | 33,649 | 33,649 | 61.39 | 70.04 | 5 | 546\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": "",
|
44
|
-
"file": "
|
45
|
-
"content": "
|
46
|
-
},
|
47
|
-
{
|
48
|
-
"location": "docs/benchmarks",
|
49
|
-
"file": "AMD Ryzen 9 7940HS w Radeon 780M Graphics.md",
|
50
|
-
"content": "# 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-------|------|-------|----------"
|
44
|
+
"file": "LICENSE",
|
45
|
+
"content": "MIT License\r\n\r\nCopyright (c) 2022 Jeongho Nam\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n"
|
51
46
|
},
|
52
47
|
{
|
53
48
|
"location": "",
|
54
49
|
"file": "nestia.config.ts",
|
55
|
-
"content": "// 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 primitive: false,\n simulate: true,\n};\nexport default NESTIA_CONFIG;\n"
|
50
|
+
"content": "// nestia configuration file\r\nimport type sdk from \"@nestia/sdk\";\r\nimport { NestFactory } from \"@nestjs/core\";\r\n\r\nimport { MyModule } from \"./src/MyModule\";\r\n\r\nconst NESTIA_CONFIG: sdk.INestiaConfig = {\r\n input: () => NestFactory.create(MyModule),\r\n output: \"src/api\",\r\n swagger: {\r\n output: \"packages/api/swagger.json\",\r\n servers: [\r\n {\r\n url: \"http://localhost:37001\",\r\n description: \"Local Server\",\r\n },\r\n ],\r\n beautify: true,\r\n },\r\n distribute: \"packages/api\",\r\n primitive: false,\r\n simulate: true,\r\n};\r\nexport default NESTIA_CONFIG;\r\n"
|
56
51
|
},
|
57
52
|
{
|
58
53
|
"location": "",
|
59
54
|
"file": "package.json",
|
60
|
-
"content": "{\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 && typia patch\",\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: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 \"@nestia/benchmark\": \"^0.3.0\",\n \"@nestia/e2e\": \"^0.7.0\",\n \"@nestia/sdk\": \"^4.6.
|
55
|
+
"content": "{\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 && typia patch\",\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: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 \"@nestia/benchmark\": \"^0.3.0\",\n \"@nestia/e2e\": \"^0.7.0\",\n \"@nestia/sdk\": \"^4.6.1-dev.20250117\",\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\": \"^6.3.1\",\n \"prettier\": \"^3.2.4\",\n \"prettier-plugin-prisma\": \"^5.0.0\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^4.18.0\",\n \"source-map-support\": \"^0.5.21\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"ts-loader\": \"^9.5.1\",\n \"ts-node\": \"^10.9.1\",\n \"ts-patch\": \"^3.3.0\",\n \"typescript\": \"~5.7.3\",\n \"typescript-transform-paths\": \"^3.5.3\",\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\": \"^4.6.1-dev.20250117\",\n \"@nestia/fetcher\": \"^4.6.1-dev.20250117\",\n \"@nestjs/common\": \"^10.4.15\",\n \"@nestjs/core\": \"^10.4.15\",\n \"@nestjs/platform-express\": \"^10.4.15\",\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.0.2\",\n \"tstl\": \"^3.0.0\",\n \"typia\": \"^7.6.0\",\n \"uuid\": \"^9.0.0\"\n },\n \"stackblitz\": {\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\n }\n}"
|
61
56
|
},
|
62
57
|
{
|
63
58
|
"location": "packages/api",
|
64
59
|
"file": ".gitignore",
|
65
|
-
"content": "lib/\nnode_modules/\n\nswagger.json\nopenai.json"
|
60
|
+
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json\r\nopenai.json"
|
66
61
|
},
|
67
62
|
{
|
68
63
|
"location": "packages/api",
|
69
64
|
"file": "LICENSE",
|
70
|
-
"content": "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."
|
65
|
+
"content": "MIT License\r\n\r\nCopyright (c) 2021 ORGANIZATION\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE."
|
71
66
|
},
|
72
67
|
{
|
73
68
|
"location": "packages/api",
|
74
|
-
"file": "
|
75
|
-
"content": "
|
69
|
+
"file": "package.json",
|
70
|
+
"content": "{\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\": \"^4.6.1-dev.20250117\",\n \"tgrid\": \"^1.1.0\",\n \"typia\": \"^7.6.0\"\n }\n}"
|
76
71
|
},
|
77
72
|
{
|
78
73
|
"location": "packages/api",
|
79
|
-
"file": "
|
80
|
-
"content": "
|
74
|
+
"file": "README.md",
|
75
|
+
"content": "# SDK Library\r\nThis is a SDK library generated by [`nestia`](https://nestia.io).\r\n\r\nWith this SDK library, you can easily and safely interact with backend server.\r\n\r\nJust import and call some API functions like gif image below:\r\n\r\n\r\n\r\n> Left is server code, and right is client code utilizing the SDK\r\n\r\n\r\n\r\n\r\n# What [`Nestia`](https://nestia.io) is:\r\n\r\n\r\n[](https://github.com/samchon/nestia/blob/master/LICENSE)\r\n[](https://www.npmjs.com/package/@nestia/core)\r\n[](https://www.npmjs.com/package/@nestia/core)\r\n[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n[](https://nestia.io/docs/)\r\n\r\nNestia is a set of helper libraries for NestJS, supporting below features:\r\n\r\n - `@nestia/core`: super-fast decorators\r\n - `@nestia/sdk`:\r\n - Swagger generator evolved than ever\r\n - SDK library generator for clients\r\n - Mockup Simulator for client applications\r\n - Automatic E2E test functions generator\r\n - `@nestia/migrate`: migration from Swagger to NestJS\r\n - `nestia`: just CLI (command line interface) tool\r\n\r\n> **Note**\r\n> \r\n> - **Only one line** required, with pure TypeScript type\r\n> - Enhance performance **30x** up\r\n> - Runtime validator is **20,000x faster** than `class-validator`\r\n> - JSON serialization is **200x faster** than `class-transformer`\r\n> - Software Development Kit\r\n> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)\r\n> - Mockup simulator means embedded backend simulator in SDK\r\n> - similar with [msw](https://mswjs.io/), but fully automated"
|
81
76
|
},
|
82
77
|
{
|
83
78
|
"location": "packages/api",
|
84
79
|
"file": "rollup.config.js",
|
85
|
-
"content": "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"
|
80
|
+
"content": "const typescript = require(\"@rollup/plugin-typescript\");\r\nconst terser = require(\"@rollup/plugin-terser\");\r\n\r\nmodule.exports = {\r\n input: `${__dirname}/../../src/api/index.ts`,\r\n output: {\r\n dir: `${__dirname}/lib`,\r\n format: \"esm\",\r\n entryFileNames: \"[name].mjs\",\r\n sourcemap: true,\r\n },\r\n plugins: [\r\n typescript({\r\n tsconfig: `${__dirname}/tsconfig.json`,\r\n module: \"ESNext\",\r\n target: \"ESNext\",\r\n }),\r\n terser({\r\n format: {\r\n comments: \"some\",\r\n beautify: true,\r\n ecma: \"2020\",\r\n },\r\n compress: false,\r\n mangle: false,\r\n module: true,\r\n }),\r\n ],\r\n};\r\n"
|
86
81
|
},
|
87
82
|
{
|
88
83
|
"location": "packages/api",
|
89
84
|
"file": "tsconfig.json",
|
90
|
-
"content": "{\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}"
|
85
|
+
"content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n /* Language and Environment */\r\n \"target\": \"ES5\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n \"lib\": [\r\n \"DOM\",\r\n \"ES2015\"\r\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */// \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n // \"paths\": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n /* Emit */\r\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\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. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\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. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\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. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n {\r\n \"transform\": \"typia/lib/transform\"\r\n }\r\n ],\r\n \"strictNullChecks\": true\r\n },\r\n \"include\": [\r\n \"../../src/api\"\r\n ]\r\n}"
|
91
86
|
},
|
92
87
|
{
|
93
88
|
"location": "",
|
94
89
|
"file": "prettier.config.js",
|
95
|
-
"content": "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"
|
96
|
-
},
|
97
|
-
{
|
98
|
-
"location": "src",
|
99
|
-
"file": "MyBackend.ts",
|
100
|
-
"content": "import { INestApplication } from \"@nestjs/common\";\nimport { NestFactory } from \"@nestjs/core\";\n\nimport { MyConfiguration } from \"./MyConfiguration\";\nimport { MyModule } from \"./MyModule\";\n\nexport class MyBackend {\n private application_?: INestApplication;\n\n public async open(): Promise<void> {\n //----\n // OPEN THE BACKEND SERVER\n //----\n // MOUNT CONTROLLERS\n this.application_ = await NestFactory.create(MyModule, { logger: false });\n\n // DO OPEN\n this.application_.enableCors();\n await this.application_.listen(MyConfiguration.API_PORT(), \"0.0.0.0\");\n\n //----\n // POST-PROCESSES\n //----\n // INFORM TO THE PM2\n if (process.send) process.send(\"ready\");\n\n // WHEN KILL COMMAND COMES\n process.on(\"SIGINT\", async () => {\n await this.close();\n process.exit(0);\n });\n }\n\n public async close(): Promise<void> {\n if (this.application_ === undefined) return;\n\n // DO CLOSE\n await this.application_.close();\n delete this.application_;\n }\n}\n"
|
90
|
+
"content": "module.exports = {\r\n // DEFAULT CONFIGURATIONS\r\n parser: \"typescript\",\r\n printWidth: 80,\r\n semi: true,\r\n tabWidth: 2,\r\n trailingComma: \"all\",\r\n\r\n // PLUG-IN CONFIGURATIONS\r\n plugins: [\"@trivago/prettier-plugin-sort-imports\"],\r\n importOrder: [\r\n \"<THIRD_PARTY_MODULES>\",\r\n \"^@ORGANIZATION/PROJECT-api(.*)$\",\r\n \"^[./]\",\r\n ],\r\n importOrderSeparation: true,\r\n importOrderSortSpecifiers: true,\r\n importOrderParserPlugins: [\"decorators-legacy\", \"typescript\"],\r\n};\r\n"
|
101
91
|
},
|
102
92
|
{
|
103
|
-
"location": "
|
104
|
-
"file": "
|
105
|
-
"content": "
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"location": "src",
|
109
|
-
"file": "MyGlobal.ts",
|
110
|
-
"content": "import dotenv from \"dotenv\";\nimport dotenvExpand from \"dotenv-expand\";\nimport { Singleton } from \"tstl\";\nimport typia from \"typia\";\n\n/* eslint-disable */\nexport class MyGlobal {\n public static testing: boolean = false;\n public static get env(): MyGlobal.IEnvironments {\n return environments.get();\n }\n}\nexport namespace MyGlobal {\n export interface IEnvironments {\n PROJECT_API_PORT: `${number}`;\n }\n}\n\nconst environments = new Singleton(() => {\n const env = dotenv.config();\n dotenvExpand.expand(env);\n return typia.assert<MyGlobal.IEnvironments>(process.env);\n});\n"
|
93
|
+
"location": "",
|
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 - 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)"
|
111
96
|
},
|
112
97
|
{
|
113
98
|
"location": "src/api",
|
114
99
|
"file": "HttpError.ts",
|
115
|
-
"content": "export { HttpError } from \"@nestia/fetcher\";\n"
|
100
|
+
"content": "export { HttpError } from \"@nestia/fetcher\";\r\n"
|
116
101
|
},
|
117
102
|
{
|
118
103
|
"location": "src/api",
|
119
104
|
"file": "IConnection.ts",
|
120
|
-
"content": "export type { IConnection } from \"@nestia/fetcher\";\n"
|
105
|
+
"content": "export type { IConnection } from \"@nestia/fetcher\";\r\n"
|
121
106
|
},
|
122
107
|
{
|
123
108
|
"location": "src/api",
|
124
|
-
"file": "
|
125
|
-
"content": "
|
109
|
+
"file": "index.ts",
|
110
|
+
"content": "import * as api from \"./module\";\r\n\r\nexport * from \"./module\";\r\nexport default api;\r\n"
|
126
111
|
},
|
127
112
|
{
|
128
113
|
"location": "src/api",
|
129
|
-
"file": "
|
130
|
-
"content": "export type
|
114
|
+
"file": "module.ts",
|
115
|
+
"content": "export type * from \"./IConnection\";\r\nexport * from \"./HttpError\";\r\n\r\nexport * as functional from \"./functional\";\r\n"
|
131
116
|
},
|
132
117
|
{
|
133
118
|
"location": "src/api",
|
134
|
-
"file": "
|
135
|
-
"content": "
|
119
|
+
"file": "Primitive.ts",
|
120
|
+
"content": "export type { Primitive } from \"typia\";\r\n"
|
136
121
|
},
|
137
122
|
{
|
138
123
|
"location": "src/api",
|
139
|
-
"file": "
|
140
|
-
"content": "export type
|
124
|
+
"file": "Resolved.ts",
|
125
|
+
"content": "export type { Resolved } from \"typia\";\r\n"
|
141
126
|
},
|
142
127
|
{
|
143
128
|
"location": "src/api/structures/bbs",
|
144
129
|
"file": "IBbsArticle.ts",
|
145
|
-
"content": "import { tags } from \"typia\";\n\nimport { IAttachmentFile } from \"../common/IAttachmentFile\";\nimport { IPage } from \"../common/IPage\";\n\n/**\n * BBS article.\n */\nexport interface IBbsArticle {\n /**\n * Primary Key.\n */\n id: string & tags.Format<\"uuid\">;\n\n /**\n * Section code.\n */\n section: string;\n\n /**\n * Name of nickname of writer.\n */\n writer: string;\n\n /**\n * List of snapshot contents.\n *\n * Whenever updating an article, its contents would be accumulated.\n */\n snapshots: IBbsArticle.ISnapshot[];\n\n /**\n * Creation time of the article.\n */\n created_at: string & tags.Format<\"date-time\">;\n}\n\nexport namespace IBbsArticle {\n /**\n * Page request info with some options.\n */\n export interface IRequest extends IPage.IRequest {\n /**\n * Searching options.\n */\n search?: IRequest.ISearch;\n\n /**\n * Sorting options.\n *\n * The plus sign means ASC and minus sign means DESC.\n */\n sort?: IPage.Sort<IRequest.SortableColumns>;\n }\n export namespace IRequest {\n /**\n * Searching options.\n */\n export interface ISearch {\n writer?: string;\n title?: string;\n body?: string;\n }\n\n /**\n * List of sortable columns.\n */\n export type SortableColumns =\n | \"writer\"\n | \"title\"\n | \"created_at\"\n | \"updated_at\";\n }\n\n /**\n * Summarized info.\n */\n export interface ISummary {\n id: string;\n writer: string;\n title: string;\n created_at: string;\n updated_at: string;\n }\n\n /**\n * Content info.\n */\n export interface ISnapshot extends Omit<IUpdate, \"password\"> {\n /**\n * Primary key of individual content.\n */\n id: string & tags.Format<\"uuid\">;\n\n /**\n * Creation time of this content.\n */\n created_at: string & tags.Format<\"date-time\">;\n }\n\n /**\n * Store info.\n */\n export interface ICreate extends IUpdate {\n /**\n * Name or nickname of the writer.\n */\n writer: string;\n }\n\n /**\n * Update info.\n */\n export interface IUpdate {\n /**\n * Title of the article.\n */\n title: string;\n\n /**\n * Content body.\n */\n body: string;\n\n /**\n * Format of the content body.\n */\n format: \"md\" | \"html\" | \"txt\";\n\n /**\n * List of files (to be) attached.\n */\n files: IAttachmentFile[];\n\n /**\n * Password of the article.\n */\n password: string;\n }\n\n /**\n * Erase info.\n */\n export interface IErase {\n /**\n * Password of the article.\n */\n password: string;\n }\n}\n"
|
130
|
+
"content": "import { tags } from \"typia\";\r\n\r\nimport { IAttachmentFile } from \"../common/IAttachmentFile\";\r\nimport { IPage } from \"../common/IPage\";\r\n\r\n/**\r\n * BBS article.\r\n */\r\nexport interface IBbsArticle {\r\n /**\r\n * Primary Key.\r\n */\r\n id: string & tags.Format<\"uuid\">;\r\n\r\n /**\r\n * Section code.\r\n */\r\n section: string;\r\n\r\n /**\r\n * Name of nickname of writer.\r\n */\r\n writer: string;\r\n\r\n /**\r\n * List of snapshot contents.\r\n *\r\n * Whenever updating an article, its contents would be accumulated.\r\n */\r\n snapshots: IBbsArticle.ISnapshot[];\r\n\r\n /**\r\n * Creation time of the article.\r\n */\r\n created_at: string & tags.Format<\"date-time\">;\r\n}\r\n\r\nexport namespace IBbsArticle {\r\n /**\r\n * Page request info with some options.\r\n */\r\n export interface IRequest extends IPage.IRequest {\r\n /**\r\n * Searching options.\r\n */\r\n search?: IRequest.ISearch;\r\n\r\n /**\r\n * Sorting options.\r\n *\r\n * The plus sign means ASC and minus sign means DESC.\r\n */\r\n sort?: IPage.Sort<IRequest.SortableColumns>;\r\n }\r\n export namespace IRequest {\r\n /**\r\n * Searching options.\r\n */\r\n export interface ISearch {\r\n writer?: string;\r\n title?: string;\r\n body?: string;\r\n }\r\n\r\n /**\r\n * List of sortable columns.\r\n */\r\n export type SortableColumns =\r\n | \"writer\"\r\n | \"title\"\r\n | \"created_at\"\r\n | \"updated_at\";\r\n }\r\n\r\n /**\r\n * Summarized info.\r\n */\r\n export interface ISummary {\r\n id: string;\r\n writer: string;\r\n title: string;\r\n created_at: string;\r\n updated_at: string;\r\n }\r\n\r\n /**\r\n * Content info.\r\n */\r\n export interface ISnapshot extends Omit<IUpdate, \"password\"> {\r\n /**\r\n * Primary key of individual content.\r\n */\r\n id: string & tags.Format<\"uuid\">;\r\n\r\n /**\r\n * Creation time of this content.\r\n */\r\n created_at: string & tags.Format<\"date-time\">;\r\n }\r\n\r\n /**\r\n * Store info.\r\n */\r\n export interface ICreate extends IUpdate {\r\n /**\r\n * Name or nickname of the writer.\r\n */\r\n writer: string;\r\n }\r\n\r\n /**\r\n * Update info.\r\n */\r\n export interface IUpdate {\r\n /**\r\n * Title of the article.\r\n */\r\n title: string;\r\n\r\n /**\r\n * Content body.\r\n */\r\n body: string;\r\n\r\n /**\r\n * Format of the content body.\r\n */\r\n format: \"md\" | \"html\" | \"txt\";\r\n\r\n /**\r\n * List of files (to be) attached.\r\n */\r\n files: IAttachmentFile[];\r\n\r\n /**\r\n * Password of the article.\r\n */\r\n password: string;\r\n }\r\n\r\n /**\r\n * Erase info.\r\n */\r\n export interface IErase {\r\n /**\r\n * Password of the article.\r\n */\r\n password: string;\r\n }\r\n}\r\n"
|
146
131
|
},
|
147
132
|
{
|
148
133
|
"location": "src/api/structures/common",
|
149
134
|
"file": "IAttachmentFile.ts",
|
150
|
-
"content": "import { tags } from \"typia\";\n\nexport interface IAttachmentFile {\n name: null | (string & tags.MinLength<1> & tags.MaxLength<255>);\n extension: null | (string & tags.MinLength<1> & tags.MaxLength<8>);\n url: string & tags.Format<\"url\">;\n}\n"
|
135
|
+
"content": "import { tags } from \"typia\";\r\n\r\nexport interface IAttachmentFile {\r\n name: null | (string & tags.MinLength<1> & tags.MaxLength<255>);\r\n extension: null | (string & tags.MinLength<1> & tags.MaxLength<8>);\r\n url: string & tags.Format<\"url\">;\r\n}\r\n"
|
151
136
|
},
|
152
137
|
{
|
153
138
|
"location": "src/api/structures/common",
|
154
139
|
"file": "IPage.ts",
|
155
|
-
"content": "import { tags } from \"typia\";\n\n/**\n * A page.\n *\n * Collection of records with pagination indformation.\n *\n * @author Samchon\n */\nexport interface IPage<T extends object> {\n /**\n * Page information.\n */\n pagination: IPage.IPagination;\n\n /**\n * List of records.\n */\n data: T[];\n}\nexport namespace IPage {\n /**\n * Page information.\n */\n export interface IPagination {\n /**\n * Current page number.\n */\n current: number & tags.Type<\"uint32\">;\n\n /**\n * Limitation of records per a page.\n *\n * @default 100\n */\n limit: number & tags.Type<\"uint32\">;\n\n /**\n * Count of total records in database.\n */\n records: number & tags.Type<\"uint32\">;\n\n /**\n * Number of total pages.\n *\n * Equal to {@link records} / {@link limit} with ceiling.\n */\n pages: number & tags.Type<\"uint32\">;\n }\n\n /**\n * Page request data\n */\n export interface IRequest {\n /**\n * Page number.\n */\n page?: number & tags.Type<\"uint32\">;\n\n /**\n * Limitation of records per a page.\n */\n limit?: number & tags.Type<\"uint32\">;\n }\n\n /**\n * Sorting column specialization.\n *\n * The plus means ascending order and the minus means descending order.\n */\n export type Sort<Literal extends string> = Array<\n `-${Literal}` | `+${Literal}`\n >;\n}\n"
|
140
|
+
"content": "import { tags } from \"typia\";\r\n\r\n/**\r\n * A page.\r\n *\r\n * Collection of records with pagination indformation.\r\n *\r\n * @author Samchon\r\n */\r\nexport interface IPage<T extends object> {\r\n /**\r\n * Page information.\r\n */\r\n pagination: IPage.IPagination;\r\n\r\n /**\r\n * List of records.\r\n */\r\n data: T[];\r\n}\r\nexport namespace IPage {\r\n /**\r\n * Page information.\r\n */\r\n export interface IPagination {\r\n /**\r\n * Current page number.\r\n */\r\n current: number & tags.Type<\"uint32\">;\r\n\r\n /**\r\n * Limitation of records per a page.\r\n *\r\n * @default 100\r\n */\r\n limit: number & tags.Type<\"uint32\">;\r\n\r\n /**\r\n * Count of total records in database.\r\n */\r\n records: number & tags.Type<\"uint32\">;\r\n\r\n /**\r\n * Number of total pages.\r\n *\r\n * Equal to {@link records} / {@link limit} with ceiling.\r\n */\r\n pages: number & tags.Type<\"uint32\">;\r\n }\r\n\r\n /**\r\n * Page request data\r\n */\r\n export interface IRequest {\r\n /**\r\n * Page number.\r\n */\r\n page?: number & tags.Type<\"uint32\">;\r\n\r\n /**\r\n * Limitation of records per a page.\r\n */\r\n limit?: number & tags.Type<\"uint32\">;\r\n }\r\n\r\n /**\r\n * Sorting column specialization.\r\n *\r\n * The plus means ascending order and the minus means descending order.\r\n */\r\n export type Sort<Literal extends string> = Array<\r\n `-${Literal}` | `+${Literal}`\r\n >;\r\n}\r\n"
|
156
141
|
},
|
157
142
|
{
|
158
143
|
"location": "src/executable",
|
159
144
|
"file": "server.ts",
|
160
|
-
"content": "import { MyBackend } from \"../MyBackend\";\n\nconst EXTENSION = __filename.substring(__filename.length - 2);\nif (EXTENSION === \"js\") require(\"source-map-support/register\");\n\nasync function main(): Promise<void> {\n // BACKEND SEVER\n const backend: MyBackend = new MyBackend();\n await backend.open();\n\n // UNEXPECTED ERRORS\n global.process.on(\"uncaughtException\", console.error);\n global.process.on(\"unhandledRejection\", console.error);\n}\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n"
|
145
|
+
"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"
|
161
146
|
},
|
162
147
|
{
|
163
148
|
"location": "src/executable",
|
164
149
|
"file": "swagger.ts",
|
165
|
-
"content": "import cp from \"child_process\";\nimport express from \"express\";\n\nconst execute = (command: string): void => {\n console.log(`\\n$ ${command}\\n`);\n cp.execSync(command, { stdio: \"inherit\" });\n};\n\nconst main = async (): Promise<void> => {\n if (!process.argv.some((str) => str === \"--skipBuild\"))\n execute(\"npm run build:swagger\");\n\n const docs = await import(\"../../packages/api/swagger.json\" as any);\n\n const app = express();\n const swaggerUi = require(\"swagger-ui-express\");\n app.use(\"/api-docs\", swaggerUi.serve, swaggerUi.setup(docs));\n app.listen(37810);\n\n console.log(\"\\n\");\n console.log(\"-----------------------------------------------------------\");\n console.log(\"\\n Swagger UI Address: http://127.0.0.1:37810/api-docs \\n\");\n console.log(\"-----------------------------------------------------------\");\n};\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n"
|
150
|
+
"content": "import cp from \"child_process\";\r\nimport express from \"express\";\r\n\r\nconst execute = (command: string): void => {\r\n console.log(`\\n$ ${command}\\n`);\r\n cp.execSync(command, { stdio: \"inherit\" });\r\n};\r\n\r\nconst main = async (): Promise<void> => {\r\n if (!process.argv.some((str) => str === \"--skipBuild\"))\r\n execute(\"npm run build:swagger\");\r\n\r\n const docs = await import(\"../../packages/api/swagger.json\" as any);\r\n\r\n const app = express();\r\n const swaggerUi = require(\"swagger-ui-express\");\r\n app.use(\"/api-docs\", swaggerUi.serve, swaggerUi.setup(docs));\r\n app.listen(37810);\r\n\r\n console.log(\"\\n\");\r\n console.log(\"-----------------------------------------------------------\");\r\n console.log(\"\\n Swagger UI Address: http://127.0.0.1:37810/api-docs \\n\");\r\n console.log(\"-----------------------------------------------------------\");\r\n};\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"location": "src",
|
154
|
+
"file": "MyBackend.ts",
|
155
|
+
"content": "import { INestApplication } from \"@nestjs/common\";\r\nimport { NestFactory } from \"@nestjs/core\";\r\n\r\nimport { MyConfiguration } from \"./MyConfiguration\";\r\nimport { MyModule } from \"./MyModule\";\r\n\r\nexport class MyBackend {\r\n private application_?: INestApplication;\r\n\r\n public async open(): Promise<void> {\r\n //----\r\n // OPEN THE BACKEND SERVER\r\n //----\r\n // MOUNT CONTROLLERS\r\n this.application_ = await NestFactory.create(MyModule, { logger: false });\r\n\r\n // DO OPEN\r\n this.application_.enableCors();\r\n await this.application_.listen(MyConfiguration.API_PORT(), \"0.0.0.0\");\r\n\r\n //----\r\n // POST-PROCESSES\r\n //----\r\n // INFORM TO THE PM2\r\n if (process.send) process.send(\"ready\");\r\n\r\n // WHEN KILL COMMAND COMES\r\n process.on(\"SIGINT\", async () => {\r\n await this.close();\r\n process.exit(0);\r\n });\r\n }\r\n\r\n public async close(): Promise<void> {\r\n if (this.application_ === undefined) return;\r\n\r\n // DO CLOSE\r\n await this.application_.close();\r\n delete this.application_;\r\n }\r\n}\r\n"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"location": "src",
|
159
|
+
"file": "MyConfiguration.ts",
|
160
|
+
"content": "import fs from \"fs\";\r\nimport path from \"path\";\r\n\r\nimport { MyGlobal } from \"./MyGlobal\";\r\n\r\nexport namespace MyConfiguration {\r\n export const API_PORT = () => Number(MyGlobal.env.PROJECT_API_PORT);\r\n\r\n export const ROOT = (() => {\r\n const splitted: string[] = __dirname.split(path.sep);\r\n return splitted.at(-1) === \"src\" && splitted.at(-2) === \"bin\"\r\n ? path.resolve(__dirname + \"/../..\")\r\n : fs.existsSync(__dirname + \"/.env\")\r\n ? __dirname\r\n : path.resolve(__dirname + \"/..\");\r\n })();\r\n}\r\n"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"location": "src",
|
164
|
+
"file": "MyGlobal.ts",
|
165
|
+
"content": "import dotenv from \"dotenv\";\r\nimport dotenvExpand from \"dotenv-expand\";\r\nimport { Singleton } from \"tstl\";\r\nimport typia from \"typia\";\r\n\r\n/* eslint-disable */\r\nexport class MyGlobal {\r\n public static testing: boolean = false;\r\n public static get env(): MyGlobal.IEnvironments {\r\n return environments.get();\r\n }\r\n}\r\nexport namespace MyGlobal {\r\n export interface IEnvironments {\r\n PROJECT_API_PORT: `${number}`;\r\n }\r\n}\r\n\r\nconst environments = new Singleton(() => {\r\n const env = dotenv.config();\r\n dotenvExpand.expand(env);\r\n return typia.assert<MyGlobal.IEnvironments>(process.env);\r\n});\r\n"
|
166
166
|
},
|
167
167
|
{
|
168
168
|
"location": "src/utils",
|
169
169
|
"file": "ErrorUtil.ts",
|
170
|
-
"content": "import serializeError = require(\"serialize-error\");\n\nexport namespace ErrorUtil {\n export const toJSON = (err: any): object =>\n err instanceof Object && err.toJSON instanceof Function\n ? err.toJSON()\n : serializeError(err);\n}\n"
|
170
|
+
"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"
|
171
171
|
},
|
172
172
|
{
|
173
173
|
"location": "src/utils",
|
174
174
|
"file": "MapUtil.ts",
|
175
|
-
"content": "export namespace MapUtil {\n export function take<Key, T>(\n dict: Map<Key, T>,\n key: Key,\n generator: () => T,\n ): T {\n const oldbie: T | undefined = dict.get(key);\n if (oldbie) return oldbie;\n\n const value: T = generator();\n dict.set(key, value);\n return value;\n }\n}\n"
|
175
|
+
"content": "export namespace MapUtil {\r\n export function take<Key, T>(\r\n dict: Map<Key, T>,\r\n key: Key,\r\n generator: () => T,\r\n ): T {\r\n const oldbie: T | undefined = dict.get(key);\r\n if (oldbie) return oldbie;\r\n\r\n const value: T = generator();\r\n dict.set(key, value);\r\n return value;\r\n }\r\n}\r\n"
|
176
176
|
},
|
177
177
|
{
|
178
178
|
"location": "test/benchmark",
|
179
179
|
"file": "index.ts",
|
180
|
-
"content": "import { DynamicBenchmarker } from \"@nestia/benchmark\";\nimport cliProgress from \"cli-progress\";\nimport fs from \"fs\";\nimport os from \"os\";\nimport { IPointer } from \"tstl\";\n\nimport { MyBackend } from \"../../src/MyBackend\";\nimport { MyConfiguration } from \"../../src/MyConfiguration\";\nimport { MyGlobal } from \"../../src/MyGlobal\";\nimport { ArgumentParser } from \"../helpers/ArgumentParser\";\n\ninterface IOptions {\n include?: string[];\n exclude?: string[];\n count: number;\n threads: number;\n simultaneous: number;\n}\n\nconst getOptions = () =>\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\n // command.option(\"--mode <string>\", \"target mode\");\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\n command.option(\"--include <string...>\", \"include feature files\");\n command.option(\"--exclude <string...>\", \"exclude feature files\");\n command.option(\"--count <number>\", \"number of requests to make\");\n command.option(\"--threads <number>\", \"number of threads to use\");\n command.option(\n \"--simultaneous <number>\",\n \"number of simultaneous requests to make\",\n );\n return action(async (options) => {\n // if (typeof options.reset === \"string\")\n // options.reset = options.reset === \"true\";\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\n // \"LOCAL\",\n // \"DEV\",\n // \"REAL\",\n // ]);\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\n options.count = Number(\n options.count ??\n (await prompt.number(\"count\")(\"Number of requests to make\")),\n );\n options.threads = Number(\n options.threads ??\n (await prompt.number(\"threads\")(\"Number of threads to use\")),\n );\n options.simultaneous = Number(\n options.simultaneous ??\n (await prompt.number(\"simultaneous\")(\n \"Number of simultaneous requests to make\",\n )),\n );\n return options as IOptions;\n });\n });\n\nconst main = async (): Promise<void> => {\n // CONFIGURATIONS\n const options: IOptions = await getOptions();\n MyGlobal.testing = true;\n\n // BACKEND SERVER\n const backend: MyBackend = new MyBackend();\n await backend.open();\n\n // DO BENCHMARK\n const prev: IPointer<number> = { value: 0 };\n const bar: cliProgress.SingleBar = new cliProgress.SingleBar(\n {},\n cliProgress.Presets.shades_classic,\n );\n bar.start(options.count, 0);\n\n const report: DynamicBenchmarker.IReport = await DynamicBenchmarker.master({\n servant: `${__dirname}/servant.js`,\n count: options.count,\n threads: options.threads,\n simultaneous: options.simultaneous,\n filter: (func) =>\n (!options.include?.length ||\n (options.include ?? []).some((str) => func.includes(str))) &&\n (!options.exclude?.length ||\n (options.exclude ?? []).every((str) => !func.includes(str))),\n progress: (value: number) => {\n if (value >= 100 + prev.value) {\n bar.update(value);\n prev.value = value;\n }\n },\n stdio: \"ignore\",\n });\n bar.stop();\n\n // DOCUMENTATION\n try {\n await fs.promises.mkdir(`${MyConfiguration.ROOT}/docs/benchmarks`, {\n recursive: true,\n });\n } catch {}\n await fs.promises.writeFile(\n `${MyConfiguration.ROOT}/docs/benchmarks/${os\n .cpus()[0]\n .model.trim()\n .split(\"\\\\\")\n .join(\"\")\n .split(\"/\")\n .join(\"\")}.md`,\n DynamicBenchmarker.markdown(report),\n \"utf8\",\n );\n\n // CLOSE\n await backend.close();\n};\nmain().catch((exp) => {\n console.error(exp);\n process.exit(-1);\n});\n"
|
180
|
+
"content": "import { DynamicBenchmarker } from \"@nestia/benchmark\";\r\nimport cliProgress from \"cli-progress\";\r\nimport fs from \"fs\";\r\nimport os from \"os\";\r\nimport { IPointer } from \"tstl\";\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 count: number;\r\n threads: number;\r\n simultaneous: number;\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 command.option(\"--count <number>\", \"number of requests to make\");\r\n command.option(\"--threads <number>\", \"number of threads to use\");\r\n command.option(\r\n \"--simultaneous <number>\",\r\n \"number of simultaneous requests to make\",\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 options.count = Number(\r\n options.count ??\r\n (await prompt.number(\"count\")(\"Number of requests to make\")),\r\n );\r\n options.threads = Number(\r\n options.threads ??\r\n (await prompt.number(\"threads\")(\"Number of threads to use\")),\r\n );\r\n options.simultaneous = Number(\r\n options.simultaneous ??\r\n (await prompt.number(\"simultaneous\")(\r\n \"Number of simultaneous requests to make\",\r\n )),\r\n );\r\n return options as IOptions;\r\n });\r\n });\r\n\r\nconst main = async (): 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 // DO BENCHMARK\r\n const prev: IPointer<number> = { value: 0 };\r\n const bar: cliProgress.SingleBar = new cliProgress.SingleBar(\r\n {},\r\n cliProgress.Presets.shades_classic,\r\n );\r\n bar.start(options.count, 0);\r\n\r\n const report: DynamicBenchmarker.IReport = await DynamicBenchmarker.master({\r\n servant: `${__dirname}/servant.js`,\r\n count: options.count,\r\n threads: options.threads,\r\n simultaneous: options.simultaneous,\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 progress: (value: number) => {\r\n if (value >= 100 + prev.value) {\r\n bar.update(value);\r\n prev.value = value;\r\n }\r\n },\r\n stdio: \"ignore\",\r\n });\r\n bar.stop();\r\n\r\n // DOCUMENTATION\r\n try {\r\n await fs.promises.mkdir(`${MyConfiguration.ROOT}/docs/benchmarks`, {\r\n recursive: true,\r\n });\r\n } catch {}\r\n await fs.promises.writeFile(\r\n `${MyConfiguration.ROOT}/docs/benchmarks/${os\r\n .cpus()[0]\r\n .model.trim()\r\n .split(\"\\\\\")\r\n .join(\"\")\r\n .split(\"/\")\r\n .join(\"\")}.md`,\r\n DynamicBenchmarker.markdown(report),\r\n \"utf8\",\r\n );\r\n\r\n // CLOSE\r\n await backend.close();\r\n};\r\nmain().catch((exp) => {\r\n console.error(exp);\r\n process.exit(-1);\r\n});\r\n"
|
181
181
|
},
|
182
182
|
{
|
183
183
|
"location": "test/benchmark",
|
184
184
|
"file": "servant.ts",
|
185
|
-
"content": "import { DynamicBenchmarker } from \"@nestia/benchmark\";\n\nimport { MyConfiguration } from \"../../src/MyConfiguration\";\n\nDynamicBenchmarker.servant({\n connection: {\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\n },\n location: `${__dirname}/../features`,\n parameters: (connection) => [connection],\n prefix: \"test_api_\",\n}).catch((exp) => {\n console.error(exp);\n process.exit(-1);\n});\n"
|
185
|
+
"content": "import { DynamicBenchmarker } from \"@nestia/benchmark\";\r\n\r\nimport { MyConfiguration } from \"../../src/MyConfiguration\";\r\n\r\nDynamicBenchmarker.servant({\r\n connection: {\r\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\r\n },\r\n location: `${__dirname}/../features`,\r\n parameters: (connection) => [connection],\r\n prefix: \"test_api_\",\r\n}).catch((exp) => {\r\n console.error(exp);\r\n process.exit(-1);\r\n});\r\n"
|
186
186
|
},
|
187
187
|
{
|
188
188
|
"location": "test/helpers",
|
189
189
|
"file": "ArgumentParser.ts",
|
190
|
-
"content": "import commander from \"commander\";\nimport * as inquirer from \"inquirer\";\n\nexport namespace ArgumentParser {\n export type Inquiry<T> = (\n command: commander.Command,\n prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule,\n action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,\n ) => Promise<T>;\n\n export interface Prompt {\n select: (\n name: string,\n ) => (\n message: string,\n ) => <Choice extends string>(choices: Choice[]) => Promise<Choice>;\n boolean: (name: string) => (message: string) => Promise<boolean>;\n number: (name: string) => (message: string) => Promise<number>;\n }\n\n export const parse = async <T>(\n inquiry: (\n command: commander.Command,\n prompt: Prompt,\n action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,\n ) => Promise<T>,\n ): Promise<T> => {\n // TAKE OPTIONS\n const action = (closure: (options: Partial<T>) => Promise<T>) =>\n new Promise<T>((resolve, reject) => {\n commander.program.action(async (options) => {\n try {\n resolve(await closure(options));\n } catch (exp) {\n reject(exp);\n }\n });\n commander.program.parseAsync().catch(reject);\n });\n\n const select =\n (name: string) =>\n (message: string) =>\n async <Choice extends string>(choices: Choice[]): Promise<Choice> =>\n (\n await inquirer.createPromptModule()({\n type: \"list\",\n name,\n message,\n choices,\n })\n )[name];\n const boolean = (name: string) => async (message: string) =>\n (\n await inquirer.createPromptModule()({\n type: \"confirm\",\n name,\n message,\n })\n )[name] as boolean;\n const number = (name: string) => async (message: string) =>\n Number(\n (\n await inquirer.createPromptModule()({\n type: \"number\",\n name,\n message,\n })\n )[name],\n );\n\n const output: T | Error = await (async () => {\n try {\n return await inquiry(\n commander.program,\n { select, boolean, number },\n action,\n );\n } catch (error) {\n return error as Error;\n }\n })();\n\n // RETURNS\n if (output instanceof Error) throw output;\n return output;\n };\n}\n"
|
190
|
+
"content": "import commander from \"commander\";\r\nimport * as inquirer from \"inquirer\";\r\n\r\nexport namespace ArgumentParser {\r\n export type Inquiry<T> = (\r\n command: commander.Command,\r\n prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule,\r\n action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,\r\n ) => Promise<T>;\r\n\r\n export interface Prompt {\r\n select: (\r\n name: string,\r\n ) => (\r\n message: string,\r\n ) => <Choice extends string>(choices: Choice[]) => Promise<Choice>;\r\n boolean: (name: string) => (message: string) => Promise<boolean>;\r\n number: (name: string) => (message: string) => Promise<number>;\r\n }\r\n\r\n export const parse = async <T>(\r\n inquiry: (\r\n command: commander.Command,\r\n prompt: Prompt,\r\n action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,\r\n ) => Promise<T>,\r\n ): Promise<T> => {\r\n // TAKE OPTIONS\r\n const action = (closure: (options: Partial<T>) => Promise<T>) =>\r\n new Promise<T>((resolve, reject) => {\r\n commander.program.action(async (options) => {\r\n try {\r\n resolve(await closure(options));\r\n } catch (exp) {\r\n reject(exp);\r\n }\r\n });\r\n commander.program.parseAsync().catch(reject);\r\n });\r\n\r\n const select =\r\n (name: string) =>\r\n (message: string) =>\r\n async <Choice extends string>(choices: Choice[]): Promise<Choice> =>\r\n (\r\n await inquirer.createPromptModule()({\r\n type: \"list\",\r\n name,\r\n message,\r\n choices,\r\n })\r\n )[name];\r\n const boolean = (name: string) => async (message: string) =>\r\n (\r\n await inquirer.createPromptModule()({\r\n type: \"confirm\",\r\n name,\r\n message,\r\n })\r\n )[name] as boolean;\r\n const number = (name: string) => async (message: string) =>\r\n Number(\r\n (\r\n await inquirer.createPromptModule()({\r\n type: \"number\",\r\n name,\r\n message,\r\n })\r\n )[name],\r\n );\r\n\r\n const output: T | Error = await (async () => {\r\n try {\r\n return await inquiry(\r\n commander.program,\r\n { select, boolean, number },\r\n action,\r\n );\r\n } catch (error) {\r\n return error as Error;\r\n }\r\n })();\r\n\r\n // RETURNS\r\n if (output instanceof Error) throw output;\r\n return output;\r\n };\r\n}\r\n"
|
191
191
|
},
|
192
192
|
{
|
193
193
|
"location": "test",
|
194
194
|
"file": "index.ts",
|
195
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport chalk from \"chalk\";\n\nimport api from \"@ORGANIZATION/PROJECT-api\";\n\nimport { MyBackend } from \"../src/MyBackend\";\nimport { MyConfiguration } from \"../src/MyConfiguration\";\nimport { MyGlobal } from \"../src/MyGlobal\";\nimport { ArgumentParser } from \"./helpers/ArgumentParser\";\n\ninterface IOptions {\n include?: string[];\n exclude?: string[];\n}\n\nconst getOptions = () =>\n ArgumentParser.parse<IOptions>(async (command, _prompt, action) => {\n // command.option(\"--mode <string>\", \"target mode\");\n // command.option(\"--reset <true|false>\", \"reset local DB or not\");\n command.option(\"--include <string...>\", \"include feature files\");\n command.option(\"--exclude <string...>\", \"exclude feature files\");\n\n return action(async (options) => {\n // if (typeof options.reset === \"string\")\n // options.reset = options.reset === \"true\";\n // options.mode ??= await prompt.select(\"mode\")(\"Select mode\")([\n // \"LOCAL\",\n // \"DEV\",\n // \"REAL\",\n // ]);\n // options.reset ??= await prompt.boolean(\"reset\")(\"Reset local DB\");\n return options as IOptions;\n });\n });\n\nasync function main(): Promise<void> {\n // CONFIGURATIONS\n const options: IOptions = await getOptions();\n MyGlobal.testing = true;\n\n // BACKEND SERVER\n const backend: MyBackend = new MyBackend();\n await backend.open();\n\n //----\n // CLINET CONNECTOR\n //----\n // DO TEST\n const connection: api.IConnection = {\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\n };\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\n prefix: \"test\",\n location: __dirname + \"/features\",\n parameters: () => [\n {\n host: connection.host,\n encryption: connection.encryption,\n },\n ],\n filter: (func) =>\n (!options.include?.length ||\n (options.include ?? []).some((str) => func.includes(str))) &&\n (!options.exclude?.length ||\n (options.exclude ?? []).every((str) => !func.includes(str))),\n onComplete: (exec) => {\n const trace = (str: string) =>\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\n if (exec.error === null) {\n const elapsed: number =\n new Date(exec.completed_at).getTime() -\n new Date(exec.started_at).getTime();\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\n } else trace(chalk.red(exec.error.name));\n },\n });\n await backend.close();\n\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\n (exec) => exec.error !== null,\n );\n if (failures.length === 0) {\n console.log(\"Success\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n } else {\n for (const f of failures) console.log(f.error);\n process.exit(-1);\n }\n\n console.log(\n [\n `All: #${report.executions.length}`,\n `Success: #${report.executions.length - failures.length}`,\n `Failed: #${failures.length}`,\n ].join(\"\\n\"),\n );\n}\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n"
|
195
|
+
"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"
|
196
196
|
},
|
197
197
|
{
|
198
198
|
"location": "test",
|
199
199
|
"file": "tsconfig.json",
|
200
|
-
"content": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../bin\",\n },\n \"include\": [\".\", \"../src\"]\n}"
|
200
|
+
"content": "{\r\n \"extends\": \"../tsconfig.json\",\r\n \"compilerOptions\": {\r\n \"outDir\": \"../bin\",\r\n },\r\n \"include\": [\".\", \"../src\"]\r\n}"
|
201
201
|
},
|
202
202
|
{
|
203
203
|
"location": "test",
|
204
204
|
"file": "webpack.ts",
|
205
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport chalk from \"chalk\";\nimport cp from \"child_process\";\nimport { sleep_for } from \"tstl\";\n\nimport { MyConfiguration } from \"../src/MyConfiguration\";\nimport api from \"../src/api\";\n\nconst main = async (): Promise<void> => {\n // OPEN BUNDLED SERVER\n const backend = cp.fork(`${MyConfiguration.ROOT}/dist/server.js`, {\n cwd: `${MyConfiguration.ROOT}/dist`,\n });\n await sleep_for(2_500);\n\n // DO TEST\n const connection: api.IConnection = {\n host: `http://127.0.0.1:${MyConfiguration.API_PORT()}`,\n };\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\n prefix: \"test\",\n location: __dirname + \"/features\",\n parameters: () => [\n {\n host: connection.host,\n encryption: connection.encryption,\n },\n ],\n onComplete: (exec) => {\n const trace = (str: string) =>\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\n if (exec.error === null) {\n const elapsed: number =\n new Date(exec.completed_at).getTime() -\n new Date(exec.started_at).getTime();\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\n } else trace(chalk.red(exec.error.name));\n },\n });\n\n backend.kill();\n\n const failures: DynamicExecutor.IExecution[] = report.executions.filter(\n (exec) => exec.error !== null,\n );\n if (failures.length === 0) {\n console.log(\"Success\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n } else {\n for (const f of failures) console.log(f.error);\n process.exit(-1);\n }\n};\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n"
|
205
|
+
"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"
|
206
206
|
},
|
207
207
|
{
|
208
208
|
"location": "",
|
209
209
|
"file": "tsconfig.json",
|
210
|
-
"content": "{\n \"compilerOptions\": {\n /* Visit https://aka.ms/tsconfig to read more about this file */\n\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\n /* Language and Environment */\n \"target\": \"ES2015\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\n // \"lib\": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */\n // \"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\n /* Modules */\n \"module\": \"commonjs\", /* Specify what module code is generated. */\n // \"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\": {\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"./src/api/*\"],\n \"@ORGANIZATION/PROJECT-api\": [\"./src/api\"],\n }, /* 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\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\n /* Emit */\n // \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */\n // \"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. */\n // \"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. */\n // \"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. */\n // \"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. */\n \"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\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. */\n // \"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. */\n\n /* Type Checking */\n \"strict\": true, /* Enable all strict type-checking options. */\n // \"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\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 { \"transform\": \"typescript-transform-paths\" },\n { \"transform\": \"typia/lib/transform\" },\n { \"transform\": \"@nestia/core/lib/transform\" },\n ]\n },\n \"include\": [\n \"src\"\n ],\n \"exclude\": [\n \"node_modules\",\n \"packages\",\n ]\n}\n"
|
210
|
+
"content": "{\r\n \"compilerOptions\": {\r\n /* Visit https://aka.ms/tsconfig to read more about this file */\r\n\r\n /* Projects */\r\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\r\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\r\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\r\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\r\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\r\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\r\n\r\n /* Language and Environment */\r\n \"target\": \"ES2015\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\r\n // \"lib\": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */\r\n // \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\r\n \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\r\n \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\r\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\r\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\r\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\r\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\r\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\r\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\r\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\r\n\r\n /* Modules */\r\n \"module\": \"commonjs\", /* Specify what module code is generated. */\r\n // \"rootDir\": \"./\", /* Specify the root folder within your source files. */\r\n // \"moduleResolution\": \"node\", /* Specify how TypeScript looks up a file from a given module specifier. */\r\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\r\n \"paths\": {\r\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"./src/api/*\"],\r\n \"@ORGANIZATION/PROJECT-api\": [\"./src/api\"],\r\n }, /* Specify a set of entries that re-map imports to additional lookup locations. */\r\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\r\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\r\n // \"types\": [], /* Specify type package names to be included without being referenced in a source file. */\r\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\r\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\r\n // \"resolveJsonModule\": true, /* Enable importing .json files. */\r\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\r\n\r\n /* JavaScript Support */\r\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\r\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\r\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\r\n\r\n /* Emit */\r\n // \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */\r\n // \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\r\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\r\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */\r\n // \"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. */\r\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */\r\n // \"removeComments\": true, /* Disable emitting comments. */\r\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\r\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\r\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\r\n // \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */\r\n // \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\r\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\r\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\r\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\r\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\r\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */\r\n \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\r\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\r\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\r\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\r\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\r\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\r\n\r\n /* Interop Constraints */\r\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\r\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\r\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */\r\n // \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\r\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. */\r\n\r\n /* Type Checking */\r\n \"strict\": true, /* Enable all strict type-checking options. */\r\n // \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\r\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\r\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\r\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\r\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\r\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\r\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\r\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\r\n \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\r\n \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\r\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\r\n \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\r\n \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\r\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\r\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\r\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\r\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\r\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\r\n\r\n /* Completeness */\r\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\r\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\r\n \"plugins\": [\r\n { \"transform\": \"typescript-transform-paths\" },\r\n { \"transform\": \"typia/lib/transform\" },\r\n { \"transform\": \"@nestia/core/lib/transform\" },\r\n ]\r\n },\r\n \"include\": [\r\n \"src\"\r\n ],\r\n \"exclude\": [\r\n \"node_modules\",\r\n \"packages\",\r\n ]\r\n}\r\n"
|
211
211
|
},
|
212
212
|
{
|
213
213
|
"location": "",
|
214
214
|
"file": "webpack.config.js",
|
215
|
-
"content": "const path = require(\"path\");\n\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\nconst WriteFilePlugin = require(\"write-file-webpack-plugin\");\nconst { IgnorePlugin } = require(\"webpack\");\n\nconst lazyImports = [\n \"@fastify/static\",\n \"@fastify/view\",\n \"@nestjs/microservices\",\n \"@nestjs/websockets\",\n \"class-transformer\",\n \"class-validator\",\n];\n\n// @reference https://tech-blog.s-yoshiki.com/entry/297\nmodule.exports = {\n // CUSTOMIZE HERE\n entry: {\n server: \"./src/executable/server.ts\",\n },\n output: {\n path: path.join(__dirname, \"dist\"),\n filename: \"[name].js\",\n },\n optimization: {\n minimize: true,\n },\n\n // JUST KEEP THEM\n mode: \"production\",\n target: \"node\",\n module: {\n rules: [\n {\n test: /\\.ts$/,\n exclude: /node_modules/,\n loader: \"ts-loader\",\n },\n ],\n },\n resolve: {\n extensions: [\".tsx\", \".ts\", \".js\"],\n },\n plugins: [\n new CopyWebpackPlugin({\n patterns: [\n {\n from: \".env\",\n to: \"[name][ext]\",\n },\n // {\n // from: \"./node_modules/.prisma/client/*.node\",\n // to: () => Promise.resolve(\"[path][name][ext]\"),\n // globOptions: {\n // dot: true,\n // },\n // },\n ],\n }),\n new WriteFilePlugin(),\n new IgnorePlugin({\n checkResource: (resource) => {\n if (lazyImports.some((modulo) => resource.startsWith(modulo))) {\n try {\n require.resolve(resource);\n } catch (err) {\n return true;\n }\n }\n return false;\n },\n }),\n ],\n};\n"
|
215
|
+
"content": "const path = require(\"path\");\r\n\r\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\r\nconst WriteFilePlugin = require(\"write-file-webpack-plugin\");\r\nconst { IgnorePlugin } = require(\"webpack\");\r\n\r\nconst lazyImports = [\r\n \"@fastify/static\",\r\n \"@fastify/view\",\r\n \"@nestjs/microservices\",\r\n \"@nestjs/websockets\",\r\n \"class-transformer\",\r\n \"class-validator\",\r\n];\r\n\r\n// @reference https://tech-blog.s-yoshiki.com/entry/297\r\nmodule.exports = {\r\n // CUSTOMIZE HERE\r\n entry: {\r\n server: \"./src/executable/server.ts\",\r\n },\r\n output: {\r\n path: path.join(__dirname, \"dist\"),\r\n filename: \"[name].js\",\r\n },\r\n optimization: {\r\n minimize: true,\r\n },\r\n\r\n // JUST KEEP THEM\r\n mode: \"production\",\r\n target: \"node\",\r\n module: {\r\n rules: [\r\n {\r\n test: /\\.ts$/,\r\n exclude: /node_modules/,\r\n loader: \"ts-loader\",\r\n },\r\n ],\r\n },\r\n resolve: {\r\n extensions: [\".tsx\", \".ts\", \".js\"],\r\n },\r\n plugins: [\r\n new CopyWebpackPlugin({\r\n patterns: [\r\n {\r\n from: \".env\",\r\n to: \"[name][ext]\",\r\n },\r\n // {\r\n // from: \"./node_modules/.prisma/client/*.node\",\r\n // to: () => Promise.resolve(\"[path][name][ext]\"),\r\n // globOptions: {\r\n // dot: true,\r\n // },\r\n // },\r\n ],\r\n }),\r\n new WriteFilePlugin(),\r\n new IgnorePlugin({\r\n checkResource: (resource) => {\r\n if (lazyImports.some((modulo) => resource.startsWith(modulo))) {\r\n try {\r\n require.resolve(resource);\r\n } catch (err) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n }),\r\n ],\r\n};\r\n"
|
216
216
|
}
|
217
217
|
]
|