@nestia/migrate 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/NestiaMigrateApplication.js +14 -14
- package/lib/bundles/TEMPLATE.js +51 -26
- package/lib/bundles/TEMPLATE.js.map +1 -1
- package/lib/programmers/ControllerProgrammer.js +2 -0
- package/lib/programmers/ControllerProgrammer.js.map +1 -1
- package/lib/programmers/MigrateProgrammer.js +17 -0
- package/lib/programmers/MigrateProgrammer.js.map +1 -1
- package/package.json +7 -4
- package/src/bundles/TEMPLATE.ts +51 -26
- package/src/programmers/ControllerProgrammer.ts +2 -0
- package/src/programmers/MigrateProgrammer.ts +30 -2
@@ -44,7 +44,7 @@ class NestiaMigrateApplication {
|
|
44
44
|
const value = input[key];
|
45
45
|
if (undefined === value)
|
46
46
|
return true;
|
47
|
-
if (
|
47
|
+
if (true)
|
48
48
|
return "object" === typeof value && null !== value && false === Array.isArray(value) && $iu0(value);
|
49
49
|
return true;
|
50
50
|
});
|
@@ -64,7 +64,7 @@ class NestiaMigrateApplication {
|
|
64
64
|
const value = input[key];
|
65
65
|
if (undefined === value)
|
66
66
|
return true;
|
67
|
-
if (
|
67
|
+
if (true)
|
68
68
|
return "object" === typeof value && null !== value && $iu1(value);
|
69
69
|
return true;
|
70
70
|
});
|
@@ -79,7 +79,7 @@ class NestiaMigrateApplication {
|
|
79
79
|
const value = input[key];
|
80
80
|
if (undefined === value)
|
81
81
|
return true;
|
82
|
-
if (
|
82
|
+
if (true)
|
83
83
|
return "string" === typeof value;
|
84
84
|
return true;
|
85
85
|
});
|
@@ -89,7 +89,7 @@ class NestiaMigrateApplication {
|
|
89
89
|
const value = input[key];
|
90
90
|
if (undefined === value)
|
91
91
|
return true;
|
92
|
-
if (
|
92
|
+
if (true)
|
93
93
|
return "object" === typeof value && null !== value && false === Array.isArray(value) && $io31(value);
|
94
94
|
return true;
|
95
95
|
});
|
@@ -97,7 +97,7 @@ class NestiaMigrateApplication {
|
|
97
97
|
const value = input[key];
|
98
98
|
if (undefined === value)
|
99
99
|
return true;
|
100
|
-
if (
|
100
|
+
if (true)
|
101
101
|
return "object" === typeof value && null !== value && false === Array.isArray(value) && $io32(value);
|
102
102
|
return true;
|
103
103
|
});
|
@@ -113,7 +113,7 @@ class NestiaMigrateApplication {
|
|
113
113
|
const value = input[key];
|
114
114
|
if (undefined === value)
|
115
115
|
return true;
|
116
|
-
if (
|
116
|
+
if (true)
|
117
117
|
return "object" === typeof value && null !== value && false === Array.isArray(value) && $io41(value);
|
118
118
|
return true;
|
119
119
|
});
|
@@ -122,7 +122,7 @@ class NestiaMigrateApplication {
|
|
122
122
|
const value = input[key];
|
123
123
|
if (undefined === value)
|
124
124
|
return true;
|
125
|
-
if (
|
125
|
+
if (true)
|
126
126
|
return Array.isArray(value) && value.every(elem => "string" === typeof elem);
|
127
127
|
return true;
|
128
128
|
});
|
@@ -334,7 +334,7 @@ class NestiaMigrateApplication {
|
|
334
334
|
const value = input[key];
|
335
335
|
if (undefined === value)
|
336
336
|
return true;
|
337
|
-
if (
|
337
|
+
if (true)
|
338
338
|
return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
|
339
339
|
path: _path + $join(key),
|
340
340
|
expected: "(ISwaggerSchema.IAnyOf | ISwaggerSchema.IArray | ISwaggerSchema.IBoolean | ISwaggerSchema.IInteger | ISwaggerSchema.INullOnly | ISwaggerSchema.INumber | ISwaggerSchema.IObject | ISwaggerSchema.IOneOf | ISwaggerSchema.IReference | ISwaggerSchema.IString | ISwaggerSchema.IUnknown)",
|
@@ -938,7 +938,7 @@ class NestiaMigrateApplication {
|
|
938
938
|
const value = input[key];
|
939
939
|
if (undefined === value)
|
940
940
|
return true;
|
941
|
-
if (
|
941
|
+
if (true)
|
942
942
|
return ("object" === typeof value && null !== value || $guard(_exceptionable, {
|
943
943
|
path: _path + $join(key),
|
944
944
|
expected: "(ISwaggerSecurity.IApiKey | ISwaggerSecurity.IHttpBasic | ISwaggerSecurity.IHttpBearer | ISwaggerSecurity.IOAuth2 | ISwaggerSecurity.IOpenId)",
|
@@ -1069,7 +1069,7 @@ class NestiaMigrateApplication {
|
|
1069
1069
|
const value = input[key];
|
1070
1070
|
if (undefined === value)
|
1071
1071
|
return true;
|
1072
|
-
if (
|
1072
|
+
if (true)
|
1073
1073
|
return "string" === typeof value || $guard(_exceptionable, {
|
1074
1074
|
path: _path + $join(key),
|
1075
1075
|
expected: "string",
|
@@ -1115,7 +1115,7 @@ class NestiaMigrateApplication {
|
|
1115
1115
|
const value = input[key];
|
1116
1116
|
if (undefined === value)
|
1117
1117
|
return true;
|
1118
|
-
if (
|
1118
|
+
if (true)
|
1119
1119
|
return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
|
1120
1120
|
path: _path + $join(key),
|
1121
1121
|
expected: "ISwagger.IPath",
|
@@ -1131,7 +1131,7 @@ class NestiaMigrateApplication {
|
|
1131
1131
|
const value = input[key];
|
1132
1132
|
if (undefined === value)
|
1133
1133
|
return true;
|
1134
|
-
if (
|
1134
|
+
if (true)
|
1135
1135
|
return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
|
1136
1136
|
path: _path + $join(key),
|
1137
1137
|
expected: "ISwaggerRoute",
|
@@ -1351,7 +1351,7 @@ class NestiaMigrateApplication {
|
|
1351
1351
|
const value = input[key];
|
1352
1352
|
if (undefined === value)
|
1353
1353
|
return true;
|
1354
|
-
if (
|
1354
|
+
if (true)
|
1355
1355
|
return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
|
1356
1356
|
path: _path + $join(key),
|
1357
1357
|
expected: "__type.o4",
|
@@ -1384,7 +1384,7 @@ class NestiaMigrateApplication {
|
|
1384
1384
|
const value = input[key];
|
1385
1385
|
if (undefined === value)
|
1386
1386
|
return true;
|
1387
|
-
if (
|
1387
|
+
if (true)
|
1388
1388
|
return (Array.isArray(value) || $guard(_exceptionable, {
|
1389
1389
|
path: _path + $join(key),
|
1390
1390
|
expected: "Array<string>",
|
package/lib/bundles/TEMPLATE.js
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TEMPLATE = void 0;
|
4
4
|
exports.TEMPLATE = [
|
5
|
+
{
|
6
|
+
"location": "",
|
7
|
+
"file": ".env",
|
8
|
+
"content": "# BASIC SERVER INFO\r\nPROJECT_API_PORT=37001"
|
9
|
+
},
|
5
10
|
{
|
6
11
|
"location": "",
|
7
12
|
"file": ".eslintrc.cjs",
|
@@ -15,12 +20,12 @@ exports.TEMPLATE = [
|
|
15
20
|
{
|
16
21
|
"location": "/.github/workflows",
|
17
22
|
"file": "build.yml",
|
18
|
-
"content": "name: build\r\non: [push, pull_request]\r\n\r\njobs:\r\n Ubuntu:\r\n runs-on: ubuntu-latest\r\n steps:\r\n - uses: actions/checkout@v3\r\n - uses: actions/setup-node@v3\r\n \r\n - name: Install Backend-Server\r\n run: npm 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: EsLint\r\n run: npm run eslint\r\n"
|
23
|
+
"content": "name: build\r\non: [push, pull_request]\r\n\r\njobs:\r\n Ubuntu:\r\n runs-on: ubuntu-latest\r\n steps:\r\n - uses: actions/checkout@v3\r\n - uses: actions/setup-node@v3\r\n \r\n - name: Install Backend-Server\r\n run: npm 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"
|
19
24
|
},
|
20
25
|
{
|
21
26
|
"location": "",
|
22
27
|
"file": ".gitignore",
|
23
|
-
"content": ".git/\r\nbin/\r\nlib/\r\nnode_modules/\r\npackages/api/lib/\r\n\r\npackage-lock.json"
|
28
|
+
"content": ".git/\r\nbin/\r\ndist/\r\nlib/\r\nnode_modules/\r\npackages/api/lib/\r\n\r\npackage-lock.json"
|
24
29
|
},
|
25
30
|
{
|
26
31
|
"location": "",
|
@@ -30,12 +35,12 @@ exports.TEMPLATE = [
|
|
30
35
|
{
|
31
36
|
"location": "/.vscode",
|
32
37
|
"file": "launch.json",
|
33
|
-
"content": "{\r\n
|
38
|
+
"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}"
|
34
39
|
},
|
35
40
|
{
|
36
41
|
"location": "/.vscode",
|
37
42
|
"file": "settings.json",
|
38
|
-
"content": "{\r\n \"editor.tabSize\":
|
43
|
+
"content": "{\r\n \"editor.tabSize\": 2,\r\n \"[typescript]\": {\r\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\r\n \"editor.formatOnSave\": true,\r\n \"editor.codeActionsOnSave\": {\r\n \"source.fixAll.eslint\": true\r\n },\r\n },\r\n \"[javascript]\": {\r\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\r\n \"editor.formatOnSave\": true,\r\n \"editor.codeActionsOnSave\": {\r\n \"source.fixAll.eslint\": true\r\n },\r\n }\r\n}"
|
39
44
|
},
|
40
45
|
{
|
41
46
|
"location": "",
|
@@ -45,12 +50,17 @@ exports.TEMPLATE = [
|
|
45
50
|
{
|
46
51
|
"location": "",
|
47
52
|
"file": "nestia.config.ts",
|
48
|
-
"content": "// nestia configuration file\r\nimport type sdk from \"@nestia/sdk\";\r\n\r\nconst NESTIA_CONFIG: sdk.INestiaConfig = {\r\n input:
|
53
|
+
"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 },\r\n distribute: \"packages/api\",\r\n simulate: true,\r\n e2e: \"test\",\r\n};\r\nexport default NESTIA_CONFIG;\r\n"
|
49
54
|
},
|
50
55
|
{
|
51
56
|
"location": "",
|
52
57
|
"file": "package.json",
|
53
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"
|
58
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.0\",\r\n \"@nestia/sdk\": \"^2.3.10\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^3.3.1\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^5.40.0\",\r\n \"@typescript-eslint/parser\": \"^5.40.0\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^1.4.1\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.0.3\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.0\",\r\n \"typescript\": \"^5.2.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.3.10\",\r\n \"@nestjs/common\": \"^10.2.10\",\r\n \"@nestjs/core\": \"^10.2.10\",\r\n \"@nestjs/platform-fastify\": \"^10.2.10\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^5.2.6\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}\r\n"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"location": "/packages/api",
|
62
|
+
"file": ".gitignore",
|
63
|
+
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json"
|
54
64
|
},
|
55
65
|
{
|
56
66
|
"location": "/packages/api",
|
@@ -60,18 +70,13 @@ exports.TEMPLATE = [
|
|
60
70
|
{
|
61
71
|
"location": "/packages/api",
|
62
72
|
"file": "package.json",
|
63
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.2.2\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.
|
73
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.2.2\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.3.10\",\r\n \"typia\": \"^5.2.6\"\r\n }\r\n}"
|
64
74
|
},
|
65
75
|
{
|
66
76
|
"location": "/packages/api",
|
67
77
|
"file": "README.md",
|
68
78
|
"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)\r\n[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n[](https://nestia.io/docs/)\r\n\r\n[Nestia](https://nestia.io) 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 - SDK generator for clients\r\n - Swagger generator evolved than ever\r\n - Automatic E2E test functions generator\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> - Runtime validator is **20,000x faster** than `class-validator`\r\n> - JSON serialization is **200x faster** than `class-transformer`\r\n> - SDK is similar with [tRPC](https://trpc.io), but much advanced"
|
69
79
|
},
|
70
|
-
{
|
71
|
-
"location": "/packages/api",
|
72
|
-
"file": "swagger.json",
|
73
|
-
"content": "{\r\n \"openapi\": \"3.0.1\",\r\n \"servers\": [\r\n {\r\n \"url\": \"http://localhost:37001\",\r\n \"description\": \"Local Server\"\r\n }\r\n ],\r\n \"info\": {\r\n \"version\": \"0.1.0\",\r\n \"title\": \"@ORGANIZATION/PROJECT\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"license\": {\r\n \"name\": \"MIT\"\r\n }\r\n },\r\n \"paths\": {\r\n \"/bbs/articles/{section}\": {\r\n \"patch\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Pagination request info with searching and sorting options\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Paged articles witb summarization\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IPage_lt_IBbsArticle.ISummary_gt_\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"List up entire articles, but paginated and summarized\",\r\n \"description\": \"List up entire articles, but paginated and summarized.\\n\\nThis method is for listing up summarized articles with pagination.\\n\\nIf you want, you can search and sort articles with specific conditions.\",\r\n \"x-nestia-namespace\": \"bbs.articles.index\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Pagination request info with searching and sorting options\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Paged articles witb summarization\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PATCH\"\r\n },\r\n \"post\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"New article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IStore\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Store a new article\",\r\n \"description\": \"Store a new article.\\n\\nStore a new article and returns its detailed record info.\",\r\n \"x-nestia-namespace\": \"bbs.articles.store\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"New article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"POST\"\r\n }\r\n },\r\n \"/bbs/articles/{section}/{id}\": {\r\n \"get\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Detailed article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Get an article with detailed info\",\r\n \"description\": \"Get an article with detailed info.\\n\\nOpen an article with detailed info, increasing reading count.\",\r\n \"x-nestia-namespace\": \"bbs.articles.at\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Detailed article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"GET\"\r\n },\r\n \"put\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Content to update\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IUpdate\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created content info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Update article\",\r\n \"description\": \"Update article.\\n\\nWhen updating, this BBS system does not overwrite the content, but accumulate it.\\nTherefore, whenever an article being updated, length of {@link IBbsArticle.snapshots }\\nwould be increased and accumulated.\",\r\n \"x-nestia-namespace\": \"bbs.articles.update\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Content to update\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created content info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PUT\"\r\n }\r\n }\r\n },\r\n \"components\": {\r\n \"schemas\": {\r\n \"IBbsArticle.IRequest\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"search\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest.ISearch\"\r\n },\r\n \"sort\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"-writer\",\r\n \"-title\",\r\n \"-created_at\",\r\n \"-updated_at\",\r\n \"+writer\",\r\n \"+title\",\r\n \"+created_at\",\r\n \"+updated_at\"\r\n ]\r\n }\r\n },\r\n \"page\": {\r\n \"description\": \"Page number.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Page request info with some options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IRequest.ISearch\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Searching options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IPage_lt_IBbsArticle.ISummary_gt_\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"pagination\": {\r\n \"$ref\": \"#/components/schemas/IPage.IPagination\"\r\n },\r\n \"data\": {\r\n \"description\": \"List of records.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISummary\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"pagination\",\r\n \"data\"\r\n ],\r\n \"description\": \"A page.\\n\\nCollection of records with pagination indformation.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"author\",\r\n \"text\": [\r\n {\r\n \"text\": \"Samchon\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n \"IPage.IPagination\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"current\": {\r\n \"description\": \"Current page number.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"default\",\r\n \"text\": [\r\n {\r\n \"text\": \"100\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\",\r\n \"default\": 100\r\n },\r\n \"records\": {\r\n \"description\": \"Count of total records in database.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"pages\": {\r\n \"description\": \"Number of total pages.\\n\\nEqual to {@link records } / {@link limit } with ceiling.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"current\",\r\n \"limit\",\r\n \"records\",\r\n \"pages\"\r\n ],\r\n \"description\": \"Page information.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISummary\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"created_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"updated_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"writer\",\r\n \"title\",\r\n \"created_at\",\r\n \"updated_at\"\r\n ],\r\n \"description\": \"Summarized info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary Key.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"section\": {\r\n \"description\": \"Section code.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"description\": \"Name of nickname of writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"snapshots\": {\r\n \"description\": \"List of snapshot contents.\\n\\nWhenever updating an article, its contents would be accumulated.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"section\",\r\n \"writer\",\r\n \"snapshots\",\r\n \"created_at\"\r\n ],\r\n \"description\": \"BBS article.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISnapshot\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary key of individual content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of this content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"created_at\",\r\n \"title\",\r\n \"format\",\r\n \"body\",\r\n \"files\"\r\n ],\r\n \"description\": \"Content info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IAttachmentFile\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 255,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"extension\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 8,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"url\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"url\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"name\",\r\n \"extension\",\r\n \"url\"\r\n ],\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IStore\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"description\": \"Name or nickname of the writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"writer\",\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Store info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IUpdate\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Update info.\",\r\n \"x-typia-jsDocTags\": []\r\n }\r\n }\r\n }\r\n}"
|
74
|
-
},
|
75
80
|
{
|
76
81
|
"location": "/packages/api",
|
77
82
|
"file": "tsconfig.json",
|
@@ -80,62 +85,82 @@ exports.TEMPLATE = [
|
|
80
85
|
{
|
81
86
|
"location": "",
|
82
87
|
"file": "prettier.config.js",
|
83
|
-
"content": "module.exports = {\r\n parser: \"typescript\",\r\n printWidth: 80,\r\n semi: true,\r\n tabWidth:
|
88
|
+
"content": "module.exports = {\r\n parser: \"typescript\",\r\n printWidth: 80,\r\n semi: true,\r\n tabWidth: 2,\r\n trailingComma: \"all\",\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"
|
84
89
|
},
|
85
90
|
{
|
86
91
|
"location": "",
|
87
92
|
"file": "README.md",
|
88
93
|
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-template/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. If you wanna much detailed boilerplate project even configured DB and Non-distruptive update system, visit [samchon/backend](https://github.com/samchon/backend) and create a new repository from that.\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 - `build`: Build everything\r\n - `build:api`: Build client SDK libray for the client developers\r\n - `build:main`: Build main program (`src` directory)\r\n - `build:sdk`: Build SDK into main program only\r\n - `build:swagger`: Build Swagger Documents\r\n - `build:test` Build test automation program (`test` directory)\r\n - `dev`: Incremental build for development (test program)\r\n - `eslint` & `eslint:fix` & `prettier`: Prettier and ESLint execution\r\n - `start`: Start local NestJS server\r\n - `test`: Run test automation program\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-template | 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 typia from \"typia\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\r\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\r\n\r\nimport { ArrayUtil } from \"../../../../utils/ArrayUtil\";\r\nimport { GaffComparator } from \"../../../internal/GaffComparator\";\r\nimport { RandomGenerator } from \"../../../internal/RandomGenerator\";\r\nimport { validate_index_sort } from \"../../../internal/validate_index_sort\";\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 const articles: IBbsArticle[] = await ArrayUtil.asyncRepeat(100, () =>\r\n api.functional.bbs.articles.store(connection, section, {\r\n writer: RandomGenerator.name(),\r\n title: RandomGenerator.paragraph(),\r\n body: RandomGenerator.content(),\r\n format: \"txt\",\r\n files: [],\r\n password: RandomGenerator.alphabets(8),\r\n }),\r\n );\r\n typia.assertEquals(articles);\r\n\r\n // PREPARE VALIDATOR\r\n const validator = validate_index_sort(\"BbsArticleProvider.index()\")(\r\n (input: IBbsArticle.IRequest) =>\r\n api.functional.bbs.articles.index(connection, section, input),\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(\"+\");\r\n await comp(\"-\");\r\n }\r\n}\r\n```"
|
89
94
|
},
|
95
|
+
{
|
96
|
+
"location": "/src/executable",
|
97
|
+
"file": "server.ts",
|
98
|
+
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport { MyBackend } from \"../MyBackend\";\r\nimport { MyConfiguration } from \"../MyConfiguration\";\r\nimport { ErrorUtil } from \"../utils/ErrorUtil\";\r\n\r\nconst EXTENSION = __filename.substring(__filename.length - 2);\r\nif (EXTENSION === \"js\") require(\"source-map-support/register\");\r\n\r\nconst directory = new Singleton(async () => {\r\n await mkdir(`${MyConfiguration.ROOT}/assets`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs/errors`);\r\n});\r\n\r\nfunction cipher(val: number): string {\r\n if (val < 10) return \"0\" + val;\r\n else return String(val);\r\n}\r\n\r\nasync function mkdir(path: string): Promise<void> {\r\n try {\r\n await fs.promises.mkdir(path);\r\n } catch {}\r\n}\r\n\r\nasync function handle_error(exp: any): Promise<void> {\r\n try {\r\n const date: Date = new Date();\r\n const fileName: string = `${date.getFullYear()}${cipher(\r\n date.getMonth() + 1,\r\n )}${cipher(date.getDate())}${cipher(date.getHours())}${cipher(\r\n date.getMinutes(),\r\n )}${cipher(date.getSeconds())}.${randint(0, Number.MAX_SAFE_INTEGER)}`;\r\n const content: string = JSON.stringify(ErrorUtil.toJSON(exp), null, 4);\r\n\r\n await directory.get();\r\n await fs.promises.writeFile(\r\n `${MyConfiguration.ROOT}/assets/logs/errors/${fileName}.log`,\r\n content,\r\n \"utf8\",\r\n );\r\n } catch {}\r\n}\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\", handle_error);\r\n global.process.on(\"unhandledRejection\", handle_error);\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"location": "/src/executable",
|
102
|
+
"file": "swagger.ts",
|
103
|
+
"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"
|
104
|
+
},
|
90
105
|
{
|
91
106
|
"location": "/src",
|
92
|
-
"file": "
|
93
|
-
"content": "import
|
107
|
+
"file": "MyBackend.ts",
|
108
|
+
"content": "import { NestFactory } from \"@nestjs/core\";\r\nimport {\r\n FastifyAdapter,\r\n NestFastifyApplication,\r\n} from \"@nestjs/platform-fastify\";\r\n\r\nimport { MyConfiguration } from \"./MyConfiguration\";\r\nimport { MyModule } from \"./MyModule\";\r\n\r\nexport class MyBackend {\r\n private application_?: NestFastifyApplication;\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(\r\n MyModule,\r\n new FastifyAdapter(),\r\n { logger: false },\r\n );\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"
|
94
109
|
},
|
95
110
|
{
|
96
111
|
"location": "/src",
|
97
|
-
"file": "
|
98
|
-
"content": "import path from \"path\";\r\n\r\nexport namespace
|
112
|
+
"file": "MyConfiguration.ts",
|
113
|
+
"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"
|
99
114
|
},
|
100
115
|
{
|
101
|
-
"location": "/src
|
102
|
-
"file": "
|
103
|
-
"content": "import
|
116
|
+
"location": "/src",
|
117
|
+
"file": "MyGlobal.ts",
|
118
|
+
"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"
|
104
119
|
},
|
105
120
|
{
|
106
121
|
"location": "/src",
|
107
|
-
"file": "
|
108
|
-
"content": "
|
122
|
+
"file": "MyModule.ts",
|
123
|
+
"content": "import { Module } from \"@nestjs/common\";\r\n\r\nimport { BbsArticleModule } from \"./controllers/bbs/BbsArticleModule\";\r\n\r\n@Module({\r\n imports: [BbsArticleModule],\r\n})\r\nexport class MyModule {}\r\n"
|
109
124
|
},
|
110
125
|
{
|
111
126
|
"location": "/src/utils",
|
112
127
|
"file": "ErrorUtil.ts",
|
113
|
-
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport {
|
128
|
+
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport { MyConfiguration } from \"../MyConfiguration\";\r\n\r\nimport 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 export const log =\r\n (prefix: string) =>\r\n async (error: string | object | Error): Promise<void> => {\r\n try {\r\n if (error instanceof Error) error = toJSON(error);\r\n\r\n const date: Date = new Date();\r\n const fileName: string = `${date.getFullYear()}${cipher(\r\n date.getMonth() + 1,\r\n )}${cipher(date.getDate())}${cipher(date.getHours())}${cipher(\r\n date.getMinutes(),\r\n )}${cipher(date.getSeconds())}.${randint(0, Number.MAX_SAFE_INTEGER)}`;\r\n const content: string = JSON.stringify(error, null, 4);\r\n\r\n await directory.get();\r\n await fs.promises.writeFile(\r\n `${MyConfiguration.ROOT}/assets/logs/errors/${prefix}_${fileName}.log`,\r\n content,\r\n \"utf8\",\r\n );\r\n } catch {}\r\n };\r\n}\r\n\r\nconst cipher = (val: number): string => String(val).padStart(2, \"0\");\r\nconst directory = new Singleton(async () => {\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs/errors`);\r\n});\r\nasync function mkdir(path: string): Promise<void> {\r\n try {\r\n await fs.promises.mkdir(path);\r\n } catch {}\r\n}\r\n"
|
114
129
|
},
|
115
130
|
{
|
116
131
|
"location": "/src/utils",
|
117
132
|
"file": "MapUtil.ts",
|
118
|
-
"content": "export namespace MapUtil {\r\n
|
133
|
+
"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"
|
119
134
|
},
|
120
135
|
{
|
121
136
|
"location": "/test/helpers",
|
122
137
|
"file": "ArgumentParser.ts",
|
123
|
-
"content": "import commander from
|
138
|
+
"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 }\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\r\n const output: T | Error = await (async () => {\r\n try {\r\n return await inquiry(commander.program, { select, boolean }, action);\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"
|
124
139
|
},
|
125
140
|
{
|
126
141
|
"location": "/test",
|
127
142
|
"file": "index.ts",
|
128
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport {
|
143
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\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 prompt;\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 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 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 })(__dirname + \"/features\");\r\n\r\n await backend.close();\r\n\r\n const failures: DynamicExecutor.IReport.IExecution[] =\r\n report.executions.filter((exec) => exec.error !== null);\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 `All : ${report.executions.length}`,\r\n `Success : ${report.executions.length - failures.length}`,\r\n `Failed : ${failures.length}`,\r\n ].join(\"\\n\"));\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
129
144
|
},
|
130
145
|
{
|
131
146
|
"location": "/test",
|
132
147
|
"file": "tsconfig.json",
|
133
148
|
"content": "{\r\n \"extends\": \"../tsconfig.json\",\r\n \"compilerOptions\": {\r\n \"outDir\": \"../bin\",\r\n },\r\n \"include\": [\".\", \"../src\"]\r\n}"
|
134
149
|
},
|
150
|
+
{
|
151
|
+
"location": "/test",
|
152
|
+
"file": "webpack.ts",
|
153
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\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 parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n })(__dirname + \"/features\");\r\n\r\n backend.kill();\r\n\r\n const failures: DynamicExecutor.IReport.IExecution[] =\r\n report.executions.filter((exec) => exec.error !== null);\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"
|
154
|
+
},
|
135
155
|
{
|
136
156
|
"location": "",
|
137
157
|
"file": "tsconfig.json",
|
138
158
|
"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"
|
159
|
+
},
|
160
|
+
{
|
161
|
+
"location": "",
|
162
|
+
"file": "webpack.config.js",
|
163
|
+
"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 // },\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"
|
139
164
|
}
|
140
165
|
];
|
141
166
|
//# sourceMappingURL=TEMPLATE.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB;QACI,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,6lCAA6lC;KAC3mC;IACD;QACI,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,qtBAAqtB;KACnuB;IACD;QACI,UAAU,EAAE,oBAAoB;QAChC,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE
|
1
|
+
{"version":3,"file":"TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/TEMPLATE.ts"],"names":[],"mappings":"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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ControllerProgrammer.js","sourceRoot":"","sources":["../../src/programmers/ControllerProgrammer.ts"],"names":[],"mappings":";;;AAKA,8CAA2C;AAC3C,oDAAiD;AACjD,yDAAsD;AACtD,uDAAoD;AAEpD,IAAiB,oBAAoB,
|
1
|
+
{"version":3,"file":"ControllerProgrammer.js","sourceRoot":"","sources":["../../src/programmers/ControllerProgrammer.ts"],"names":[],"mappings":"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"}
|
@@ -25,7 +25,24 @@ var MigrateProgrammer;
|
|
25
25
|
file: `${c.name}.ts`,
|
26
26
|
content: ControllerProgrammer_1.ControllerProgrammer.write(components)(c),
|
27
27
|
})),
|
28
|
+
{
|
29
|
+
location: "src",
|
30
|
+
file: "MyModule.ts",
|
31
|
+
content: MyModule(program.controllers),
|
32
|
+
},
|
28
33
|
];
|
29
34
|
};
|
30
35
|
})(MigrateProgrammer || (exports.MigrateProgrammer = MigrateProgrammer = {}));
|
36
|
+
const MyModule = (controllers) => [
|
37
|
+
`import { Module } from "@nestjs/common";`,
|
38
|
+
``,
|
39
|
+
...controllers.map((c) => `import { ${c.name} } from "${c.location.replace("src/", "./")}/${c.name}";`),
|
40
|
+
``,
|
41
|
+
`@Module({`,
|
42
|
+
` controllers: [`,
|
43
|
+
...controllers.map((c) => ` ${c.name},`),
|
44
|
+
` ],`,
|
45
|
+
`})`,
|
46
|
+
`export class MyModule {}`,
|
47
|
+
].join("\n");
|
31
48
|
//# sourceMappingURL=MigrateProgrammer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MigrateProgrammer.js","sourceRoot":"","sources":["../../src/programmers/MigrateProgrammer.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"MigrateProgrammer.js","sourceRoot":"","sources":["../../src/programmers/MigrateProgrammer.ts"],"names":[],"mappings":";;;AAMA,iEAA8D;AAC9D,mDAAgD;AAEhD,IAAiB,iBAAiB,CAgCjC;AAhCD,WAAiB,iBAAiB;IACjB,yBAAO,GAAG,CAAC,OAAiB,EAAmB,EAAE;QAC1D,MAAM,WAAW,GACb,2CAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAkB,6BAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACjE,OAAO;YACH,WAAW;YACX,UAAU;SACb,CAAC;IACN,CAAC,CAAC;IAEW,uBAAK,GACd,CAAC,UAA8B,EAAE,EAAE,CACnC,CAAC,OAAwB,EAAkB,EAAE;QACzC,OAAO;YACH,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK;gBACpB,OAAO,EAAE,6BAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aAC9C,CAAC,CAAC;YACH,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC/B,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK;gBACpB,OAAO,EAAE,2CAAoB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aACrD,CAAC,CAAC;YACH;gBACI,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;aACzC;SACJ,CAAC;IACN,CAAC,CAAC;AACV,CAAC,EAhCgB,iBAAiB,iCAAjB,iBAAiB,QAgCjC;AAED,MAAM,QAAQ,GAAG,CAAC,WAAiC,EAAU,EAAE,CAC3D;IACI,0CAA0C;IAC1C,EAAE;IACF,GAAG,WAAW,CAAC,GAAG,CACd,CAAC,CAAC,EAAE,EAAE,CACF,YAAY,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,QAAQ,CAAC,OAAO,CAC5C,MAAM,EACN,IAAI,CACP,IAAI,CAAC,CAAC,IAAI,IAAI,CACtB;IACD,EAAE;IACF,WAAW;IACX,oBAAoB;IACpB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,IAAI,GAAG,CAAC;IAC/C,QAAQ;IACR,IAAI;IACJ,0BAA0B;CAC7B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nestia/migrate",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0",
|
4
4
|
"description": "Migration program from swagger to NestJS",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"typings": "lib/index.d.ts",
|
@@ -30,10 +30,13 @@
|
|
30
30
|
},
|
31
31
|
"homepage": "https://github.com/samchon/nestia#readme",
|
32
32
|
"devDependencies": {
|
33
|
-
"@nestia/core": "^2.
|
34
|
-
"@nestia/fetcher": "^2.
|
33
|
+
"@nestia/core": "^2.3.10",
|
34
|
+
"@nestia/fetcher": "^2.3.10",
|
35
35
|
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
36
|
+
"@types/express": "^4.17.21",
|
36
37
|
"@types/node": "^20.3.3",
|
38
|
+
"dotenv": "^16.3.1",
|
39
|
+
"dotenv-expand": "^10.0.0",
|
37
40
|
"prettier": "^2.8.8",
|
38
41
|
"rimraf": "^5.0.1",
|
39
42
|
"serialize-error": "^4.1.0",
|
@@ -45,7 +48,7 @@
|
|
45
48
|
"typescript-transform-paths": "^3.4.6"
|
46
49
|
},
|
47
50
|
"dependencies": {
|
48
|
-
"typia": "^5.2.
|
51
|
+
"typia": "^5.2.6"
|
49
52
|
},
|
50
53
|
"files": [
|
51
54
|
"lib",
|
package/src/bundles/TEMPLATE.ts
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
export const TEMPLATE = [
|
2
|
+
{
|
3
|
+
"location": "",
|
4
|
+
"file": ".env",
|
5
|
+
"content": "# BASIC SERVER INFO\r\nPROJECT_API_PORT=37001"
|
6
|
+
},
|
2
7
|
{
|
3
8
|
"location": "",
|
4
9
|
"file": ".eslintrc.cjs",
|
@@ -12,12 +17,12 @@ export const TEMPLATE = [
|
|
12
17
|
{
|
13
18
|
"location": "/.github/workflows",
|
14
19
|
"file": "build.yml",
|
15
|
-
"content": "name: build\r\non: [push, pull_request]\r\n\r\njobs:\r\n Ubuntu:\r\n runs-on: ubuntu-latest\r\n steps:\r\n - uses: actions/checkout@v3\r\n - uses: actions/setup-node@v3\r\n \r\n - name: Install Backend-Server\r\n run: npm 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: EsLint\r\n run: npm run eslint\r\n"
|
20
|
+
"content": "name: build\r\non: [push, pull_request]\r\n\r\njobs:\r\n Ubuntu:\r\n runs-on: ubuntu-latest\r\n steps:\r\n - uses: actions/checkout@v3\r\n - uses: actions/setup-node@v3\r\n \r\n - name: Install Backend-Server\r\n run: npm 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
21
|
},
|
17
22
|
{
|
18
23
|
"location": "",
|
19
24
|
"file": ".gitignore",
|
20
|
-
"content": ".git/\r\nbin/\r\nlib/\r\nnode_modules/\r\npackages/api/lib/\r\n\r\npackage-lock.json"
|
25
|
+
"content": ".git/\r\nbin/\r\ndist/\r\nlib/\r\nnode_modules/\r\npackages/api/lib/\r\n\r\npackage-lock.json"
|
21
26
|
},
|
22
27
|
{
|
23
28
|
"location": "",
|
@@ -27,12 +32,12 @@ export const TEMPLATE = [
|
|
27
32
|
{
|
28
33
|
"location": "/.vscode",
|
29
34
|
"file": "launch.json",
|
30
|
-
"content": "{\r\n
|
35
|
+
"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
36
|
},
|
32
37
|
{
|
33
38
|
"location": "/.vscode",
|
34
39
|
"file": "settings.json",
|
35
|
-
"content": "{\r\n \"editor.tabSize\":
|
40
|
+
"content": "{\r\n \"editor.tabSize\": 2,\r\n \"[typescript]\": {\r\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\r\n \"editor.formatOnSave\": true,\r\n \"editor.codeActionsOnSave\": {\r\n \"source.fixAll.eslint\": true\r\n },\r\n },\r\n \"[javascript]\": {\r\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\r\n \"editor.formatOnSave\": true,\r\n \"editor.codeActionsOnSave\": {\r\n \"source.fixAll.eslint\": true\r\n },\r\n }\r\n}"
|
36
41
|
},
|
37
42
|
{
|
38
43
|
"location": "",
|
@@ -42,12 +47,17 @@ export const TEMPLATE = [
|
|
42
47
|
{
|
43
48
|
"location": "",
|
44
49
|
"file": "nestia.config.ts",
|
45
|
-
"content": "// nestia configuration file\r\nimport type sdk from \"@nestia/sdk\";\r\n\r\nconst NESTIA_CONFIG: sdk.INestiaConfig = {\r\n input:
|
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 },\r\n distribute: \"packages/api\",\r\n simulate: true,\r\n e2e: \"test\",\r\n};\r\nexport default NESTIA_CONFIG;\r\n"
|
46
51
|
},
|
47
52
|
{
|
48
53
|
"location": "",
|
49
54
|
"file": "package.json",
|
50
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"
|
55
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.0\",\r\n \"@nestia/sdk\": \"^2.3.10\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^3.3.1\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^5.40.0\",\r\n \"@typescript-eslint/parser\": \"^5.40.0\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^1.4.1\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.0.3\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.0\",\r\n \"typescript\": \"^5.2.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.3.10\",\r\n \"@nestjs/common\": \"^10.2.10\",\r\n \"@nestjs/core\": \"^10.2.10\",\r\n \"@nestjs/platform-fastify\": \"^10.2.10\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^5.2.6\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}\r\n"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"location": "/packages/api",
|
59
|
+
"file": ".gitignore",
|
60
|
+
"content": "lib/\r\nnode_modules/\r\n\r\nswagger.json"
|
51
61
|
},
|
52
62
|
{
|
53
63
|
"location": "/packages/api",
|
@@ -57,18 +67,13 @@ export const TEMPLATE = [
|
|
57
67
|
{
|
58
68
|
"location": "/packages/api",
|
59
69
|
"file": "package.json",
|
60
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.2.2\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.
|
70
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.2.2\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.3.10\",\r\n \"typia\": \"^5.2.6\"\r\n }\r\n}"
|
61
71
|
},
|
62
72
|
{
|
63
73
|
"location": "/packages/api",
|
64
74
|
"file": "README.md",
|
65
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)\r\n[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\r\n[](https://nestia.io/docs/)\r\n\r\n[Nestia](https://nestia.io) 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 - SDK generator for clients\r\n - Swagger generator evolved than ever\r\n - Automatic E2E test functions generator\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> - Runtime validator is **20,000x faster** than `class-validator`\r\n> - JSON serialization is **200x faster** than `class-transformer`\r\n> - SDK is similar with [tRPC](https://trpc.io), but much advanced"
|
66
76
|
},
|
67
|
-
{
|
68
|
-
"location": "/packages/api",
|
69
|
-
"file": "swagger.json",
|
70
|
-
"content": "{\r\n \"openapi\": \"3.0.1\",\r\n \"servers\": [\r\n {\r\n \"url\": \"http://localhost:37001\",\r\n \"description\": \"Local Server\"\r\n }\r\n ],\r\n \"info\": {\r\n \"version\": \"0.1.0\",\r\n \"title\": \"@ORGANIZATION/PROJECT\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"license\": {\r\n \"name\": \"MIT\"\r\n }\r\n },\r\n \"paths\": {\r\n \"/bbs/articles/{section}\": {\r\n \"patch\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Pagination request info with searching and sorting options\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Paged articles witb summarization\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IPage_lt_IBbsArticle.ISummary_gt_\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"List up entire articles, but paginated and summarized\",\r\n \"description\": \"List up entire articles, but paginated and summarized.\\n\\nThis method is for listing up summarized articles with pagination.\\n\\nIf you want, you can search and sort articles with specific conditions.\",\r\n \"x-nestia-namespace\": \"bbs.articles.index\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Pagination request info with searching and sorting options\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Paged articles witb summarization\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PATCH\"\r\n },\r\n \"post\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"New article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IStore\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Store a new article\",\r\n \"description\": \"Store a new article.\\n\\nStore a new article and returns its detailed record info.\",\r\n \"x-nestia-namespace\": \"bbs.articles.store\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"New article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"POST\"\r\n }\r\n },\r\n \"/bbs/articles/{section}/{id}\": {\r\n \"get\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Detailed article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Get an article with detailed info\",\r\n \"description\": \"Get an article with detailed info.\\n\\nOpen an article with detailed info, increasing reading count.\",\r\n \"x-nestia-namespace\": \"bbs.articles.at\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Detailed article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"GET\"\r\n },\r\n \"put\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Content to update\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IUpdate\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created content info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Update article\",\r\n \"description\": \"Update article.\\n\\nWhen updating, this BBS system does not overwrite the content, but accumulate it.\\nTherefore, whenever an article being updated, length of {@link IBbsArticle.snapshots }\\nwould be increased and accumulated.\",\r\n \"x-nestia-namespace\": \"bbs.articles.update\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Content to update\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created content info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PUT\"\r\n }\r\n }\r\n },\r\n \"components\": {\r\n \"schemas\": {\r\n \"IBbsArticle.IRequest\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"search\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest.ISearch\"\r\n },\r\n \"sort\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"-writer\",\r\n \"-title\",\r\n \"-created_at\",\r\n \"-updated_at\",\r\n \"+writer\",\r\n \"+title\",\r\n \"+created_at\",\r\n \"+updated_at\"\r\n ]\r\n }\r\n },\r\n \"page\": {\r\n \"description\": \"Page number.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Page request info with some options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IRequest.ISearch\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Searching options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IPage_lt_IBbsArticle.ISummary_gt_\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"pagination\": {\r\n \"$ref\": \"#/components/schemas/IPage.IPagination\"\r\n },\r\n \"data\": {\r\n \"description\": \"List of records.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISummary\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"pagination\",\r\n \"data\"\r\n ],\r\n \"description\": \"A page.\\n\\nCollection of records with pagination indformation.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"author\",\r\n \"text\": [\r\n {\r\n \"text\": \"Samchon\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n \"IPage.IPagination\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"current\": {\r\n \"description\": \"Current page number.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"default\",\r\n \"text\": [\r\n {\r\n \"text\": \"100\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\",\r\n \"default\": 100\r\n },\r\n \"records\": {\r\n \"description\": \"Count of total records in database.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"pages\": {\r\n \"description\": \"Number of total pages.\\n\\nEqual to {@link records } / {@link limit } with ceiling.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"current\",\r\n \"limit\",\r\n \"records\",\r\n \"pages\"\r\n ],\r\n \"description\": \"Page information.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISummary\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"created_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"updated_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"writer\",\r\n \"title\",\r\n \"created_at\",\r\n \"updated_at\"\r\n ],\r\n \"description\": \"Summarized info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary Key.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"section\": {\r\n \"description\": \"Section code.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"description\": \"Name of nickname of writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"snapshots\": {\r\n \"description\": \"List of snapshot contents.\\n\\nWhenever updating an article, its contents would be accumulated.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"section\",\r\n \"writer\",\r\n \"snapshots\",\r\n \"created_at\"\r\n ],\r\n \"description\": \"BBS article.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISnapshot\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary key of individual content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of this content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"created_at\",\r\n \"title\",\r\n \"format\",\r\n \"body\",\r\n \"files\"\r\n ],\r\n \"description\": \"Content info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IAttachmentFile\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 255,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"extension\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 8,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"url\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"url\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"name\",\r\n \"extension\",\r\n \"url\"\r\n ],\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IStore\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"description\": \"Name or nickname of the writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"writer\",\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Store info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IUpdate\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Update info.\",\r\n \"x-typia-jsDocTags\": []\r\n }\r\n }\r\n }\r\n}"
|
71
|
-
},
|
72
77
|
{
|
73
78
|
"location": "/packages/api",
|
74
79
|
"file": "tsconfig.json",
|
@@ -77,61 +82,81 @@ export const TEMPLATE = [
|
|
77
82
|
{
|
78
83
|
"location": "",
|
79
84
|
"file": "prettier.config.js",
|
80
|
-
"content": "module.exports = {\r\n parser: \"typescript\",\r\n printWidth: 80,\r\n semi: true,\r\n tabWidth:
|
85
|
+
"content": "module.exports = {\r\n parser: \"typescript\",\r\n printWidth: 80,\r\n semi: true,\r\n tabWidth: 2,\r\n trailingComma: \"all\",\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"
|
81
86
|
},
|
82
87
|
{
|
83
88
|
"location": "",
|
84
89
|
"file": "README.md",
|
85
90
|
"content": "# Nestia Template\r\n## Outline\r\n[](https://github.com/samchon/nestia-template/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. If you wanna much detailed boilerplate project even configured DB and Non-distruptive update system, visit [samchon/backend](https://github.com/samchon/backend) and create a new repository from that.\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 - `build`: Build everything\r\n - `build:api`: Build client SDK libray for the client developers\r\n - `build:main`: Build main program (`src` directory)\r\n - `build:sdk`: Build SDK into main program only\r\n - `build:swagger`: Build Swagger Documents\r\n - `build:test` Build test automation program (`test` directory)\r\n - `dev`: Incremental build for development (test program)\r\n - `eslint` & `eslint:fix` & `prettier`: Prettier and ESLint execution\r\n - `start`: Start local NestJS server\r\n - `test`: Run test automation program\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-template | 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 typia from \"typia\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api/lib/index\";\r\nimport { IBbsArticle } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticle\";\r\n\r\nimport { ArrayUtil } from \"../../../../utils/ArrayUtil\";\r\nimport { GaffComparator } from \"../../../internal/GaffComparator\";\r\nimport { RandomGenerator } from \"../../../internal/RandomGenerator\";\r\nimport { validate_index_sort } from \"../../../internal/validate_index_sort\";\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 const articles: IBbsArticle[] = await ArrayUtil.asyncRepeat(100, () =>\r\n api.functional.bbs.articles.store(connection, section, {\r\n writer: RandomGenerator.name(),\r\n title: RandomGenerator.paragraph(),\r\n body: RandomGenerator.content(),\r\n format: \"txt\",\r\n files: [],\r\n password: RandomGenerator.alphabets(8),\r\n }),\r\n );\r\n typia.assertEquals(articles);\r\n\r\n // PREPARE VALIDATOR\r\n const validator = validate_index_sort(\"BbsArticleProvider.index()\")(\r\n (input: IBbsArticle.IRequest) =>\r\n api.functional.bbs.articles.index(connection, section, input),\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(\"+\");\r\n await comp(\"-\");\r\n }\r\n}\r\n```"
|
86
91
|
},
|
92
|
+
{
|
93
|
+
"location": "/src/executable",
|
94
|
+
"file": "server.ts",
|
95
|
+
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport { MyBackend } from \"../MyBackend\";\r\nimport { MyConfiguration } from \"../MyConfiguration\";\r\nimport { ErrorUtil } from \"../utils/ErrorUtil\";\r\n\r\nconst EXTENSION = __filename.substring(__filename.length - 2);\r\nif (EXTENSION === \"js\") require(\"source-map-support/register\");\r\n\r\nconst directory = new Singleton(async () => {\r\n await mkdir(`${MyConfiguration.ROOT}/assets`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs/errors`);\r\n});\r\n\r\nfunction cipher(val: number): string {\r\n if (val < 10) return \"0\" + val;\r\n else return String(val);\r\n}\r\n\r\nasync function mkdir(path: string): Promise<void> {\r\n try {\r\n await fs.promises.mkdir(path);\r\n } catch {}\r\n}\r\n\r\nasync function handle_error(exp: any): Promise<void> {\r\n try {\r\n const date: Date = new Date();\r\n const fileName: string = `${date.getFullYear()}${cipher(\r\n date.getMonth() + 1,\r\n )}${cipher(date.getDate())}${cipher(date.getHours())}${cipher(\r\n date.getMinutes(),\r\n )}${cipher(date.getSeconds())}.${randint(0, Number.MAX_SAFE_INTEGER)}`;\r\n const content: string = JSON.stringify(ErrorUtil.toJSON(exp), null, 4);\r\n\r\n await directory.get();\r\n await fs.promises.writeFile(\r\n `${MyConfiguration.ROOT}/assets/logs/errors/${fileName}.log`,\r\n content,\r\n \"utf8\",\r\n );\r\n } catch {}\r\n}\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\", handle_error);\r\n global.process.on(\"unhandledRejection\", handle_error);\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"location": "/src/executable",
|
99
|
+
"file": "swagger.ts",
|
100
|
+
"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"
|
101
|
+
},
|
87
102
|
{
|
88
103
|
"location": "/src",
|
89
|
-
"file": "
|
90
|
-
"content": "import
|
104
|
+
"file": "MyBackend.ts",
|
105
|
+
"content": "import { NestFactory } from \"@nestjs/core\";\r\nimport {\r\n FastifyAdapter,\r\n NestFastifyApplication,\r\n} from \"@nestjs/platform-fastify\";\r\n\r\nimport { MyConfiguration } from \"./MyConfiguration\";\r\nimport { MyModule } from \"./MyModule\";\r\n\r\nexport class MyBackend {\r\n private application_?: NestFastifyApplication;\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(\r\n MyModule,\r\n new FastifyAdapter(),\r\n { logger: false },\r\n );\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"
|
91
106
|
},
|
92
107
|
{
|
93
108
|
"location": "/src",
|
94
|
-
"file": "
|
95
|
-
"content": "import path from \"path\";\r\n\r\nexport namespace
|
109
|
+
"file": "MyConfiguration.ts",
|
110
|
+
"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"
|
96
111
|
},
|
97
112
|
{
|
98
|
-
"location": "/src
|
99
|
-
"file": "
|
100
|
-
"content": "import
|
113
|
+
"location": "/src",
|
114
|
+
"file": "MyGlobal.ts",
|
115
|
+
"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"
|
101
116
|
},
|
102
117
|
{
|
103
118
|
"location": "/src",
|
104
|
-
"file": "
|
105
|
-
"content": "
|
119
|
+
"file": "MyModule.ts",
|
120
|
+
"content": "import { Module } from \"@nestjs/common\";\r\n\r\nimport { BbsArticleModule } from \"./controllers/bbs/BbsArticleModule\";\r\n\r\n@Module({\r\n imports: [BbsArticleModule],\r\n})\r\nexport class MyModule {}\r\n"
|
106
121
|
},
|
107
122
|
{
|
108
123
|
"location": "/src/utils",
|
109
124
|
"file": "ErrorUtil.ts",
|
110
|
-
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport {
|
125
|
+
"content": "import fs from \"fs\";\r\nimport { randint } from \"tstl/algorithm/random\";\r\nimport { Singleton } from \"tstl/thread/Singleton\";\r\n\r\nimport { MyConfiguration } from \"../MyConfiguration\";\r\n\r\nimport 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 export const log =\r\n (prefix: string) =>\r\n async (error: string | object | Error): Promise<void> => {\r\n try {\r\n if (error instanceof Error) error = toJSON(error);\r\n\r\n const date: Date = new Date();\r\n const fileName: string = `${date.getFullYear()}${cipher(\r\n date.getMonth() + 1,\r\n )}${cipher(date.getDate())}${cipher(date.getHours())}${cipher(\r\n date.getMinutes(),\r\n )}${cipher(date.getSeconds())}.${randint(0, Number.MAX_SAFE_INTEGER)}`;\r\n const content: string = JSON.stringify(error, null, 4);\r\n\r\n await directory.get();\r\n await fs.promises.writeFile(\r\n `${MyConfiguration.ROOT}/assets/logs/errors/${prefix}_${fileName}.log`,\r\n content,\r\n \"utf8\",\r\n );\r\n } catch {}\r\n };\r\n}\r\n\r\nconst cipher = (val: number): string => String(val).padStart(2, \"0\");\r\nconst directory = new Singleton(async () => {\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs`);\r\n await mkdir(`${MyConfiguration.ROOT}/assets/logs/errors`);\r\n});\r\nasync function mkdir(path: string): Promise<void> {\r\n try {\r\n await fs.promises.mkdir(path);\r\n } catch {}\r\n}\r\n"
|
111
126
|
},
|
112
127
|
{
|
113
128
|
"location": "/src/utils",
|
114
129
|
"file": "MapUtil.ts",
|
115
|
-
"content": "export namespace MapUtil {\r\n
|
130
|
+
"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"
|
116
131
|
},
|
117
132
|
{
|
118
133
|
"location": "/test/helpers",
|
119
134
|
"file": "ArgumentParser.ts",
|
120
|
-
"content": "import commander from
|
135
|
+
"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 }\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\r\n const output: T | Error = await (async () => {\r\n try {\r\n return await inquiry(commander.program, { select, boolean }, action);\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"
|
121
136
|
},
|
122
137
|
{
|
123
138
|
"location": "/test",
|
124
139
|
"file": "index.ts",
|
125
|
-
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\r\n\r\nimport api from \"@ORGANIZATION/PROJECT-api\";\r\n\r\nimport {
|
140
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\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 prompt;\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 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 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 })(__dirname + \"/features\");\r\n\r\n await backend.close();\r\n\r\n const failures: DynamicExecutor.IReport.IExecution[] =\r\n report.executions.filter((exec) => exec.error !== null);\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 `All : ${report.executions.length}`,\r\n `Success : ${report.executions.length - failures.length}`,\r\n `Failed : ${failures.length}`,\r\n ].join(\"\\n\"));\r\n}\r\nmain().catch((exp) => {\r\n console.log(exp);\r\n process.exit(-1);\r\n});\r\n"
|
126
141
|
},
|
127
142
|
{
|
128
143
|
"location": "/test",
|
129
144
|
"file": "tsconfig.json",
|
130
145
|
"content": "{\r\n \"extends\": \"../tsconfig.json\",\r\n \"compilerOptions\": {\r\n \"outDir\": \"../bin\",\r\n },\r\n \"include\": [\".\", \"../src\"]\r\n}"
|
131
146
|
},
|
147
|
+
{
|
148
|
+
"location": "/test",
|
149
|
+
"file": "webpack.ts",
|
150
|
+
"content": "import { DynamicExecutor } from \"@nestia/e2e\";\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 parameters: () => [\r\n {\r\n host: connection.host,\r\n encryption: connection.encryption,\r\n },\r\n ],\r\n })(__dirname + \"/features\");\r\n\r\n backend.kill();\r\n\r\n const failures: DynamicExecutor.IReport.IExecution[] =\r\n report.executions.filter((exec) => exec.error !== null);\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"
|
151
|
+
},
|
132
152
|
{
|
133
153
|
"location": "",
|
134
154
|
"file": "tsconfig.json",
|
135
155
|
"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"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"location": "",
|
159
|
+
"file": "webpack.config.js",
|
160
|
+
"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 // },\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"
|
136
161
|
}
|
137
162
|
]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { IMigrateController } from "../structures/IMigrateController";
|
2
|
+
import { IMigrateDto } from "../structures/IMigrateDto";
|
1
3
|
import { IMigrateFile } from "../structures/IMigrateFile";
|
2
4
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
3
5
|
import { ISwagger } from "../structures/ISwagger";
|
@@ -7,8 +9,9 @@ import { DtoProgrammer } from "./DtoProgrammer";
|
|
7
9
|
|
8
10
|
export namespace MigrateProgrammer {
|
9
11
|
export const analyze = (swagger: ISwagger): IMigrateProgram => {
|
10
|
-
const controllers =
|
11
|
-
|
12
|
+
const controllers: IMigrateController[] =
|
13
|
+
ControllerProgrammer.analyze(swagger);
|
14
|
+
const structures: IMigrateDto[] = DtoProgrammer.analyze(swagger);
|
12
15
|
return {
|
13
16
|
controllers,
|
14
17
|
structures,
|
@@ -29,6 +32,31 @@ export namespace MigrateProgrammer {
|
|
29
32
|
file: `${c.name}.ts`,
|
30
33
|
content: ControllerProgrammer.write(components)(c),
|
31
34
|
})),
|
35
|
+
{
|
36
|
+
location: "src",
|
37
|
+
file: "MyModule.ts",
|
38
|
+
content: MyModule(program.controllers),
|
39
|
+
},
|
32
40
|
];
|
33
41
|
};
|
34
42
|
}
|
43
|
+
|
44
|
+
const MyModule = (controllers: IMigrateController[]): string =>
|
45
|
+
[
|
46
|
+
`import { Module } from "@nestjs/common";`,
|
47
|
+
``,
|
48
|
+
...controllers.map(
|
49
|
+
(c) =>
|
50
|
+
`import { ${c.name} } from "${c.location.replace(
|
51
|
+
"src/",
|
52
|
+
"./",
|
53
|
+
)}/${c.name}";`,
|
54
|
+
),
|
55
|
+
``,
|
56
|
+
`@Module({`,
|
57
|
+
` controllers: [`,
|
58
|
+
...controllers.map((c) => ` ${c.name},`),
|
59
|
+
` ],`,
|
60
|
+
`})`,
|
61
|
+
`export class MyModule {}`,
|
62
|
+
].join("\n");
|