@nestia/sdk 1.3.9 → 1.3.10

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.
Files changed (52) hide show
  1. package/lib/NestiaSdkApplication.d.ts +1 -1
  2. package/lib/NestiaSdkApplication.js +15 -9
  3. package/lib/NestiaSdkApplication.js.map +1 -1
  4. package/lib/analyses/ControllerAnalyzer.js +3 -3
  5. package/lib/analyses/ControllerAnalyzer.js.map +1 -1
  6. package/lib/analyses/ImportAnalyzer.js +2 -6
  7. package/lib/analyses/ImportAnalyzer.js.map +1 -1
  8. package/lib/executable/internal/NestiaConfigCompilerOptions.d.ts +1 -0
  9. package/lib/executable/internal/NestiaConfigCompilerOptions.js +1 -1
  10. package/lib/executable/internal/NestiaConfigCompilerOptions.js.map +1 -1
  11. package/lib/executable/internal/NestiaSdkCommand.js +2 -2
  12. package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
  13. package/lib/executable/sdk.js +11 -11
  14. package/lib/generates/SdkGenerator.js +28 -0
  15. package/lib/generates/SdkGenerator.js.map +1 -1
  16. package/lib/generates/SwaggerGenerator.js +9 -9
  17. package/lib/generates/internal/E2eFileProgrammer.js +12 -12
  18. package/lib/structures/IRoute.d.ts +1 -0
  19. package/package.json +2 -2
  20. package/src/NestiaSdkApplication.ts +273 -262
  21. package/src/analyses/ControllerAnalyzer.ts +266 -261
  22. package/src/analyses/GenericAnalyzer.ts +53 -53
  23. package/src/analyses/ImportAnalyzer.ts +158 -164
  24. package/src/analyses/PathAnalyzer.ts +58 -58
  25. package/src/analyses/ReflectAnalyzer.ts +321 -321
  26. package/src/executable/internal/CommandParser.ts +15 -15
  27. package/src/executable/internal/NestiaConfigCompilerOptions.ts +19 -18
  28. package/src/executable/internal/NestiaSdkCommand.ts +157 -156
  29. package/src/executable/internal/NestiaSdkConfig.ts +36 -36
  30. package/src/executable/internal/nestia.config.getter.ts +12 -12
  31. package/src/executable/sdk.ts +70 -70
  32. package/src/generates/E2eGenerator.ts +67 -67
  33. package/src/generates/SdkGenerator.ts +94 -65
  34. package/src/generates/SwaggerGenerator.ts +504 -504
  35. package/src/generates/internal/E2eFileProgrammer.ts +135 -135
  36. package/src/generates/internal/SdkRouteDirectory.ts +21 -21
  37. package/src/index.ts +4 -4
  38. package/src/module.ts +2 -2
  39. package/src/structures/IController.ts +31 -31
  40. package/src/structures/IRoute.ts +40 -39
  41. package/src/structures/ISwaggerDocument.ts +120 -120
  42. package/src/structures/ITypeTuple.ts +6 -6
  43. package/src/structures/MethodType.ts +11 -11
  44. package/src/structures/ParamCategory.ts +1 -1
  45. package/src/structures/TypeEntry.ts +22 -22
  46. package/src/utils/ArrayUtil.ts +26 -26
  47. package/src/utils/FileRetriever.ts +22 -22
  48. package/src/utils/ImportDictionary.ts +56 -56
  49. package/src/utils/MapUtil.ts +14 -14
  50. package/src/utils/NestiaConfigUtil.ts +21 -21
  51. package/src/utils/SourceFinder.ts +60 -60
  52. package/src/utils/StripEnums.ts +10 -10
@@ -1,60 +1,60 @@
1
- import fs from "fs";
2
- import glob from "glob";
3
- import path from "path";
4
-
5
- export namespace SourceFinder {
6
- export const find = async (props: IProps): Promise<string[]> => {
7
- const dict: Set<string> = new Set();
8
-
9
- await emplace(props.filter)(props.include)((str) => dict.add(str));
10
- if (props.exclude?.length)
11
- await emplace(props.filter)(props.exclude)((str) =>
12
- dict.delete(str),
13
- );
14
-
15
- return [...dict];
16
- };
17
-
18
- const emplace =
19
- (filter: (file: string) => boolean) =>
20
- (input: string[]) =>
21
- async (closure: (location: string) => void): Promise<void> => {
22
- for (const pattern of input) {
23
- for (const file of await _Glob(path.resolve(pattern))) {
24
- const stats: fs.Stats = await fs.promises.stat(file);
25
- if (stats.isDirectory() === true)
26
- await iterate(filter)(closure)(file);
27
- else if (stats.isFile() && filter(file)) closure(file);
28
- }
29
- }
30
- };
31
-
32
- const iterate =
33
- (filter: (location: string) => boolean) =>
34
- (closure: (location: string) => void) =>
35
- async (location: string): Promise<void> => {
36
- const directory: string[] = await fs.promises.readdir(location);
37
- for (const file of directory) {
38
- const next: string = path.resolve(`${location}/${file}`);
39
- const stats: fs.Stats = await fs.promises.stat(next);
40
-
41
- if (stats.isDirectory() === true)
42
- await iterate(filter)(closure)(next);
43
- else if (stats.isFile() && filter(next)) closure(next);
44
- }
45
- };
46
-
47
- const _Glob = (pattern: string): Promise<string[]> =>
48
- new Promise((resolve, reject) => {
49
- glob(pattern, (err, matches) => {
50
- if (err) reject(err);
51
- else resolve(matches.map((str) => path.resolve(str)));
52
- });
53
- });
54
- }
55
-
56
- interface IProps {
57
- exclude?: string[];
58
- include: string[];
59
- filter: (location: string) => boolean;
60
- }
1
+ import fs from "fs";
2
+ import glob from "glob";
3
+ import path from "path";
4
+
5
+ export namespace SourceFinder {
6
+ export const find = async (props: IProps): Promise<string[]> => {
7
+ const dict: Set<string> = new Set();
8
+
9
+ await emplace(props.filter)(props.include)((str) => dict.add(str));
10
+ if (props.exclude?.length)
11
+ await emplace(props.filter)(props.exclude)((str) =>
12
+ dict.delete(str),
13
+ );
14
+
15
+ return [...dict];
16
+ };
17
+
18
+ const emplace =
19
+ (filter: (file: string) => boolean) =>
20
+ (input: string[]) =>
21
+ async (closure: (location: string) => void): Promise<void> => {
22
+ for (const pattern of input) {
23
+ for (const file of await _Glob(path.resolve(pattern))) {
24
+ const stats: fs.Stats = await fs.promises.stat(file);
25
+ if (stats.isDirectory() === true)
26
+ await iterate(filter)(closure)(file);
27
+ else if (stats.isFile() && filter(file)) closure(file);
28
+ }
29
+ }
30
+ };
31
+
32
+ const iterate =
33
+ (filter: (location: string) => boolean) =>
34
+ (closure: (location: string) => void) =>
35
+ async (location: string): Promise<void> => {
36
+ const directory: string[] = await fs.promises.readdir(location);
37
+ for (const file of directory) {
38
+ const next: string = path.resolve(`${location}/${file}`);
39
+ const stats: fs.Stats = await fs.promises.stat(next);
40
+
41
+ if (stats.isDirectory() === true)
42
+ await iterate(filter)(closure)(next);
43
+ else if (stats.isFile() && filter(next)) closure(next);
44
+ }
45
+ };
46
+
47
+ const _Glob = (pattern: string): Promise<string[]> =>
48
+ new Promise((resolve, reject) => {
49
+ glob(pattern, (err, matches) => {
50
+ if (err) reject(err);
51
+ else resolve(matches.map((str) => path.resolve(str)));
52
+ });
53
+ });
54
+ }
55
+
56
+ interface IProps {
57
+ exclude?: string[];
58
+ include: string[];
59
+ filter: (location: string) => boolean;
60
+ }
@@ -1,10 +1,10 @@
1
- export type StripEnums<T extends Record<string, any>> = {
2
- [Key in keyof T]: T[Key] extends
3
- | string
4
- | boolean
5
- | object
6
- | undefined
7
- | any[]
8
- ? T[Key]
9
- : any;
10
- };
1
+ export type StripEnums<T extends Record<string, any>> = {
2
+ [Key in keyof T]: T[Key] extends
3
+ | string
4
+ | boolean
5
+ | object
6
+ | undefined
7
+ | any[]
8
+ ? T[Key]
9
+ : any;
10
+ };