@nestia/sdk 0.2.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/config/nestia.config.ts +79 -70
- package/lib/INestiaConfig.d.ts +18 -14
- package/lib/executable/sdk.js +16 -16
- package/lib/generates/FunctionGenerator.js +9 -9
- package/lib/generates/FunctionGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +9 -9
- package/package.json +3 -3
- package/src/INestiaConfig.ts +124 -120
- package/src/NestiaSdkApplication.ts +183 -183
- package/src/analyses/ControllerAnalyzer.ts +203 -203
- package/src/analyses/GenericAnalyzer.ts +53 -53
- package/src/analyses/ImportAnalyzer.ts +143 -143
- package/src/analyses/PathAnalyzer.ts +58 -58
- package/src/analyses/ReflectAnalyzer.ts +279 -279
- package/src/analyses/SourceFinder.ts +59 -59
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigCompilerOptions.ts +18 -18
- package/src/executable/internal/NestiaSdkCommand.ts +174 -174
- package/src/executable/internal/NestiaSdkConfig.ts +35 -35
- package/src/executable/internal/nestia.config.getter.ts +12 -12
- package/src/executable/sdk.ts +74 -74
- package/src/generates/FileGenerator.ts +156 -156
- package/src/generates/FunctionGenerator.ts +284 -287
- package/src/generates/SdkGenerator.ts +50 -50
- package/src/generates/SwaggerGenerator.ts +393 -393
- package/src/index.ts +3 -3
- package/src/module.ts +2 -2
- package/src/structures/IController.ts +27 -27
- package/src/structures/IRoute.ts +29 -29
- package/src/structures/ISwagger.ts +55 -55
- package/src/structures/ITypeTuple.ts +6 -6
- package/src/structures/MethodType.ts +11 -11
- package/src/structures/ParamCategory.ts +1 -1
- package/src/structures/TypeEntry.ts +22 -22
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/ImportDictionary.ts +56 -56
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/StripEnums.ts +10 -10
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import NodePath from "path";
|
|
3
|
-
import ts from "typescript";
|
|
4
|
-
|
|
5
|
-
import { INestiaConfig } from "../INestiaConfig";
|
|
6
|
-
import { IRoute } from "../structures/IRoute";
|
|
7
|
-
import { FileGenerator } from "./FileGenerator";
|
|
8
|
-
|
|
9
|
-
export namespace SdkGenerator {
|
|
10
|
-
export async function generate(
|
|
11
|
-
_checker: ts.TypeChecker,
|
|
12
|
-
config: INestiaConfig,
|
|
13
|
-
routeList: IRoute[],
|
|
14
|
-
): Promise<void> {
|
|
15
|
-
// PREPARE NEW DIRECTORIES
|
|
16
|
-
try {
|
|
17
|
-
await fs.promises.mkdir(config.output!);
|
|
18
|
-
} catch {}
|
|
19
|
-
|
|
20
|
-
// BUNDLING
|
|
21
|
-
const bundle: string[] = await fs.promises.readdir(BUNDLE_PATH);
|
|
22
|
-
for (const file of bundle) {
|
|
23
|
-
const current: string = `${BUNDLE_PATH}/${file}`;
|
|
24
|
-
const stats: fs.Stats = await fs.promises.stat(current);
|
|
25
|
-
|
|
26
|
-
if (stats.isFile() === true) {
|
|
27
|
-
const content: string = await fs.promises.readFile(
|
|
28
|
-
current,
|
|
29
|
-
"utf8",
|
|
30
|
-
);
|
|
31
|
-
await fs.promises.writeFile(
|
|
32
|
-
`${config.output}/${file}`,
|
|
33
|
-
content,
|
|
34
|
-
"utf8",
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// FUNCTIONAL
|
|
40
|
-
await FileGenerator.generate(config, routeList);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const BUNDLE_PATH = NodePath.join(
|
|
44
|
-
__dirname,
|
|
45
|
-
"..",
|
|
46
|
-
"..",
|
|
47
|
-
"assets",
|
|
48
|
-
"bundle",
|
|
49
|
-
);
|
|
50
|
-
}
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import NodePath from "path";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
|
|
5
|
+
import { INestiaConfig } from "../INestiaConfig";
|
|
6
|
+
import { IRoute } from "../structures/IRoute";
|
|
7
|
+
import { FileGenerator } from "./FileGenerator";
|
|
8
|
+
|
|
9
|
+
export namespace SdkGenerator {
|
|
10
|
+
export async function generate(
|
|
11
|
+
_checker: ts.TypeChecker,
|
|
12
|
+
config: INestiaConfig,
|
|
13
|
+
routeList: IRoute[],
|
|
14
|
+
): Promise<void> {
|
|
15
|
+
// PREPARE NEW DIRECTORIES
|
|
16
|
+
try {
|
|
17
|
+
await fs.promises.mkdir(config.output!);
|
|
18
|
+
} catch {}
|
|
19
|
+
|
|
20
|
+
// BUNDLING
|
|
21
|
+
const bundle: string[] = await fs.promises.readdir(BUNDLE_PATH);
|
|
22
|
+
for (const file of bundle) {
|
|
23
|
+
const current: string = `${BUNDLE_PATH}/${file}`;
|
|
24
|
+
const stats: fs.Stats = await fs.promises.stat(current);
|
|
25
|
+
|
|
26
|
+
if (stats.isFile() === true) {
|
|
27
|
+
const content: string = await fs.promises.readFile(
|
|
28
|
+
current,
|
|
29
|
+
"utf8",
|
|
30
|
+
);
|
|
31
|
+
await fs.promises.writeFile(
|
|
32
|
+
`${config.output}/${file}`,
|
|
33
|
+
content,
|
|
34
|
+
"utf8",
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// FUNCTIONAL
|
|
40
|
+
await FileGenerator.generate(config, routeList);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const BUNDLE_PATH = NodePath.join(
|
|
44
|
+
__dirname,
|
|
45
|
+
"..",
|
|
46
|
+
"..",
|
|
47
|
+
"assets",
|
|
48
|
+
"bundle",
|
|
49
|
+
);
|
|
50
|
+
}
|